com.amazonaws.services.redshift.model.ClusterNode Maven / Gradle / Ivy
Show all versions of aws-java-sdk-redshift Show documentation
/*
* Copyright 2010-2016 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 com.amazonaws.services.redshift.model;
import java.io.Serializable;
/**
*
* The identifier of a node in a cluster.
*
*/
public class ClusterNode implements Serializable, Cloneable {
/**
*
* Whether the node is a leader node or a compute node.
*
*/
private String nodeRole;
/**
*
* The private IP address of a node within a cluster.
*
*/
private String privateIPAddress;
/**
*
* The public IP address of a node within a cluster.
*
*/
private String publicIPAddress;
/**
*
* Whether the node is a leader node or a compute node.
*
*
* @param nodeRole
* Whether the node is a leader node or a compute node.
*/
public void setNodeRole(String nodeRole) {
this.nodeRole = nodeRole;
}
/**
*
* Whether the node is a leader node or a compute node.
*
*
* @return Whether the node is a leader node or a compute node.
*/
public String getNodeRole() {
return this.nodeRole;
}
/**
*
* Whether the node is a leader node or a compute node.
*
*
* @param nodeRole
* Whether the node is a leader node or a compute node.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterNode withNodeRole(String nodeRole) {
setNodeRole(nodeRole);
return this;
}
/**
*
* The private IP address of a node within a cluster.
*
*
* @param privateIPAddress
* The private IP address of a node within a cluster.
*/
public void setPrivateIPAddress(String privateIPAddress) {
this.privateIPAddress = privateIPAddress;
}
/**
*
* The private IP address of a node within a cluster.
*
*
* @return The private IP address of a node within a cluster.
*/
public String getPrivateIPAddress() {
return this.privateIPAddress;
}
/**
*
* The private IP address of a node within a cluster.
*
*
* @param privateIPAddress
* The private IP address of a node within a cluster.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterNode withPrivateIPAddress(String privateIPAddress) {
setPrivateIPAddress(privateIPAddress);
return this;
}
/**
*
* The public IP address of a node within a cluster.
*
*
* @param publicIPAddress
* The public IP address of a node within a cluster.
*/
public void setPublicIPAddress(String publicIPAddress) {
this.publicIPAddress = publicIPAddress;
}
/**
*
* The public IP address of a node within a cluster.
*
*
* @return The public IP address of a node within a cluster.
*/
public String getPublicIPAddress() {
return this.publicIPAddress;
}
/**
*
* The public IP address of a node within a cluster.
*
*
* @param publicIPAddress
* The public IP address of a node within a cluster.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterNode withPublicIPAddress(String publicIPAddress) {
setPublicIPAddress(publicIPAddress);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getNodeRole() != null)
sb.append("NodeRole: " + getNodeRole() + ",");
if (getPrivateIPAddress() != null)
sb.append("PrivateIPAddress: " + getPrivateIPAddress() + ",");
if (getPublicIPAddress() != null)
sb.append("PublicIPAddress: " + getPublicIPAddress());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ClusterNode == false)
return false;
ClusterNode other = (ClusterNode) obj;
if (other.getNodeRole() == null ^ this.getNodeRole() == null)
return false;
if (other.getNodeRole() != null
&& other.getNodeRole().equals(this.getNodeRole()) == false)
return false;
if (other.getPrivateIPAddress() == null
^ this.getPrivateIPAddress() == null)
return false;
if (other.getPrivateIPAddress() != null
&& other.getPrivateIPAddress().equals(
this.getPrivateIPAddress()) == false)
return false;
if (other.getPublicIPAddress() == null
^ this.getPublicIPAddress() == null)
return false;
if (other.getPublicIPAddress() != null
&& other.getPublicIPAddress().equals(this.getPublicIPAddress()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getNodeRole() == null) ? 0 : getNodeRole().hashCode());
hashCode = prime
* hashCode
+ ((getPrivateIPAddress() == null) ? 0 : getPrivateIPAddress()
.hashCode());
hashCode = prime
* hashCode
+ ((getPublicIPAddress() == null) ? 0 : getPublicIPAddress()
.hashCode());
return hashCode;
}
@Override
public ClusterNode clone() {
try {
return (ClusterNode) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}