ISecretTargetAttachment¶
-
class
aws_cdk.aws_secretsmanager.
ISecretTargetAttachment
(*args, **kwds)¶ Bases:
aws_cdk.aws_secretsmanager.ISecret
,typing_extensions.Protocol
Methods
-
add_rotation_schedule
(id, *, automatically_after=None, hosted_rotation=None, rotation_lambda=None)¶ Adds a rotation schedule to the secret.
- Parameters
id (
str
) –automatically_after (
Optional
[Duration
]) – Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation. A value of zero will disable automatic rotation -Duration.days(0)
. Default: Duration.days(30)hosted_rotation (
Optional
[HostedRotation
]) – Hosted rotation. Default: - eitherrotationLambda
orhostedRotation
must be specifiedrotation_lambda (
Optional
[IFunction
]) – A Lambda function that can rotate the secret. Default: - eitherrotationLambda
orhostedRotation
must be specified
- Return type
-
add_to_resource_policy
(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.- Parameters
statement (
PolicyStatement
) –- Return type
-
apply_removal_policy
(policy)¶ Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters
policy (
RemovalPolicy
) –- Return type
None
-
attach
(target)¶ Attach a target to this secret.
- Parameters
target (
ISecretAttachmentTarget
) – The target to attach.- Return type
- Returns
An attached secret
-
deny_account_root_delete
()¶ Denies the
DeleteSecret
action to all principals within the current account.- Return type
None
-
grant_read
(grantee, version_stages=None)¶ Grants reading the secret value to some role.
- Parameters
grantee (
IGrantable
) – the principal being granted permission.version_stages (
Optional
[Sequence
[str
]]) – the version stages the grant is limited to. If not specified, no restriction on the version stages is applied.
- Return type
-
grant_write
(grantee)¶ Grants writing and updating the secret value to some role.
- Parameters
grantee (
IGrantable
) – the principal being granted permission.- Return type
-
secret_value_from_json
(key)¶ Interpret the secret as a JSON object and return a field’s value from it as a
SecretValue
.- Parameters
key (
str
) –- Return type
Attributes
-
encryption_key
¶ 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.
- Return type
Optional
[IKey
]
-
env
¶ The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
- Return type
-
node
¶ The construct tree node for this construct.
- Return type
-
secret_arn
¶ 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
.- Attribute
true
- Return type
str
-
secret_full_arn
¶ 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).- Return type
Optional
[str
]
-
secret_name
¶ 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.
- Return type
str
-
secret_target_attachment_secret_arn
¶ Same as
secretArn
.- Attribute
true
- Return type
str
-
secret_value
¶ Retrieve the value of the stored secret as a
SecretValue
.- Attribute
true
- Return type
-