Class: CDK8sPlus25::Secret
- Inherits:
-
Resource
- Object
- Resource
- CDK8sPlus25::Secret
- Includes:
- ISecret
- Defined in:
- secret.rb
Overview
Kubernetes Secrets let you store and manage sensitive information, such as passwords, OAuth tokens, and ssh keys.
Storing confidential information in a Secret is safer and more flexible than putting it verbatim in a Pod definition or in a container image.
Direct Known Subclasses
BasicAuthSecret, DockerConfigSecret, ServiceAccountTokenSecret, SshAuthSecret, TLSSecret
Class Method Summary collapse
-
.from_secret_name(scope, id, name) ⇒ CDK8sPlus25::ISecret
Imports a secret from the cluster as a reference.
- .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#add_string_data(key, value) ⇒ void
Adds a string data field to the secert.
-
#api_group ⇒ String
The group portion of the API version (e.g. "authorization.k8s.io").
-
#api_object ⇒ CDK8s::APIObject
The underlying cdk8s API object.
-
#api_version ⇒ String
The object's API version (e.g. "authorization.k8s.io/v1").
-
#as_api_resource ⇒ CDK8sPlus25::IAPIResource?
Return the IApiResource this object represents.
-
#as_non_api_resource ⇒ String?
Return the non resource url this object represents.
-
#env_value(key, options = nil) ⇒ CDK8sPlus25::EnvValue
Returns EnvValue object from a secret's key.
-
#get_string_data(key) ⇒ String?
Gets a string data by key or undefined.
-
#immutable ⇒ Boolean
Whether or not the secret is immutable.
-
#initialize(scope, id, props = nil, &jsii_block) ⇒ Secret
constructor
A new instance of Secret.
-
#kind ⇒ String
The object kind (e.g. "Deployment").
- #metadata ⇒ CDK8s::APIObjectMetadataDefinition
-
#name ⇒ String
The name of this API object.
-
#node ⇒ Constructs::Node
The tree node.
- #permissions ⇒ CDK8sPlus25::ResourcePermissions
-
#resource_name ⇒ String?
The unique, namespace-global, name of an object inside the Kubernetes cluster.
-
#resource_type ⇒ String
The name of a resource type as it appears in the relevant API endpoint.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props = nil, &jsii_block) ⇒ Secret
Returns a new instance of Secret.
18 19 20 21 22 23 24 |
# File 'secret.rb', line 18 def initialize(scope, id, props = nil, &jsii_block) props = props.is_a?(Hash) ? ::CDK8sPlus25::SecretProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(scope, "eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9", "scope") Jsii::Type.check_type(id, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "id") Jsii::Type.check_type(props, "eyJmcW4iOiJjZGs4cy1wbHVzLTI1LlNlY3JldFByb3BzIn0=", "props") unless props.nil? Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props, &jsii_block) end |
Class Method Details
.from_secret_name(scope, id, name) ⇒ CDK8sPlus25::ISecret
Imports a secret from the cluster as a reference.
55 56 57 58 59 60 |
# File 'secret.rb', line 55 def self.from_secret_name(scope, id, name) Jsii::Type.check_type(scope, "eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9", "scope") Jsii::Type.check_type(id, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "id") Jsii::Type.check_type(name, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "name") Jsii::Kernel.instance.call_static("cdk8s-plus-25.Secret", "fromSecretName", [scope, id, name]) end |
.jsii_overridable_methods ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'secret.rb', line 26 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :api_group => { kind: :property, name: "apiGroup", is_optional: false }, :api_object => { kind: :property, name: "apiObject", is_optional: false }, :api_version => { kind: :property, name: "apiVersion", is_optional: false }, :kind => { kind: :property, name: "kind", is_optional: false }, :metadata => { kind: :property, name: "metadata", is_optional: false }, :name => { kind: :property, name: "name", is_optional: false }, :permissions => { kind: :property, name: "permissions", is_optional: false }, :resource_type => { kind: :property, name: "resourceType", is_optional: false }, :resource_name => { kind: :property, name: "resourceName", is_optional: true }, :immutable => { kind: :property, name: "immutable", is_optional: false }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :as_api_resource => { kind: :method, name: "asApiResource", is_optional: false }, :as_non_api_resource => { kind: :method, name: "asNonApiResource", is_optional: false }, :add_string_data => { kind: :method, name: "addStringData", is_optional: false }, :env_value => { kind: :method, name: "envValue", is_optional: false }, :get_string_data => { kind: :method, name: "getStringData", is_optional: false }, } end |
Instance Method Details
#add_string_data(key, value) ⇒ void
This method returns an undefined value.
Adds a string data field to the secert.
180 181 182 183 184 |
# File 'secret.rb', line 180 def add_string_data(key, value) Jsii::Type.check_type(key, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "key") Jsii::Type.check_type(value, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "value") jsii_call_method("addStringData", [key, value]) end |
#api_group ⇒ String
The group portion of the API version (e.g. "authorization.k8s.io").
72 73 74 |
# File 'secret.rb', line 72 def api_group() jsii_get_property("apiGroup") end |
#api_object ⇒ CDK8s::APIObject
The underlying cdk8s API object.
80 81 82 |
# File 'secret.rb', line 80 def api_object() jsii_get_property("apiObject") end |
#api_version ⇒ String
The object's API version (e.g. "authorization.k8s.io/v1").
87 88 89 |
# File 'secret.rb', line 87 def api_version() jsii_get_property("apiVersion") end |
#as_api_resource ⇒ CDK8sPlus25::IAPIResource?
Return the IApiResource this object represents.
164 165 166 |
# File 'secret.rb', line 164 def as_api_resource() jsii_call_method("asApiResource", []) end |
#as_non_api_resource ⇒ String?
Return the non resource url this object represents.
171 172 173 |
# File 'secret.rb', line 171 def as_non_api_resource() jsii_call_method("asNonApiResource", []) end |
#env_value(key, options = nil) ⇒ CDK8sPlus25::EnvValue
Returns EnvValue object from a secret's key.
191 192 193 194 195 196 |
# File 'secret.rb', line 191 def env_value(key, = nil) Jsii::Type.check_type(key, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "key") = .is_a?(Hash) ? ::CDK8sPlus25::EnvValueFromSecretOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, "eyJmcW4iOiJjZGs4cy1wbHVzLTI1LkVudlZhbHVlRnJvbVNlY3JldE9wdGlvbnMifQ==", "options") unless .nil? jsii_call_method("envValue", [key, ]) end |
#get_string_data(key) ⇒ String?
Gets a string data by key or undefined.
202 203 204 205 |
# File 'secret.rb', line 202 def get_string_data(key) Jsii::Type.check_type(key, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "key") jsii_call_method("getStringData", [key]) end |
#immutable ⇒ Boolean
Whether or not the secret is immutable.
134 135 136 |
# File 'secret.rb', line 134 def immutable() jsii_get_property("immutable") end |
#kind ⇒ String
The object kind (e.g. "Deployment").
94 95 96 |
# File 'secret.rb', line 94 def kind() jsii_get_property("kind") end |
#metadata ⇒ CDK8s::APIObjectMetadataDefinition
99 100 101 |
# File 'secret.rb', line 99 def () jsii_get_property("metadata") end |
#name ⇒ String
The name of this API object.
106 107 108 |
# File 'secret.rb', line 106 def name() jsii_get_property("name") end |
#node ⇒ Constructs::Node
The tree node.
65 66 67 |
# File 'secret.rb', line 65 def node() jsii_get_property("node") end |
#permissions ⇒ CDK8sPlus25::ResourcePermissions
111 112 113 |
# File 'secret.rb', line 111 def () jsii_get_property("permissions") end |
#resource_name ⇒ String?
The unique, namespace-global, name of an object inside the Kubernetes cluster.
If this is omitted, the ApiResource should represent all objects of the given type.
127 128 129 |
# File 'secret.rb', line 127 def resource_name() jsii_get_property("resourceName") end |
#resource_type ⇒ String
The name of a resource type as it appears in the relevant API endpoint.
118 119 120 |
# File 'secret.rb', line 118 def resource_type() jsii_get_property("resourceType") end |
#to_string ⇒ String
Returns a string representation of this construct.
141 142 143 |
# File 'secret.rb', line 141 def to_string() jsii_call_method("toString", []) end |
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
154 155 156 157 158 159 |
# File 'secret.rb', line 154 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, "eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9", "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |