software.amazon.awscdk.SecretValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cdk Show documentation
Show all versions of cdk Show documentation
AWS Cloud Development Kit Core Library
package software.amazon.awscdk;
/**
* Work with secret values in the CDK.
*
* Secret values in the CDK (such as those retrieved from SecretsManager) are
* represented as regular strings, just like other values that are only
* available at deployment time.
*
* To help you avoid accidental mistakes which would lead to you putting your
* secret values directly into a CloudFormation template, constructs that take
* secret values will not allow you to pass in a literal secret value. They do
* so by calling `Secret.assertSafeSecret()`.
*
* You can escape the check by calling `Secret.plainTex()`, but doing
* so is highly discouraged.
*/
@javax.annotation.Generated(value = "jsii-pacmak/0.10.5 (build 46bc9b0)", date = "2019-05-06T20:49:40.957Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.$Module.class, fqn = "@aws-cdk/cdk.SecretValue")
public class SecretValue extends software.amazon.awscdk.Token {
protected SecretValue(final software.amazon.jsii.JsiiObject.InitializationMode mode) {
super(mode);
}
/**
* Creates a token that resolves to `value`.
*
* If value is a function, the function is evaluated upon resolution and
* the value it returns will be used as the token's value.
*
* displayName is used to represent the Token when it's embedded into a string; it
* will look something like this:
*
* "embedded in a larger string is ${Token[DISPLAY_NAME.123]}"
*
* This value is used as a hint to humans what the meaning of the Token is,
* and does not have any effect on the evaluation.
*
* Must contain only alphanumeric and simple separator characters (_.:-).
*
* @param valueOrFunction What this token will evaluate to, literal or function.
* @param displayName A human-readable display hint for this Token.
*/
public SecretValue(@javax.annotation.Nullable final java.lang.Object valueOrFunction, @javax.annotation.Nullable final java.lang.String displayName) {
super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { valueOrFunction, displayName });
}
/**
* Creates a token that resolves to `value`.
*
* If value is a function, the function is evaluated upon resolution and
* the value it returns will be used as the token's value.
*
* displayName is used to represent the Token when it's embedded into a string; it
* will look something like this:
*
* "embedded in a larger string is ${Token[DISPLAY_NAME.123]}"
*
* This value is used as a hint to humans what the meaning of the Token is,
* and does not have any effect on the evaluation.
*
* Must contain only alphanumeric and simple separator characters (_.:-).
*
* @param valueOrFunction What this token will evaluate to, literal or function.
*/
public SecretValue(@javax.annotation.Nullable final java.lang.Object valueOrFunction) {
super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { valueOrFunction });
}
/**
* Creates a token that resolves to `value`.
*
* If value is a function, the function is evaluated upon resolution and
* the value it returns will be used as the token's value.
*
* displayName is used to represent the Token when it's embedded into a string; it
* will look something like this:
*
* "embedded in a larger string is ${Token[DISPLAY_NAME.123]}"
*
* This value is used as a hint to humans what the meaning of the Token is,
* and does not have any effect on the evaluation.
*
* Must contain only alphanumeric and simple separator characters (_.:-).
*/
public SecretValue() {
super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
* Obtain the secret value through a CloudFormation dynamic reference.
*
* If possible, use `SecretValue.ssmSecure` or `SecretValue.secretsManager` directly.
*
* @param ref The dynamic reference to use.
*/
public static software.amazon.awscdk.SecretValue cfnDynamicReference(final software.amazon.awscdk.CfnDynamicReference ref) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.SecretValue.class, "cfnDynamicReference", software.amazon.awscdk.SecretValue.class, new Object[] { java.util.Objects.requireNonNull(ref, "ref is required") });
}
/**
* Obtain the secret value through a CloudFormation parameter.
*
* Generally, this is not a recommended approach. AWS Secrets Manager is the
* recommended way to reference secrets.
*
* @param param The CloudFormation parameter to use.
*/
public static software.amazon.awscdk.SecretValue cfnParameter(final software.amazon.awscdk.CfnParameter param) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.SecretValue.class, "cfnParameter", software.amazon.awscdk.SecretValue.class, new Object[] { java.util.Objects.requireNonNull(param, "param is required") });
}
/**
* Construct a literal secret value for use with secret-aware constructs.
*
* *Do not use this method for any secrets that you care about.*
*
* The only reasonable use case for using this method is when you are testing.
*/
public static software.amazon.awscdk.SecretValue plainText(final java.lang.String secret) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.SecretValue.class, "plainText", software.amazon.awscdk.SecretValue.class, new Object[] { java.util.Objects.requireNonNull(secret, "secret is required") });
}
/**
* Creates a `SecretValue` with a value which is dynamically loaded from AWS Secrets Manager.
*
* @param secretId The ID or ARN of the secret.
* @param options Options.
*/
public static software.amazon.awscdk.SecretValue secretsManager(final java.lang.String secretId, @javax.annotation.Nullable final software.amazon.awscdk.SecretsManagerSecretOptions options) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.SecretValue.class, "secretsManager", software.amazon.awscdk.SecretValue.class, new Object[] { java.util.Objects.requireNonNull(secretId, "secretId is required"), options });
}
/**
* Creates a `SecretValue` with a value which is dynamically loaded from AWS Secrets Manager.
*
* @param secretId The ID or ARN of the secret.
*/
public static software.amazon.awscdk.SecretValue secretsManager(final java.lang.String secretId) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.SecretValue.class, "secretsManager", software.amazon.awscdk.SecretValue.class, new Object[] { java.util.Objects.requireNonNull(secretId, "secretId is required") });
}
/**
* Use a secret value stored from a Systems Manager (SSM) parameter.
*
* @param parameterName The name of the parameter in the Systems Manager Parameter Store.
* @param version An integer that specifies the version of the parameter to use.
*/
public static software.amazon.awscdk.SecretValue ssmSecure(final java.lang.String parameterName, final java.lang.String version) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.SecretValue.class, "ssmSecure", software.amazon.awscdk.SecretValue.class, new Object[] { java.util.Objects.requireNonNull(parameterName, "parameterName is required"), java.util.Objects.requireNonNull(version, "version is required") });
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy