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

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:23:57.766Z") @Stability(Stable) public abstract class Secret extends software.amazon.jsii.JsiiObject
A secret environment variable.

Example:

 ISecret mySecret;
 EcsJobDefinition jobDefn = EcsJobDefinition.Builder.create(this, "JobDefn")
         .container(EcsEc2ContainerDefinition.Builder.create(this, "containerDefn")
                 .image(ContainerImage.fromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"))
                 .memory(Size.mebibytes(2048))
                 .cpu(256)
                 .secrets(Map.of(
                         "MY_SECRET_ENV_VAR", Secret.fromSecretsManager(mySecret)))
                 .build())
         .build();
 
  • 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
    Creates a environment variable value from a secret stored in AWS Secrets Manager.
    static Secret
    Creates a environment variable value from a secret stored in AWS Secrets Manager.
    static Secret
    Creates a environment variable value from a secret stored in AWS Secrets Manager.
    static Secret
    Creates a environment variable value from a secret stored in AWS Secrets Manager.
    static Secret
    Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store.
    abstract String
    The ARN of the secret.
    abstract Boolean
    Whether this secret uses a specific JSON field.
    abstract Grant
    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(Stable) protected Secret()
  • Method Details

    • fromSecretsManager

      @Stability(Stable) @NotNull public static Secret fromSecretsManager(@NotNull ISecret secret, @Nullable String field)
      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(Stable) @NotNull public static Secret fromSecretsManager(@NotNull ISecret secret)
      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(Stable) @NotNull public static Secret fromSecretsManagerVersion(@NotNull ISecret secret, @NotNull SecretVersionInfo versionInfo, @Nullable String field)
      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(Stable) @NotNull public static Secret fromSecretsManagerVersion(@NotNull ISecret secret, @NotNull SecretVersionInfo versionInfo)
      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(Stable) @NotNull public static Secret fromSsmParameter(@NotNull IParameter parameter)
      Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store.

      Parameters:
      parameter - This parameter is required.
    • grantRead

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

      Parameters:
      grantee - This parameter is required.
    • getArn

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

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