
software.amazon.awscdk.services.rds.OptionConfiguration Maven / Gradle / Ivy
package software.amazon.awscdk.services.rds;
/**
* Configuration properties for an option.
*
* 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.ec2.*;
* import software.amazon.awscdk.services.rds.*;
* SecurityGroup securityGroup;
* Vpc vpc;
* OptionConfiguration optionConfiguration = OptionConfiguration.builder()
* .name("name")
* // the properties below are optional
* .port(123)
* .securityGroups(List.of(securityGroup))
* .settings(Map.of(
* "settingsKey", "settings"))
* .version("version")
* .vpc(vpc)
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.70.0 (build 03c2f6f)", date = "2022-11-01T13:16:39.664Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.rds.$Module.class, fqn = "@aws-cdk/aws-rds.OptionConfiguration")
@software.amazon.jsii.Jsii.Proxy(OptionConfiguration.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface OptionConfiguration extends software.amazon.jsii.JsiiSerializable {
/**
* The name of the option.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getName();
/**
* The port number that this option uses.
*
* If port
is specified then vpc
* must also be specified.
*
* Default: - no port
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Number getPort() {
return null;
}
/**
* Optional list of security groups to use for this option, if `vpc` is specified.
*
* If no groups are provided, a default one will be created.
*
* Default: - a default group will be created if `port` or `vpc` are specified.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getSecurityGroups() {
return null;
}
/**
* The settings for the option.
*
* Default: - no settings
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.Map getSettings() {
return null;
}
/**
* The version for the option.
*
* Default: - no version
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getVersion() {
return null;
}
/**
* The VPC where a security group should be created for this option.
*
* If vpc
* is specified then port
must also be specified.
*
* Default: - no VPC
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.IVpc getVpc() {
return null;
}
/**
* @return a {@link Builder} of {@link OptionConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link OptionConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String name;
java.lang.Number port;
java.util.List securityGroups;
java.util.Map settings;
java.lang.String version;
software.amazon.awscdk.services.ec2.IVpc vpc;
/**
* Sets the value of {@link OptionConfiguration#getName}
* @param name The name of the option. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder name(java.lang.String name) {
this.name = name;
return this;
}
/**
* Sets the value of {@link OptionConfiguration#getPort}
* @param port The port number that this option uses.
* If port
is specified then vpc
* must also be specified.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder port(java.lang.Number port) {
this.port = port;
return this;
}
/**
* Sets the value of {@link OptionConfiguration#getSecurityGroups}
* @param securityGroups Optional list of security groups to use for this option, if `vpc` is specified.
* If no groups are provided, a default one will be created.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder securityGroups(java.util.List extends software.amazon.awscdk.services.ec2.ISecurityGroup> securityGroups) {
this.securityGroups = (java.util.List)securityGroups;
return this;
}
/**
* Sets the value of {@link OptionConfiguration#getSettings}
* @param settings The settings for the option.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder settings(java.util.Map settings) {
this.settings = settings;
return this;
}
/**
* Sets the value of {@link OptionConfiguration#getVersion}
* @param version The version for the option.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder version(java.lang.String version) {
this.version = version;
return this;
}
/**
* Sets the value of {@link OptionConfiguration#getVpc}
* @param vpc The VPC where a security group should be created for this option.
* If vpc
* is specified then port
must also be specified.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder vpc(software.amazon.awscdk.services.ec2.IVpc vpc) {
this.vpc = vpc;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link OptionConfiguration}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public OptionConfiguration build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link OptionConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements OptionConfiguration {
private final java.lang.String name;
private final java.lang.Number port;
private final java.util.List securityGroups;
private final java.util.Map settings;
private final java.lang.String version;
private final software.amazon.awscdk.services.ec2.IVpc vpc;
/**
* 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.name = software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.port = software.amazon.jsii.Kernel.get(this, "port", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.securityGroups = software.amazon.jsii.Kernel.get(this, "securityGroups", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.ISecurityGroup.class)));
this.settings = software.amazon.jsii.Kernel.get(this, "settings", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.version = software.amazon.jsii.Kernel.get(this, "version", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.vpc = software.amazon.jsii.Kernel.get(this, "vpc", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.IVpc.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.name = java.util.Objects.requireNonNull(builder.name, "name is required");
this.port = builder.port;
this.securityGroups = (java.util.List)builder.securityGroups;
this.settings = builder.settings;
this.version = builder.version;
this.vpc = builder.vpc;
}
@Override
public final java.lang.String getName() {
return this.name;
}
@Override
public final java.lang.Number getPort() {
return this.port;
}
@Override
public final java.util.List getSecurityGroups() {
return this.securityGroups;
}
@Override
public final java.util.Map getSettings() {
return this.settings;
}
@Override
public final java.lang.String getVersion() {
return this.version;
}
@Override
public final software.amazon.awscdk.services.ec2.IVpc getVpc() {
return this.vpc;
}
@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("name", om.valueToTree(this.getName()));
if (this.getPort() != null) {
data.set("port", om.valueToTree(this.getPort()));
}
if (this.getSecurityGroups() != null) {
data.set("securityGroups", om.valueToTree(this.getSecurityGroups()));
}
if (this.getSettings() != null) {
data.set("settings", om.valueToTree(this.getSettings()));
}
if (this.getVersion() != null) {
data.set("version", om.valueToTree(this.getVersion()));
}
if (this.getVpc() != null) {
data.set("vpc", om.valueToTree(this.getVpc()));
}
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.OptionConfiguration"));
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;
OptionConfiguration.Jsii$Proxy that = (OptionConfiguration.Jsii$Proxy) o;
if (!name.equals(that.name)) return false;
if (this.port != null ? !this.port.equals(that.port) : that.port != null) return false;
if (this.securityGroups != null ? !this.securityGroups.equals(that.securityGroups) : that.securityGroups != null) return false;
if (this.settings != null ? !this.settings.equals(that.settings) : that.settings != null) return false;
if (this.version != null ? !this.version.equals(that.version) : that.version != null) return false;
return this.vpc != null ? this.vpc.equals(that.vpc) : that.vpc == null;
}
@Override
public final int hashCode() {
int result = this.name.hashCode();
result = 31 * result + (this.port != null ? this.port.hashCode() : 0);
result = 31 * result + (this.securityGroups != null ? this.securityGroups.hashCode() : 0);
result = 31 * result + (this.settings != null ? this.settings.hashCode() : 0);
result = 31 * result + (this.version != null ? this.version.hashCode() : 0);
result = 31 * result + (this.vpc != null ? this.vpc.hashCode() : 0);
return result;
}
}
}