Class SecretTargetAttachment
- All Implemented Interfaces:
IConstruct
,IDependable
,IResource
,ISecret
,ISecretTargetAttachment
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
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 classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.secretsmanager.ISecret
ISecret.Jsii$Default, ISecret.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.secretsmanager.ISecretTargetAttachment
ISecretTargetAttachment.Jsii$Default, ISecretTargetAttachment.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionprotected
SecretTargetAttachment
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
SecretTargetAttachment
(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) Adds a statement to the IAM resource policy associated with this secret.attach
(ISecretAttachmentTarget target) Attach a target to this secret.void
Denies theDeleteSecret
action to all principals within the current account.static ISecretTargetAttachment
fromSecretTargetAttachmentSecretArn
(software.constructs.Construct scope, String id, String secretTargetAttachmentSecretArn) protected String
Provides an identifier for this secret for use in IAM policies.protected Boolean
The 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
.validate()
Validate the current construct.Methods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize
Methods inherited from class software.constructs.Construct
toString
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, wait, wait, wait
Methods inherited from interface software.amazon.awscdk.core.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.core.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
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:
addRotationSchedule
in interfaceISecret
- Parameters:
id
- This parameter is required.options
- This parameter is required.
-
addToResourcePolicy
@Stability(Stable) @NotNull public AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement statement) Adds a statement to the IAM resource policy associated with this secret.If this secret was created in this stack, a resource policy will be automatically created upon the first call to
addToResourcePolicy
. If the secret is imported, then this is a no-op.- Specified by:
addToResourcePolicy
in interfaceISecret
- Parameters:
statement
- This parameter is required.
-
attach
Attach a target to this secret. -
denyAccountRootDelete
@Stability(Stable) public void denyAccountRootDelete()Denies theDeleteSecret
action to all principals within the current account.- Specified by:
denyAccountRootDelete
in 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:
grantWrite
in 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:
secretValueFromJson
in interfaceISecret
- Parameters:
jsonField
- This parameter is required.
-
validate
Validate the current construct.This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.
-
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:
getSecretArn
in 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:
getSecretName
in interfaceISecret
-
getSecretTargetAttachmentSecretArn
Same assecretArn
.- Specified by:
getSecretTargetAttachmentSecretArn
in interfaceISecretTargetAttachment
-
getSecretValue
Retrieve the value of the stored secret as aSecretValue
.- Specified by:
getSecretValue
in 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:
getEncryptionKey
in 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
secretArn
in most cases, but is undefined when a full ARN is not available (e.g., secrets imported by name).- Specified by:
getSecretFullArn
in interfaceISecret
-