
software.amazon.awssdk.services.elasticsearch.model.ElasticsearchClusterConfig 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.elasticsearch.model;
import java.io.Serializable;
import java.util.Arrays;
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 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;
/**
*
* Specifies the configuration for the domain cluster, such as the type and number of instances.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ElasticsearchClusterConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ElasticsearchClusterConfig::instanceTypeAsString)).setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build();
private static final SdkField INSTANCE_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(ElasticsearchClusterConfig::instanceCount)).setter(setter(Builder::instanceCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceCount").build()).build();
private static final SdkField DEDICATED_MASTER_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(ElasticsearchClusterConfig::dedicatedMasterEnabled)).setter(setter(Builder::dedicatedMasterEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DedicatedMasterEnabled").build())
.build();
private static final SdkField ZONE_AWARENESS_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(ElasticsearchClusterConfig::zoneAwarenessEnabled)).setter(setter(Builder::zoneAwarenessEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ZoneAwarenessEnabled").build())
.build();
private static final SdkField ZONE_AWARENESS_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(ElasticsearchClusterConfig::zoneAwarenessConfig)).setter(setter(Builder::zoneAwarenessConfig))
.constructor(ZoneAwarenessConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ZoneAwarenessConfig").build())
.build();
private static final SdkField DEDICATED_MASTER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ElasticsearchClusterConfig::dedicatedMasterTypeAsString)).setter(setter(Builder::dedicatedMasterType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DedicatedMasterType").build())
.build();
private static final SdkField DEDICATED_MASTER_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(ElasticsearchClusterConfig::dedicatedMasterCount)).setter(setter(Builder::dedicatedMasterCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DedicatedMasterCount").build())
.build();
private static final SdkField WARM_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(ElasticsearchClusterConfig::warmEnabled)).setter(setter(Builder::warmEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WarmEnabled").build()).build();
private static final SdkField WARM_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ElasticsearchClusterConfig::warmTypeAsString)).setter(setter(Builder::warmType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WarmType").build()).build();
private static final SdkField WARM_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(ElasticsearchClusterConfig::warmCount)).setter(setter(Builder::warmCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WarmCount").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INSTANCE_TYPE_FIELD,
INSTANCE_COUNT_FIELD, DEDICATED_MASTER_ENABLED_FIELD, ZONE_AWARENESS_ENABLED_FIELD, ZONE_AWARENESS_CONFIG_FIELD,
DEDICATED_MASTER_TYPE_FIELD, DEDICATED_MASTER_COUNT_FIELD, WARM_ENABLED_FIELD, WARM_TYPE_FIELD, WARM_COUNT_FIELD));
private static final long serialVersionUID = 1L;
private final String instanceType;
private final Integer instanceCount;
private final Boolean dedicatedMasterEnabled;
private final Boolean zoneAwarenessEnabled;
private final ZoneAwarenessConfig zoneAwarenessConfig;
private final String dedicatedMasterType;
private final Integer dedicatedMasterCount;
private final Boolean warmEnabled;
private final String warmType;
private final Integer warmCount;
private ElasticsearchClusterConfig(BuilderImpl builder) {
this.instanceType = builder.instanceType;
this.instanceCount = builder.instanceCount;
this.dedicatedMasterEnabled = builder.dedicatedMasterEnabled;
this.zoneAwarenessEnabled = builder.zoneAwarenessEnabled;
this.zoneAwarenessConfig = builder.zoneAwarenessConfig;
this.dedicatedMasterType = builder.dedicatedMasterType;
this.dedicatedMasterCount = builder.dedicatedMasterCount;
this.warmEnabled = builder.warmEnabled;
this.warmType = builder.warmType;
this.warmCount = builder.warmCount;
}
/**
*
* The instance type for an Elasticsearch cluster. UltraWarm instance types are not supported for data instances.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link ESPartitionInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #instanceTypeAsString}.
*
*
* @return The instance type for an Elasticsearch cluster. UltraWarm instance types are not supported for data
* instances.
* @see ESPartitionInstanceType
*/
public ESPartitionInstanceType instanceType() {
return ESPartitionInstanceType.fromValue(instanceType);
}
/**
*
* The instance type for an Elasticsearch cluster. UltraWarm instance types are not supported for data instances.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link ESPartitionInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #instanceTypeAsString}.
*
*
* @return The instance type for an Elasticsearch cluster. UltraWarm instance types are not supported for data
* instances.
* @see ESPartitionInstanceType
*/
public String instanceTypeAsString() {
return instanceType;
}
/**
*
* The number of instances in the specified domain cluster.
*
*
* @return The number of instances in the specified domain cluster.
*/
public Integer instanceCount() {
return instanceCount;
}
/**
*
* A boolean value to indicate whether a dedicated master node is enabled. See About Dedicated Master Nodes for more information.
*
*
* @return A boolean value to indicate whether a dedicated master node is enabled. See About Dedicated Master Nodes for more information.
*/
public Boolean dedicatedMasterEnabled() {
return dedicatedMasterEnabled;
}
/**
*
* A boolean value to indicate whether zone awareness is enabled. See About Zone Awareness for more information.
*
*
* @return A boolean value to indicate whether zone awareness is enabled. See About Zone Awareness for more information.
*/
public Boolean zoneAwarenessEnabled() {
return zoneAwarenessEnabled;
}
/**
*
* Specifies the zone awareness configuration for a domain when zone awareness is enabled.
*
*
* @return Specifies the zone awareness configuration for a domain when zone awareness is enabled.
*/
public ZoneAwarenessConfig zoneAwarenessConfig() {
return zoneAwarenessConfig;
}
/**
*
* The instance type for a dedicated master node.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dedicatedMasterType} will return {@link ESPartitionInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dedicatedMasterTypeAsString}.
*
*
* @return The instance type for a dedicated master node.
* @see ESPartitionInstanceType
*/
public ESPartitionInstanceType dedicatedMasterType() {
return ESPartitionInstanceType.fromValue(dedicatedMasterType);
}
/**
*
* The instance type for a dedicated master node.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dedicatedMasterType} will return {@link ESPartitionInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dedicatedMasterTypeAsString}.
*
*
* @return The instance type for a dedicated master node.
* @see ESPartitionInstanceType
*/
public String dedicatedMasterTypeAsString() {
return dedicatedMasterType;
}
/**
*
* Total number of dedicated master nodes, active and on standby, for the cluster.
*
*
* @return Total number of dedicated master nodes, active and on standby, for the cluster.
*/
public Integer dedicatedMasterCount() {
return dedicatedMasterCount;
}
/**
*
* True to enable warm storage.
*
*
* @return True to enable warm storage.
*/
public Boolean warmEnabled() {
return warmEnabled;
}
/**
*
* The instance type for the Elasticsearch cluster's warm nodes.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #warmType} will
* return {@link ESWarmPartitionInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #warmTypeAsString}.
*
*
* @return The instance type for the Elasticsearch cluster's warm nodes.
* @see ESWarmPartitionInstanceType
*/
public ESWarmPartitionInstanceType warmType() {
return ESWarmPartitionInstanceType.fromValue(warmType);
}
/**
*
* The instance type for the Elasticsearch cluster's warm nodes.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #warmType} will
* return {@link ESWarmPartitionInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #warmTypeAsString}.
*
*
* @return The instance type for the Elasticsearch cluster's warm nodes.
* @see ESWarmPartitionInstanceType
*/
public String warmTypeAsString() {
return warmType;
}
/**
*
* The number of warm nodes in the cluster.
*
*
* @return The number of warm nodes in the cluster.
*/
public Integer warmCount() {
return warmCount;
}
@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(instanceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(instanceCount());
hashCode = 31 * hashCode + Objects.hashCode(dedicatedMasterEnabled());
hashCode = 31 * hashCode + Objects.hashCode(zoneAwarenessEnabled());
hashCode = 31 * hashCode + Objects.hashCode(zoneAwarenessConfig());
hashCode = 31 * hashCode + Objects.hashCode(dedicatedMasterTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(dedicatedMasterCount());
hashCode = 31 * hashCode + Objects.hashCode(warmEnabled());
hashCode = 31 * hashCode + Objects.hashCode(warmTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(warmCount());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ElasticsearchClusterConfig)) {
return false;
}
ElasticsearchClusterConfig other = (ElasticsearchClusterConfig) obj;
return Objects.equals(instanceTypeAsString(), other.instanceTypeAsString())
&& Objects.equals(instanceCount(), other.instanceCount())
&& Objects.equals(dedicatedMasterEnabled(), other.dedicatedMasterEnabled())
&& Objects.equals(zoneAwarenessEnabled(), other.zoneAwarenessEnabled())
&& Objects.equals(zoneAwarenessConfig(), other.zoneAwarenessConfig())
&& Objects.equals(dedicatedMasterTypeAsString(), other.dedicatedMasterTypeAsString())
&& Objects.equals(dedicatedMasterCount(), other.dedicatedMasterCount())
&& Objects.equals(warmEnabled(), other.warmEnabled())
&& Objects.equals(warmTypeAsString(), other.warmTypeAsString()) && Objects.equals(warmCount(), other.warmCount());
}
/**
* 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 String toString() {
return ToString.builder("ElasticsearchClusterConfig").add("InstanceType", instanceTypeAsString())
.add("InstanceCount", instanceCount()).add("DedicatedMasterEnabled", dedicatedMasterEnabled())
.add("ZoneAwarenessEnabled", zoneAwarenessEnabled()).add("ZoneAwarenessConfig", zoneAwarenessConfig())
.add("DedicatedMasterType", dedicatedMasterTypeAsString()).add("DedicatedMasterCount", dedicatedMasterCount())
.add("WarmEnabled", warmEnabled()).add("WarmType", warmTypeAsString()).add("WarmCount", warmCount()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceTypeAsString()));
case "InstanceCount":
return Optional.ofNullable(clazz.cast(instanceCount()));
case "DedicatedMasterEnabled":
return Optional.ofNullable(clazz.cast(dedicatedMasterEnabled()));
case "ZoneAwarenessEnabled":
return Optional.ofNullable(clazz.cast(zoneAwarenessEnabled()));
case "ZoneAwarenessConfig":
return Optional.ofNullable(clazz.cast(zoneAwarenessConfig()));
case "DedicatedMasterType":
return Optional.ofNullable(clazz.cast(dedicatedMasterTypeAsString()));
case "DedicatedMasterCount":
return Optional.ofNullable(clazz.cast(dedicatedMasterCount()));
case "WarmEnabled":
return Optional.ofNullable(clazz.cast(warmEnabled()));
case "WarmType":
return Optional.ofNullable(clazz.cast(warmTypeAsString()));
case "WarmCount":
return Optional.ofNullable(clazz.cast(warmCount()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function