software.amazon.awssdk.services.rds.model.DBProxyEndpoint 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.time.Instant;
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.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.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;
/**
*
* The data structure representing an endpoint associated with a DB proxy. RDS automatically creates one endpoint for
* each DB proxy. For Aurora DB clusters, you can associate additional endpoints with the same DB proxy. These endpoints
* can be read/write or read-only. They can also reside in different VPCs than the associated DB proxy.
*
*
* This data type is used as a response element in the DescribeDBProxyEndpoints
operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DBProxyEndpoint implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField DB_PROXY_ENDPOINT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DBProxyEndpointName").getter(getter(DBProxyEndpoint::dbProxyEndpointName))
.setter(setter(Builder::dbProxyEndpointName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBProxyEndpointName").build())
.build();
private static final SdkField DB_PROXY_ENDPOINT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DBProxyEndpointArn").getter(getter(DBProxyEndpoint::dbProxyEndpointArn))
.setter(setter(Builder::dbProxyEndpointArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBProxyEndpointArn").build())
.build();
private static final SdkField DB_PROXY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DBProxyName").getter(getter(DBProxyEndpoint::dbProxyName)).setter(setter(Builder::dbProxyName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBProxyName").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(DBProxyEndpoint::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField VPC_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("VpcId")
.getter(getter(DBProxyEndpoint::vpcId)).setter(setter(Builder::vpcId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcId").build()).build();
private static final SdkField> VPC_SECURITY_GROUP_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("VpcSecurityGroupIds")
.getter(getter(DBProxyEndpoint::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> VPC_SUBNET_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("VpcSubnetIds")
.getter(getter(DBProxyEndpoint::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 ENDPOINT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Endpoint").getter(getter(DBProxyEndpoint::endpoint)).setter(setter(Builder::endpoint))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Endpoint").build()).build();
private static final SdkField CREATED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedDate").getter(getter(DBProxyEndpoint::createdDate)).setter(setter(Builder::createdDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedDate").build()).build();
private static final SdkField TARGET_ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetRole").getter(getter(DBProxyEndpoint::targetRoleAsString)).setter(setter(Builder::targetRole))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetRole").build()).build();
private static final SdkField IS_DEFAULT_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsDefault").getter(getter(DBProxyEndpoint::isDefault)).setter(setter(Builder::isDefault))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsDefault").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DB_PROXY_ENDPOINT_NAME_FIELD,
DB_PROXY_ENDPOINT_ARN_FIELD, DB_PROXY_NAME_FIELD, STATUS_FIELD, VPC_ID_FIELD, VPC_SECURITY_GROUP_IDS_FIELD,
VPC_SUBNET_IDS_FIELD, ENDPOINT_FIELD, CREATED_DATE_FIELD, TARGET_ROLE_FIELD, IS_DEFAULT_FIELD));
private static final long serialVersionUID = 1L;
private final String dbProxyEndpointName;
private final String dbProxyEndpointArn;
private final String dbProxyName;
private final String status;
private final String vpcId;
private final List vpcSecurityGroupIds;
private final List vpcSubnetIds;
private final String endpoint;
private final Instant createdDate;
private final String targetRole;
private final Boolean isDefault;
private DBProxyEndpoint(BuilderImpl builder) {
this.dbProxyEndpointName = builder.dbProxyEndpointName;
this.dbProxyEndpointArn = builder.dbProxyEndpointArn;
this.dbProxyName = builder.dbProxyName;
this.status = builder.status;
this.vpcId = builder.vpcId;
this.vpcSecurityGroupIds = builder.vpcSecurityGroupIds;
this.vpcSubnetIds = builder.vpcSubnetIds;
this.endpoint = builder.endpoint;
this.createdDate = builder.createdDate;
this.targetRole = builder.targetRole;
this.isDefault = builder.isDefault;
}
/**
*
* The name for the DB proxy endpoint. 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 name for the DB proxy endpoint. 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 dbProxyEndpointName() {
return dbProxyEndpointName;
}
/**
*
* The Amazon Resource Name (ARN) for the DB proxy endpoint.
*
*
* @return The Amazon Resource Name (ARN) for the DB proxy endpoint.
*/
public final String dbProxyEndpointArn() {
return dbProxyEndpointArn;
}
/**
*
* The identifier for the DB proxy that is associated with this DB proxy endpoint.
*
*
* @return The identifier for the DB proxy that is associated with this DB proxy endpoint.
*/
public final String dbProxyName() {
return dbProxyName;
}
/**
*
* The current status of this DB proxy endpoint. A status of available
means the endpoint is ready to
* handle requests. Other values indicate that you must wait for the endpoint to be ready, or take some action to
* resolve an issue.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DBProxyEndpointStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The current status of this DB proxy endpoint. A status of available
means the endpoint is
* ready to handle requests. Other values indicate that you must wait for the endpoint to be ready, or take
* some action to resolve an issue.
* @see DBProxyEndpointStatus
*/
public final DBProxyEndpointStatus status() {
return DBProxyEndpointStatus.fromValue(status);
}
/**
*
* The current status of this DB proxy endpoint. A status of available
means the endpoint is ready to
* handle requests. Other values indicate that you must wait for the endpoint to be ready, or take some action to
* resolve an issue.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DBProxyEndpointStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The current status of this DB proxy endpoint. A status of available
means the endpoint is
* ready to handle requests. Other values indicate that you must wait for the endpoint to be ready, or take
* some action to resolve an issue.
* @see DBProxyEndpointStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* Provides the VPC ID of the DB proxy endpoint.
*
*
* @return Provides the VPC ID of the DB proxy endpoint.
*/
public final String vpcId() {
return vpcId;
}
/**
* 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);
}
/**
*
* Provides a list of VPC security groups that the DB proxy endpoint belongs to.
*
*
* 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 Provides a list of VPC security groups that the DB proxy endpoint belongs to.
*/
public final List vpcSecurityGroupIds() {
return vpcSecurityGroupIds;
}
/**
* 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);
}
/**
*
* The EC2 subnet IDs for the DB proxy endpoint.
*
*
* 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 The EC2 subnet IDs for the DB proxy endpoint.
*/
public final List vpcSubnetIds() {
return vpcSubnetIds;
}
/**
*
* The endpoint that you can use to connect to the DB proxy. You include the endpoint value in the connection string
* for a database client application.
*
*
* @return The endpoint that you can use to connect to the DB proxy. You include the endpoint value in the
* connection string for a database client application.
*/
public final String endpoint() {
return endpoint;
}
/**
*
* The date and time when the DB proxy endpoint was first created.
*
*
* @return The date and time when the DB proxy endpoint was first created.
*/
public final Instant createdDate() {
return createdDate;
}
/**
*
* A value that indicates whether the DB proxy endpoint can be used for read/write or read-only operations.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #targetRole} will
* return {@link DBProxyEndpointTargetRole#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #targetRoleAsString}.
*
*
* @return A value that indicates whether the DB proxy endpoint can be used for read/write or read-only operations.
* @see DBProxyEndpointTargetRole
*/
public final DBProxyEndpointTargetRole targetRole() {
return DBProxyEndpointTargetRole.fromValue(targetRole);
}
/**
*
* A value that indicates whether the DB proxy endpoint can be used for read/write or read-only operations.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #targetRole} will
* return {@link DBProxyEndpointTargetRole#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #targetRoleAsString}.
*
*
* @return A value that indicates whether the DB proxy endpoint can be used for read/write or read-only operations.
* @see DBProxyEndpointTargetRole
*/
public final String targetRoleAsString() {
return targetRole;
}
/**
*
* Indicates whether this endpoint is the default endpoint for the associated DB proxy. Default DB proxy endpoints
* always have read/write capability. Other endpoints that you associate with the DB proxy can be either read/write
* or read-only.
*
*
* @return Indicates whether this endpoint is the default endpoint for the associated DB proxy. Default DB proxy
* endpoints always have read/write capability. Other endpoints that you associate with the DB proxy can be
* either read/write or read-only.
*/
public final Boolean isDefault() {
return isDefault;
}
@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(dbProxyEndpointName());
hashCode = 31 * hashCode + Objects.hashCode(dbProxyEndpointArn());
hashCode = 31 * hashCode + Objects.hashCode(dbProxyName());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(vpcId());
hashCode = 31 * hashCode + Objects.hashCode(hasVpcSecurityGroupIds() ? vpcSecurityGroupIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasVpcSubnetIds() ? vpcSubnetIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(endpoint());
hashCode = 31 * hashCode + Objects.hashCode(createdDate());
hashCode = 31 * hashCode + Objects.hashCode(targetRoleAsString());
hashCode = 31 * hashCode + Objects.hashCode(isDefault());
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 DBProxyEndpoint)) {
return false;
}
DBProxyEndpoint other = (DBProxyEndpoint) obj;
return Objects.equals(dbProxyEndpointName(), other.dbProxyEndpointName())
&& Objects.equals(dbProxyEndpointArn(), other.dbProxyEndpointArn())
&& Objects.equals(dbProxyName(), other.dbProxyName()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(vpcId(), other.vpcId()) && hasVpcSecurityGroupIds() == other.hasVpcSecurityGroupIds()
&& Objects.equals(vpcSecurityGroupIds(), other.vpcSecurityGroupIds())
&& hasVpcSubnetIds() == other.hasVpcSubnetIds() && Objects.equals(vpcSubnetIds(), other.vpcSubnetIds())
&& Objects.equals(endpoint(), other.endpoint()) && Objects.equals(createdDate(), other.createdDate())
&& Objects.equals(targetRoleAsString(), other.targetRoleAsString())
&& Objects.equals(isDefault(), other.isDefault());
}
/**
* 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("DBProxyEndpoint").add("DBProxyEndpointName", dbProxyEndpointName())
.add("DBProxyEndpointArn", dbProxyEndpointArn()).add("DBProxyName", dbProxyName())
.add("Status", statusAsString()).add("VpcId", vpcId())
.add("VpcSecurityGroupIds", hasVpcSecurityGroupIds() ? vpcSecurityGroupIds() : null)
.add("VpcSubnetIds", hasVpcSubnetIds() ? vpcSubnetIds() : null).add("Endpoint", endpoint())
.add("CreatedDate", createdDate()).add("TargetRole", targetRoleAsString()).add("IsDefault", isDefault()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DBProxyEndpointName":
return Optional.ofNullable(clazz.cast(dbProxyEndpointName()));
case "DBProxyEndpointArn":
return Optional.ofNullable(clazz.cast(dbProxyEndpointArn()));
case "DBProxyName":
return Optional.ofNullable(clazz.cast(dbProxyName()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "VpcId":
return Optional.ofNullable(clazz.cast(vpcId()));
case "VpcSecurityGroupIds":
return Optional.ofNullable(clazz.cast(vpcSecurityGroupIds()));
case "VpcSubnetIds":
return Optional.ofNullable(clazz.cast(vpcSubnetIds()));
case "Endpoint":
return Optional.ofNullable(clazz.cast(endpoint()));
case "CreatedDate":
return Optional.ofNullable(clazz.cast(createdDate()));
case "TargetRole":
return Optional.ofNullable(clazz.cast(targetRoleAsString()));
case "IsDefault":
return Optional.ofNullable(clazz.cast(isDefault()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function