java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.apprunner.alpha.Secret
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:15.631Z") @Stability(Experimental) public abstract class Secret extends software.amazon.jsii.JsiiObject
(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"));
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
    protected
    Secret(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Secret(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Secret
    (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
    static Secret
    (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
    static Secret
    (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
    static Secret
    (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
    static Secret
    (experimental) Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store.
    abstract String
    (experimental) The ARN of the secret.
    abstract Boolean
    (experimental) Whether this secret uses a specific JSON field.
    abstract Grant
    (experimental) Grants reading the secret to a principal.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • Secret

      protected Secret(software.amazon.jsii.JsiiObjectRef objRef)
    • Secret

      protected Secret(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Secret

      @Stability(Experimental) protected Secret()
  • Method Details

    • fromSecretsManager

      @Stability(Experimental) @NotNull public static Secret fromSecretsManager(@NotNull ISecret secret, @Nullable String field)
      (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.

      Parameters:
      secret - the secret stored in AWS Secrets Manager. This parameter is required.
      field - the name of the field with the value that you want to set as the environment variable value.
    • fromSecretsManager

      @Stability(Experimental) @NotNull public static Secret fromSecretsManager(@NotNull ISecret secret)
      (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.

      Parameters:
      secret - the secret stored in AWS Secrets Manager. This parameter is required.
    • fromSecretsManagerVersion

      @Stability(Experimental) @NotNull public static Secret fromSecretsManagerVersion(@NotNull ISecret secret, @NotNull SecretVersionInfo versionInfo, @Nullable String field)
      (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.

      Parameters:
      secret - the secret stored in AWS Secrets Manager. This parameter is required.
      versionInfo - the version information to reference the secret. This parameter is required.
      field - the name of the field with the value that you want to set as the environment variable value.
    • fromSecretsManagerVersion

      @Stability(Experimental) @NotNull public static Secret fromSecretsManagerVersion(@NotNull ISecret secret, @NotNull SecretVersionInfo versionInfo)
      (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.

      Parameters:
      secret - the secret stored in AWS Secrets Manager. This parameter is required.
      versionInfo - the version information to reference the secret. This parameter is required.
    • fromSsmParameter

      @Stability(Experimental) @NotNull public static Secret fromSsmParameter(@NotNull IParameter parameter)
      (experimental) Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store.

      Parameters:
      parameter - This parameter is required.
    • grantRead

      @Stability(Experimental) @NotNull public abstract Grant grantRead(@NotNull IGrantable grantee)
      (experimental) Grants reading the secret to a principal.

      Parameters:
      grantee - This parameter is required.
    • getArn

      @Stability(Experimental) @NotNull public abstract String getArn()
      (experimental) The ARN of the secret.
    • getHasField

      @Stability(Experimental) @Nullable public abstract Boolean getHasField()
      (experimental) Whether this secret uses a specific JSON field.