software.amazon.awssdk.services.neptune.model.ValidStorageOptions Maven / Gradle / Ivy
Show all versions of neptune 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.neptune.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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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;
/**
*
* Information about valid modifications that you can make to your DB instance.
*
*
* Contains the result of a successful call to the DescribeValidDBInstanceModifications action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ValidStorageOptions implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField STORAGE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StorageType").getter(getter(ValidStorageOptions::storageType)).setter(setter(Builder::storageType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageType").build()).build();
private static final SdkField> STORAGE_SIZE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("StorageSize")
.getter(getter(ValidStorageOptions::storageSize))
.setter(setter(Builder::storageSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageSize").build(),
ListTrait
.builder()
.memberLocationName("Range")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Range::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("Range").build()).build()).build()).build();
private static final SdkField> PROVISIONED_IOPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ProvisionedIops")
.getter(getter(ValidStorageOptions::provisionedIops))
.setter(setter(Builder::provisionedIops))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProvisionedIops").build(),
ListTrait
.builder()
.memberLocationName("Range")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Range::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("Range").build()).build()).build()).build();
private static final SdkField> IOPS_TO_STORAGE_RATIO_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("IopsToStorageRatio")
.getter(getter(ValidStorageOptions::iopsToStorageRatio))
.setter(setter(Builder::iopsToStorageRatio))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IopsToStorageRatio").build(),
ListTrait
.builder()
.memberLocationName("DoubleRange")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DoubleRange::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("DoubleRange").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STORAGE_TYPE_FIELD,
STORAGE_SIZE_FIELD, PROVISIONED_IOPS_FIELD, IOPS_TO_STORAGE_RATIO_FIELD));
private static final long serialVersionUID = 1L;
private final String storageType;
private final List storageSize;
private final List provisionedIops;
private final List iopsToStorageRatio;
private ValidStorageOptions(BuilderImpl builder) {
this.storageType = builder.storageType;
this.storageSize = builder.storageSize;
this.provisionedIops = builder.provisionedIops;
this.iopsToStorageRatio = builder.iopsToStorageRatio;
}
/**
*
* The valid storage types for your DB instance. For example, gp2, io1.
*
*
* @return The valid storage types for your DB instance. For example, gp2, io1.
*/
public final String storageType() {
return storageType;
}
/**
* For responses, this returns true if the service returned a value for the StorageSize 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 hasStorageSize() {
return storageSize != null && !(storageSize instanceof SdkAutoConstructList);
}
/**
*
* The valid range of storage in gibibytes. For example, 100 to 16384.
*
*
* 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 #hasStorageSize} method.
*
*
* @return The valid range of storage in gibibytes. For example, 100 to 16384.
*/
public final List storageSize() {
return storageSize;
}
/**
* For responses, this returns true if the service returned a value for the ProvisionedIops 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 hasProvisionedIops() {
return provisionedIops != null && !(provisionedIops instanceof SdkAutoConstructList);
}
/**
*
* The valid range of provisioned IOPS. For example, 1000-20000.
*
*
* 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 #hasProvisionedIops} method.
*
*
* @return The valid range of provisioned IOPS. For example, 1000-20000.
*/
public final List provisionedIops() {
return provisionedIops;
}
/**
* For responses, this returns true if the service returned a value for the IopsToStorageRatio 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 hasIopsToStorageRatio() {
return iopsToStorageRatio != null && !(iopsToStorageRatio instanceof SdkAutoConstructList);
}
/**
*
* The valid range of Provisioned IOPS to gibibytes of storage multiplier. For example, 3-10, which means that
* provisioned IOPS can be between 3 and 10 times storage.
*
*
* 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 #hasIopsToStorageRatio} method.
*
*
* @return The valid range of Provisioned IOPS to gibibytes of storage multiplier. For example, 3-10, which means
* that provisioned IOPS can be between 3 and 10 times storage.
*/
public final List iopsToStorageRatio() {
return iopsToStorageRatio;
}
@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(storageType());
hashCode = 31 * hashCode + Objects.hashCode(hasStorageSize() ? storageSize() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasProvisionedIops() ? provisionedIops() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasIopsToStorageRatio() ? iopsToStorageRatio() : null);
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 ValidStorageOptions)) {
return false;
}
ValidStorageOptions other = (ValidStorageOptions) obj;
return Objects.equals(storageType(), other.storageType()) && hasStorageSize() == other.hasStorageSize()
&& Objects.equals(storageSize(), other.storageSize()) && hasProvisionedIops() == other.hasProvisionedIops()
&& Objects.equals(provisionedIops(), other.provisionedIops())
&& hasIopsToStorageRatio() == other.hasIopsToStorageRatio()
&& Objects.equals(iopsToStorageRatio(), other.iopsToStorageRatio());
}
/**
* 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("ValidStorageOptions").add("StorageType", storageType())
.add("StorageSize", hasStorageSize() ? storageSize() : null)
.add("ProvisionedIops", hasProvisionedIops() ? provisionedIops() : null)
.add("IopsToStorageRatio", hasIopsToStorageRatio() ? iopsToStorageRatio() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StorageType":
return Optional.ofNullable(clazz.cast(storageType()));
case "StorageSize":
return Optional.ofNullable(clazz.cast(storageSize()));
case "ProvisionedIops":
return Optional.ofNullable(clazz.cast(provisionedIops()));
case "IopsToStorageRatio":
return Optional.ofNullable(clazz.cast(iopsToStorageRatio()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function