Class CfnSecret
- All Implemented Interfaces:
IInspectable
,ITaggable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
A secret can be a password, a set of credentials such as a user name and password, an OAuth token, or other secret information that you store in an encrypted form in Secrets Manager.
For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .
For Amazon Redshift admin user credentials, see AWS::Redshift::Cluster .
To retrieve a secret in a CloudFormation template, use a dynamic reference . For more information, see Retrieve a secret in an AWS CloudFormation resource .
For information about creating a secret in the console, see Create a secret . For information about creating a secret using the CLI or SDK, see CreateSecret .
For information about retrieving a secret in code, see Retrieve secrets from Secrets Manager .
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.*; CfnSecret cfnSecret = CfnSecret.Builder.create(this, "MyCfnSecret") .description("description") .generateSecretString(GenerateSecretStringProperty.builder() .excludeCharacters("excludeCharacters") .excludeLowercase(false) .excludeNumbers(false) .excludePunctuation(false) .excludeUppercase(false) .generateStringKey("generateStringKey") .includeSpace(false) .passwordLength(123) .requireEachIncludedType(false) .secretStringTemplate("secretStringTemplate") .build()) .kmsKeyId("kmsKeyId") .name("name") .replicaRegions(List.of(ReplicaRegionProperty.builder() .region("region") // the properties below are optional .kmsKeyId("kmsKeyId") .build())) .secretString("secretString") .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .build();
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A fluent builder forCfnSecret
.static interface
Generates a random password.static interface
Specifies aRegion
and theKmsKeyId
for a replica secret.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnSecret
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnSecret
(software.amazon.jsii.JsiiObjectRef objRef) CfnSecret
(software.constructs.Construct scope, String id, CfnSecretProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe ARN of the secret.The description of the secret.A structure that specifies how to generate a password to encrypt and store in the secret.The ARN, key ID, or alias of the AWS KMS key that Secrets Manager uses to encrypt the secret value in the secret.getName()
The name of the new secret.A custom type that specifies aRegion
and theKmsKeyId
for a replica secret.The text to encrypt and store in the secret.getTags()
Tag Manager which manages the tags for this resource.A list of tags to attach to the secret.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setDescription
(String value) The description of the secret.void
A structure that specifies how to generate a password to encrypt and store in the secret.void
A structure that specifies how to generate a password to encrypt and store in the secret.void
setKmsKeyId
(String value) The ARN, key ID, or alias of the AWS KMS key that Secrets Manager uses to encrypt the secret value in the secret.void
The name of the new secret.void
setReplicaRegions
(List<Object> value) A custom type that specifies aRegion
and theKmsKeyId
for a replica secret.void
setReplicaRegions
(IResolvable value) A custom type that specifies aRegion
and theKmsKeyId
for a replica secret.void
setSecretString
(String value) The text to encrypt and store in the secret.void
setTagsRaw
(List<CfnTag> value) A list of tags to attach to the secret.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
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.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnSecret
protected CfnSecret(software.amazon.jsii.JsiiObjectRef objRef) -
CfnSecret
protected CfnSecret(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnSecret
@Stability(Stable) public CfnSecret(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnSecretProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties.
-
CfnSecret
@Stability(Stable) public CfnSecret(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrId
The ARN of the secret. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
Tag Manager which manages the tags for this resource. -
getDescription
The description of the secret. -
setDescription
The description of the secret. -
getGenerateSecretString
A structure that specifies how to generate a password to encrypt and store in the secret. -
setGenerateSecretString
A structure that specifies how to generate a password to encrypt and store in the secret. -
setGenerateSecretString
@Stability(Stable) public void setGenerateSecretString(@Nullable CfnSecret.GenerateSecretStringProperty value) A structure that specifies how to generate a password to encrypt and store in the secret. -
getKmsKeyId
The ARN, key ID, or alias of the AWS KMS key that Secrets Manager uses to encrypt the secret value in the secret. -
setKmsKeyId
The ARN, key ID, or alias of the AWS KMS key that Secrets Manager uses to encrypt the secret value in the secret. -
getName
The name of the new secret. -
setName
The name of the new secret. -
getReplicaRegions
A custom type that specifies aRegion
and theKmsKeyId
for a replica secret. -
setReplicaRegions
A custom type that specifies aRegion
and theKmsKeyId
for a replica secret. -
setReplicaRegions
A custom type that specifies aRegion
and theKmsKeyId
for a replica secret. -
getSecretString
The text to encrypt and store in the secret. -
setSecretString
The text to encrypt and store in the secret. -
getTagsRaw
A list of tags to attach to the secret. -
setTagsRaw
A list of tags to attach to the secret.
-