org.cdk8s.plus22.Secret Maven / Gradle / Ivy
Show all versions of cdk8s-plus-22 Show documentation
package org.cdk8s.plus22;
/**
* 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.
*
* @see https://kubernetes.io/docs/concepts/configuration/secret
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.47.0 (build 86d2c33)", date = "2021-12-08T00:16:55.117Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = org.cdk8s.plus22.$Module.class, fqn = "cdk8s-plus-22.Secret")
public class Secret extends org.cdk8s.plus22.Resource implements org.cdk8s.plus22.ISecret {
protected Secret(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Secret(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Secret(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable org.cdk8s.plus22.SecretProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), props });
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Secret(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* Imports a secret from the cluster as a reference.
*
* @param name The name of the secret to reference. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.plus22.ISecret fromSecretName(final @org.jetbrains.annotations.NotNull java.lang.String name) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.plus22.Secret.class, "fromSecretName", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus22.ISecret.class), new Object[] { java.util.Objects.requireNonNull(name, "name is required") });
}
/**
* Adds a string data field to the secert.
*
* @param key Key. This parameter is required.
* @param value Value. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void addStringData(final @org.jetbrains.annotations.NotNull java.lang.String key, final @org.jetbrains.annotations.NotNull java.lang.String value) {
software.amazon.jsii.Kernel.call(this, "addStringData", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(key, "key is required"), java.util.Objects.requireNonNull(value, "value is required") });
}
/**
* Gets a string data by key or undefined.
*
* @param key Key. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.Nullable java.lang.String getStringData(final @org.jetbrains.annotations.NotNull java.lang.String key) {
return software.amazon.jsii.Kernel.call(this, "getStringData", software.amazon.jsii.NativeType.forClass(java.lang.String.class), new Object[] { java.util.Objects.requireNonNull(key, "key is required") });
}
/**
* The underlying cdk8s API object.
*
* @see base.Resource.apiObject
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
protected @org.jetbrains.annotations.NotNull org.cdk8s.ApiObject getApiObject() {
return software.amazon.jsii.Kernel.get(this, "apiObject", software.amazon.jsii.NativeType.forClass(org.cdk8s.ApiObject.class));
}
/**
* A fluent builder for {@link org.cdk8s.plus22.Secret}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private org.cdk8s.plus22.SecretProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
}
/**
* Metadata that all persisted resources must have, which includes all objects users must create.
*
* @return {@code this}
* @param metadata Metadata that all persisted resources must have, which includes all objects users must create. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder metadata(final org.cdk8s.ApiObjectMetadata metadata) {
this.props().metadata(metadata);
return this;
}
/**
* stringData allows specifying non-binary secret data in string form.
*
* It is
* provided as a write-only convenience method. All keys and values are merged
* into the data field on write, overwriting any existing values. It is never
* output when reading from the API.
*
* @return {@code this}
* @param stringData stringData allows specifying non-binary secret data in string form. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder stringData(final java.util.Map stringData) {
this.props().stringData(stringData);
return this;
}
/**
* Optional type associated with the secret.
*
* Used to facilitate programmatic
* handling of secret data by various controllers.
*
* Default: undefined - Don't set a type.
*
* @return {@code this}
* @param type Optional type associated with the secret. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder type(final java.lang.String type) {
this.props().type(type);
return this;
}
/**
* @returns a newly built instance of {@link org.cdk8s.plus22.Secret}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public org.cdk8s.plus22.Secret build() {
return new org.cdk8s.plus22.Secret(
this.scope,
this.id,
this.props != null ? this.props.build() : null
);
}
private org.cdk8s.plus22.SecretProps.Builder props() {
if (this.props == null) {
this.props = new org.cdk8s.plus22.SecretProps.Builder();
}
return this.props;
}
}
}