Interface SecretVersionInfo

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
SecretVersionInfo.Jsii$Proxy

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-25T14:21:14.674Z") @Stability(Stable) public interface SecretVersionInfo extends software.amazon.jsii.JsiiSerializable
Specify the secret's version id or version stage.

Example:

 Secret secret;
 Secret dbSecret;
 StringParameter parameter;
 TaskDefinition taskDefinition;
 Bucket s3Bucket;
 ContainerDefinition newContainer = taskDefinition.addContainer("container", ContainerDefinitionOptions.builder()
         .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
         .memoryLimitMiB(1024)
         .environment(Map.of( // clear text, not for sensitive data
                 "STAGE", "prod"))
         .environmentFiles(List.of(EnvironmentFile.fromAsset("./demo-env-file.env"), EnvironmentFile.fromBucket(s3Bucket, "assets/demo-env-file.env")))
         .secrets(Map.of( // Retrieved from AWS Secrets Manager or AWS Systems Manager Parameter Store at container start-up.
                 "SECRET", Secret.fromSecretsManager(secret),
                 "DB_PASSWORD", Secret.fromSecretsManager(dbSecret, "password"),  // Reference a specific JSON field, (requires platform version 1.4.0 or later for Fargate tasks)
                 "API_KEY", Secret.fromSecretsManagerVersion(secret, SecretVersionInfo.builder().versionId("12345").build(), "apiKey"),  // Reference a specific version of the secret by its version id or version stage (requires platform version 1.4.0 or later for Fargate tasks)
                 "PARAMETER", Secret.fromSsmParameter(parameter)))
         .build());
 newContainer.addEnvironment("QUEUE_NAME", "MyQueue");
 newContainer.addSecret("API_KEY", Secret.fromSecretsManager(secret));
 newContainer.addSecret("DB_PASSWORD", Secret.fromSecretsManager(secret, "password"));
 
  • Method Details

    • getVersionId

      @Stability(Stable) @Nullable default String getVersionId()
      version id of the secret.

      Default: - use default version id

    • getVersionStage

      @Stability(Stable) @Nullable default String getVersionStage()
      version stage of the secret.

      Default: - use default version stage

    • builder

      @Stability(Stable) static SecretVersionInfo.Builder builder()
      Returns:
      a SecretVersionInfo.Builder of SecretVersionInfo