Class SecretTargetAttachment
- All Implemented Interfaces:
IEnvironmentAware,IResource,ISecret,ISecretTargetAttachment,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.secretsmanager.*;
Secret secret;
ISecretAttachmentTarget secretAttachmentTarget;
SecretTargetAttachment secretTargetAttachment = SecretTargetAttachment.Builder.create(this, "MySecretTargetAttachment")
.secret(secret)
.target(secretAttachmentTarget)
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.secretsmanager.ISecret
ISecret.Jsii$Default, ISecret.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.secretsmanager.ISecretTargetAttachment
ISecretTargetAttachment.Jsii$Default, ISecretTargetAttachment.Jsii$Proxy -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSecretTargetAttachment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedSecretTargetAttachment(software.amazon.jsii.JsiiObjectRef objRef) SecretTargetAttachment(software.constructs.Construct scope, String id, SecretTargetAttachmentProps props) -
Method Summary
Modifier and TypeMethodDescriptionaddRotationSchedule(String id, RotationScheduleOptions options) Adds a rotation schedule to the secret.addToResourcePolicy(PolicyStatement statement) Forward any additions to the resource policy to the original secret.attach(ISecretAttachmentTarget target) Attach a target to this secret.Returns a key which can be used within an AWS CloudFormation dynamic reference to dynamically load this secret from AWS Secrets Manager.Returns a key which can be used within an AWS CloudFormation dynamic reference to dynamically load this secret from AWS Secrets Manager.voidDenies theDeleteSecretaction to all principals within the current account.static ISecretTargetAttachmentfromSecretTargetAttachmentSecretArn(software.constructs.Construct scope, String id, String secretTargetAttachmentSecretArn) protected StringProvides an identifier for this secret for use in IAM policies.protected BooleanThe customer-managed encryption key that is used to encrypt this secret, if any.The ARN of the secret in AWS Secrets Manager.The full ARN of the secret in AWS Secrets Manager, which is the ARN including the Secrets Manager-supplied 6-character suffix.The name of the secret.Same assecretArn.Retrieve the value of the stored secret as aSecretValue.grantRead(IGrantable grantee) Grants reading the secret value to some role.grantRead(IGrantable grantee, List<String> versionStages) Grants reading the secret value to some role.grantWrite(IGrantable grantee) Grants writing and updating the secret value to some role.secretValueFromJson(String jsonField) Interpret the secret as a JSON object and return a field's value from it as aSecretValue.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
SecretTargetAttachment
protected SecretTargetAttachment(software.amazon.jsii.JsiiObjectRef objRef) -
SecretTargetAttachment
protected SecretTargetAttachment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
SecretTargetAttachment
@Stability(Stable) public SecretTargetAttachment(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull SecretTargetAttachmentProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromSecretTargetAttachmentSecretArn
@Stability(Stable) @NotNull public static ISecretTargetAttachment fromSecretTargetAttachmentSecretArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String secretTargetAttachmentSecretArn) - Parameters:
scope- This parameter is required.id- This parameter is required.secretTargetAttachmentSecretArn- This parameter is required.
-
addRotationSchedule
@Stability(Stable) @NotNull public RotationSchedule addRotationSchedule(@NotNull String id, @NotNull RotationScheduleOptions options) Adds a rotation schedule to the secret.- Specified by:
addRotationSchedulein interfaceISecret- Parameters:
id- This parameter is required.options- This parameter is required.
-
addToResourcePolicy
@Stability(Stable) @NotNull public AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement statement) Forward any additions to the resource policy to the original secret.This is required because a secret can only have a single resource policy. If we do not forward policy additions, a new policy resource is created using the secret attachment ARN. This ends up being rejected by CloudFormation.
- Specified by:
addToResourcePolicyin interfaceISecret- Parameters:
statement- This parameter is required.
-
attach
Attach a target to this secret. -
cfnDynamicReferenceKey
@Stability(Stable) @NotNull public String cfnDynamicReferenceKey(@Nullable SecretsManagerSecretOptions options) Returns a key which can be used within an AWS CloudFormation dynamic reference to dynamically load this secret from AWS Secrets Manager.- Specified by:
cfnDynamicReferenceKeyin interfaceISecret- Parameters:
options- Options.- See Also:
-
cfnDynamicReferenceKey
Returns a key which can be used within an AWS CloudFormation dynamic reference to dynamically load this secret from AWS Secrets Manager.- Specified by:
cfnDynamicReferenceKeyin interfaceISecret- See Also:
-
denyAccountRootDelete
@Stability(Stable) public void denyAccountRootDelete()Denies theDeleteSecretaction to all principals within the current account.- Specified by:
denyAccountRootDeletein interfaceISecret
-
grantRead
@Stability(Stable) @NotNull public Grant grantRead(@NotNull IGrantable grantee, @Nullable List<String> versionStages) Grants reading the secret value to some role. -
grantRead
Grants reading the secret value to some role. -
grantWrite
Grants writing and updating the secret value to some role.- Specified by:
grantWritein interfaceISecret- Parameters:
grantee- This parameter is required.
-
secretValueFromJson
Interpret the secret as a JSON object and return a field's value from it as aSecretValue.- Specified by:
secretValueFromJsonin interfaceISecret- Parameters:
jsonField- This parameter is required.
-
getArnForPolicies
Provides an identifier for this secret for use in IAM policies.If there is a full ARN, this is just the ARN; if we have a partial ARN -- due to either importing by secret name or partial ARN -- then we need to add a suffix to capture the full ARN's format.
-
getAutoCreatePolicy
-
getSecretArn
The ARN of the secret in AWS Secrets Manager.Will return the full ARN if available, otherwise a partial arn. For secrets imported by the deprecated
fromSecretName, it will return thesecretName.- Specified by:
getSecretArnin interfaceISecret
-
getSecretName
The name of the secret.For "owned" secrets, this will be the full resource name (secret name + suffix), unless the '@aws-cdk/aws-secretsmanager:parseOwnedSecretName' feature flag is set.
- Specified by:
getSecretNamein interfaceISecret
-
getSecretTargetAttachmentSecretArn
Same assecretArn.- Specified by:
getSecretTargetAttachmentSecretArnin interfaceISecretTargetAttachment
-
getSecretValue
Retrieve the value of the stored secret as aSecretValue.- Specified by:
getSecretValuein interfaceISecret
-
getEncryptionKey
The customer-managed encryption key that is used to encrypt this secret, if any.When not specified, the default KMS key for the account and region is being used.
- Specified by:
getEncryptionKeyin interfaceISecret
-
getSecretFullArn
The full ARN of the secret in AWS Secrets Manager, which is the ARN including the Secrets Manager-supplied 6-character suffix.This is equal to
secretArnin most cases, but is undefined when a full ARN is not available (e.g., secrets imported by name).- Specified by:
getSecretFullArnin interfaceISecret
-