software.amazon.awssdk.services.opensearch.model.DomainNodesStatus 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 information about nodes on the domain.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DomainNodesStatus implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NODE_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("NodeId")
.getter(getter(DomainNodesStatus::nodeId)).setter(setter(Builder::nodeId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeId").build()).build();
private static final SdkField NODE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NodeType").getter(getter(DomainNodesStatus::nodeTypeAsString)).setter(setter(Builder::nodeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeType").build()).build();
private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AvailabilityZone").getter(getter(DomainNodesStatus::availabilityZone))
.setter(setter(Builder::availabilityZone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZone").build()).build();
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceType").getter(getter(DomainNodesStatus::instanceTypeAsString))
.setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build();
private static final SdkField NODE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NodeStatus").getter(getter(DomainNodesStatus::nodeStatusAsString)).setter(setter(Builder::nodeStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeStatus").build()).build();
private static final SdkField STORAGE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StorageType").getter(getter(DomainNodesStatus::storageType)).setter(setter(Builder::storageType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageType").build()).build();
private static final SdkField STORAGE_VOLUME_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StorageVolumeType").getter(getter(DomainNodesStatus::storageVolumeTypeAsString))
.setter(setter(Builder::storageVolumeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageVolumeType").build()).build();
private static final SdkField STORAGE_SIZE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StorageSize").getter(getter(DomainNodesStatus::storageSize)).setter(setter(Builder::storageSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageSize").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NODE_ID_FIELD,
NODE_TYPE_FIELD, AVAILABILITY_ZONE_FIELD, INSTANCE_TYPE_FIELD, NODE_STATUS_FIELD, STORAGE_TYPE_FIELD,
STORAGE_VOLUME_TYPE_FIELD, STORAGE_SIZE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String nodeId;
private final String nodeType;
private final String availabilityZone;
private final String instanceType;
private final String nodeStatus;
private final String storageType;
private final String storageVolumeType;
private final String storageSize;
private DomainNodesStatus(BuilderImpl builder) {
this.nodeId = builder.nodeId;
this.nodeType = builder.nodeType;
this.availabilityZone = builder.availabilityZone;
this.instanceType = builder.instanceType;
this.nodeStatus = builder.nodeStatus;
this.storageType = builder.storageType;
this.storageVolumeType = builder.storageVolumeType;
this.storageSize = builder.storageSize;
}
/**
*
* The ID of the node.
*
*
* @return The ID of the node.
*/
public final String nodeId() {
return nodeId;
}
/**
*
* Indicates whether the nodes is a data, master, or ultrawarm node.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #nodeType} will
* return {@link NodeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nodeTypeAsString}.
*
*
* @return Indicates whether the nodes is a data, master, or ultrawarm node.
* @see NodeType
*/
public final NodeType nodeType() {
return NodeType.fromValue(nodeType);
}
/**
*
* Indicates whether the nodes is a data, master, or ultrawarm node.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #nodeType} will
* return {@link NodeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nodeTypeAsString}.
*
*
* @return Indicates whether the nodes is a data, master, or ultrawarm node.
* @see NodeType
*/
public final String nodeTypeAsString() {
return nodeType;
}
/**
*
* The Availability Zone of the node.
*
*
* @return The Availability Zone of the node.
*/
public final String availabilityZone() {
return availabilityZone;
}
/**
*
* The instance type information of the node.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link OpenSearchPartitionInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #instanceTypeAsString}.
*
*
* @return The instance type information of the node.
* @see OpenSearchPartitionInstanceType
*/
public final OpenSearchPartitionInstanceType instanceType() {
return OpenSearchPartitionInstanceType.fromValue(instanceType);
}
/**
*
* The instance type information of the node.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link OpenSearchPartitionInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #instanceTypeAsString}.
*
*
* @return The instance type information of the node.
* @see OpenSearchPartitionInstanceType
*/
public final String instanceTypeAsString() {
return instanceType;
}
/**
*
* Indicates if the node is active or in standby.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #nodeStatus} will
* return {@link NodeStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nodeStatusAsString}.
*
*
* @return Indicates if the node is active or in standby.
* @see NodeStatus
*/
public final NodeStatus nodeStatus() {
return NodeStatus.fromValue(nodeStatus);
}
/**
*
* Indicates if the node is active or in standby.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #nodeStatus} will
* return {@link NodeStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nodeStatusAsString}.
*
*
* @return Indicates if the node is active or in standby.
* @see NodeStatus
*/
public final String nodeStatusAsString() {
return nodeStatus;
}
/**
*
* Indicates if the node has EBS or instance storage.
*
*
* @return Indicates if the node has EBS or instance storage.
*/
public final String storageType() {
return storageType;
}
/**
*
* If the nodes has EBS storage, indicates if the volume type is GP2 or GP3. Only applicable for data nodes.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #storageVolumeType}
* will return {@link VolumeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #storageVolumeTypeAsString}.
*
*
* @return If the nodes has EBS storage, indicates if the volume type is GP2 or GP3. Only applicable for data nodes.
* @see VolumeType
*/
public final VolumeType storageVolumeType() {
return VolumeType.fromValue(storageVolumeType);
}
/**
*
* If the nodes has EBS storage, indicates if the volume type is GP2 or GP3. Only applicable for data nodes.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #storageVolumeType}
* will return {@link VolumeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #storageVolumeTypeAsString}.
*
*
* @return If the nodes has EBS storage, indicates if the volume type is GP2 or GP3. Only applicable for data nodes.
* @see VolumeType
*/
public final String storageVolumeTypeAsString() {
return storageVolumeType;
}
/**
*
* The storage size of the node, in GiB.
*
*
* @return The storage size of the node, in GiB.
*/
public final String storageSize() {
return storageSize;
}
@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(nodeId());
hashCode = 31 * hashCode + Objects.hashCode(nodeTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(availabilityZone());
hashCode = 31 * hashCode + Objects.hashCode(instanceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(nodeStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(storageType());
hashCode = 31 * hashCode + Objects.hashCode(storageVolumeTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(storageSize());
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 DomainNodesStatus)) {
return false;
}
DomainNodesStatus other = (DomainNodesStatus) obj;
return Objects.equals(nodeId(), other.nodeId()) && Objects.equals(nodeTypeAsString(), other.nodeTypeAsString())
&& Objects.equals(availabilityZone(), other.availabilityZone())
&& Objects.equals(instanceTypeAsString(), other.instanceTypeAsString())
&& Objects.equals(nodeStatusAsString(), other.nodeStatusAsString())
&& Objects.equals(storageType(), other.storageType())
&& Objects.equals(storageVolumeTypeAsString(), other.storageVolumeTypeAsString())
&& Objects.equals(storageSize(), other.storageSize());
}
/**
* 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("DomainNodesStatus").add("NodeId", nodeId()).add("NodeType", nodeTypeAsString())
.add("AvailabilityZone", availabilityZone()).add("InstanceType", instanceTypeAsString())
.add("NodeStatus", nodeStatusAsString()).add("StorageType", storageType())
.add("StorageVolumeType", storageVolumeTypeAsString()).add("StorageSize", storageSize()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "NodeId":
return Optional.ofNullable(clazz.cast(nodeId()));
case "NodeType":
return Optional.ofNullable(clazz.cast(nodeTypeAsString()));
case "AvailabilityZone":
return Optional.ofNullable(clazz.cast(availabilityZone()));
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceTypeAsString()));
case "NodeStatus":
return Optional.ofNullable(clazz.cast(nodeStatusAsString()));
case "StorageType":
return Optional.ofNullable(clazz.cast(storageType()));
case "StorageVolumeType":
return Optional.ofNullable(clazz.cast(storageVolumeTypeAsString()));
case "StorageSize":
return Optional.ofNullable(clazz.cast(storageSize()));
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("NodeId", NODE_ID_FIELD);
map.put("NodeType", NODE_TYPE_FIELD);
map.put("AvailabilityZone", AVAILABILITY_ZONE_FIELD);
map.put("InstanceType", INSTANCE_TYPE_FIELD);
map.put("NodeStatus", NODE_STATUS_FIELD);
map.put("StorageType", STORAGE_TYPE_FIELD);
map.put("StorageVolumeType", STORAGE_VOLUME_TYPE_FIELD);
map.put("StorageSize", STORAGE_SIZE_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function