/* * Copyright 2010-2018 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; /** *
* Describes a security group rule. *
*/ public class IpPermission implements Serializable { /** * The IP protocol name (fortcp
, udp
, and
* icmp
) or number (see Protocol
* Numbers). [EC2-VPC only] When you authorize or revoke security
* group rules, you can use [EC2-VPC only] When you authorize or revoke security
* group rules, you can use [EC2-VPC only] When you authorize or revoke security
* group rules, you can use [EC2-VPC only] When you authorize or revoke security
* group rules, you can use [EC2-VPC only] When you authorize or revoke security
* group rules, you can use [EC2-VPC only] When you authorize or revoke security
* group rules, you can use
* Returns a reference to this object so that method calls can be chained together.
*
* @param ipProtocol The IP protocol name (for [EC2-VPC only] When you authorize or revoke security
* group rules, you can use
* Returns a reference to this object so that method calls can be chained together.
*
* @param fromPort The start of port range for the TCP and UDP protocols, or an ICMP type
* number. A value of
* Returns a reference to this object so that method calls can be chained together.
*
* @param toPort The end of port range for the TCP and UDP protocols, or an ICMP code.
* A value of
* Returns a reference to this object so that method calls can be chained together.
*
* @param userIdGroupPairs One or more security group and AWS account ID pairs.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public IpPermission withUserIdGroupPairs(UserIdGroupPair... userIdGroupPairs) {
if (getUserIdGroupPairs() == null) setUserIdGroupPairs(new java.util.ArrayList
* Returns a reference to this object so that method calls can be chained together.
*
* @param userIdGroupPairs One or more security group and AWS account ID pairs.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public IpPermission withUserIdGroupPairs(java.util.Collection
* Returns a reference to this object so that method calls can be chained together.
*
* @param ipRanges One or more IP ranges.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public IpPermission withIpRanges(String... ipRanges) {
if (getIpRanges() == null) setIpRanges(new java.util.ArrayList
* Returns a reference to this object so that method calls can be chained together.
*
* @param ipRanges One or more IP ranges.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public IpPermission withIpRanges(java.util.Collection
* Returns a reference to this object so that method calls can be chained together.
*
* @param prefixListIds (Valid for AuthorizeSecurityGroupEgress,
* RevokeSecurityGroupEgress and DescribeSecurityGroups
* only) One or more prefix list IDs for an AWS service. In an
* AuthorizeSecurityGroupEgress request, this is the AWS service
* that you want to access through a VPC endpoint from instances
* associated with the security group.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public IpPermission withPrefixListIds(PrefixListId... prefixListIds) {
if (getPrefixListIds() == null) setPrefixListIds(new java.util.ArrayList
* Returns a reference to this object so that method calls can be chained together.
*
* @param prefixListIds (Valid for AuthorizeSecurityGroupEgress,
* RevokeSecurityGroupEgress and DescribeSecurityGroups
* only) One or more prefix list IDs for an AWS service. In an
* AuthorizeSecurityGroupEgress request, this is the AWS service
* that you want to access through a VPC endpoint from instances
* associated with the security group.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public IpPermission withPrefixListIds(java.util.Collection-1
to specify all.
*/
private String ipProtocol;
/**
* The start of port range for the TCP and UDP protocols, or an ICMP type
* number. A value of -1
indicates all ICMP types.
*/
private Integer fromPort;
/**
* The end of port range for the TCP and UDP protocols, or an ICMP code.
* A value of -1
indicates all ICMP codes for the specified
* ICMP type.
*/
private Integer toPort;
/**
* One or more security group and AWS account ID pairs.
*/
private com.amazonaws.internal.ListWithAutoConstructFlagtcp
, udp
, and
* icmp
) or number (see Protocol
* Numbers). -1
to specify all.
*
* @return The IP protocol name (for tcp
, udp
, and
* icmp
) or number (see Protocol
* Numbers). -1
to specify all.
*/
public String getIpProtocol() {
return ipProtocol;
}
/**
* The IP protocol name (for tcp
, udp
, and
* icmp
) or number (see Protocol
* Numbers). -1
to specify all.
*
* @param ipProtocol The IP protocol name (for tcp
, udp
, and
* icmp
) or number (see Protocol
* Numbers). -1
to specify all.
*/
public void setIpProtocol(String ipProtocol) {
this.ipProtocol = ipProtocol;
}
/**
* The IP protocol name (for tcp
, udp
, and
* icmp
) or number (see Protocol
* Numbers). -1
to specify all.
* tcp
, udp
, and
* icmp
) or number (see Protocol
* Numbers). -1
to specify all.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public IpPermission withIpProtocol(String ipProtocol) {
this.ipProtocol = ipProtocol;
return this;
}
/**
* The start of port range for the TCP and UDP protocols, or an ICMP type
* number. A value of -1
indicates all ICMP types.
*
* @return The start of port range for the TCP and UDP protocols, or an ICMP type
* number. A value of -1
indicates all ICMP types.
*/
public Integer getFromPort() {
return fromPort;
}
/**
* The start of port range for the TCP and UDP protocols, or an ICMP type
* number. A value of -1
indicates all ICMP types.
*
* @param fromPort The start of port range for the TCP and UDP protocols, or an ICMP type
* number. A value of -1
indicates all ICMP types.
*/
public void setFromPort(Integer fromPort) {
this.fromPort = fromPort;
}
/**
* The start of port range for the TCP and UDP protocols, or an ICMP type
* number. A value of -1
indicates all ICMP types.
* -1
indicates all ICMP types.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public IpPermission withFromPort(Integer fromPort) {
this.fromPort = fromPort;
return this;
}
/**
* The end of port range for the TCP and UDP protocols, or an ICMP code.
* A value of -1
indicates all ICMP codes for the specified
* ICMP type.
*
* @return The end of port range for the TCP and UDP protocols, or an ICMP code.
* A value of -1
indicates all ICMP codes for the specified
* ICMP type.
*/
public Integer getToPort() {
return toPort;
}
/**
* The end of port range for the TCP and UDP protocols, or an ICMP code.
* A value of -1
indicates all ICMP codes for the specified
* ICMP type.
*
* @param toPort The end of port range for the TCP and UDP protocols, or an ICMP code.
* A value of -1
indicates all ICMP codes for the specified
* ICMP type.
*/
public void setToPort(Integer toPort) {
this.toPort = toPort;
}
/**
* The end of port range for the TCP and UDP protocols, or an ICMP code.
* A value of -1
indicates all ICMP codes for the specified
* ICMP type.
* -1
indicates all ICMP codes for the specified
* ICMP type.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public IpPermission withToPort(Integer toPort) {
this.toPort = toPort;
return this;
}
/**
* One or more security group and AWS account ID pairs.
*
* @return One or more security group and AWS account ID pairs.
*/
public java.util.List