@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-04T15:39:13.488Z") @Stability(value=Experimental) public interface DatabaseSecretProps extends software.amazon.jsii.JsiiSerializable
Example:
// Build a data source for AppSync to access the database.
GraphqlApi api;
// Create username and password secret for DB Cluster
DatabaseSecret secret = DatabaseSecret.Builder.create(this, "AuroraSecret")
.username("clusteradmin")
.build();
// The VPC to place the cluster in
Vpc vpc = new Vpc(this, "AuroraVpc");
// Create the serverless cluster, provide all values needed to customise the database.
ServerlessCluster cluster = ServerlessCluster.Builder.create(this, "AuroraCluster")
.engine(DatabaseClusterEngine.AURORA_MYSQL)
.vpc(vpc)
.credentials(Map.of("username", "clusteradmin"))
.clusterIdentifier("db-endpoint-test")
.defaultDatabaseName("demos")
.build();
RdsDataSource rdsDS = api.addRdsDataSource("rds", cluster, secret, "demos");
// Set up a resolver for an RDS query.
rdsDS.createResolver(BaseResolverProps.builder()
.typeName("Query")
.fieldName("getDemosRds")
.requestMappingTemplate(MappingTemplate.fromString("\n {\n \"version\": \"2018-05-29\",\n \"statements\": [\n \"SELECT * FROM demos\"\n ]\n }\n "))
.responseMappingTemplate(MappingTemplate.fromString("\n $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])\n "))
.build());
// Set up a resolver for an RDS mutation.
rdsDS.createResolver(BaseResolverProps.builder()
.typeName("Mutation")
.fieldName("addDemoRds")
.requestMappingTemplate(MappingTemplate.fromString("\n {\n \"version\": \"2018-05-29\",\n \"statements\": [\n \"INSERT INTO demos VALUES (:id, :version)\",\n \"SELECT * WHERE id = :id\"\n ],\n \"variableMap\": {\n \":id\": $util.toJson($util.autoId()),\n \":version\": $util.toJson($ctx.args.version)\n }\n }\n "))
.responseMappingTemplate(MappingTemplate.fromString("\n $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])\n "))
.build());
| Modifier and Type | Interface and Description |
|---|---|
static class |
DatabaseSecretProps.Builder
A builder for
DatabaseSecretProps |
static class |
DatabaseSecretProps.Jsii$Proxy
An implementation for
DatabaseSecretProps |
| Modifier and Type | Method and Description |
|---|---|
static DatabaseSecretProps.Builder |
builder() |
default IKey |
getEncryptionKey()
(experimental) The KMS key to use to encrypt the secret.
|
default String |
getExcludeCharacters()
(experimental) Characters to not include in the generated password.
|
default ISecret |
getMasterSecret()
(experimental) The master secret which will be used to rotate this secret.
|
default Boolean |
getReplaceOnPasswordCriteriaChanges()
(experimental) Whether to replace this secret when the criteria for the password change.
|
default List<ReplicaRegion> |
getReplicaRegions()
(experimental) A list of regions where to replicate this secret.
|
default String |
getSecretName()
(experimental) A name for the secret.
|
String |
getUsername()
(experimental) The username.
|
@Stability(value=Experimental) @NotNull String getUsername()
@Stability(value=Experimental) @Nullable default IKey getEncryptionKey()
Default: default master key
@Stability(value=Experimental) @Nullable default String getExcludeCharacters()
Default: " %+~`#$&*()|[]{}:;<>?!'/
@Stability(value=Experimental) @Nullable default ISecret getMasterSecret()
Default: - no master secret information will be included
@Stability(value=Experimental) @Nullable default Boolean getReplaceOnPasswordCriteriaChanges()
This is achieved by overriding the logical id of the AWS::SecretsManager::Secret with a hash of the options that influence the password generation. This way a new secret will be created when the password is regenerated and the cluster or instance consuming this secret will have its credentials updated.
Default: false
@Stability(value=Experimental) @Nullable default List<ReplicaRegion> getReplicaRegions()
Default: - Secret is not replicated
@Stability(value=Experimental) @Nullable default String getSecretName()
Default: - A name is generated by CloudFormation.
@Stability(value=Experimental) static DatabaseSecretProps.Builder builder()
DatabaseSecretProps.Builder of DatabaseSecretPropsCopyright © 2022. All rights reserved.