All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awscdk.services.rds.CredentialsBaseOptions Maven / Gradle / Ivy

The newest version!
package software.amazon.awscdk.services.rds;

/**
 * Base options for creating Credentials.
 * 

* Example: *

*

 * Vpc vpc;
 * IInstanceEngine engine = DatabaseInstanceEngine.postgres(PostgresInstanceEngineProps.builder().version(PostgresEngineVersion.VER_12_3).build());
 * Key myKey = new Key(this, "MyKey");
 * DatabaseInstance.Builder.create(this, "InstanceWithCustomizedSecret")
 *         .engine(engine)
 *         .vpc(vpc)
 *         .credentials(Credentials.fromGeneratedSecret("postgres", CredentialsBaseOptions.builder()
 *                 .secretName("my-cool-name")
 *                 .encryptionKey(myKey)
 *                 .excludeCharacters("!&*^#@()")
 *                 .replicaRegions(List.of(ReplicaRegion.builder().region("eu-west-1").build(), ReplicaRegion.builder().region("eu-west-2").build()))
 *                 .build()))
 *         .build();
 * 
*/ @javax.annotation.Generated(value = "jsii-pacmak/1.84.0 (build 5404dcf)", date = "2023-06-19T16:30:49.086Z") @software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.rds.$Module.class, fqn = "@aws-cdk/aws-rds.CredentialsBaseOptions") @software.amazon.jsii.Jsii.Proxy(CredentialsBaseOptions.Jsii$Proxy.class) @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public interface CredentialsBaseOptions extends software.amazon.jsii.JsiiSerializable { /** * KMS encryption key to encrypt the generated secret. *

* Default: - default master key */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.kms.IKey getEncryptionKey() { return null; } /** * The characters to exclude from the generated password. *

* Has no effect if {@link password} has been provided. *

* Default: - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/ */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.lang.String getExcludeCharacters() { return null; } /** * A list of regions where to replicate this secret. *

* Default: - Secret is not replicated */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.util.List getReplicaRegions() { return null; } /** * The name of the secret. *

* Default: - A name is generated by CloudFormation. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.lang.String getSecretName() { return null; } /** * @return a {@link Builder} of {@link CredentialsBaseOptions} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) static Builder builder() { return new Builder(); } /** * A builder for {@link CredentialsBaseOptions} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static final class Builder implements software.amazon.jsii.Builder { software.amazon.awscdk.services.kms.IKey encryptionKey; java.lang.String excludeCharacters; java.util.List replicaRegions; java.lang.String secretName; /** * Sets the value of {@link CredentialsBaseOptions#getEncryptionKey} * @param encryptionKey KMS encryption key to encrypt the generated secret. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder encryptionKey(software.amazon.awscdk.services.kms.IKey encryptionKey) { this.encryptionKey = encryptionKey; return this; } /** * Sets the value of {@link CredentialsBaseOptions#getExcludeCharacters} * @param excludeCharacters The characters to exclude from the generated password. * Has no effect if {@link password} has been provided. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder excludeCharacters(java.lang.String excludeCharacters) { this.excludeCharacters = excludeCharacters; return this; } /** * Sets the value of {@link CredentialsBaseOptions#getReplicaRegions} * @param replicaRegions A list of regions where to replicate this secret. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @SuppressWarnings("unchecked") public Builder replicaRegions(java.util.List replicaRegions) { this.replicaRegions = (java.util.List)replicaRegions; return this; } /** * Sets the value of {@link CredentialsBaseOptions#getSecretName} * @param secretName The name of the secret. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder secretName(java.lang.String secretName) { this.secretName = secretName; return this; } /** * Builds the configured instance. * @return a new instance of {@link CredentialsBaseOptions} * @throws NullPointerException if any required attribute was not provided */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public CredentialsBaseOptions build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link CredentialsBaseOptions} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements CredentialsBaseOptions { private final software.amazon.awscdk.services.kms.IKey encryptionKey; private final java.lang.String excludeCharacters; private final java.util.List replicaRegions; private final java.lang.String secretName; /** * Constructor that initializes the object based on values retrieved from the JsiiObject. * @param objRef Reference to the JSII managed object. */ protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); this.encryptionKey = software.amazon.jsii.Kernel.get(this, "encryptionKey", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.kms.IKey.class)); this.excludeCharacters = software.amazon.jsii.Kernel.get(this, "excludeCharacters", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); this.replicaRegions = software.amazon.jsii.Kernel.get(this, "replicaRegions", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.secretsmanager.ReplicaRegion.class))); this.secretName = software.amazon.jsii.Kernel.get(this, "secretName", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * Constructor that initializes the object based on literal property values passed by the {@link Builder}. */ @SuppressWarnings("unchecked") protected Jsii$Proxy(final Builder builder) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); this.encryptionKey = builder.encryptionKey; this.excludeCharacters = builder.excludeCharacters; this.replicaRegions = (java.util.List)builder.replicaRegions; this.secretName = builder.secretName; } @Override public final software.amazon.awscdk.services.kms.IKey getEncryptionKey() { return this.encryptionKey; } @Override public final java.lang.String getExcludeCharacters() { return this.excludeCharacters; } @Override public final java.util.List getReplicaRegions() { return this.replicaRegions; } @Override public final java.lang.String getSecretName() { return this.secretName; } @Override @software.amazon.jsii.Internal public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); if (this.getEncryptionKey() != null) { data.set("encryptionKey", om.valueToTree(this.getEncryptionKey())); } if (this.getExcludeCharacters() != null) { data.set("excludeCharacters", om.valueToTree(this.getExcludeCharacters())); } if (this.getReplicaRegions() != null) { data.set("replicaRegions", om.valueToTree(this.getReplicaRegions())); } if (this.getSecretName() != null) { data.set("secretName", om.valueToTree(this.getSecretName())); } final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("@aws-cdk/aws-rds.CredentialsBaseOptions")); struct.set("data", data); final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); obj.set("$jsii.struct", struct); return obj; } @Override public final boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CredentialsBaseOptions.Jsii$Proxy that = (CredentialsBaseOptions.Jsii$Proxy) o; if (this.encryptionKey != null ? !this.encryptionKey.equals(that.encryptionKey) : that.encryptionKey != null) return false; if (this.excludeCharacters != null ? !this.excludeCharacters.equals(that.excludeCharacters) : that.excludeCharacters != null) return false; if (this.replicaRegions != null ? !this.replicaRegions.equals(that.replicaRegions) : that.replicaRegions != null) return false; return this.secretName != null ? this.secretName.equals(that.secretName) : that.secretName == null; } @Override public final int hashCode() { int result = this.encryptionKey != null ? this.encryptionKey.hashCode() : 0; result = 31 * result + (this.excludeCharacters != null ? this.excludeCharacters.hashCode() : 0); result = 31 * result + (this.replicaRegions != null ? this.replicaRegions.hashCode() : 0); result = 31 * result + (this.secretName != null ? this.secretName.hashCode() : 0); return result; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy