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

software.amazon.awssdk.services.rds.model.ModifyDbProxyRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon RDS module holds the client classes that are used for communicating with Amazon Relational Database Service

There is a newer version: 2.29.15
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((ModifyDbProxyRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends RdsRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The identifier for the DBProxy to modify. *

* * @param dbProxyName * The identifier for the DBProxy to modify. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dbProxyName(String 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. *

* * @param newDBProxyName * 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 Returns a reference to this object so that method calls can be chained together. */ Builder newDBProxyName(String newDBProxyName); /** *

* The new authentication settings for the DBProxy. *

* * @param auth * The new authentication settings for the DBProxy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder auth(Collection auth); /** *

* The new authentication settings for the DBProxy. *

* * @param auth * The new authentication settings for the DBProxy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder auth(UserAuthConfig... auth); /** *

* The new authentication settings for the DBProxy. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.rds.model.UserAuthConfig.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.rds.model.UserAuthConfig#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.rds.model.UserAuthConfig.Builder#build()} is called immediately and * its result is passed to {@link #auth(List)}. * * @param auth * a consumer that will call methods on * {@link software.amazon.awssdk.services.rds.model.UserAuthConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #auth(java.util.Collection) */ Builder auth(Consumer... 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. *

* * @param requireTLS * 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 Returns a reference to this object so that method calls can be chained together. */ Builder requireTLS(Boolean 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. *

* * @param idleClientTimeout * 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 Returns a reference to this object so that method calls can be chained together. */ Builder idleClientTimeout(Integer 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. *

* * @param debugLogging * 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 Returns a reference to this object so that method calls can be chained together. */ Builder debugLogging(Boolean debugLogging); /** *

* The Amazon Resource Name (ARN) of the IAM role that the proxy uses to access secrets in Amazon Web Services * Secrets Manager. *

* * @param roleArn * The Amazon Resource Name (ARN) of the IAM role that the proxy uses to access secrets in Amazon Web * Services Secrets Manager. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleArn(String roleArn); /** *

* The new list of security groups for the DBProxy. *

* * @param securityGroups * The new list of security groups for the DBProxy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder securityGroups(Collection securityGroups); /** *

* The new list of security groups for the DBProxy. *

* * @param securityGroups * The new list of security groups for the DBProxy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder securityGroups(String... securityGroups); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends RdsRequest.BuilderImpl implements Builder { private String dbProxyName; private String newDBProxyName; private List auth = DefaultSdkAutoConstructList.getInstance(); private Boolean requireTLS; private Integer idleClientTimeout; private Boolean debugLogging; private String roleArn; private List securityGroups = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ModifyDbProxyRequest model) { super(model); dbProxyName(model.dbProxyName); newDBProxyName(model.newDBProxyName); auth(model.auth); requireTLS(model.requireTLS); idleClientTimeout(model.idleClientTimeout); debugLogging(model.debugLogging); roleArn(model.roleArn); securityGroups(model.securityGroups); } public final String getDbProxyName() { return dbProxyName; } public final void setDbProxyName(String dbProxyName) { this.dbProxyName = dbProxyName; } @Override public final Builder dbProxyName(String dbProxyName) { this.dbProxyName = dbProxyName; return this; } public final String getNewDBProxyName() { return newDBProxyName; } public final void setNewDBProxyName(String newDBProxyName) { this.newDBProxyName = newDBProxyName; } @Override public final Builder newDBProxyName(String newDBProxyName) { this.newDBProxyName = newDBProxyName; return this; } public final List getAuth() { List result = UserAuthConfigListCopier.copyToBuilder(this.auth); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setAuth(Collection auth) { this.auth = UserAuthConfigListCopier.copyFromBuilder(auth); } @Override public final Builder auth(Collection auth) { this.auth = UserAuthConfigListCopier.copy(auth); return this; } @Override @SafeVarargs public final Builder auth(UserAuthConfig... auth) { auth(Arrays.asList(auth)); return this; } @Override @SafeVarargs public final Builder auth(Consumer... auth) { auth(Stream.of(auth).map(c -> UserAuthConfig.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final Boolean getRequireTLS() { return requireTLS; } public final void setRequireTLS(Boolean requireTLS) { this.requireTLS = requireTLS; } @Override public final Builder requireTLS(Boolean requireTLS) { this.requireTLS = requireTLS; return this; } public final Integer getIdleClientTimeout() { return idleClientTimeout; } public final void setIdleClientTimeout(Integer idleClientTimeout) { this.idleClientTimeout = idleClientTimeout; } @Override public final Builder idleClientTimeout(Integer idleClientTimeout) { this.idleClientTimeout = idleClientTimeout; return this; } public final Boolean getDebugLogging() { return debugLogging; } public final void setDebugLogging(Boolean debugLogging) { this.debugLogging = debugLogging; } @Override public final Builder debugLogging(Boolean debugLogging) { this.debugLogging = debugLogging; return this; } public final String getRoleArn() { return roleArn; } public final void setRoleArn(String roleArn) { this.roleArn = roleArn; } @Override public final Builder roleArn(String roleArn) { this.roleArn = roleArn; return this; } public final Collection getSecurityGroups() { if (securityGroups instanceof SdkAutoConstructList) { return null; } return securityGroups; } public final void setSecurityGroups(Collection securityGroups) { this.securityGroups = StringListCopier.copy(securityGroups); } @Override public final Builder securityGroups(Collection securityGroups) { this.securityGroups = StringListCopier.copy(securityGroups); return this; } @Override @SafeVarargs public final Builder securityGroups(String... securityGroups) { securityGroups(Arrays.asList(securityGroups)); return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public ModifyDbProxyRequest build() { return new ModifyDbProxyRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy