@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:41.508Z") @Stability(value=Stable) public abstract class SnapshotCredentials extends software.amazon.jsii.JsiiObject
Example:
Vpc vpc;
IInstanceEngine engine = DatabaseInstanceEngine.postgres(PostgresInstanceEngineProps.builder().version(PostgresEngineVersion.VER_12_3).build());
Key myKey = new Key(this, "MyKey");
DatabaseInstanceFromSnapshot.Builder.create(this, "InstanceFromSnapshotWithCustomizedSecret")
.engine(engine)
.vpc(vpc)
.snapshotIdentifier("mySnapshot")
.credentials(SnapshotCredentials.fromGeneratedSecret("username", SnapshotCredentialsFromGeneratedPasswordOptions.builder()
.encryptionKey(myKey)
.excludeCharacters("!&*^#@()")
.replicaRegions(List.of(ReplicaRegion.builder().region("eu-west-1").build(), ReplicaRegion.builder().region("eu-west-2").build()))
.build()))
.build();
| Modifier | Constructor and Description |
|---|---|
protected |
SnapshotCredentials() |
protected |
SnapshotCredentials(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
SnapshotCredentials(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
static SnapshotCredentials |
fromGeneratedPassword(String username)
Generate a new password for the snapshot, using the existing username and an optional encryption key.
|
static SnapshotCredentials |
fromGeneratedPassword(String username,
SnapshotCredentialsFromGeneratedPasswordOptions options)
Generate a new password for the snapshot, using the existing username and an optional encryption key.
|
static SnapshotCredentials |
fromGeneratedSecret(String username)
Generate a new password for the snapshot, using the existing username and an optional encryption key.
|
static SnapshotCredentials |
fromGeneratedSecret(String username,
SnapshotCredentialsFromGeneratedPasswordOptions options)
Generate a new password for the snapshot, using the existing username and an optional encryption key.
|
static SnapshotCredentials |
fromPassword(SecretValue password)
Update the snapshot login with an existing password.
|
static SnapshotCredentials |
fromSecret(ISecret secret)
Update the snapshot login with an existing password from a Secret.
|
abstract IKey |
getEncryptionKey()
KMS encryption key to encrypt the generated secret.
|
abstract String |
getExcludeCharacters()
The characters to exclude from the generated password.
|
abstract Boolean |
getGeneratePassword()
Whether a new password should be generated.
|
abstract SecretValue |
getPassword()
The master user password.
|
abstract Boolean |
getReplaceOnPasswordCriteriaChanges()
Whether to replace the generated secret when the criteria for the password change.
|
abstract List<ReplicaRegion> |
getReplicaRegions()
A list of regions where to replicate the generated secret.
|
abstract ISecret |
getSecret()
Secret used to instantiate this Login.
|
abstract String |
getUsername()
The master user name.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected SnapshotCredentials(software.amazon.jsii.JsiiObjectRef objRef)
protected SnapshotCredentials(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) protected SnapshotCredentials()
@Stability(value=Stable) @NotNull public static SnapshotCredentials fromGeneratedPassword(@NotNull String username, @Nullable SnapshotCredentialsFromGeneratedPasswordOptions options)
Note - The username must match the existing master username of the snapshot.
NOTE: use fromGeneratedSecret() for new Clusters and Instances. Switching from
fromGeneratedPassword() to fromGeneratedSecret() for already deployed Clusters
or Instances will update their master password.
username - This parameter is required.options - @Stability(value=Stable) @NotNull public static SnapshotCredentials fromGeneratedPassword(@NotNull String username)
Note - The username must match the existing master username of the snapshot.
NOTE: use fromGeneratedSecret() for new Clusters and Instances. Switching from
fromGeneratedPassword() to fromGeneratedSecret() for already deployed Clusters
or Instances will update their master password.
username - This parameter is required.@Stability(value=Stable) @NotNull public static SnapshotCredentials fromGeneratedSecret(@NotNull String username, @Nullable SnapshotCredentialsFromGeneratedPasswordOptions options)
The new credentials are stored in Secrets Manager.
Note - The username must match the existing master username of the snapshot.
username - This parameter is required.options - @Stability(value=Stable) @NotNull public static SnapshotCredentials fromGeneratedSecret(@NotNull String username)
The new credentials are stored in Secrets Manager.
Note - The username must match the existing master username of the snapshot.
username - This parameter is required.@Stability(value=Stable) @NotNull public static SnapshotCredentials fromPassword(@NotNull SecretValue password)
password - This parameter is required.@Stability(value=Stable) @NotNull public static SnapshotCredentials fromSecret(@NotNull ISecret secret)
The Secret must be a JSON string with a password field:
{
...
"password": <required: password>,
}
secret - This parameter is required.@Stability(value=Stable) @NotNull public abstract Boolean getGeneratePassword()
@Stability(value=Stable) @Nullable public abstract IKey getEncryptionKey()
Default: - default master key
@Stability(value=Stable) @Nullable public abstract String getExcludeCharacters()
Only used if {@link generatePassword} if true.
Default: - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/
@Stability(value=Stable) @Nullable public abstract SecretValue getPassword()
Do not put passwords in your CDK code directly.
Default: - the existing password from the snapshot
@Stability(value=Stable) @Nullable public abstract Boolean getReplaceOnPasswordCriteriaChanges()
Default: false
@Stability(value=Stable) @Nullable public abstract List<ReplicaRegion> getReplicaRegions()
Default: - Secret is not replicated
@Stability(value=Stable) @Nullable public abstract ISecret getSecret()
Default: - none
@Stability(value=Stable) @Nullable public abstract String getUsername()
Must be the current master user name of the snapshot. It is not possible to change the master user name of a RDS instance.
Default: - the existing username from the snapshot
Copyright © 2022. All rights reserved.