software.amazon.awssdk.services.rds.model.CreateDbProxyRequest Maven / Gradle / Ivy
Show all versions of rds Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.rds.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateDbProxyRequest extends RdsRequest implements
ToCopyableBuilder {
private static final SdkField DB_PROXY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DBProxyName").getter(getter(CreateDbProxyRequest::dbProxyName)).setter(setter(Builder::dbProxyName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBProxyName").build()).build();
private static final SdkField ENGINE_FAMILY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EngineFamily").getter(getter(CreateDbProxyRequest::engineFamilyAsString))
.setter(setter(Builder::engineFamily))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EngineFamily").build()).build();
private static final SdkField> AUTH_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Auth")
.getter(getter(CreateDbProxyRequest::auth))
.setter(setter(Builder::auth))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Auth").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(UserAuthConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleArn").getter(getter(CreateDbProxyRequest::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build();
private static final SdkField> VPC_SUBNET_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("VpcSubnetIds")
.getter(getter(CreateDbProxyRequest::vpcSubnetIds))
.setter(setter(Builder::vpcSubnetIds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcSubnetIds").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> VPC_SECURITY_GROUP_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("VpcSecurityGroupIds")
.getter(getter(CreateDbProxyRequest::vpcSecurityGroupIds))
.setter(setter(Builder::vpcSecurityGroupIds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcSecurityGroupIds").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField REQUIRE_TLS_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("RequireTLS").getter(getter(CreateDbProxyRequest::requireTLS)).setter(setter(Builder::requireTLS))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RequireTLS").build()).build();
private static final SdkField IDLE_CLIENT_TIMEOUT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("IdleClientTimeout").getter(getter(CreateDbProxyRequest::idleClientTimeout))
.setter(setter(Builder::idleClientTimeout))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IdleClientTimeout").build()).build();
private static final SdkField DEBUG_LOGGING_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("DebugLogging").getter(getter(CreateDbProxyRequest::debugLogging)).setter(setter(Builder::debugLogging))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DebugLogging").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateDbProxyRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName("Tag")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("Tag").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DB_PROXY_NAME_FIELD,
ENGINE_FAMILY_FIELD, AUTH_FIELD, ROLE_ARN_FIELD, VPC_SUBNET_IDS_FIELD, VPC_SECURITY_GROUP_IDS_FIELD,
REQUIRE_TLS_FIELD, IDLE_CLIENT_TIMEOUT_FIELD, DEBUG_LOGGING_FIELD, TAGS_FIELD));
private final String dbProxyName;
private final String engineFamily;
private final List auth;
private final String roleArn;
private final List vpcSubnetIds;
private final List vpcSecurityGroupIds;
private final Boolean requireTLS;
private final Integer idleClientTimeout;
private final Boolean debugLogging;
private final List tags;
private CreateDbProxyRequest(BuilderImpl builder) {
super(builder);
this.dbProxyName = builder.dbProxyName;
this.engineFamily = builder.engineFamily;
this.auth = builder.auth;
this.roleArn = builder.roleArn;
this.vpcSubnetIds = builder.vpcSubnetIds;
this.vpcSecurityGroupIds = builder.vpcSecurityGroupIds;
this.requireTLS = builder.requireTLS;
this.idleClientTimeout = builder.idleClientTimeout;
this.debugLogging = builder.debugLogging;
this.tags = builder.tags;
}
/**
*
* The identifier for the proxy. This name must be unique for all proxies owned by your Amazon Web Services account
* in the specified Amazon Web Services Region. An identifier must begin with a letter and must contain only ASCII
* letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
*
*
* @return The identifier for the proxy. This name must be unique for all proxies owned by your Amazon Web Services
* account in the specified Amazon Web Services Region. An identifier must begin with a letter and must
* contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive
* hyphens.
*/
public final String dbProxyName() {
return dbProxyName;
}
/**
*
* The kinds of databases that the proxy can connect to. This value determines which database network protocol the
* proxy recognizes when it interprets network traffic to and from the database. For Aurora MySQL, RDS for MariaDB,
* and RDS for MySQL databases, specify MYSQL
. For Aurora PostgreSQL and RDS for PostgreSQL databases,
* specify POSTGRESQL
. For RDS for Microsoft SQL Server, specify SQLSERVER
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #engineFamily} will
* return {@link EngineFamily#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #engineFamilyAsString}.
*
*
* @return The kinds of databases that the proxy can connect to. This value determines which database network
* protocol the proxy recognizes when it interprets network traffic to and from the database. For Aurora
* MySQL, RDS for MariaDB, and RDS for MySQL databases, specify MYSQL
. For Aurora PostgreSQL
* and RDS for PostgreSQL databases, specify POSTGRESQL
. For RDS for Microsoft SQL Server,
* specify SQLSERVER
.
* @see EngineFamily
*/
public final EngineFamily engineFamily() {
return EngineFamily.fromValue(engineFamily);
}
/**
*
* The kinds of databases that the proxy can connect to. This value determines which database network protocol the
* proxy recognizes when it interprets network traffic to and from the database. For Aurora MySQL, RDS for MariaDB,
* and RDS for MySQL databases, specify MYSQL
. For Aurora PostgreSQL and RDS for PostgreSQL databases,
* specify POSTGRESQL
. For RDS for Microsoft SQL Server, specify SQLSERVER
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #engineFamily} will
* return {@link EngineFamily#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #engineFamilyAsString}.
*
*
* @return The kinds of databases that the proxy can connect to. This value determines which database network
* protocol the proxy recognizes when it interprets network traffic to and from the database. For Aurora
* MySQL, RDS for MariaDB, and RDS for MySQL databases, specify MYSQL
. For Aurora PostgreSQL
* and RDS for PostgreSQL databases, specify POSTGRESQL
. For RDS for Microsoft SQL Server,
* specify SQLSERVER
.
* @see EngineFamily
*/
public final String engineFamilyAsString() {
return engineFamily;
}
/**
* For responses, this returns true if the service returned a value for the Auth property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasAuth() {
return auth != null && !(auth instanceof SdkAutoConstructList);
}
/**
*
* The authorization mechanism that the proxy uses.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasAuth} method.
*
*
* @return The authorization mechanism that the proxy uses.
*/
public final List auth() {
return auth;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role that the proxy uses to access secrets in Amazon Web Services
* Secrets Manager.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role that the proxy uses to access secrets in Amazon Web
* Services Secrets Manager.
*/
public final String roleArn() {
return roleArn;
}
/**
* For responses, this returns true if the service returned a value for the VpcSubnetIds property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasVpcSubnetIds() {
return vpcSubnetIds != null && !(vpcSubnetIds instanceof SdkAutoConstructList);
}
/**
*
* One or more VPC subnet IDs to associate with the new proxy.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasVpcSubnetIds} method.
*
*
* @return One or more VPC subnet IDs to associate with the new proxy.
*/
public final List vpcSubnetIds() {
return vpcSubnetIds;
}
/**
* For responses, this returns true if the service returned a value for the VpcSecurityGroupIds property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasVpcSecurityGroupIds() {
return vpcSecurityGroupIds != null && !(vpcSecurityGroupIds instanceof SdkAutoConstructList);
}
/**
*
* One or more VPC security group IDs to associate with the new proxy.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasVpcSecurityGroupIds} method.
*
*
* @return One or more VPC security group IDs to associate with the new proxy.
*/
public final List vpcSecurityGroupIds() {
return vpcSecurityGroupIds;
}
/**
*
* Specifies whether Transport Layer Security (TLS) encryption is required for connections to the proxy. By enabling
* this setting, you can enforce encrypted TLS connections to the proxy.
*
*
* @return Specifies whether Transport Layer Security (TLS) encryption is required for connections to the proxy. By
* enabling this setting, you can enforce encrypted TLS connections to the proxy.
*/
public final Boolean requireTLS() {
return requireTLS;
}
/**
*
* The number of seconds that a connection to the proxy can be inactive before the proxy disconnects it. You can set
* this value higher or lower than the connection timeout limit for the associated database.
*
*
* @return The number of seconds that a connection to the proxy can be inactive before the proxy disconnects it. You
* can set this value higher or lower than the connection timeout limit for the associated database.
*/
public final Integer idleClientTimeout() {
return idleClientTimeout;
}
/**
*
* Specifies whether the proxy includes detailed information about SQL statements in its logs. This information
* helps you to debug issues involving SQL behavior or the performance and scalability of the proxy connections. The
* debug information includes the text of SQL statements that you submit through the proxy. Thus, only enable this
* setting when needed for debugging, and only when you have security measures in place to safeguard any sensitive
* information that appears in the logs.
*
*
* @return Specifies whether the proxy includes detailed information about SQL statements in its logs. This
* information helps you to debug issues involving SQL behavior or the performance and scalability of the
* proxy connections. The debug information includes the text of SQL statements that you submit through the
* proxy. Thus, only enable this setting when needed for debugging, and only when you have security measures
* in place to safeguard any sensitive information that appears in the logs.
*/
public final Boolean debugLogging() {
return debugLogging;
}
/**
* For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* An optional set of key-value pairs to associate arbitrary data of your choosing with the proxy.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTags} method.
*
*
* @return An optional set of key-value pairs to associate arbitrary data of your choosing with the proxy.
*/
public final List tags() {
return tags;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(dbProxyName());
hashCode = 31 * hashCode + Objects.hashCode(engineFamilyAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasAuth() ? auth() : null);
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(hasVpcSubnetIds() ? vpcSubnetIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasVpcSecurityGroupIds() ? vpcSecurityGroupIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(requireTLS());
hashCode = 31 * hashCode + Objects.hashCode(idleClientTimeout());
hashCode = 31 * hashCode + Objects.hashCode(debugLogging());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateDbProxyRequest)) {
return false;
}
CreateDbProxyRequest other = (CreateDbProxyRequest) obj;
return Objects.equals(dbProxyName(), other.dbProxyName())
&& Objects.equals(engineFamilyAsString(), other.engineFamilyAsString()) && hasAuth() == other.hasAuth()
&& Objects.equals(auth(), other.auth()) && Objects.equals(roleArn(), other.roleArn())
&& hasVpcSubnetIds() == other.hasVpcSubnetIds() && Objects.equals(vpcSubnetIds(), other.vpcSubnetIds())
&& hasVpcSecurityGroupIds() == other.hasVpcSecurityGroupIds()
&& Objects.equals(vpcSecurityGroupIds(), other.vpcSecurityGroupIds())
&& Objects.equals(requireTLS(), other.requireTLS())
&& Objects.equals(idleClientTimeout(), other.idleClientTimeout())
&& Objects.equals(debugLogging(), other.debugLogging()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("CreateDbProxyRequest").add("DBProxyName", dbProxyName())
.add("EngineFamily", engineFamilyAsString()).add("Auth", hasAuth() ? auth() : null).add("RoleArn", roleArn())
.add("VpcSubnetIds", hasVpcSubnetIds() ? vpcSubnetIds() : null)
.add("VpcSecurityGroupIds", hasVpcSecurityGroupIds() ? vpcSecurityGroupIds() : null)
.add("RequireTLS", requireTLS()).add("IdleClientTimeout", idleClientTimeout())
.add("DebugLogging", debugLogging()).add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DBProxyName":
return Optional.ofNullable(clazz.cast(dbProxyName()));
case "EngineFamily":
return Optional.ofNullable(clazz.cast(engineFamilyAsString()));
case "Auth":
return Optional.ofNullable(clazz.cast(auth()));
case "RoleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "VpcSubnetIds":
return Optional.ofNullable(clazz.cast(vpcSubnetIds()));
case "VpcSecurityGroupIds":
return Optional.ofNullable(clazz.cast(vpcSecurityGroupIds()));
case "RequireTLS":
return Optional.ofNullable(clazz.cast(requireTLS()));
case "IdleClientTimeout":
return Optional.ofNullable(clazz.cast(idleClientTimeout()));
case "DebugLogging":
return Optional.ofNullable(clazz.cast(debugLogging()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function