software.amazon.awssdk.services.opensearch.model.EBSOptions Maven / Gradle / Ivy
Show all versions of opensearch 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.opensearch.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Container for the parameters required to enable EBS-based storage for an OpenSearch Service domain.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EBSOptions implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField EBS_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("EBSEnabled").getter(getter(EBSOptions::ebsEnabled)).setter(setter(Builder::ebsEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EBSEnabled").build()).build();
private static final SdkField VOLUME_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VolumeType").getter(getter(EBSOptions::volumeTypeAsString)).setter(setter(Builder::volumeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeType").build()).build();
private static final SdkField VOLUME_SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("VolumeSize").getter(getter(EBSOptions::volumeSize)).setter(setter(Builder::volumeSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeSize").build()).build();
private static final SdkField IOPS_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Iops")
.getter(getter(EBSOptions::iops)).setter(setter(Builder::iops))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Iops").build()).build();
private static final SdkField THROUGHPUT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Throughput").getter(getter(EBSOptions::throughput)).setter(setter(Builder::throughput))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Throughput").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(EBS_ENABLED_FIELD,
VOLUME_TYPE_FIELD, VOLUME_SIZE_FIELD, IOPS_FIELD, THROUGHPUT_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final Boolean ebsEnabled;
private final String volumeType;
private final Integer volumeSize;
private final Integer iops;
private final Integer throughput;
private EBSOptions(BuilderImpl builder) {
this.ebsEnabled = builder.ebsEnabled;
this.volumeType = builder.volumeType;
this.volumeSize = builder.volumeSize;
this.iops = builder.iops;
this.throughput = builder.throughput;
}
/**
*
* Indicates whether EBS volumes are attached to data nodes in an OpenSearch Service domain.
*
*
* @return Indicates whether EBS volumes are attached to data nodes in an OpenSearch Service domain.
*/
public final Boolean ebsEnabled() {
return ebsEnabled;
}
/**
*
* Specifies the type of EBS volumes attached to data nodes.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #volumeType} will
* return {@link VolumeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #volumeTypeAsString}.
*
*
* @return Specifies the type of EBS volumes attached to data nodes.
* @see VolumeType
*/
public final VolumeType volumeType() {
return VolumeType.fromValue(volumeType);
}
/**
*
* Specifies the type of EBS volumes attached to data nodes.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #volumeType} will
* return {@link VolumeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #volumeTypeAsString}.
*
*
* @return Specifies the type of EBS volumes attached to data nodes.
* @see VolumeType
*/
public final String volumeTypeAsString() {
return volumeType;
}
/**
*
* Specifies the size (in GiB) of EBS volumes attached to data nodes.
*
*
* @return Specifies the size (in GiB) of EBS volumes attached to data nodes.
*/
public final Integer volumeSize() {
return volumeSize;
}
/**
*
* Specifies the baseline input/output (I/O) performance of EBS volumes attached to data nodes. Applicable only for
* the gp3
and provisioned IOPS EBS volume types.
*
*
* @return Specifies the baseline input/output (I/O) performance of EBS volumes attached to data nodes. Applicable
* only for the gp3
and provisioned IOPS EBS volume types.
*/
public final Integer iops() {
return iops;
}
/**
*
* Specifies the throughput (in MiB/s) of the EBS volumes attached to data nodes. Applicable only for the
* gp3
volume type.
*
*
* @return Specifies the throughput (in MiB/s) of the EBS volumes attached to data nodes. Applicable only for the
* gp3
volume type.
*/
public final Integer throughput() {
return throughput;
}
@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(ebsEnabled());
hashCode = 31 * hashCode + Objects.hashCode(volumeTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(volumeSize());
hashCode = 31 * hashCode + Objects.hashCode(iops());
hashCode = 31 * hashCode + Objects.hashCode(throughput());
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 EBSOptions)) {
return false;
}
EBSOptions other = (EBSOptions) obj;
return Objects.equals(ebsEnabled(), other.ebsEnabled())
&& Objects.equals(volumeTypeAsString(), other.volumeTypeAsString())
&& Objects.equals(volumeSize(), other.volumeSize()) && Objects.equals(iops(), other.iops())
&& Objects.equals(throughput(), other.throughput());
}
/**
* 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("EBSOptions").add("EBSEnabled", ebsEnabled()).add("VolumeType", volumeTypeAsString())
.add("VolumeSize", volumeSize()).add("Iops", iops()).add("Throughput", throughput()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "EBSEnabled":
return Optional.ofNullable(clazz.cast(ebsEnabled()));
case "VolumeType":
return Optional.ofNullable(clazz.cast(volumeTypeAsString()));
case "VolumeSize":
return Optional.ofNullable(clazz.cast(volumeSize()));
case "Iops":
return Optional.ofNullable(clazz.cast(iops()));
case "Throughput":
return Optional.ofNullable(clazz.cast(throughput()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("EBSEnabled", EBS_ENABLED_FIELD);
map.put("VolumeType", VOLUME_TYPE_FIELD);
map.put("VolumeSize", VOLUME_SIZE_FIELD);
map.put("Iops", IOPS_FIELD);
map.put("Throughput", THROUGHPUT_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function