software.amazon.awscdk.services.apprunner.alpha.Secret Maven / Gradle / Ivy
package software.amazon.awscdk.services.apprunner.alpha;
/**
* (experimental) A secret environment variable.
*
* Example:
*
*
* import software.amazon.awscdk.services.secretsmanager.*;
* import software.amazon.awscdk.services.ssm.*;
* Stack stack;
* Secret secret = new Secret(stack, "Secret");
* IStringParameter parameter = StringParameter.fromSecureStringParameterAttributes(stack, "Parameter", SecureStringParameterAttributes.builder()
* .parameterName("/name")
* .version(1)
* .build());
* Service service = Service.Builder.create(stack, "Service")
* .source(Source.fromEcrPublic(EcrPublicProps.builder()
* .imageConfiguration(ImageConfiguration.builder()
* .port(8000)
* .environmentSecrets(Map.of(
* "SECRET", Secret.fromSecretsManager(secret),
* "PARAMETER", Secret.fromSsmParameter(parameter),
* "SECRET_ID", Secret.fromSecretsManagerVersion(secret, SecretVersionInfo.builder().versionId("version-id").build()),
* "SECRET_STAGE", Secret.fromSecretsManagerVersion(secret, SecretVersionInfo.builder().versionStage("version-stage").build())))
* .build())
* .imageIdentifier("public.ecr.aws/aws-containers/hello-app-runner:latest")
* .build()))
* .build();
* service.addSecret("LATER_SECRET", Secret.fromSecretsManager(secret, "field"));
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-12-17T21:37:41.240Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.apprunner.alpha.$Module.class, fqn = "@aws-cdk/aws-apprunner-alpha.Secret")
public abstract class Secret extends software.amazon.jsii.JsiiObject {
protected Secret(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Secret(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected Secret() {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
* (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
*
* @param secret the secret stored in AWS Secrets Manager. This parameter is required.
* @param field the name of the field with the value that you want to set as the environment variable value.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.apprunner.alpha.Secret fromSecretsManager(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.secretsmanager.ISecret secret, final @org.jetbrains.annotations.Nullable java.lang.String field) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.apprunner.alpha.Secret.class, "fromSecretsManager", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.apprunner.alpha.Secret.class), new Object[] { java.util.Objects.requireNonNull(secret, "secret is required"), field });
}
/**
* (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
*
* @param secret the secret stored in AWS Secrets Manager. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.apprunner.alpha.Secret fromSecretsManager(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.secretsmanager.ISecret secret) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.apprunner.alpha.Secret.class, "fromSecretsManager", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.apprunner.alpha.Secret.class), new Object[] { java.util.Objects.requireNonNull(secret, "secret is required") });
}
/**
* (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
*
* @param secret the secret stored in AWS Secrets Manager. This parameter is required.
* @param versionInfo the version information to reference the secret. This parameter is required.
* @param field the name of the field with the value that you want to set as the environment variable value.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.apprunner.alpha.Secret fromSecretsManagerVersion(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.secretsmanager.ISecret secret, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.apprunner.alpha.SecretVersionInfo versionInfo, final @org.jetbrains.annotations.Nullable java.lang.String field) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.apprunner.alpha.Secret.class, "fromSecretsManagerVersion", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.apprunner.alpha.Secret.class), new Object[] { java.util.Objects.requireNonNull(secret, "secret is required"), java.util.Objects.requireNonNull(versionInfo, "versionInfo is required"), field });
}
/**
* (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
*
* @param secret the secret stored in AWS Secrets Manager. This parameter is required.
* @param versionInfo the version information to reference the secret. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.apprunner.alpha.Secret fromSecretsManagerVersion(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.secretsmanager.ISecret secret, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.apprunner.alpha.SecretVersionInfo versionInfo) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.apprunner.alpha.Secret.class, "fromSecretsManagerVersion", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.apprunner.alpha.Secret.class), new Object[] { java.util.Objects.requireNonNull(secret, "secret is required"), java.util.Objects.requireNonNull(versionInfo, "versionInfo is required") });
}
/**
* (experimental) Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store.
*
* @param parameter This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.apprunner.alpha.Secret fromSsmParameter(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ssm.IParameter parameter) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.apprunner.alpha.Secret.class, "fromSsmParameter", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.apprunner.alpha.Secret.class), new Object[] { java.util.Objects.requireNonNull(parameter, "parameter is required") });
}
/**
* (experimental) Grants reading the secret to a principal.
*
* @param grantee This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public abstract @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.Grant grantRead(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IGrantable grantee);
/**
* (experimental) The ARN of the secret.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public abstract @org.jetbrains.annotations.NotNull java.lang.String getArn();
/**
* (experimental) Whether this secret uses a specific JSON field.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public abstract @org.jetbrains.annotations.Nullable java.lang.Boolean getHasField();
/**
* A proxy class which represents a concrete javascript instance of this type.
*/
@software.amazon.jsii.Internal
private static final class Jsii$Proxy extends software.amazon.awscdk.services.apprunner.alpha.Secret {
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
/**
* (experimental) The ARN of the secret.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public final @org.jetbrains.annotations.NotNull java.lang.String getArn() {
return software.amazon.jsii.Kernel.get(this, "arn", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) Whether this secret uses a specific JSON field.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public final @org.jetbrains.annotations.Nullable java.lang.Boolean getHasField() {
return software.amazon.jsii.Kernel.get(this, "hasField", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
/**
* (experimental) Grants reading the secret to a principal.
*
* @param grantee This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.Grant grantRead(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IGrantable grantee) {
return software.amazon.jsii.Kernel.call(this, "grantRead", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.Grant.class), new Object[] { java.util.Objects.requireNonNull(grantee, "grantee is required") });
}
}
}