software.amazon.awssdk.services.dax.model.Node Maven / Gradle / Ivy
Show all versions of dax 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.dax.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* Represents an individual node within a DAX cluster.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Node implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField NODE_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("NodeId")
.getter(getter(Node::nodeId)).setter(setter(Builder::nodeId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeId").build()).build();
private static final SdkField ENDPOINT_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Endpoint").getter(getter(Node::endpoint)).setter(setter(Builder::endpoint))
.constructor(Endpoint::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Endpoint").build()).build();
private static final SdkField NODE_CREATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("NodeCreateTime").getter(getter(Node::nodeCreateTime)).setter(setter(Builder::nodeCreateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeCreateTime").build()).build();
private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AvailabilityZone").getter(getter(Node::availabilityZone)).setter(setter(Builder::availabilityZone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZone").build()).build();
private static final SdkField NODE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NodeStatus").getter(getter(Node::nodeStatus)).setter(setter(Builder::nodeStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeStatus").build()).build();
private static final SdkField PARAMETER_GROUP_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ParameterGroupStatus").getter(getter(Node::parameterGroupStatus))
.setter(setter(Builder::parameterGroupStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParameterGroupStatus").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NODE_ID_FIELD, ENDPOINT_FIELD,
NODE_CREATE_TIME_FIELD, AVAILABILITY_ZONE_FIELD, NODE_STATUS_FIELD, PARAMETER_GROUP_STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final String nodeId;
private final Endpoint endpoint;
private final Instant nodeCreateTime;
private final String availabilityZone;
private final String nodeStatus;
private final String parameterGroupStatus;
private Node(BuilderImpl builder) {
this.nodeId = builder.nodeId;
this.endpoint = builder.endpoint;
this.nodeCreateTime = builder.nodeCreateTime;
this.availabilityZone = builder.availabilityZone;
this.nodeStatus = builder.nodeStatus;
this.parameterGroupStatus = builder.parameterGroupStatus;
}
/**
*
* A system-generated identifier for the node.
*
*
* @return A system-generated identifier for the node.
*/
public final String nodeId() {
return nodeId;
}
/**
*
* The endpoint for the node, consisting of a DNS name and a port number. Client applications can connect directly
* to a node endpoint, if desired (as an alternative to allowing DAX client software to intelligently route requests
* and responses to nodes in the DAX cluster.
*
*
* @return The endpoint for the node, consisting of a DNS name and a port number. Client applications can connect
* directly to a node endpoint, if desired (as an alternative to allowing DAX client software to
* intelligently route requests and responses to nodes in the DAX cluster.
*/
public final Endpoint endpoint() {
return endpoint;
}
/**
*
* The date and time (in UNIX epoch format) when the node was launched.
*
*
* @return The date and time (in UNIX epoch format) when the node was launched.
*/
public final Instant nodeCreateTime() {
return nodeCreateTime;
}
/**
*
* The Availability Zone (AZ) in which the node has been deployed.
*
*
* @return The Availability Zone (AZ) in which the node has been deployed.
*/
public final String availabilityZone() {
return availabilityZone;
}
/**
*
* The current status of the node. For example: available
.
*
*
* @return The current status of the node. For example: available
.
*/
public final String nodeStatus() {
return nodeStatus;
}
/**
*
* The status of the parameter group associated with this node. For example, in-sync
.
*
*
* @return The status of the parameter group associated with this node. For example, in-sync
.
*/
public final String parameterGroupStatus() {
return parameterGroupStatus;
}
@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(endpoint());
hashCode = 31 * hashCode + Objects.hashCode(nodeCreateTime());
hashCode = 31 * hashCode + Objects.hashCode(availabilityZone());
hashCode = 31 * hashCode + Objects.hashCode(nodeStatus());
hashCode = 31 * hashCode + Objects.hashCode(parameterGroupStatus());
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 Node)) {
return false;
}
Node other = (Node) obj;
return Objects.equals(nodeId(), other.nodeId()) && Objects.equals(endpoint(), other.endpoint())
&& Objects.equals(nodeCreateTime(), other.nodeCreateTime())
&& Objects.equals(availabilityZone(), other.availabilityZone())
&& Objects.equals(nodeStatus(), other.nodeStatus())
&& Objects.equals(parameterGroupStatus(), other.parameterGroupStatus());
}
/**
* 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("Node").add("NodeId", nodeId()).add("Endpoint", endpoint())
.add("NodeCreateTime", nodeCreateTime()).add("AvailabilityZone", availabilityZone())
.add("NodeStatus", nodeStatus()).add("ParameterGroupStatus", parameterGroupStatus()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "NodeId":
return Optional.ofNullable(clazz.cast(nodeId()));
case "Endpoint":
return Optional.ofNullable(clazz.cast(endpoint()));
case "NodeCreateTime":
return Optional.ofNullable(clazz.cast(nodeCreateTime()));
case "AvailabilityZone":
return Optional.ofNullable(clazz.cast(availabilityZone()));
case "NodeStatus":
return Optional.ofNullable(clazz.cast(nodeStatus()));
case "ParameterGroupStatus":
return Optional.ofNullable(clazz.cast(parameterGroupStatus()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function