
software.amazon.awssdk.services.rds.model.DBProxyTargetGroup 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.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 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;
/**
*
* Represents a set of RDS DB instances, Aurora DB clusters, or both that a proxy can connect to. Currently, each target
* group is associated with exactly one RDS DB instance or Aurora DB cluster.
*
*
* This data type is used as a response element in the DescribeDBProxyTargetGroups
action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DBProxyTargetGroup implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DB_PROXY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DBProxyName").getter(getter(DBProxyTargetGroup::dbProxyName)).setter(setter(Builder::dbProxyName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBProxyName").build()).build();
private static final SdkField TARGET_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetGroupName").getter(getter(DBProxyTargetGroup::targetGroupName))
.setter(setter(Builder::targetGroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetGroupName").build()).build();
private static final SdkField TARGET_GROUP_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetGroupArn").getter(getter(DBProxyTargetGroup::targetGroupArn))
.setter(setter(Builder::targetGroupArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetGroupArn").build()).build();
private static final SdkField IS_DEFAULT_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsDefault").getter(getter(DBProxyTargetGroup::isDefault)).setter(setter(Builder::isDefault))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsDefault").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(DBProxyTargetGroup::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField CONNECTION_POOL_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ConnectionPoolConfig")
.getter(getter(DBProxyTargetGroup::connectionPoolConfig)).setter(setter(Builder::connectionPoolConfig))
.constructor(ConnectionPoolConfigurationInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionPoolConfig").build())
.build();
private static final SdkField CREATED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedDate").getter(getter(DBProxyTargetGroup::createdDate)).setter(setter(Builder::createdDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedDate").build()).build();
private static final SdkField UPDATED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("UpdatedDate").getter(getter(DBProxyTargetGroup::updatedDate)).setter(setter(Builder::updatedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdatedDate").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DB_PROXY_NAME_FIELD,
TARGET_GROUP_NAME_FIELD, TARGET_GROUP_ARN_FIELD, IS_DEFAULT_FIELD, STATUS_FIELD, CONNECTION_POOL_CONFIG_FIELD,
CREATED_DATE_FIELD, UPDATED_DATE_FIELD));
private static final long serialVersionUID = 1L;
private final String dbProxyName;
private final String targetGroupName;
private final String targetGroupArn;
private final Boolean isDefault;
private final String status;
private final ConnectionPoolConfigurationInfo connectionPoolConfig;
private final Instant createdDate;
private final Instant updatedDate;
private DBProxyTargetGroup(BuilderImpl builder) {
this.dbProxyName = builder.dbProxyName;
this.targetGroupName = builder.targetGroupName;
this.targetGroupArn = builder.targetGroupArn;
this.isDefault = builder.isDefault;
this.status = builder.status;
this.connectionPoolConfig = builder.connectionPoolConfig;
this.createdDate = builder.createdDate;
this.updatedDate = builder.updatedDate;
}
/**
*
* The identifier for the RDS proxy associated with this target group.
*
*
* @return The identifier for the RDS proxy associated with this target group.
*/
public final String dbProxyName() {
return dbProxyName;
}
/**
*
* The identifier for the target group. This name must be unique for all target groups owned by your Amazon Web
* Services account in the specified Amazon Web Services Region.
*
*
* @return The identifier for the target group. This name must be unique for all target groups owned by your Amazon
* Web Services account in the specified Amazon Web Services Region.
*/
public final String targetGroupName() {
return targetGroupName;
}
/**
*
* The Amazon Resource Name (ARN) representing the target group.
*
*
* @return The Amazon Resource Name (ARN) representing the target group.
*/
public final String targetGroupArn() {
return targetGroupArn;
}
/**
*
* Indicates whether this target group is the first one used for connection requests by the associated proxy.
* Because each proxy is currently associated with a single target group, currently this setting is always
* true
.
*
*
* @return Indicates whether this target group is the first one used for connection requests by the associated
* proxy. Because each proxy is currently associated with a single target group, currently this setting is
* always true
.
*/
public final Boolean isDefault() {
return isDefault;
}
/**
*
* The current status of this target group. A status of available
means the target group is correctly
* associated with a database. Other values indicate that you must wait for the target group to be ready, or take
* some action to resolve an issue.
*
*
* @return The current status of this target group. A status of available
means the target group is
* correctly associated with a database. Other values indicate that you must wait for the target group to be
* ready, or take some action to resolve an issue.
*/
public final String status() {
return status;
}
/**
*
* The settings that determine the size and behavior of the connection pool for the target group.
*
*
* @return The settings that determine the size and behavior of the connection pool for the target group.
*/
public final ConnectionPoolConfigurationInfo connectionPoolConfig() {
return connectionPoolConfig;
}
/**
*
* The date and time when the target group was first created.
*
*
* @return The date and time when the target group was first created.
*/
public final Instant createdDate() {
return createdDate;
}
/**
*
* The date and time when the target group was last updated.
*
*
* @return The date and time when the target group was last updated.
*/
public final Instant updatedDate() {
return updatedDate;
}
@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(dbProxyName());
hashCode = 31 * hashCode + Objects.hashCode(targetGroupName());
hashCode = 31 * hashCode + Objects.hashCode(targetGroupArn());
hashCode = 31 * hashCode + Objects.hashCode(isDefault());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(connectionPoolConfig());
hashCode = 31 * hashCode + Objects.hashCode(createdDate());
hashCode = 31 * hashCode + Objects.hashCode(updatedDate());
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 DBProxyTargetGroup)) {
return false;
}
DBProxyTargetGroup other = (DBProxyTargetGroup) obj;
return Objects.equals(dbProxyName(), other.dbProxyName()) && Objects.equals(targetGroupName(), other.targetGroupName())
&& Objects.equals(targetGroupArn(), other.targetGroupArn()) && Objects.equals(isDefault(), other.isDefault())
&& Objects.equals(status(), other.status())
&& Objects.equals(connectionPoolConfig(), other.connectionPoolConfig())
&& Objects.equals(createdDate(), other.createdDate()) && Objects.equals(updatedDate(), other.updatedDate());
}
/**
* 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("DBProxyTargetGroup").add("DBProxyName", dbProxyName()).add("TargetGroupName", targetGroupName())
.add("TargetGroupArn", targetGroupArn()).add("IsDefault", isDefault()).add("Status", status())
.add("ConnectionPoolConfig", connectionPoolConfig()).add("CreatedDate", createdDate())
.add("UpdatedDate", updatedDate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DBProxyName":
return Optional.ofNullable(clazz.cast(dbProxyName()));
case "TargetGroupName":
return Optional.ofNullable(clazz.cast(targetGroupName()));
case "TargetGroupArn":
return Optional.ofNullable(clazz.cast(targetGroupArn()));
case "IsDefault":
return Optional.ofNullable(clazz.cast(isDefault()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "ConnectionPoolConfig":
return Optional.ofNullable(clazz.cast(connectionPoolConfig()));
case "CreatedDate":
return Optional.ofNullable(clazz.cast(createdDate()));
case "UpdatedDate":
return Optional.ofNullable(clazz.cast(updatedDate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function