
software.amazon.awssdk.services.databasemigration.model.OrderableReplicationInstance Maven / Gradle / Ivy
/*
* 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.databasemigration.model;
import java.io.Serializable;
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;
/**
*
* In response to the DescribeOrderableReplicationInstances
operation, this object describes an available
* replication instance. This description includes the replication instance's type, engine version, and allocated
* storage.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OrderableReplicationInstance implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EngineVersion").getter(getter(OrderableReplicationInstance::engineVersion))
.setter(setter(Builder::engineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EngineVersion").build()).build();
private static final SdkField REPLICATION_INSTANCE_CLASS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReplicationInstanceClass").getter(getter(OrderableReplicationInstance::replicationInstanceClass))
.setter(setter(Builder::replicationInstanceClass))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicationInstanceClass").build())
.build();
private static final SdkField STORAGE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StorageType").getter(getter(OrderableReplicationInstance::storageType))
.setter(setter(Builder::storageType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageType").build()).build();
private static final SdkField MIN_ALLOCATED_STORAGE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MinAllocatedStorage").getter(getter(OrderableReplicationInstance::minAllocatedStorage))
.setter(setter(Builder::minAllocatedStorage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MinAllocatedStorage").build())
.build();
private static final SdkField MAX_ALLOCATED_STORAGE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxAllocatedStorage").getter(getter(OrderableReplicationInstance::maxAllocatedStorage))
.setter(setter(Builder::maxAllocatedStorage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxAllocatedStorage").build())
.build();
private static final SdkField DEFAULT_ALLOCATED_STORAGE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("DefaultAllocatedStorage").getter(getter(OrderableReplicationInstance::defaultAllocatedStorage))
.setter(setter(Builder::defaultAllocatedStorage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultAllocatedStorage").build())
.build();
private static final SdkField INCLUDED_ALLOCATED_STORAGE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("IncludedAllocatedStorage").getter(getter(OrderableReplicationInstance::includedAllocatedStorage))
.setter(setter(Builder::includedAllocatedStorage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IncludedAllocatedStorage").build())
.build();
private static final SdkField> AVAILABILITY_ZONES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AvailabilityZones")
.getter(getter(OrderableReplicationInstance::availabilityZones))
.setter(setter(Builder::availabilityZones))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZones").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 RELEASE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReleaseStatus").getter(getter(OrderableReplicationInstance::releaseStatusAsString))
.setter(setter(Builder::releaseStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReleaseStatus").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENGINE_VERSION_FIELD,
REPLICATION_INSTANCE_CLASS_FIELD, STORAGE_TYPE_FIELD, MIN_ALLOCATED_STORAGE_FIELD, MAX_ALLOCATED_STORAGE_FIELD,
DEFAULT_ALLOCATED_STORAGE_FIELD, INCLUDED_ALLOCATED_STORAGE_FIELD, AVAILABILITY_ZONES_FIELD, RELEASE_STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final String engineVersion;
private final String replicationInstanceClass;
private final String storageType;
private final Integer minAllocatedStorage;
private final Integer maxAllocatedStorage;
private final Integer defaultAllocatedStorage;
private final Integer includedAllocatedStorage;
private final List availabilityZones;
private final String releaseStatus;
private OrderableReplicationInstance(BuilderImpl builder) {
this.engineVersion = builder.engineVersion;
this.replicationInstanceClass = builder.replicationInstanceClass;
this.storageType = builder.storageType;
this.minAllocatedStorage = builder.minAllocatedStorage;
this.maxAllocatedStorage = builder.maxAllocatedStorage;
this.defaultAllocatedStorage = builder.defaultAllocatedStorage;
this.includedAllocatedStorage = builder.includedAllocatedStorage;
this.availabilityZones = builder.availabilityZones;
this.releaseStatus = builder.releaseStatus;
}
/**
*
* The version of the replication engine.
*
*
* @return The version of the replication engine.
*/
public final String engineVersion() {
return engineVersion;
}
/**
*
* The compute and memory capacity of the replication instance as defined for the specified replication instance
* class. For example to specify the instance class dms.c4.large, set this parameter to "dms.c4.large"
.
*
*
* For more information on the settings and capacities for the available replication instance classes, see Selecting the right DMS replication instance for your migration.
*
*
* @return The compute and memory capacity of the replication instance as defined for the specified replication
* instance class. For example to specify the instance class dms.c4.large, set this parameter to
* "dms.c4.large"
.
*
* For more information on the settings and capacities for the available replication instance classes, see
* Selecting the right DMS replication instance for your migration.
*/
public final String replicationInstanceClass() {
return replicationInstanceClass;
}
/**
*
* The type of storage used by the replication instance.
*
*
* @return The type of storage used by the replication instance.
*/
public final String storageType() {
return storageType;
}
/**
*
* The minimum amount of storage (in gigabytes) that can be allocated for the replication instance.
*
*
* @return The minimum amount of storage (in gigabytes) that can be allocated for the replication instance.
*/
public final Integer minAllocatedStorage() {
return minAllocatedStorage;
}
/**
*
* The minimum amount of storage (in gigabytes) that can be allocated for the replication instance.
*
*
* @return The minimum amount of storage (in gigabytes) that can be allocated for the replication instance.
*/
public final Integer maxAllocatedStorage() {
return maxAllocatedStorage;
}
/**
*
* The default amount of storage (in gigabytes) that is allocated for the replication instance.
*
*
* @return The default amount of storage (in gigabytes) that is allocated for the replication instance.
*/
public final Integer defaultAllocatedStorage() {
return defaultAllocatedStorage;
}
/**
*
* The amount of storage (in gigabytes) that is allocated for the replication instance.
*
*
* @return The amount of storage (in gigabytes) that is allocated for the replication instance.
*/
public final Integer includedAllocatedStorage() {
return includedAllocatedStorage;
}
/**
* For responses, this returns true if the service returned a value for the AvailabilityZones 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 hasAvailabilityZones() {
return availabilityZones != null && !(availabilityZones instanceof SdkAutoConstructList);
}
/**
*
* List of Availability Zones for this replication instance.
*
*
* 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 #hasAvailabilityZones} method.
*
*
* @return List of Availability Zones for this replication instance.
*/
public final List availabilityZones() {
return availabilityZones;
}
/**
*
* The value returned when the specified EngineVersion
of the replication instance is in Beta or test
* mode. This indicates some features might not work as expected.
*
*
*
* DMS supports the ReleaseStatus
parameter in versions 3.1.4 and later.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #releaseStatus}
* will return {@link ReleaseStatusValues#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #releaseStatusAsString}.
*
*
* @return The value returned when the specified EngineVersion
of the replication instance is in Beta
* or test mode. This indicates some features might not work as expected.
*
* DMS supports the ReleaseStatus
parameter in versions 3.1.4 and later.
*
* @see ReleaseStatusValues
*/
public final ReleaseStatusValues releaseStatus() {
return ReleaseStatusValues.fromValue(releaseStatus);
}
/**
*
* The value returned when the specified EngineVersion
of the replication instance is in Beta or test
* mode. This indicates some features might not work as expected.
*
*
*
* DMS supports the ReleaseStatus
parameter in versions 3.1.4 and later.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #releaseStatus}
* will return {@link ReleaseStatusValues#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #releaseStatusAsString}.
*
*
* @return The value returned when the specified EngineVersion
of the replication instance is in Beta
* or test mode. This indicates some features might not work as expected.
*
* DMS supports the ReleaseStatus
parameter in versions 3.1.4 and later.
*
* @see ReleaseStatusValues
*/
public final String releaseStatusAsString() {
return releaseStatus;
}
@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(engineVersion());
hashCode = 31 * hashCode + Objects.hashCode(replicationInstanceClass());
hashCode = 31 * hashCode + Objects.hashCode(storageType());
hashCode = 31 * hashCode + Objects.hashCode(minAllocatedStorage());
hashCode = 31 * hashCode + Objects.hashCode(maxAllocatedStorage());
hashCode = 31 * hashCode + Objects.hashCode(defaultAllocatedStorage());
hashCode = 31 * hashCode + Objects.hashCode(includedAllocatedStorage());
hashCode = 31 * hashCode + Objects.hashCode(hasAvailabilityZones() ? availabilityZones() : null);
hashCode = 31 * hashCode + Objects.hashCode(releaseStatusAsString());
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 OrderableReplicationInstance)) {
return false;
}
OrderableReplicationInstance other = (OrderableReplicationInstance) obj;
return Objects.equals(engineVersion(), other.engineVersion())
&& Objects.equals(replicationInstanceClass(), other.replicationInstanceClass())
&& Objects.equals(storageType(), other.storageType())
&& Objects.equals(minAllocatedStorage(), other.minAllocatedStorage())
&& Objects.equals(maxAllocatedStorage(), other.maxAllocatedStorage())
&& Objects.equals(defaultAllocatedStorage(), other.defaultAllocatedStorage())
&& Objects.equals(includedAllocatedStorage(), other.includedAllocatedStorage())
&& hasAvailabilityZones() == other.hasAvailabilityZones()
&& Objects.equals(availabilityZones(), other.availabilityZones())
&& Objects.equals(releaseStatusAsString(), other.releaseStatusAsString());
}
/**
* 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("OrderableReplicationInstance").add("EngineVersion", engineVersion())
.add("ReplicationInstanceClass", replicationInstanceClass()).add("StorageType", storageType())
.add("MinAllocatedStorage", minAllocatedStorage()).add("MaxAllocatedStorage", maxAllocatedStorage())
.add("DefaultAllocatedStorage", defaultAllocatedStorage())
.add("IncludedAllocatedStorage", includedAllocatedStorage())
.add("AvailabilityZones", hasAvailabilityZones() ? availabilityZones() : null)
.add("ReleaseStatus", releaseStatusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "EngineVersion":
return Optional.ofNullable(clazz.cast(engineVersion()));
case "ReplicationInstanceClass":
return Optional.ofNullable(clazz.cast(replicationInstanceClass()));
case "StorageType":
return Optional.ofNullable(clazz.cast(storageType()));
case "MinAllocatedStorage":
return Optional.ofNullable(clazz.cast(minAllocatedStorage()));
case "MaxAllocatedStorage":
return Optional.ofNullable(clazz.cast(maxAllocatedStorage()));
case "DefaultAllocatedStorage":
return Optional.ofNullable(clazz.cast(defaultAllocatedStorage()));
case "IncludedAllocatedStorage":
return Optional.ofNullable(clazz.cast(includedAllocatedStorage()));
case "AvailabilityZones":
return Optional.ofNullable(clazz.cast(availabilityZones()));
case "ReleaseStatus":
return Optional.ofNullable(clazz.cast(releaseStatusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function