software.amazon.awscdk.services.rds.ProxyTargetConfig Maven / Gradle / Ivy
package software.amazon.awscdk.services.rds;
/**
* The result of binding a ProxyTarget
to a DatabaseProxy
.
*
* 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.rds.*;
* DatabaseCluster databaseCluster;
* DatabaseInstance databaseInstance;
* ProxyTargetConfig proxyTargetConfig = ProxyTargetConfig.builder()
* .engineFamily("engineFamily")
* // the properties below are optional
* .dbClusters(List.of(databaseCluster))
* .dbInstances(List.of(databaseInstance))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.84.0 (build 5404dcf)", date = "2023-06-19T16:30:49.255Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.rds.$Module.class, fqn = "@aws-cdk/aws-rds.ProxyTargetConfig")
@software.amazon.jsii.Jsii.Proxy(ProxyTargetConfig.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface ProxyTargetConfig extends software.amazon.jsii.JsiiSerializable {
/**
* The engine family of the database instance or cluster this proxy connects with.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getEngineFamily();
/**
* The database clusters to which this proxy connects.
*
* Either this or dbInstances
will be set and the other undefined
.
*
* Default: - `undefined` if `dbInstances` is set.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getDbClusters() {
return null;
}
/**
* The database instances to which this proxy connects.
*
* Either this or dbClusters
will be set and the other undefined
.
*
* Default: - `undefined` if `dbClusters` is set.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getDbInstances() {
return null;
}
/**
* @return a {@link Builder} of {@link ProxyTargetConfig}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ProxyTargetConfig}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String engineFamily;
java.util.List dbClusters;
java.util.List dbInstances;
/**
* Sets the value of {@link ProxyTargetConfig#getEngineFamily}
* @param engineFamily The engine family of the database instance or cluster this proxy connects with. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder engineFamily(java.lang.String engineFamily) {
this.engineFamily = engineFamily;
return this;
}
/**
* Sets the value of {@link ProxyTargetConfig#getDbClusters}
* @param dbClusters The database clusters to which this proxy connects.
* Either this or dbInstances
will be set and the other undefined
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder dbClusters(java.util.List extends software.amazon.awscdk.services.rds.IDatabaseCluster> dbClusters) {
this.dbClusters = (java.util.List)dbClusters;
return this;
}
/**
* Sets the value of {@link ProxyTargetConfig#getDbInstances}
* @param dbInstances The database instances to which this proxy connects.
* Either this or dbClusters
will be set and the other undefined
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder dbInstances(java.util.List extends software.amazon.awscdk.services.rds.IDatabaseInstance> dbInstances) {
this.dbInstances = (java.util.List)dbInstances;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ProxyTargetConfig}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public ProxyTargetConfig build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ProxyTargetConfig}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ProxyTargetConfig {
private final java.lang.String engineFamily;
private final java.util.List dbClusters;
private final java.util.List dbInstances;
/**
* 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.engineFamily = software.amazon.jsii.Kernel.get(this, "engineFamily", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.dbClusters = software.amazon.jsii.Kernel.get(this, "dbClusters", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.rds.IDatabaseCluster.class)));
this.dbInstances = software.amazon.jsii.Kernel.get(this, "dbInstances", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.rds.IDatabaseInstance.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.engineFamily = java.util.Objects.requireNonNull(builder.engineFamily, "engineFamily is required");
this.dbClusters = (java.util.List)builder.dbClusters;
this.dbInstances = (java.util.List)builder.dbInstances;
}
@Override
public final java.lang.String getEngineFamily() {
return this.engineFamily;
}
@Override
public final java.util.List getDbClusters() {
return this.dbClusters;
}
@Override
public final java.util.List getDbInstances() {
return this.dbInstances;
}
@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();
data.set("engineFamily", om.valueToTree(this.getEngineFamily()));
if (this.getDbClusters() != null) {
data.set("dbClusters", om.valueToTree(this.getDbClusters()));
}
if (this.getDbInstances() != null) {
data.set("dbInstances", om.valueToTree(this.getDbInstances()));
}
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.ProxyTargetConfig"));
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;
ProxyTargetConfig.Jsii$Proxy that = (ProxyTargetConfig.Jsii$Proxy) o;
if (!engineFamily.equals(that.engineFamily)) return false;
if (this.dbClusters != null ? !this.dbClusters.equals(that.dbClusters) : that.dbClusters != null) return false;
return this.dbInstances != null ? this.dbInstances.equals(that.dbInstances) : that.dbInstances == null;
}
@Override
public final int hashCode() {
int result = this.engineFamily.hashCode();
result = 31 * result + (this.dbClusters != null ? this.dbClusters.hashCode() : 0);
result = 31 * result + (this.dbInstances != null ? this.dbInstances.hashCode() : 0);
return result;
}
}
}