Interface ISecret
- All Superinterfaces:
IConstruct
,software.constructs.IConstruct
,IDependable
,IResource
,software.amazon.jsii.JsiiSerializable
- All Known Subinterfaces:
ISecret.Jsii$Default
,ISecretTargetAttachment
,ISecretTargetAttachment.Jsii$Default
- All Known Implementing Classes:
DatabaseSecret
,DatabaseSecret
,DatabaseSecret
,ISecret.Jsii$Proxy
,ISecretTargetAttachment.Jsii$Proxy
,Secret
,SecretTargetAttachment
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:41.289Z")
@Stability(Stable)
public interface ISecret
extends software.amazon.jsii.JsiiSerializable, IResource
A secret in AWS Secrets Manager.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Internal default implementation forISecret
.static final class
A proxy class which represents a concrete javascript instance of this type. -
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.default IKey
The customer-managed encryption key that is used to encrypt this secret, if any.The ARN of the secret in AWS Secrets Manager.default String
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.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.Interpret the secret as a JSON object and return a field's value from it as aSecretValue
.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
-
Method Details
-
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
. -
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.
-
getSecretValue
Retrieve the value of the stored secret as aSecretValue
. -
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.
-
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). -
addRotationSchedule
@Stability(Stable) @NotNull RotationSchedule addRotationSchedule(@NotNull String id, @NotNull RotationScheduleOptions options) Adds a rotation schedule to the secret.- Parameters:
id
- This parameter is required.options
- This parameter is required.
-
addToResourcePolicy
@Stability(Stable) @NotNull 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.- Parameters:
statement
- This parameter is required.
-
attach
Attach a target to this secret.- Parameters:
target
- The target to attach. This parameter is required.- Returns:
- An attached secret
-
denyAccountRootDelete
@Stability(Stable) void denyAccountRootDelete()Denies theDeleteSecret
action to all principals within the current account. -
grantRead
@Stability(Stable) @NotNull Grant grantRead(@NotNull IGrantable grantee, @Nullable List<String> versionStages) Grants reading the secret value to some role.- Parameters:
grantee
- the principal being granted permission. This parameter is required.versionStages
- the version stages the grant is limited to.
-
grantRead
Grants reading the secret value to some role.- Parameters:
grantee
- the principal being granted permission. This parameter is required.
-
grantWrite
Grants writing and updating the secret value to some role.- Parameters:
grantee
- the principal being granted permission. This parameter is required.
-
secretValueFromJson
Interpret the secret as a JSON object and return a field's value from it as aSecretValue
.- Parameters:
key
- This parameter is required.
-