Class Secret
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.103.1 (build bef2dea)",
date="2024-10-25T14:21:11.028Z")
@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
-
Method Summary
Modifier and TypeMethodDescriptionstatic Secret
fromSecretsManager
(ISecret secret) Creates a environment variable value from a secret stored in AWS Secrets Manager.static Secret
fromSecretsManager
(ISecret secret, String field) Creates a environment variable value from a secret stored in AWS Secrets Manager.static Secret
fromSecretsManagerVersion
(ISecret secret, SecretVersionInfo versionInfo) Creates a environment variable value from a secret stored in AWS Secrets Manager.static Secret
fromSecretsManagerVersion
(ISecret secret, SecretVersionInfo versionInfo, String field) Creates a environment variable value from a secret stored in AWS Secrets Manager.static Secret
fromSsmParameter
(IParameter parameter) Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store.abstract String
getArn()
The ARN of the secret.abstract Boolean
Whether this secret uses a specific JSON field.abstract Grant
grantRead
(IGrantable grantee) 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
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
Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store.- Parameters:
parameter
- This parameter is required.
-
grantRead
Grants reading the secret to a principal.- Parameters:
grantee
- This parameter is required.
-
getArn
The ARN of the secret. -
getHasField
Whether this secret uses a specific JSON field.
-