@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-04T15:39:13.422Z") @Stability(value=Experimental) public abstract class Credentials extends software.amazon.jsii.JsiiObject
Example:
Vpc vpc;
DatabaseCluster cluster = DatabaseCluster.Builder.create(this, "Database")
.engine(DatabaseClusterEngine.auroraMysql(AuroraMysqlClusterEngineProps.builder().version(AuroraMysqlEngineVersion.VER_2_08_1).build()))
.credentials(Credentials.fromGeneratedSecret("clusteradmin")) // Optional - will default to 'admin' username and generated password
.instanceProps(InstanceProps.builder()
// optional , defaults to t3.medium
.instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.SMALL))
.vpcSubnets(SubnetSelection.builder()
.subnetType(SubnetType.PRIVATE)
.build())
.vpc(vpc)
.build())
.build();
| Modifier | Constructor and Description |
|---|---|
protected |
Credentials() |
protected |
Credentials(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Credentials(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
static Credentials |
fromGeneratedSecret(String username)
(experimental) Creates Credentials with a password generated and stored in Secrets Manager.
|
static Credentials |
fromGeneratedSecret(String username,
CredentialsBaseOptions options)
(experimental) Creates Credentials with a password generated and stored in Secrets Manager.
|
static Credentials |
fromPassword(String username,
SecretValue password)
(experimental) Creates Credentials from a password.
|
static Credentials |
fromSecret(ISecret secret)
(experimental) Creates Credentials from an existing Secrets Manager ``Secret`` (or ``DatabaseSecret``).
|
static Credentials |
fromSecret(ISecret secret,
String username)
(experimental) Creates Credentials from an existing Secrets Manager ``Secret`` (or ``DatabaseSecret``).
|
static Credentials |
fromUsername(String username)
(experimental) Creates Credentials for the given username, and optional password and key.
|
static Credentials |
fromUsername(String username,
CredentialsFromUsernameOptions options)
(experimental) Creates Credentials for the given username, and optional password and key.
|
abstract IKey |
getEncryptionKey()
(experimental) KMS encryption key to encrypt the generated secret.
|
abstract String |
getExcludeCharacters()
(experimental) The characters to exclude from the generated password.
|
abstract SecretValue |
getPassword()
(experimental) Password.
|
abstract List<ReplicaRegion> |
getReplicaRegions()
(experimental) A list of regions where to replicate the generated secret.
|
abstract ISecret |
getSecret()
(experimental) Secret used to instantiate this Login.
|
abstract String |
getSecretName()
(experimental) The name to use for the Secret if a new Secret is to be generated in SecretsManager for these Credentials.
|
abstract String |
getUsername()
(experimental) Username.
|
abstract Boolean |
getUsernameAsString()
(experimental) Whether the username should be referenced as a string and not as a dynamic reference to the username in the secret.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Credentials(software.amazon.jsii.JsiiObjectRef objRef)
protected Credentials(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental) protected Credentials()
@Stability(value=Experimental) @NotNull public static Credentials fromGeneratedSecret(@NotNull String username, @Nullable CredentialsBaseOptions options)
username - This parameter is required.options - @Stability(value=Experimental) @NotNull public static Credentials fromGeneratedSecret(@NotNull String username)
username - This parameter is required.@Stability(value=Experimental) @NotNull public static Credentials fromPassword(@NotNull String username, @NotNull SecretValue password)
Do not put passwords in your CDK code directly.
username - This parameter is required.password - This parameter is required.@Stability(value=Experimental) @NotNull public static Credentials fromSecret(@NotNull ISecret secret, @Nullable String username)
The Secret must be a JSON string with a username and password field:
{
...
"username": <required: username>,
"password": <required: password>,
}
secret - The secret where the credentials are stored. This parameter is required.username - The username defined in the secret.@Stability(value=Experimental) @NotNull public static Credentials fromSecret(@NotNull ISecret secret)
The Secret must be a JSON string with a username and password field:
{
...
"username": <required: username>,
"password": <required: password>,
}
secret - The secret where the credentials are stored. This parameter is required.@Stability(value=Experimental) @NotNull public static Credentials fromUsername(@NotNull String username, @Nullable CredentialsFromUsernameOptions options)
If no password is provided, one will be generated and stored in Secrets Manager.
username - This parameter is required.options - @Stability(value=Experimental) @NotNull public static Credentials fromUsername(@NotNull String username)
If no password is provided, one will be generated and stored in Secrets Manager.
username - This parameter is required.@Stability(value=Experimental) @NotNull public abstract String getUsername()
@Stability(value=Experimental) @Nullable public abstract IKey getEncryptionKey()
Default: - default master key
@Stability(value=Experimental) @Nullable public abstract String getExcludeCharacters()
Only used if {@link password} has not been set.
Default: - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/
@Stability(value=Experimental) @Nullable public abstract SecretValue getPassword()
Do not put passwords in your CDK code directly.
Default: - a Secrets Manager generated password
@Stability(value=Experimental) @Nullable public abstract List<ReplicaRegion> getReplicaRegions()
Default: - Secret is not replicated
@Stability(value=Experimental) @Nullable public abstract ISecret getSecret()
Default: - none
@Stability(value=Experimental) @Nullable public abstract String getSecretName()
Default: - A name is generated by CloudFormation.
@Stability(value=Experimental) @Nullable public abstract Boolean getUsernameAsString()
Default: false
Copyright © 2022. All rights reserved.