software.amazon.awssdk.services.rds.model.ModifyDbProxyRequest 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 ModifyDbProxyRequest extends RdsRequest implements
ToCopyableBuilder {
private static final SdkField DB_PROXY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DBProxyName").getter(getter(ModifyDbProxyRequest::dbProxyName)).setter(setter(Builder::dbProxyName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBProxyName").build()).build();
private static final SdkField NEW_DB_PROXY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NewDBProxyName").getter(getter(ModifyDbProxyRequest::newDBProxyName))
.setter(setter(Builder::newDBProxyName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NewDBProxyName").build()).build();
private static final SdkField> AUTH_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Auth")
.getter(getter(ModifyDbProxyRequest::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 REQUIRE_TLS_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("RequireTLS").getter(getter(ModifyDbProxyRequest::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(ModifyDbProxyRequest::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(ModifyDbProxyRequest::debugLogging)).setter(setter(Builder::debugLogging))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DebugLogging").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleArn").getter(getter(ModifyDbProxyRequest::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build();
private static final SdkField> SECURITY_GROUPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SecurityGroups")
.getter(getter(ModifyDbProxyRequest::securityGroups))
.setter(setter(Builder::securityGroups))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecurityGroups").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DB_PROXY_NAME_FIELD,
NEW_DB_PROXY_NAME_FIELD, AUTH_FIELD, REQUIRE_TLS_FIELD, IDLE_CLIENT_TIMEOUT_FIELD, DEBUG_LOGGING_FIELD,
ROLE_ARN_FIELD, SECURITY_GROUPS_FIELD));
private final String dbProxyName;
private final String newDBProxyName;
private final List auth;
private final Boolean requireTLS;
private final Integer idleClientTimeout;
private final Boolean debugLogging;
private final String roleArn;
private final List securityGroups;
private ModifyDbProxyRequest(BuilderImpl builder) {
super(builder);
this.dbProxyName = builder.dbProxyName;
this.newDBProxyName = builder.newDBProxyName;
this.auth = builder.auth;
this.requireTLS = builder.requireTLS;
this.idleClientTimeout = builder.idleClientTimeout;
this.debugLogging = builder.debugLogging;
this.roleArn = builder.roleArn;
this.securityGroups = builder.securityGroups;
}
/**
*
* The identifier for the DBProxy
to modify.
*
*
* @return The identifier for the DBProxy
to modify.
*/
public final String dbProxyName() {
return dbProxyName;
}
/**
*
* The new identifier for the DBProxy
. 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 new identifier for the DBProxy
. 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 newDBProxyName() {
return newDBProxyName;
}
/**
* 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 new authentication settings for the DBProxy
.
*
*
* 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 new authentication settings for the DBProxy
.
*/
public final List auth() {
return auth;
}
/**
*
* 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, even if the associated database doesn't use TLS.
*
*
* @return 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, even if the associated database
* doesn't use TLS.
*/
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;
}
/**
*
* 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 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;
}
/**
*
* 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 SecurityGroups 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 hasSecurityGroups() {
return securityGroups != null && !(securityGroups instanceof SdkAutoConstructList);
}
/**
*
* The new list of security groups for the DBProxy
.
*
*
* 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 #hasSecurityGroups} method.
*
*
* @return The new list of security groups for the DBProxy
.
*/
public final List securityGroups() {
return securityGroups;
}
@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(newDBProxyName());
hashCode = 31 * hashCode + Objects.hashCode(hasAuth() ? auth() : null);
hashCode = 31 * hashCode + Objects.hashCode(requireTLS());
hashCode = 31 * hashCode + Objects.hashCode(idleClientTimeout());
hashCode = 31 * hashCode + Objects.hashCode(debugLogging());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(hasSecurityGroups() ? securityGroups() : 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 ModifyDbProxyRequest)) {
return false;
}
ModifyDbProxyRequest other = (ModifyDbProxyRequest) obj;
return Objects.equals(dbProxyName(), other.dbProxyName()) && Objects.equals(newDBProxyName(), other.newDBProxyName())
&& hasAuth() == other.hasAuth() && Objects.equals(auth(), other.auth())
&& Objects.equals(requireTLS(), other.requireTLS())
&& Objects.equals(idleClientTimeout(), other.idleClientTimeout())
&& Objects.equals(debugLogging(), other.debugLogging()) && Objects.equals(roleArn(), other.roleArn())
&& hasSecurityGroups() == other.hasSecurityGroups() && Objects.equals(securityGroups(), other.securityGroups());
}
/**
* 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("ModifyDbProxyRequest").add("DBProxyName", dbProxyName()).add("NewDBProxyName", newDBProxyName())
.add("Auth", hasAuth() ? auth() : null).add("RequireTLS", requireTLS())
.add("IdleClientTimeout", idleClientTimeout()).add("DebugLogging", debugLogging()).add("RoleArn", roleArn())
.add("SecurityGroups", hasSecurityGroups() ? securityGroups() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DBProxyName":
return Optional.ofNullable(clazz.cast(dbProxyName()));
case "NewDBProxyName":
return Optional.ofNullable(clazz.cast(newDBProxyName()));
case "Auth":
return Optional.ofNullable(clazz.cast(auth()));
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 "RoleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "SecurityGroups":
return Optional.ofNullable(clazz.cast(securityGroups()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function