![JAR search and dependency download from the Maven repository](/logo.png)
software.amazon.awssdk.services.rds.model.UserAuthConfig 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.io.Serializable;
import java.util.Arrays;
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.Function;
import software.amazon.awssdk.annotations.Generated;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Specifies the details of authentication used by a proxy to log in as a specific database user.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class UserAuthConfig implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(UserAuthConfig::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField USER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserName").getter(getter(UserAuthConfig::userName)).setter(setter(Builder::userName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserName").build()).build();
private static final SdkField AUTH_SCHEME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AuthScheme").getter(getter(UserAuthConfig::authSchemeAsString)).setter(setter(Builder::authScheme))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthScheme").build()).build();
private static final SdkField SECRET_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SecretArn").getter(getter(UserAuthConfig::secretArn)).setter(setter(Builder::secretArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecretArn").build()).build();
private static final SdkField IAM_AUTH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IAMAuth").getter(getter(UserAuthConfig::iamAuthAsString)).setter(setter(Builder::iamAuth))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IAMAuth").build()).build();
private static final SdkField CLIENT_PASSWORD_AUTH_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ClientPasswordAuthType").getter(getter(UserAuthConfig::clientPasswordAuthTypeAsString))
.setter(setter(Builder::clientPasswordAuthType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClientPasswordAuthType").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DESCRIPTION_FIELD,
USER_NAME_FIELD, AUTH_SCHEME_FIELD, SECRET_ARN_FIELD, IAM_AUTH_FIELD, CLIENT_PASSWORD_AUTH_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String description;
private final String userName;
private final String authScheme;
private final String secretArn;
private final String iamAuth;
private final String clientPasswordAuthType;
private UserAuthConfig(BuilderImpl builder) {
this.description = builder.description;
this.userName = builder.userName;
this.authScheme = builder.authScheme;
this.secretArn = builder.secretArn;
this.iamAuth = builder.iamAuth;
this.clientPasswordAuthType = builder.clientPasswordAuthType;
}
/**
*
* A user-specified description about the authentication used by a proxy to log in as a specific database user.
*
*
* @return A user-specified description about the authentication used by a proxy to log in as a specific database
* user.
*/
public final String description() {
return description;
}
/**
*
* The name of the database user to which the proxy connects.
*
*
* @return The name of the database user to which the proxy connects.
*/
public final String userName() {
return userName;
}
/**
*
* The type of authentication that the proxy uses for connections from the proxy to the underlying database.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #authScheme} will
* return {@link AuthScheme#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #authSchemeAsString}.
*
*
* @return The type of authentication that the proxy uses for connections from the proxy to the underlying database.
* @see AuthScheme
*/
public final AuthScheme authScheme() {
return AuthScheme.fromValue(authScheme);
}
/**
*
* The type of authentication that the proxy uses for connections from the proxy to the underlying database.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #authScheme} will
* return {@link AuthScheme#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #authSchemeAsString}.
*
*
* @return The type of authentication that the proxy uses for connections from the proxy to the underlying database.
* @see AuthScheme
*/
public final String authSchemeAsString() {
return authScheme;
}
/**
*
* The Amazon Resource Name (ARN) representing the secret that the proxy uses to authenticate to the RDS DB instance
* or Aurora DB cluster. These secrets are stored within Amazon Secrets Manager.
*
*
* @return The Amazon Resource Name (ARN) representing the secret that the proxy uses to authenticate to the RDS DB
* instance or Aurora DB cluster. These secrets are stored within Amazon Secrets Manager.
*/
public final String secretArn() {
return secretArn;
}
/**
*
* A value that indicates whether to require or disallow Amazon Web Services Identity and Access Management (IAM)
* authentication for connections to the proxy. The ENABLED
value is valid only for proxies with RDS
* for Microsoft SQL Server.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #iamAuth} will
* return {@link IAMAuthMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #iamAuthAsString}.
*
*
* @return A value that indicates whether to require or disallow Amazon Web Services Identity and Access Management
* (IAM) authentication for connections to the proxy. The ENABLED
value is valid only for
* proxies with RDS for Microsoft SQL Server.
* @see IAMAuthMode
*/
public final IAMAuthMode iamAuth() {
return IAMAuthMode.fromValue(iamAuth);
}
/**
*
* A value that indicates whether to require or disallow Amazon Web Services Identity and Access Management (IAM)
* authentication for connections to the proxy. The ENABLED
value is valid only for proxies with RDS
* for Microsoft SQL Server.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #iamAuth} will
* return {@link IAMAuthMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #iamAuthAsString}.
*
*
* @return A value that indicates whether to require or disallow Amazon Web Services Identity and Access Management
* (IAM) authentication for connections to the proxy. The ENABLED
value is valid only for
* proxies with RDS for Microsoft SQL Server.
* @see IAMAuthMode
*/
public final String iamAuthAsString() {
return iamAuth;
}
/**
*
* The type of authentication the proxy uses for connections from clients.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #clientPasswordAuthType} will return {@link ClientPasswordAuthType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #clientPasswordAuthTypeAsString}.
*
*
* @return The type of authentication the proxy uses for connections from clients.
* @see ClientPasswordAuthType
*/
public final ClientPasswordAuthType clientPasswordAuthType() {
return ClientPasswordAuthType.fromValue(clientPasswordAuthType);
}
/**
*
* The type of authentication the proxy uses for connections from clients.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #clientPasswordAuthType} will return {@link ClientPasswordAuthType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #clientPasswordAuthTypeAsString}.
*
*
* @return The type of authentication the proxy uses for connections from clients.
* @see ClientPasswordAuthType
*/
public final String clientPasswordAuthTypeAsString() {
return clientPasswordAuthType;
}
@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 + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(userName());
hashCode = 31 * hashCode + Objects.hashCode(authSchemeAsString());
hashCode = 31 * hashCode + Objects.hashCode(secretArn());
hashCode = 31 * hashCode + Objects.hashCode(iamAuthAsString());
hashCode = 31 * hashCode + Objects.hashCode(clientPasswordAuthTypeAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UserAuthConfig)) {
return false;
}
UserAuthConfig other = (UserAuthConfig) obj;
return Objects.equals(description(), other.description()) && Objects.equals(userName(), other.userName())
&& Objects.equals(authSchemeAsString(), other.authSchemeAsString())
&& Objects.equals(secretArn(), other.secretArn()) && Objects.equals(iamAuthAsString(), other.iamAuthAsString())
&& Objects.equals(clientPasswordAuthTypeAsString(), other.clientPasswordAuthTypeAsString());
}
/**
* 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("UserAuthConfig").add("Description", description()).add("UserName", userName())
.add("AuthScheme", authSchemeAsString()).add("SecretArn", secretArn()).add("IAMAuth", iamAuthAsString())
.add("ClientPasswordAuthType", clientPasswordAuthTypeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "UserName":
return Optional.ofNullable(clazz.cast(userName()));
case "AuthScheme":
return Optional.ofNullable(clazz.cast(authSchemeAsString()));
case "SecretArn":
return Optional.ofNullable(clazz.cast(secretArn()));
case "IAMAuth":
return Optional.ofNullable(clazz.cast(iamAuthAsString()));
case "ClientPasswordAuthType":
return Optional.ofNullable(clazz.cast(clientPasswordAuthTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function