com.amazonaws.services.ec2.model.RevokeSecurityGroupIngressRequest 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;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.services.ec2.model.transform.RevokeSecurityGroupIngressRequestMarshaller;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class RevokeSecurityGroupIngressRequest extends AmazonWebServiceRequest implements Serializable, Cloneable,
DryRunSupportedRequest {
/**
*
* The CIDR IP address range. You can't specify this parameter when specifying a source security group.
*
*/
private String cidrIp;
/**
*
* If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP
* type or -1 (all ICMP types).
*
*/
private Integer fromPort;
/**
*
* The ID of the security group.
*
*/
private String groupId;
/**
*
* [Default VPC] The name of the security group. You must specify either the security group ID or the security group
* name in the request. For security groups in a nondefault VPC, you must specify the security group ID.
*
*/
private String groupName;
/**
*
* The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set
* of permissions.
*
*/
private com.amazonaws.internal.SdkInternalList ipPermissions;
/**
*
* The IP protocol name (tcp
, udp
, icmp
) or number (see Protocol Numbers). Use
* -1
to specify all.
*
*/
private String ipProtocol;
/**
*
* [Default VPC] The name of the source security group. You can't specify this parameter in combination with the
* following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the
* port range. The source security group must be in the same VPC. To revoke a specific rule for an IP protocol and
* port range, use a set of IP permissions instead.
*
*/
private String sourceSecurityGroupName;
/**
*
* Not supported.
*
*/
private String sourceSecurityGroupOwnerId;
/**
*
* If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code
* or -1 (all ICMP codes).
*
*/
private Integer toPort;
/**
*
* The IDs of the security group rules.
*
*/
private com.amazonaws.internal.SdkInternalList securityGroupRuleIds;
/**
* Default constructor for RevokeSecurityGroupIngressRequest object. Callers should use the setter or fluent setter
* (with...) methods to initialize the object after creating it.
*/
public RevokeSecurityGroupIngressRequest() {
}
/**
* Constructs a new RevokeSecurityGroupIngressRequest object. Callers should use the setter or fluent setter
* (with...) methods to initialize any additional object members.
*
* @param groupName
* [Default VPC] The name of the security group. You must specify either the security group ID or the
* security group name in the request. For security groups in a nondefault VPC, you must specify the security
* group ID.
* @param ipPermissions
* The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the
* same set of permissions.
*/
public RevokeSecurityGroupIngressRequest(String groupName, java.util.List ipPermissions) {
setGroupName(groupName);
setIpPermissions(ipPermissions);
}
/**
*
* The CIDR IP address range. You can't specify this parameter when specifying a source security group.
*
*
* @param cidrIp
* The CIDR IP address range. You can't specify this parameter when specifying a source security group.
*/
public void setCidrIp(String cidrIp) {
this.cidrIp = cidrIp;
}
/**
*
* The CIDR IP address range. You can't specify this parameter when specifying a source security group.
*
*
* @return The CIDR IP address range. You can't specify this parameter when specifying a source security group.
*/
public String getCidrIp() {
return this.cidrIp;
}
/**
*
* The CIDR IP address range. You can't specify this parameter when specifying a source security group.
*
*
* @param cidrIp
* The CIDR IP address range. You can't specify this parameter when specifying a source security group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withCidrIp(String cidrIp) {
setCidrIp(cidrIp);
return this;
}
/**
*
* If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP
* type or -1 (all ICMP types).
*
*
* @param fromPort
* If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the
* ICMP type or -1 (all ICMP types).
*/
public void setFromPort(Integer fromPort) {
this.fromPort = fromPort;
}
/**
*
* If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP
* type or -1 (all ICMP types).
*
*
* @return If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the
* ICMP type or -1 (all ICMP types).
*/
public Integer getFromPort() {
return this.fromPort;
}
/**
*
* If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP
* type or -1 (all ICMP types).
*
*
* @param fromPort
* If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the
* ICMP type or -1 (all ICMP types).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withFromPort(Integer fromPort) {
setFromPort(fromPort);
return this;
}
/**
*
* The ID of the security group.
*
*
* @param groupId
* The ID of the security group.
*/
public void setGroupId(String groupId) {
this.groupId = groupId;
}
/**
*
* The ID of the security group.
*
*
* @return The ID of the security group.
*/
public String getGroupId() {
return this.groupId;
}
/**
*
* The ID of the security group.
*
*
* @param groupId
* The ID of the security group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withGroupId(String groupId) {
setGroupId(groupId);
return this;
}
/**
*
* [Default VPC] The name of the security group. You must specify either the security group ID or the security group
* name in the request. For security groups in a nondefault VPC, you must specify the security group ID.
*
*
* @param groupName
* [Default VPC] The name of the security group. You must specify either the security group ID or the
* security group name in the request. For security groups in a nondefault VPC, you must specify the security
* group ID.
*/
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
*
* [Default VPC] The name of the security group. You must specify either the security group ID or the security group
* name in the request. For security groups in a nondefault VPC, you must specify the security group ID.
*
*
* @return [Default VPC] The name of the security group. You must specify either the security group ID or the
* security group name in the request. For security groups in a nondefault VPC, you must specify the
* security group ID.
*/
public String getGroupName() {
return this.groupName;
}
/**
*
* [Default VPC] The name of the security group. You must specify either the security group ID or the security group
* name in the request. For security groups in a nondefault VPC, you must specify the security group ID.
*
*
* @param groupName
* [Default VPC] The name of the security group. You must specify either the security group ID or the
* security group name in the request. For security groups in a nondefault VPC, you must specify the security
* group ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withGroupName(String groupName) {
setGroupName(groupName);
return this;
}
/**
*
* The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set
* of permissions.
*
*
* @return The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the
* same set of permissions.
*/
public java.util.List getIpPermissions() {
if (ipPermissions == null) {
ipPermissions = new com.amazonaws.internal.SdkInternalList();
}
return ipPermissions;
}
/**
*
* The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set
* of permissions.
*
*
* @param ipPermissions
* The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the
* same set of permissions.
*/
public void setIpPermissions(java.util.Collection ipPermissions) {
if (ipPermissions == null) {
this.ipPermissions = null;
return;
}
this.ipPermissions = new com.amazonaws.internal.SdkInternalList(ipPermissions);
}
/**
*
* The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set
* of permissions.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setIpPermissions(java.util.Collection)} or {@link #withIpPermissions(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param ipPermissions
* The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the
* same set of permissions.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withIpPermissions(IpPermission... ipPermissions) {
if (this.ipPermissions == null) {
setIpPermissions(new com.amazonaws.internal.SdkInternalList(ipPermissions.length));
}
for (IpPermission ele : ipPermissions) {
this.ipPermissions.add(ele);
}
return this;
}
/**
*
* The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set
* of permissions.
*
*
* @param ipPermissions
* The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the
* same set of permissions.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withIpPermissions(java.util.Collection ipPermissions) {
setIpPermissions(ipPermissions);
return this;
}
/**
*
* The IP protocol name (tcp
, udp
, icmp
) or number (see Protocol Numbers). Use
* -1
to specify all.
*
*
* @param ipProtocol
* The IP protocol name (tcp
, udp
, icmp
) or number (see Protocol Numbers). Use
* -1
to specify all.
*/
public void setIpProtocol(String ipProtocol) {
this.ipProtocol = ipProtocol;
}
/**
*
* The IP protocol name (tcp
, udp
, icmp
) or number (see Protocol Numbers). Use
* -1
to specify all.
*
*
* @return The IP protocol name (tcp
, udp
, icmp
) or number (see Protocol Numbers). Use
* -1
to specify all.
*/
public String getIpProtocol() {
return this.ipProtocol;
}
/**
*
* The IP protocol name (tcp
, udp
, icmp
) or number (see Protocol Numbers). Use
* -1
to specify all.
*
*
* @param ipProtocol
* The IP protocol name (tcp
, udp
, icmp
) or number (see Protocol Numbers). Use
* -1
to specify all.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withIpProtocol(String ipProtocol) {
setIpProtocol(ipProtocol);
return this;
}
/**
*
* [Default VPC] The name of the source security group. You can't specify this parameter in combination with the
* following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the
* port range. The source security group must be in the same VPC. To revoke a specific rule for an IP protocol and
* port range, use a set of IP permissions instead.
*
*
* @param sourceSecurityGroupName
* [Default VPC] The name of the source security group. You can't specify this parameter in combination with
* the following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the
* end of the port range. The source security group must be in the same VPC. To revoke a specific rule for an
* IP protocol and port range, use a set of IP permissions instead.
*/
public void setSourceSecurityGroupName(String sourceSecurityGroupName) {
this.sourceSecurityGroupName = sourceSecurityGroupName;
}
/**
*
* [Default VPC] The name of the source security group. You can't specify this parameter in combination with the
* following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the
* port range. The source security group must be in the same VPC. To revoke a specific rule for an IP protocol and
* port range, use a set of IP permissions instead.
*
*
* @return [Default VPC] The name of the source security group. You can't specify this parameter in combination with
* the following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and
* the end of the port range. The source security group must be in the same VPC. To revoke a specific rule
* for an IP protocol and port range, use a set of IP permissions instead.
*/
public String getSourceSecurityGroupName() {
return this.sourceSecurityGroupName;
}
/**
*
* [Default VPC] The name of the source security group. You can't specify this parameter in combination with the
* following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the
* port range. The source security group must be in the same VPC. To revoke a specific rule for an IP protocol and
* port range, use a set of IP permissions instead.
*
*
* @param sourceSecurityGroupName
* [Default VPC] The name of the source security group. You can't specify this parameter in combination with
* the following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the
* end of the port range. The source security group must be in the same VPC. To revoke a specific rule for an
* IP protocol and port range, use a set of IP permissions instead.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withSourceSecurityGroupName(String sourceSecurityGroupName) {
setSourceSecurityGroupName(sourceSecurityGroupName);
return this;
}
/**
*
* Not supported.
*
*
* @param sourceSecurityGroupOwnerId
* Not supported.
*/
public void setSourceSecurityGroupOwnerId(String sourceSecurityGroupOwnerId) {
this.sourceSecurityGroupOwnerId = sourceSecurityGroupOwnerId;
}
/**
*
* Not supported.
*
*
* @return Not supported.
*/
public String getSourceSecurityGroupOwnerId() {
return this.sourceSecurityGroupOwnerId;
}
/**
*
* Not supported.
*
*
* @param sourceSecurityGroupOwnerId
* Not supported.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withSourceSecurityGroupOwnerId(String sourceSecurityGroupOwnerId) {
setSourceSecurityGroupOwnerId(sourceSecurityGroupOwnerId);
return this;
}
/**
*
* If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code
* or -1 (all ICMP codes).
*
*
* @param toPort
* If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the
* ICMP code or -1 (all ICMP codes).
*/
public void setToPort(Integer toPort) {
this.toPort = toPort;
}
/**
*
* If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code
* or -1 (all ICMP codes).
*
*
* @return If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the
* ICMP code or -1 (all ICMP codes).
*/
public Integer getToPort() {
return this.toPort;
}
/**
*
* If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code
* or -1 (all ICMP codes).
*
*
* @param toPort
* If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the
* ICMP code or -1 (all ICMP codes).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withToPort(Integer toPort) {
setToPort(toPort);
return this;
}
/**
*
* The IDs of the security group rules.
*
*
* @return The IDs of the security group rules.
*/
public java.util.List getSecurityGroupRuleIds() {
if (securityGroupRuleIds == null) {
securityGroupRuleIds = new com.amazonaws.internal.SdkInternalList();
}
return securityGroupRuleIds;
}
/**
*
* The IDs of the security group rules.
*
*
* @param securityGroupRuleIds
* The IDs of the security group rules.
*/
public void setSecurityGroupRuleIds(java.util.Collection securityGroupRuleIds) {
if (securityGroupRuleIds == null) {
this.securityGroupRuleIds = null;
return;
}
this.securityGroupRuleIds = new com.amazonaws.internal.SdkInternalList(securityGroupRuleIds);
}
/**
*
* The IDs of the security group rules.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSecurityGroupRuleIds(java.util.Collection)} or {@link #withSecurityGroupRuleIds(java.util.Collection)}
* if you want to override the existing values.
*
*
* @param securityGroupRuleIds
* The IDs of the security group rules.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withSecurityGroupRuleIds(String... securityGroupRuleIds) {
if (this.securityGroupRuleIds == null) {
setSecurityGroupRuleIds(new com.amazonaws.internal.SdkInternalList(securityGroupRuleIds.length));
}
for (String ele : securityGroupRuleIds) {
this.securityGroupRuleIds.add(ele);
}
return this;
}
/**
*
* The IDs of the security group rules.
*
*
* @param securityGroupRuleIds
* The IDs of the security group rules.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RevokeSecurityGroupIngressRequest withSecurityGroupRuleIds(java.util.Collection securityGroupRuleIds) {
setSecurityGroupRuleIds(securityGroupRuleIds);
return this;
}
/**
* This method is intended for internal use only. Returns the marshaled request configured with additional
* parameters to enable operation dry-run.
*/
@Override
public Request getDryRunRequest() {
Request request = new RevokeSecurityGroupIngressRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
}
/**
* 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 (getCidrIp() != null)
sb.append("CidrIp: ").append(getCidrIp()).append(",");
if (getFromPort() != null)
sb.append("FromPort: ").append(getFromPort()).append(",");
if (getGroupId() != null)
sb.append("GroupId: ").append(getGroupId()).append(",");
if (getGroupName() != null)
sb.append("GroupName: ").append(getGroupName()).append(",");
if (getIpPermissions() != null)
sb.append("IpPermissions: ").append(getIpPermissions()).append(",");
if (getIpProtocol() != null)
sb.append("IpProtocol: ").append(getIpProtocol()).append(",");
if (getSourceSecurityGroupName() != null)
sb.append("SourceSecurityGroupName: ").append(getSourceSecurityGroupName()).append(",");
if (getSourceSecurityGroupOwnerId() != null)
sb.append("SourceSecurityGroupOwnerId: ").append(getSourceSecurityGroupOwnerId()).append(",");
if (getToPort() != null)
sb.append("ToPort: ").append(getToPort()).append(",");
if (getSecurityGroupRuleIds() != null)
sb.append("SecurityGroupRuleIds: ").append(getSecurityGroupRuleIds());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof RevokeSecurityGroupIngressRequest == false)
return false;
RevokeSecurityGroupIngressRequest other = (RevokeSecurityGroupIngressRequest) obj;
if (other.getCidrIp() == null ^ this.getCidrIp() == null)
return false;
if (other.getCidrIp() != null && other.getCidrIp().equals(this.getCidrIp()) == false)
return false;
if (other.getFromPort() == null ^ this.getFromPort() == null)
return false;
if (other.getFromPort() != null && other.getFromPort().equals(this.getFromPort()) == false)
return false;
if (other.getGroupId() == null ^ this.getGroupId() == null)
return false;
if (other.getGroupId() != null && other.getGroupId().equals(this.getGroupId()) == false)
return false;
if (other.getGroupName() == null ^ this.getGroupName() == null)
return false;
if (other.getGroupName() != null && other.getGroupName().equals(this.getGroupName()) == false)
return false;
if (other.getIpPermissions() == null ^ this.getIpPermissions() == null)
return false;
if (other.getIpPermissions() != null && other.getIpPermissions().equals(this.getIpPermissions()) == false)
return false;
if (other.getIpProtocol() == null ^ this.getIpProtocol() == null)
return false;
if (other.getIpProtocol() != null && other.getIpProtocol().equals(this.getIpProtocol()) == false)
return false;
if (other.getSourceSecurityGroupName() == null ^ this.getSourceSecurityGroupName() == null)
return false;
if (other.getSourceSecurityGroupName() != null && other.getSourceSecurityGroupName().equals(this.getSourceSecurityGroupName()) == false)
return false;
if (other.getSourceSecurityGroupOwnerId() == null ^ this.getSourceSecurityGroupOwnerId() == null)
return false;
if (other.getSourceSecurityGroupOwnerId() != null && other.getSourceSecurityGroupOwnerId().equals(this.getSourceSecurityGroupOwnerId()) == false)
return false;
if (other.getToPort() == null ^ this.getToPort() == null)
return false;
if (other.getToPort() != null && other.getToPort().equals(this.getToPort()) == false)
return false;
if (other.getSecurityGroupRuleIds() == null ^ this.getSecurityGroupRuleIds() == null)
return false;
if (other.getSecurityGroupRuleIds() != null && other.getSecurityGroupRuleIds().equals(this.getSecurityGroupRuleIds()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getCidrIp() == null) ? 0 : getCidrIp().hashCode());
hashCode = prime * hashCode + ((getFromPort() == null) ? 0 : getFromPort().hashCode());
hashCode = prime * hashCode + ((getGroupId() == null) ? 0 : getGroupId().hashCode());
hashCode = prime * hashCode + ((getGroupName() == null) ? 0 : getGroupName().hashCode());
hashCode = prime * hashCode + ((getIpPermissions() == null) ? 0 : getIpPermissions().hashCode());
hashCode = prime * hashCode + ((getIpProtocol() == null) ? 0 : getIpProtocol().hashCode());
hashCode = prime * hashCode + ((getSourceSecurityGroupName() == null) ? 0 : getSourceSecurityGroupName().hashCode());
hashCode = prime * hashCode + ((getSourceSecurityGroupOwnerId() == null) ? 0 : getSourceSecurityGroupOwnerId().hashCode());
hashCode = prime * hashCode + ((getToPort() == null) ? 0 : getToPort().hashCode());
hashCode = prime * hashCode + ((getSecurityGroupRuleIds() == null) ? 0 : getSecurityGroupRuleIds().hashCode());
return hashCode;
}
@Override
public RevokeSecurityGroupIngressRequest clone() {
return (RevokeSecurityGroupIngressRequest) super.clone();
}
}