![JAR search and dependency download from the Maven repository](/logo.png)
software.amazon.awssdk.services.databasemigration.model.ReplicationSubnetGroup Maven / Gradle / Ivy
Show all versions of dms Show documentation
/*
* Copyright 2013-2018 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.databasemigration.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.services.databasemigration.transform.ReplicationSubnetGroupMarshaller;
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 ReplicationSubnetGroup implements StructuredPojo,
ToCopyableBuilder {
private final String replicationSubnetGroupIdentifier;
private final String replicationSubnetGroupDescription;
private final String vpcId;
private final String subnetGroupStatus;
private final List subnets;
private ReplicationSubnetGroup(BuilderImpl builder) {
this.replicationSubnetGroupIdentifier = builder.replicationSubnetGroupIdentifier;
this.replicationSubnetGroupDescription = builder.replicationSubnetGroupDescription;
this.vpcId = builder.vpcId;
this.subnetGroupStatus = builder.subnetGroupStatus;
this.subnets = builder.subnets;
}
/**
*
* The identifier of the replication instance subnet group.
*
*
* @return The identifier of the replication instance subnet group.
*/
public String replicationSubnetGroupIdentifier() {
return replicationSubnetGroupIdentifier;
}
/**
*
* The description of the replication subnet group.
*
*
* @return The description of the replication subnet group.
*/
public String replicationSubnetGroupDescription() {
return replicationSubnetGroupDescription;
}
/**
*
* The ID of the VPC.
*
*
* @return The ID of the VPC.
*/
public String vpcId() {
return vpcId;
}
/**
*
* The status of the subnet group.
*
*
* @return The status of the subnet group.
*/
public String subnetGroupStatus() {
return subnetGroupStatus;
}
/**
*
* The subnets that are in the subnet group.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The subnets that are in the subnet group.
*/
public List subnets() {
return subnets;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(replicationSubnetGroupIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(replicationSubnetGroupDescription());
hashCode = 31 * hashCode + Objects.hashCode(vpcId());
hashCode = 31 * hashCode + Objects.hashCode(subnetGroupStatus());
hashCode = 31 * hashCode + Objects.hashCode(subnets());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ReplicationSubnetGroup)) {
return false;
}
ReplicationSubnetGroup other = (ReplicationSubnetGroup) obj;
return Objects.equals(replicationSubnetGroupIdentifier(), other.replicationSubnetGroupIdentifier())
&& Objects.equals(replicationSubnetGroupDescription(), other.replicationSubnetGroupDescription())
&& Objects.equals(vpcId(), other.vpcId()) && Objects.equals(subnetGroupStatus(), other.subnetGroupStatus())
&& Objects.equals(subnets(), other.subnets());
}
@Override
public String toString() {
return ToString.builder("ReplicationSubnetGroup")
.add("ReplicationSubnetGroupIdentifier", replicationSubnetGroupIdentifier())
.add("ReplicationSubnetGroupDescription", replicationSubnetGroupDescription()).add("VpcId", vpcId())
.add("SubnetGroupStatus", subnetGroupStatus()).add("Subnets", subnets()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ReplicationSubnetGroupIdentifier":
return Optional.ofNullable(clazz.cast(replicationSubnetGroupIdentifier()));
case "ReplicationSubnetGroupDescription":
return Optional.ofNullable(clazz.cast(replicationSubnetGroupDescription()));
case "VpcId":
return Optional.ofNullable(clazz.cast(vpcId()));
case "SubnetGroupStatus":
return Optional.ofNullable(clazz.cast(subnetGroupStatus()));
case "Subnets":
return Optional.ofNullable(clazz.cast(subnets()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
ReplicationSubnetGroupMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The identifier of the replication instance subnet group.
*
*
* @param replicationSubnetGroupIdentifier
* The identifier of the replication instance subnet group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationSubnetGroupIdentifier(String replicationSubnetGroupIdentifier);
/**
*
* The description of the replication subnet group.
*
*
* @param replicationSubnetGroupDescription
* The description of the replication subnet group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationSubnetGroupDescription(String replicationSubnetGroupDescription);
/**
*
* The ID of the VPC.
*
*
* @param vpcId
* The ID of the VPC.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder vpcId(String vpcId);
/**
*
* The status of the subnet group.
*
*
* @param subnetGroupStatus
* The status of the subnet group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder subnetGroupStatus(String subnetGroupStatus);
/**
*
* The subnets that are in the subnet group.
*
*
* @param subnets
* The subnets that are in the subnet group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder subnets(Collection subnets);
/**
*
* The subnets that are in the subnet group.
*
*
* @param subnets
* The subnets that are in the subnet group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder subnets(Subnet... subnets);
/**
*
* The subnets that are in the subnet group.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to
* create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its
* result is passed to {@link #subnets(List)}.
*
* @param subnets
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #subnets(List)
*/
Builder subnets(Consumer... subnets);
}
static final class BuilderImpl implements Builder {
private String replicationSubnetGroupIdentifier;
private String replicationSubnetGroupDescription;
private String vpcId;
private String subnetGroupStatus;
private List subnets = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(ReplicationSubnetGroup model) {
replicationSubnetGroupIdentifier(model.replicationSubnetGroupIdentifier);
replicationSubnetGroupDescription(model.replicationSubnetGroupDescription);
vpcId(model.vpcId);
subnetGroupStatus(model.subnetGroupStatus);
subnets(model.subnets);
}
public final String getReplicationSubnetGroupIdentifier() {
return replicationSubnetGroupIdentifier;
}
@Override
public final Builder replicationSubnetGroupIdentifier(String replicationSubnetGroupIdentifier) {
this.replicationSubnetGroupIdentifier = replicationSubnetGroupIdentifier;
return this;
}
public final void setReplicationSubnetGroupIdentifier(String replicationSubnetGroupIdentifier) {
this.replicationSubnetGroupIdentifier = replicationSubnetGroupIdentifier;
}
public final String getReplicationSubnetGroupDescription() {
return replicationSubnetGroupDescription;
}
@Override
public final Builder replicationSubnetGroupDescription(String replicationSubnetGroupDescription) {
this.replicationSubnetGroupDescription = replicationSubnetGroupDescription;
return this;
}
public final void setReplicationSubnetGroupDescription(String replicationSubnetGroupDescription) {
this.replicationSubnetGroupDescription = replicationSubnetGroupDescription;
}
public final String getVpcId() {
return vpcId;
}
@Override
public final Builder vpcId(String vpcId) {
this.vpcId = vpcId;
return this;
}
public final void setVpcId(String vpcId) {
this.vpcId = vpcId;
}
public final String getSubnetGroupStatus() {
return subnetGroupStatus;
}
@Override
public final Builder subnetGroupStatus(String subnetGroupStatus) {
this.subnetGroupStatus = subnetGroupStatus;
return this;
}
public final void setSubnetGroupStatus(String subnetGroupStatus) {
this.subnetGroupStatus = subnetGroupStatus;
}
public final Collection getSubnets() {
return subnets != null ? subnets.stream().map(Subnet::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder subnets(Collection subnets) {
this.subnets = SubnetListCopier.copy(subnets);
return this;
}
@Override
@SafeVarargs
public final Builder subnets(Subnet... subnets) {
subnets(Arrays.asList(subnets));
return this;
}
@Override
@SafeVarargs
public final Builder subnets(Consumer... subnets) {
subnets(Stream.of(subnets).map(c -> Subnet.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setSubnets(Collection subnets) {
this.subnets = SubnetListCopier.copyFromBuilder(subnets);
}
@Override
public ReplicationSubnetGroup build() {
return new ReplicationSubnetGroup(this);
}
}
}