com.amazonaws.services.elasticache.model.NodeGroup Maven / Gradle / Ivy
Show all versions of aws-java-sdk-elasticache Show documentation
/*
* Copyright 2019-2024 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.elasticache.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* Represents a collection of cache nodes in a replication group. One node in the node group is the read/write primary
* node. All the other nodes are read-only Replica nodes.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class NodeGroup implements Serializable, Cloneable {
/**
*
* The identifier for the node group (shard). A Redis OSS (cluster mode disabled) replication group contains only 1
* node group; therefore, the node group ID is 0001. A Redis OSS (cluster mode enabled) replication group contains 1
* to 90 node groups numbered 0001 to 0090. Optionally, the user can provide the id for a node group.
*
*/
private String nodeGroupId;
/**
*
* The current state of this replication group - creating
, available
,
* modifying
, deleting
.
*
*/
private String status;
/**
*
* The endpoint of the primary node in this node group (shard).
*
*/
private Endpoint primaryEndpoint;
/**
*
* The endpoint of the replica nodes in this node group (shard). This value is read-only.
*
*/
private Endpoint readerEndpoint;
/**
*
* The keyspace for this node group (shard).
*
*/
private String slots;
/**
*
* A list containing information about individual nodes within the node group (shard).
*
*/
private com.amazonaws.internal.SdkInternalList nodeGroupMembers;
/**
*
* The identifier for the node group (shard). A Redis OSS (cluster mode disabled) replication group contains only 1
* node group; therefore, the node group ID is 0001. A Redis OSS (cluster mode enabled) replication group contains 1
* to 90 node groups numbered 0001 to 0090. Optionally, the user can provide the id for a node group.
*
*
* @param nodeGroupId
* The identifier for the node group (shard). A Redis OSS (cluster mode disabled) replication group contains
* only 1 node group; therefore, the node group ID is 0001. A Redis OSS (cluster mode enabled) replication
* group contains 1 to 90 node groups numbered 0001 to 0090. Optionally, the user can provide the id for a
* node group.
*/
public void setNodeGroupId(String nodeGroupId) {
this.nodeGroupId = nodeGroupId;
}
/**
*
* The identifier for the node group (shard). A Redis OSS (cluster mode disabled) replication group contains only 1
* node group; therefore, the node group ID is 0001. A Redis OSS (cluster mode enabled) replication group contains 1
* to 90 node groups numbered 0001 to 0090. Optionally, the user can provide the id for a node group.
*
*
* @return The identifier for the node group (shard). A Redis OSS (cluster mode disabled) replication group contains
* only 1 node group; therefore, the node group ID is 0001. A Redis OSS (cluster mode enabled) replication
* group contains 1 to 90 node groups numbered 0001 to 0090. Optionally, the user can provide the id for a
* node group.
*/
public String getNodeGroupId() {
return this.nodeGroupId;
}
/**
*
* The identifier for the node group (shard). A Redis OSS (cluster mode disabled) replication group contains only 1
* node group; therefore, the node group ID is 0001. A Redis OSS (cluster mode enabled) replication group contains 1
* to 90 node groups numbered 0001 to 0090. Optionally, the user can provide the id for a node group.
*
*
* @param nodeGroupId
* The identifier for the node group (shard). A Redis OSS (cluster mode disabled) replication group contains
* only 1 node group; therefore, the node group ID is 0001. A Redis OSS (cluster mode enabled) replication
* group contains 1 to 90 node groups numbered 0001 to 0090. Optionally, the user can provide the id for a
* node group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NodeGroup withNodeGroupId(String nodeGroupId) {
setNodeGroupId(nodeGroupId);
return this;
}
/**
*
* The current state of this replication group - creating
, available
,
* modifying
, deleting
.
*
*
* @param status
* The current state of this replication group - creating
, available
,
* modifying
, deleting
.
*/
public void setStatus(String status) {
this.status = status;
}
/**
*
* The current state of this replication group - creating
, available
,
* modifying
, deleting
.
*
*
* @return The current state of this replication group - creating
, available
,
* modifying
, deleting
.
*/
public String getStatus() {
return this.status;
}
/**
*
* The current state of this replication group - creating
, available
,
* modifying
, deleting
.
*
*
* @param status
* The current state of this replication group - creating
, available
,
* modifying
, deleting
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NodeGroup withStatus(String status) {
setStatus(status);
return this;
}
/**
*
* The endpoint of the primary node in this node group (shard).
*
*
* @param primaryEndpoint
* The endpoint of the primary node in this node group (shard).
*/
public void setPrimaryEndpoint(Endpoint primaryEndpoint) {
this.primaryEndpoint = primaryEndpoint;
}
/**
*
* The endpoint of the primary node in this node group (shard).
*
*
* @return The endpoint of the primary node in this node group (shard).
*/
public Endpoint getPrimaryEndpoint() {
return this.primaryEndpoint;
}
/**
*
* The endpoint of the primary node in this node group (shard).
*
*
* @param primaryEndpoint
* The endpoint of the primary node in this node group (shard).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NodeGroup withPrimaryEndpoint(Endpoint primaryEndpoint) {
setPrimaryEndpoint(primaryEndpoint);
return this;
}
/**
*
* The endpoint of the replica nodes in this node group (shard). This value is read-only.
*
*
* @param readerEndpoint
* The endpoint of the replica nodes in this node group (shard). This value is read-only.
*/
public void setReaderEndpoint(Endpoint readerEndpoint) {
this.readerEndpoint = readerEndpoint;
}
/**
*
* The endpoint of the replica nodes in this node group (shard). This value is read-only.
*
*
* @return The endpoint of the replica nodes in this node group (shard). This value is read-only.
*/
public Endpoint getReaderEndpoint() {
return this.readerEndpoint;
}
/**
*
* The endpoint of the replica nodes in this node group (shard). This value is read-only.
*
*
* @param readerEndpoint
* The endpoint of the replica nodes in this node group (shard). This value is read-only.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NodeGroup withReaderEndpoint(Endpoint readerEndpoint) {
setReaderEndpoint(readerEndpoint);
return this;
}
/**
*
* The keyspace for this node group (shard).
*
*
* @param slots
* The keyspace for this node group (shard).
*/
public void setSlots(String slots) {
this.slots = slots;
}
/**
*
* The keyspace for this node group (shard).
*
*
* @return The keyspace for this node group (shard).
*/
public String getSlots() {
return this.slots;
}
/**
*
* The keyspace for this node group (shard).
*
*
* @param slots
* The keyspace for this node group (shard).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NodeGroup withSlots(String slots) {
setSlots(slots);
return this;
}
/**
*
* A list containing information about individual nodes within the node group (shard).
*
*
* @return A list containing information about individual nodes within the node group (shard).
*/
public java.util.List getNodeGroupMembers() {
if (nodeGroupMembers == null) {
nodeGroupMembers = new com.amazonaws.internal.SdkInternalList();
}
return nodeGroupMembers;
}
/**
*
* A list containing information about individual nodes within the node group (shard).
*
*
* @param nodeGroupMembers
* A list containing information about individual nodes within the node group (shard).
*/
public void setNodeGroupMembers(java.util.Collection nodeGroupMembers) {
if (nodeGroupMembers == null) {
this.nodeGroupMembers = null;
return;
}
this.nodeGroupMembers = new com.amazonaws.internal.SdkInternalList(nodeGroupMembers);
}
/**
*
* A list containing information about individual nodes within the node group (shard).
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setNodeGroupMembers(java.util.Collection)} or {@link #withNodeGroupMembers(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param nodeGroupMembers
* A list containing information about individual nodes within the node group (shard).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NodeGroup withNodeGroupMembers(NodeGroupMember... nodeGroupMembers) {
if (this.nodeGroupMembers == null) {
setNodeGroupMembers(new com.amazonaws.internal.SdkInternalList(nodeGroupMembers.length));
}
for (NodeGroupMember ele : nodeGroupMembers) {
this.nodeGroupMembers.add(ele);
}
return this;
}
/**
*
* A list containing information about individual nodes within the node group (shard).
*
*
* @param nodeGroupMembers
* A list containing information about individual nodes within the node group (shard).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NodeGroup withNodeGroupMembers(java.util.Collection nodeGroupMembers) {
setNodeGroupMembers(nodeGroupMembers);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getNodeGroupId() != null)
sb.append("NodeGroupId: ").append(getNodeGroupId()).append(",");
if (getStatus() != null)
sb.append("Status: ").append(getStatus()).append(",");
if (getPrimaryEndpoint() != null)
sb.append("PrimaryEndpoint: ").append(getPrimaryEndpoint()).append(",");
if (getReaderEndpoint() != null)
sb.append("ReaderEndpoint: ").append(getReaderEndpoint()).append(",");
if (getSlots() != null)
sb.append("Slots: ").append(getSlots()).append(",");
if (getNodeGroupMembers() != null)
sb.append("NodeGroupMembers: ").append(getNodeGroupMembers());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof NodeGroup == false)
return false;
NodeGroup other = (NodeGroup) obj;
if (other.getNodeGroupId() == null ^ this.getNodeGroupId() == null)
return false;
if (other.getNodeGroupId() != null && other.getNodeGroupId().equals(this.getNodeGroupId()) == false)
return false;
if (other.getStatus() == null ^ this.getStatus() == null)
return false;
if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
return false;
if (other.getPrimaryEndpoint() == null ^ this.getPrimaryEndpoint() == null)
return false;
if (other.getPrimaryEndpoint() != null && other.getPrimaryEndpoint().equals(this.getPrimaryEndpoint()) == false)
return false;
if (other.getReaderEndpoint() == null ^ this.getReaderEndpoint() == null)
return false;
if (other.getReaderEndpoint() != null && other.getReaderEndpoint().equals(this.getReaderEndpoint()) == false)
return false;
if (other.getSlots() == null ^ this.getSlots() == null)
return false;
if (other.getSlots() != null && other.getSlots().equals(this.getSlots()) == false)
return false;
if (other.getNodeGroupMembers() == null ^ this.getNodeGroupMembers() == null)
return false;
if (other.getNodeGroupMembers() != null && other.getNodeGroupMembers().equals(this.getNodeGroupMembers()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getNodeGroupId() == null) ? 0 : getNodeGroupId().hashCode());
hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
hashCode = prime * hashCode + ((getPrimaryEndpoint() == null) ? 0 : getPrimaryEndpoint().hashCode());
hashCode = prime * hashCode + ((getReaderEndpoint() == null) ? 0 : getReaderEndpoint().hashCode());
hashCode = prime * hashCode + ((getSlots() == null) ? 0 : getSlots().hashCode());
hashCode = prime * hashCode + ((getNodeGroupMembers() == null) ? 0 : getNodeGroupMembers().hashCode());
return hashCode;
}
@Override
public NodeGroup clone() {
try {
return (NodeGroup) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}