com.amazonaws.services.redshift.model.ClusterSecurityGroup 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;
/**
*
* Describes a security group.
*
*/
public class ClusterSecurityGroup implements Serializable, Cloneable {
/**
*
* The name of the cluster security group to which the operation was
* applied.
*
*/
private String clusterSecurityGroupName;
/**
*
* A description of the security group.
*
*/
private String description;
/**
*
* A list of EC2 security groups that are permitted to access clusters
* associated with this cluster security group.
*
*/
private com.amazonaws.internal.SdkInternalList eC2SecurityGroups;
/**
*
* A list of IP ranges (CIDR blocks) that are permitted to access clusters
* associated with this cluster security group.
*
*/
private com.amazonaws.internal.SdkInternalList iPRanges;
/**
*
* The list of tags for the cluster security group.
*
*/
private com.amazonaws.internal.SdkInternalList tags;
/**
*
* The name of the cluster security group to which the operation was
* applied.
*
*
* @param clusterSecurityGroupName
* The name of the cluster security group to which the operation was
* applied.
*/
public void setClusterSecurityGroupName(String clusterSecurityGroupName) {
this.clusterSecurityGroupName = clusterSecurityGroupName;
}
/**
*
* The name of the cluster security group to which the operation was
* applied.
*
*
* @return The name of the cluster security group to which the operation was
* applied.
*/
public String getClusterSecurityGroupName() {
return this.clusterSecurityGroupName;
}
/**
*
* The name of the cluster security group to which the operation was
* applied.
*
*
* @param clusterSecurityGroupName
* The name of the cluster security group to which the operation was
* applied.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterSecurityGroup withClusterSecurityGroupName(
String clusterSecurityGroupName) {
setClusterSecurityGroupName(clusterSecurityGroupName);
return this;
}
/**
*
* A description of the security group.
*
*
* @param description
* A description of the security group.
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* A description of the security group.
*
*
* @return A description of the security group.
*/
public String getDescription() {
return this.description;
}
/**
*
* A description of the security group.
*
*
* @param description
* A description of the security group.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterSecurityGroup withDescription(String description) {
setDescription(description);
return this;
}
/**
*
* A list of EC2 security groups that are permitted to access clusters
* associated with this cluster security group.
*
*
* @return A list of EC2 security groups that are permitted to access
* clusters associated with this cluster security group.
*/
public java.util.List getEC2SecurityGroups() {
if (eC2SecurityGroups == null) {
eC2SecurityGroups = new com.amazonaws.internal.SdkInternalList();
}
return eC2SecurityGroups;
}
/**
*
* A list of EC2 security groups that are permitted to access clusters
* associated with this cluster security group.
*
*
* @param eC2SecurityGroups
* A list of EC2 security groups that are permitted to access
* clusters associated with this cluster security group.
*/
public void setEC2SecurityGroups(
java.util.Collection eC2SecurityGroups) {
if (eC2SecurityGroups == null) {
this.eC2SecurityGroups = null;
return;
}
this.eC2SecurityGroups = new com.amazonaws.internal.SdkInternalList(
eC2SecurityGroups);
}
/**
*
* A list of EC2 security groups that are permitted to access clusters
* associated with this cluster security group.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setEC2SecurityGroups(java.util.Collection)} or
* {@link #withEC2SecurityGroups(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param eC2SecurityGroups
* A list of EC2 security groups that are permitted to access
* clusters associated with this cluster security group.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterSecurityGroup withEC2SecurityGroups(
EC2SecurityGroup... eC2SecurityGroups) {
if (this.eC2SecurityGroups == null) {
setEC2SecurityGroups(new com.amazonaws.internal.SdkInternalList(
eC2SecurityGroups.length));
}
for (EC2SecurityGroup ele : eC2SecurityGroups) {
this.eC2SecurityGroups.add(ele);
}
return this;
}
/**
*
* A list of EC2 security groups that are permitted to access clusters
* associated with this cluster security group.
*
*
* @param eC2SecurityGroups
* A list of EC2 security groups that are permitted to access
* clusters associated with this cluster security group.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterSecurityGroup withEC2SecurityGroups(
java.util.Collection eC2SecurityGroups) {
setEC2SecurityGroups(eC2SecurityGroups);
return this;
}
/**
*
* A list of IP ranges (CIDR blocks) that are permitted to access clusters
* associated with this cluster security group.
*
*
* @return A list of IP ranges (CIDR blocks) that are permitted to access
* clusters associated with this cluster security group.
*/
public java.util.List getIPRanges() {
if (iPRanges == null) {
iPRanges = new com.amazonaws.internal.SdkInternalList();
}
return iPRanges;
}
/**
*
* A list of IP ranges (CIDR blocks) that are permitted to access clusters
* associated with this cluster security group.
*
*
* @param iPRanges
* A list of IP ranges (CIDR blocks) that are permitted to access
* clusters associated with this cluster security group.
*/
public void setIPRanges(java.util.Collection iPRanges) {
if (iPRanges == null) {
this.iPRanges = null;
return;
}
this.iPRanges = new com.amazonaws.internal.SdkInternalList(
iPRanges);
}
/**
*
* A list of IP ranges (CIDR blocks) that are permitted to access clusters
* associated with this cluster security group.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setIPRanges(java.util.Collection)} or
* {@link #withIPRanges(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param iPRanges
* A list of IP ranges (CIDR blocks) that are permitted to access
* clusters associated with this cluster security group.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterSecurityGroup withIPRanges(IPRange... iPRanges) {
if (this.iPRanges == null) {
setIPRanges(new com.amazonaws.internal.SdkInternalList(
iPRanges.length));
}
for (IPRange ele : iPRanges) {
this.iPRanges.add(ele);
}
return this;
}
/**
*
* A list of IP ranges (CIDR blocks) that are permitted to access clusters
* associated with this cluster security group.
*
*
* @param iPRanges
* A list of IP ranges (CIDR blocks) that are permitted to access
* clusters associated with this cluster security group.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterSecurityGroup withIPRanges(
java.util.Collection iPRanges) {
setIPRanges(iPRanges);
return this;
}
/**
*
* The list of tags for the cluster security group.
*
*
* @return The list of tags for the cluster security group.
*/
public java.util.List getTags() {
if (tags == null) {
tags = new com.amazonaws.internal.SdkInternalList();
}
return tags;
}
/**
*
* The list of tags for the cluster security group.
*
*
* @param tags
* The list of tags for the cluster security group.
*/
public void setTags(java.util.Collection tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new com.amazonaws.internal.SdkInternalList(tags);
}
/**
*
* The list of tags for the cluster security group.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setTags(java.util.Collection)} or
* {@link #withTags(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param tags
* The list of tags for the cluster security group.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterSecurityGroup withTags(Tag... tags) {
if (this.tags == null) {
setTags(new com.amazonaws.internal.SdkInternalList(tags.length));
}
for (Tag ele : tags) {
this.tags.add(ele);
}
return this;
}
/**
*
* The list of tags for the cluster security group.
*
*
* @param tags
* The list of tags for the cluster security group.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ClusterSecurityGroup withTags(java.util.Collection tags) {
setTags(tags);
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 (getClusterSecurityGroupName() != null)
sb.append("ClusterSecurityGroupName: "
+ getClusterSecurityGroupName() + ",");
if (getDescription() != null)
sb.append("Description: " + getDescription() + ",");
if (getEC2SecurityGroups() != null)
sb.append("EC2SecurityGroups: " + getEC2SecurityGroups() + ",");
if (getIPRanges() != null)
sb.append("IPRanges: " + getIPRanges() + ",");
if (getTags() != null)
sb.append("Tags: " + getTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ClusterSecurityGroup == false)
return false;
ClusterSecurityGroup other = (ClusterSecurityGroup) obj;
if (other.getClusterSecurityGroupName() == null
^ this.getClusterSecurityGroupName() == null)
return false;
if (other.getClusterSecurityGroupName() != null
&& other.getClusterSecurityGroupName().equals(
this.getClusterSecurityGroupName()) == false)
return false;
if (other.getDescription() == null ^ this.getDescription() == null)
return false;
if (other.getDescription() != null
&& other.getDescription().equals(this.getDescription()) == false)
return false;
if (other.getEC2SecurityGroups() == null
^ this.getEC2SecurityGroups() == null)
return false;
if (other.getEC2SecurityGroups() != null
&& other.getEC2SecurityGroups().equals(
this.getEC2SecurityGroups()) == false)
return false;
if (other.getIPRanges() == null ^ this.getIPRanges() == null)
return false;
if (other.getIPRanges() != null
&& other.getIPRanges().equals(this.getIPRanges()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null
&& other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getClusterSecurityGroupName() == null) ? 0
: getClusterSecurityGroupName().hashCode());
hashCode = prime
* hashCode
+ ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime
* hashCode
+ ((getEC2SecurityGroups() == null) ? 0
: getEC2SecurityGroups().hashCode());
hashCode = prime * hashCode
+ ((getIPRanges() == null) ? 0 : getIPRanges().hashCode());
hashCode = prime * hashCode
+ ((getTags() == null) ? 0 : getTags().hashCode());
return hashCode;
}
@Override
public ClusterSecurityGroup clone() {
try {
return (ClusterSecurityGroup) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}