com.amazonaws.services.ec2.model.AnalysisSecurityGroupRule Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 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.ec2.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* Describes a security group rule.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AnalysisSecurityGroupRule implements Serializable, Cloneable {
/**
*
* The IPv4 address range, in CIDR notation.
*
*/
private String cidr;
/**
*
* The direction. The following are the possible values:
*
*
* -
*
* egress
*
*
* -
*
* ingress
*
*
*
*/
private String direction;
/**
*
* The security group ID.
*
*/
private String securityGroupId;
/**
*
* The port range.
*
*/
private PortRange portRange;
/**
*
* The prefix list ID.
*
*/
private String prefixListId;
/**
*
* The protocol name.
*
*/
private String protocol;
/**
*
* The IPv4 address range, in CIDR notation.
*
*
* @param cidr
* The IPv4 address range, in CIDR notation.
*/
public void setCidr(String cidr) {
this.cidr = cidr;
}
/**
*
* The IPv4 address range, in CIDR notation.
*
*
* @return The IPv4 address range, in CIDR notation.
*/
public String getCidr() {
return this.cidr;
}
/**
*
* The IPv4 address range, in CIDR notation.
*
*
* @param cidr
* The IPv4 address range, in CIDR notation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalysisSecurityGroupRule withCidr(String cidr) {
setCidr(cidr);
return this;
}
/**
*
* The direction. The following are the possible values:
*
*
* -
*
* egress
*
*
* -
*
* ingress
*
*
*
*
* @param direction
* The direction. The following are the possible values:
*
* -
*
* egress
*
*
* -
*
* ingress
*
*
*/
public void setDirection(String direction) {
this.direction = direction;
}
/**
*
* The direction. The following are the possible values:
*
*
* -
*
* egress
*
*
* -
*
* ingress
*
*
*
*
* @return The direction. The following are the possible values:
*
* -
*
* egress
*
*
* -
*
* ingress
*
*
*/
public String getDirection() {
return this.direction;
}
/**
*
* The direction. The following are the possible values:
*
*
* -
*
* egress
*
*
* -
*
* ingress
*
*
*
*
* @param direction
* The direction. The following are the possible values:
*
* -
*
* egress
*
*
* -
*
* ingress
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalysisSecurityGroupRule withDirection(String direction) {
setDirection(direction);
return this;
}
/**
*
* The security group ID.
*
*
* @param securityGroupId
* The security group ID.
*/
public void setSecurityGroupId(String securityGroupId) {
this.securityGroupId = securityGroupId;
}
/**
*
* The security group ID.
*
*
* @return The security group ID.
*/
public String getSecurityGroupId() {
return this.securityGroupId;
}
/**
*
* The security group ID.
*
*
* @param securityGroupId
* The security group ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalysisSecurityGroupRule withSecurityGroupId(String securityGroupId) {
setSecurityGroupId(securityGroupId);
return this;
}
/**
*
* The port range.
*
*
* @param portRange
* The port range.
*/
public void setPortRange(PortRange portRange) {
this.portRange = portRange;
}
/**
*
* The port range.
*
*
* @return The port range.
*/
public PortRange getPortRange() {
return this.portRange;
}
/**
*
* The port range.
*
*
* @param portRange
* The port range.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalysisSecurityGroupRule withPortRange(PortRange portRange) {
setPortRange(portRange);
return this;
}
/**
*
* The prefix list ID.
*
*
* @param prefixListId
* The prefix list ID.
*/
public void setPrefixListId(String prefixListId) {
this.prefixListId = prefixListId;
}
/**
*
* The prefix list ID.
*
*
* @return The prefix list ID.
*/
public String getPrefixListId() {
return this.prefixListId;
}
/**
*
* The prefix list ID.
*
*
* @param prefixListId
* The prefix list ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalysisSecurityGroupRule withPrefixListId(String prefixListId) {
setPrefixListId(prefixListId);
return this;
}
/**
*
* The protocol name.
*
*
* @param protocol
* The protocol name.
*/
public void setProtocol(String protocol) {
this.protocol = protocol;
}
/**
*
* The protocol name.
*
*
* @return The protocol name.
*/
public String getProtocol() {
return this.protocol;
}
/**
*
* The protocol name.
*
*
* @param protocol
* The protocol name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalysisSecurityGroupRule withProtocol(String protocol) {
setProtocol(protocol);
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 (getCidr() != null)
sb.append("Cidr: ").append(getCidr()).append(",");
if (getDirection() != null)
sb.append("Direction: ").append(getDirection()).append(",");
if (getSecurityGroupId() != null)
sb.append("SecurityGroupId: ").append(getSecurityGroupId()).append(",");
if (getPortRange() != null)
sb.append("PortRange: ").append(getPortRange()).append(",");
if (getPrefixListId() != null)
sb.append("PrefixListId: ").append(getPrefixListId()).append(",");
if (getProtocol() != null)
sb.append("Protocol: ").append(getProtocol());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof AnalysisSecurityGroupRule == false)
return false;
AnalysisSecurityGroupRule other = (AnalysisSecurityGroupRule) obj;
if (other.getCidr() == null ^ this.getCidr() == null)
return false;
if (other.getCidr() != null && other.getCidr().equals(this.getCidr()) == false)
return false;
if (other.getDirection() == null ^ this.getDirection() == null)
return false;
if (other.getDirection() != null && other.getDirection().equals(this.getDirection()) == false)
return false;
if (other.getSecurityGroupId() == null ^ this.getSecurityGroupId() == null)
return false;
if (other.getSecurityGroupId() != null && other.getSecurityGroupId().equals(this.getSecurityGroupId()) == false)
return false;
if (other.getPortRange() == null ^ this.getPortRange() == null)
return false;
if (other.getPortRange() != null && other.getPortRange().equals(this.getPortRange()) == false)
return false;
if (other.getPrefixListId() == null ^ this.getPrefixListId() == null)
return false;
if (other.getPrefixListId() != null && other.getPrefixListId().equals(this.getPrefixListId()) == false)
return false;
if (other.getProtocol() == null ^ this.getProtocol() == null)
return false;
if (other.getProtocol() != null && other.getProtocol().equals(this.getProtocol()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getCidr() == null) ? 0 : getCidr().hashCode());
hashCode = prime * hashCode + ((getDirection() == null) ? 0 : getDirection().hashCode());
hashCode = prime * hashCode + ((getSecurityGroupId() == null) ? 0 : getSecurityGroupId().hashCode());
hashCode = prime * hashCode + ((getPortRange() == null) ? 0 : getPortRange().hashCode());
hashCode = prime * hashCode + ((getPrefixListId() == null) ? 0 : getPrefixListId().hashCode());
hashCode = prime * hashCode + ((getProtocol() == null) ? 0 : getProtocol().hashCode());
return hashCode;
}
@Override
public AnalysisSecurityGroupRule clone() {
try {
return (AnalysisSecurityGroupRule) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}