software.amazon.awssdk.services.databasemigration.model.Subnet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dms Show documentation
Show all versions of dms Show documentation
The AWS Java SDK for AWS Database Migration Service module holds the client classes that are used for
communicating with AWS Database Migration Service.
/*
* Copyright 2012-2017 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.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import javax.annotation.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.services.databasemigration.transform.SubnetMarshaller;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*/
@Generated("software.amazon.awssdk:codegen")
public class Subnet implements StructuredPojo, ToCopyableBuilder {
private final String subnetIdentifier;
private final AvailabilityZone subnetAvailabilityZone;
private final String subnetStatus;
private Subnet(BuilderImpl builder) {
this.subnetIdentifier = builder.subnetIdentifier;
this.subnetAvailabilityZone = builder.subnetAvailabilityZone;
this.subnetStatus = builder.subnetStatus;
}
/**
*
* The subnet identifier.
*
*
* @return The subnet identifier.
*/
public String subnetIdentifier() {
return subnetIdentifier;
}
/**
*
* The Availability Zone of the subnet.
*
*
* @return The Availability Zone of the subnet.
*/
public AvailabilityZone subnetAvailabilityZone() {
return subnetAvailabilityZone;
}
/**
*
* The status of the subnet.
*
*
* @return The status of the subnet.
*/
public String subnetStatus() {
return subnetStatus;
}
@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(subnetIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(subnetAvailabilityZone());
hashCode = 31 * hashCode + Objects.hashCode(subnetStatus());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Subnet)) {
return false;
}
Subnet other = (Subnet) obj;
return Objects.equals(subnetIdentifier(), other.subnetIdentifier())
&& Objects.equals(subnetAvailabilityZone(), other.subnetAvailabilityZone())
&& Objects.equals(subnetStatus(), other.subnetStatus());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
if (subnetIdentifier() != null) {
sb.append("SubnetIdentifier: ").append(subnetIdentifier()).append(",");
}
if (subnetAvailabilityZone() != null) {
sb.append("SubnetAvailabilityZone: ").append(subnetAvailabilityZone()).append(",");
}
if (subnetStatus() != null) {
sb.append("SubnetStatus: ").append(subnetStatus()).append(",");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
sb.append("}");
return sb.toString();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SubnetIdentifier":
return Optional.of(clazz.cast(subnetIdentifier()));
case "SubnetAvailabilityZone":
return Optional.of(clazz.cast(subnetAvailabilityZone()));
case "SubnetStatus":
return Optional.of(clazz.cast(subnetStatus()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
SubnetMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The subnet identifier.
*
*
* @param subnetIdentifier
* The subnet identifier.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder subnetIdentifier(String subnetIdentifier);
/**
*
* The Availability Zone of the subnet.
*
*
* @param subnetAvailabilityZone
* The Availability Zone of the subnet.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder subnetAvailabilityZone(AvailabilityZone subnetAvailabilityZone);
/**
*
* The Availability Zone of the subnet.
*
* This is a convenience that creates an instance of the {@link AvailabilityZone.Builder} avoiding the need to
* create one manually via {@link AvailabilityZone#builder()}.
*
* When the {@link Consumer} completes, {@link AvailabilityZone.Builder#build()} is called immediately and its
* result is passed to {@link #subnetAvailabilityZone(AvailabilityZone)}.
*
* @param subnetAvailabilityZone
* a consumer that will call methods on {@link AvailabilityZone.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #subnetAvailabilityZone(AvailabilityZone)
*/
default Builder subnetAvailabilityZone(Consumer subnetAvailabilityZone) {
return subnetAvailabilityZone(AvailabilityZone.builder().apply(subnetAvailabilityZone).build());
}
/**
*
* The status of the subnet.
*
*
* @param subnetStatus
* The status of the subnet.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder subnetStatus(String subnetStatus);
}
static final class BuilderImpl implements Builder {
private String subnetIdentifier;
private AvailabilityZone subnetAvailabilityZone;
private String subnetStatus;
private BuilderImpl() {
}
private BuilderImpl(Subnet model) {
subnetIdentifier(model.subnetIdentifier);
subnetAvailabilityZone(model.subnetAvailabilityZone);
subnetStatus(model.subnetStatus);
}
public final String getSubnetIdentifier() {
return subnetIdentifier;
}
@Override
public final Builder subnetIdentifier(String subnetIdentifier) {
this.subnetIdentifier = subnetIdentifier;
return this;
}
public final void setSubnetIdentifier(String subnetIdentifier) {
this.subnetIdentifier = subnetIdentifier;
}
public final AvailabilityZone.Builder getSubnetAvailabilityZone() {
return subnetAvailabilityZone != null ? subnetAvailabilityZone.toBuilder() : null;
}
@Override
public final Builder subnetAvailabilityZone(AvailabilityZone subnetAvailabilityZone) {
this.subnetAvailabilityZone = subnetAvailabilityZone;
return this;
}
public final void setSubnetAvailabilityZone(AvailabilityZone.BuilderImpl subnetAvailabilityZone) {
this.subnetAvailabilityZone = subnetAvailabilityZone != null ? subnetAvailabilityZone.build() : null;
}
public final String getSubnetStatus() {
return subnetStatus;
}
@Override
public final Builder subnetStatus(String subnetStatus) {
this.subnetStatus = subnetStatus;
return this;
}
public final void setSubnetStatus(String subnetStatus) {
this.subnetStatus = subnetStatus;
}
@Override
public Subnet build() {
return new Subnet(this);
}
}
}