software.amazon.awssdk.services.redshift.model.NodeConfigurationOption Maven / Gradle / Ivy
Show all versions of redshift 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.redshift.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;
/**
*
* A list of node configurations.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NodeConfigurationOption implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NODE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NodeType").getter(getter(NodeConfigurationOption::nodeType)).setter(setter(Builder::nodeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeType").build()).build();
private static final SdkField NUMBER_OF_NODES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("NumberOfNodes").getter(getter(NodeConfigurationOption::numberOfNodes))
.setter(setter(Builder::numberOfNodes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NumberOfNodes").build()).build();
private static final SdkField ESTIMATED_DISK_UTILIZATION_PERCENT_FIELD = SdkField
. builder(MarshallingType.DOUBLE)
.memberName("EstimatedDiskUtilizationPercent")
.getter(getter(NodeConfigurationOption::estimatedDiskUtilizationPercent))
.setter(setter(Builder::estimatedDiskUtilizationPercent))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EstimatedDiskUtilizationPercent")
.build()).build();
private static final SdkField MODE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Mode")
.getter(getter(NodeConfigurationOption::modeAsString)).setter(setter(Builder::mode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Mode").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NODE_TYPE_FIELD,
NUMBER_OF_NODES_FIELD, ESTIMATED_DISK_UTILIZATION_PERCENT_FIELD, MODE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("NodeType", NODE_TYPE_FIELD);
put("NumberOfNodes", NUMBER_OF_NODES_FIELD);
put("EstimatedDiskUtilizationPercent", ESTIMATED_DISK_UTILIZATION_PERCENT_FIELD);
put("Mode", MODE_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String nodeType;
private final Integer numberOfNodes;
private final Double estimatedDiskUtilizationPercent;
private final String mode;
private NodeConfigurationOption(BuilderImpl builder) {
this.nodeType = builder.nodeType;
this.numberOfNodes = builder.numberOfNodes;
this.estimatedDiskUtilizationPercent = builder.estimatedDiskUtilizationPercent;
this.mode = builder.mode;
}
/**
*
* The node type, such as, "ra3.4xlarge".
*
*
* @return The node type, such as, "ra3.4xlarge".
*/
public final String nodeType() {
return nodeType;
}
/**
*
* The number of nodes.
*
*
* @return The number of nodes.
*/
public final Integer numberOfNodes() {
return numberOfNodes;
}
/**
*
* The estimated disk utilizaton percentage.
*
*
* @return The estimated disk utilizaton percentage.
*/
public final Double estimatedDiskUtilizationPercent() {
return estimatedDiskUtilizationPercent;
}
/**
*
* The category of the node configuration recommendation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #mode} will return
* {@link Mode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #modeAsString}.
*
*
* @return The category of the node configuration recommendation.
* @see Mode
*/
public final Mode mode() {
return Mode.fromValue(mode);
}
/**
*
* The category of the node configuration recommendation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #mode} will return
* {@link Mode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #modeAsString}.
*
*
* @return The category of the node configuration recommendation.
* @see Mode
*/
public final String modeAsString() {
return mode;
}
@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(nodeType());
hashCode = 31 * hashCode + Objects.hashCode(numberOfNodes());
hashCode = 31 * hashCode + Objects.hashCode(estimatedDiskUtilizationPercent());
hashCode = 31 * hashCode + Objects.hashCode(modeAsString());
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 NodeConfigurationOption)) {
return false;
}
NodeConfigurationOption other = (NodeConfigurationOption) obj;
return Objects.equals(nodeType(), other.nodeType()) && Objects.equals(numberOfNodes(), other.numberOfNodes())
&& Objects.equals(estimatedDiskUtilizationPercent(), other.estimatedDiskUtilizationPercent())
&& Objects.equals(modeAsString(), other.modeAsString());
}
/**
* 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("NodeConfigurationOption").add("NodeType", nodeType()).add("NumberOfNodes", numberOfNodes())
.add("EstimatedDiskUtilizationPercent", estimatedDiskUtilizationPercent()).add("Mode", modeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "NodeType":
return Optional.ofNullable(clazz.cast(nodeType()));
case "NumberOfNodes":
return Optional.ofNullable(clazz.cast(numberOfNodes()));
case "EstimatedDiskUtilizationPercent":
return Optional.ofNullable(clazz.cast(estimatedDiskUtilizationPercent()));
case "Mode":
return Optional.ofNullable(clazz.cast(modeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function