/* * Copyright 2018-2023 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 set of permissions for a security group rule. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class IpPermission implements Serializable, Cloneable { /** ** If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP or ICMPv6, this is * the type number. A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must * specify all ICMP/ICMPv6 codes. *
*/ private Integer fromPort; /** *
* The IP protocol name (tcp
, udp
, icmp
, icmpv6
) or number (see
* Protocol Numbers).
*
* Use -1
to specify all protocols. When authorizing security group rules, specifying -1
* or a protocol number other than tcp
, udp
, icmp
, or icmpv6
* allows traffic on all ports, regardless of any port range you specify. For tcp
, udp
,
* and icmp
, you must specify a port range. For icmpv6
, the port range is optional; if you
* omit the port range, traffic for all types and codes is allowed.
*
* The IPv6 ranges. *
*/ private com.amazonaws.internal.SdkInternalList* The prefix list IDs. *
*/ private com.amazonaws.internal.SdkInternalList* If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP or ICMPv6, this is the * code. A value of -1 indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must specify all * ICMP/ICMPv6 codes. *
*/ private Integer toPort; /** ** The security group and Amazon Web Services account ID pairs. *
*/ private com.amazonaws.internal.SdkInternalList* The IPv4 ranges. *
*/ private com.amazonaws.internal.SdkInternalList* If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP or ICMPv6, this is * the type number. A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must * specify all ICMP/ICMPv6 codes. *
* * @param fromPort * If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP or ICMPv6, * this is the type number. A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 * types, you must specify all ICMP/ICMPv6 codes. */ 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 or ICMPv6, this is * the type number. A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must * specify all ICMP/ICMPv6 codes. *
* * @return If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP or ICMPv6, * this is the type number. A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 * types, you must specify all ICMP/ICMPv6 codes. */ 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 or ICMPv6, this is * the type number. A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must * specify all ICMP/ICMPv6 codes. *
* * @param fromPort * If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP or ICMPv6, * this is the type number. A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 * types, you must specify all ICMP/ICMPv6 codes. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withFromPort(Integer fromPort) { setFromPort(fromPort); return this; } /** *
* The IP protocol name (tcp
, udp
, icmp
, icmpv6
) or number (see
* Protocol Numbers).
*
* Use -1
to specify all protocols. When authorizing security group rules, specifying -1
* or a protocol number other than tcp
, udp
, icmp
, or icmpv6
* allows traffic on all ports, regardless of any port range you specify. For tcp
, udp
,
* and icmp
, you must specify a port range. For icmpv6
, the port range is optional; if you
* omit the port range, traffic for all types and codes is allowed.
*
tcp
, udp
, icmp
, icmpv6
) or
* number (see Protocol
* Numbers).
*
* Use -1
to specify all protocols. When authorizing security group rules, specifying
* -1
or a protocol number other than tcp
, udp
, icmp
, or
* icmpv6
allows traffic on all ports, regardless of any port range you specify. For
* tcp
, udp
, and icmp
, you must specify a port range. For
* icmpv6
, the port range is optional; if you omit the port range, traffic for all types and
* codes is allowed.
*/
public void setIpProtocol(String ipProtocol) {
this.ipProtocol = ipProtocol;
}
/**
*
* The IP protocol name (tcp
, udp
, icmp
, icmpv6
) or number (see
* Protocol Numbers).
*
* Use -1
to specify all protocols. When authorizing security group rules, specifying -1
* or a protocol number other than tcp
, udp
, icmp
, or icmpv6
* allows traffic on all ports, regardless of any port range you specify. For tcp
, udp
,
* and icmp
, you must specify a port range. For icmpv6
, the port range is optional; if you
* omit the port range, traffic for all types and codes is allowed.
*
tcp
, udp
, icmp
, icmpv6
) or
* number (see Protocol
* Numbers).
*
* Use -1
to specify all protocols. When authorizing security group rules, specifying
* -1
or a protocol number other than tcp
, udp
, icmp
, or
* icmpv6
allows traffic on all ports, regardless of any port range you specify. For
* tcp
, udp
, and icmp
, you must specify a port range. For
* icmpv6
, the port range is optional; if you omit the port range, traffic for all types and
* codes is allowed.
*/
public String getIpProtocol() {
return this.ipProtocol;
}
/**
*
* The IP protocol name (tcp
, udp
, icmp
, icmpv6
) or number (see
* Protocol Numbers).
*
* Use -1
to specify all protocols. When authorizing security group rules, specifying -1
* or a protocol number other than tcp
, udp
, icmp
, or icmpv6
* allows traffic on all ports, regardless of any port range you specify. For tcp
, udp
,
* and icmp
, you must specify a port range. For icmpv6
, the port range is optional; if you
* omit the port range, traffic for all types and codes is allowed.
*
tcp
, udp
, icmp
, icmpv6
) or
* number (see Protocol
* Numbers).
*
* Use -1
to specify all protocols. When authorizing security group rules, specifying
* -1
or a protocol number other than tcp
, udp
, icmp
, or
* icmpv6
allows traffic on all ports, regardless of any port range you specify. For
* tcp
, udp
, and icmp
, you must specify a port range. For
* icmpv6
, the port range is optional; if you omit the port range, traffic for all types and
* codes is allowed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public IpPermission withIpProtocol(String ipProtocol) {
setIpProtocol(ipProtocol);
return this;
}
/**
*
* The IPv6 ranges. *
* * @return The IPv6 ranges. */ public java.util.List* The IPv6 ranges. *
* * @param ipv6Ranges * The IPv6 ranges. */ public void setIpv6Ranges(java.util.Collection* The IPv6 ranges. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setIpv6Ranges(java.util.Collection)} or {@link #withIpv6Ranges(java.util.Collection)} if you want to * override the existing values. *
* * @param ipv6Ranges * The IPv6 ranges. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withIpv6Ranges(Ipv6Range... ipv6Ranges) { if (this.ipv6Ranges == null) { setIpv6Ranges(new com.amazonaws.internal.SdkInternalList* The IPv6 ranges. *
* * @param ipv6Ranges * The IPv6 ranges. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withIpv6Ranges(java.util.Collection* The prefix list IDs. *
* * @return The prefix list IDs. */ public java.util.List* The prefix list IDs. *
* * @param prefixListIds * The prefix list IDs. */ public void setPrefixListIds(java.util.Collection* The prefix list IDs. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setPrefixListIds(java.util.Collection)} or {@link #withPrefixListIds(java.util.Collection)} if you want * to override the existing values. *
* * @param prefixListIds * The prefix list IDs. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withPrefixListIds(PrefixListId... prefixListIds) { if (this.prefixListIds == null) { setPrefixListIds(new com.amazonaws.internal.SdkInternalList* The prefix list IDs. *
* * @param prefixListIds * The prefix list IDs. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withPrefixListIds(java.util.Collection* If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP or ICMPv6, this is the * code. A value of -1 indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must specify all * ICMP/ICMPv6 codes. *
* * @param toPort * If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP or ICMPv6, this * is the code. A value of -1 indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must * specify all ICMP/ICMPv6 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 or ICMPv6, this is the * code. A value of -1 indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must specify all * ICMP/ICMPv6 codes. *
* * @return If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP or ICMPv6, this * is the code. A value of -1 indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you * must specify all ICMP/ICMPv6 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 or ICMPv6, this is the * code. A value of -1 indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must specify all * ICMP/ICMPv6 codes. *
* * @param toPort * If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP or ICMPv6, this * is the code. A value of -1 indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must * specify all ICMP/ICMPv6 codes. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withToPort(Integer toPort) { setToPort(toPort); return this; } /** ** The security group and Amazon Web Services account ID pairs. *
* * @return The security group and Amazon Web Services account ID pairs. */ public java.util.List* The security group and Amazon Web Services account ID pairs. *
* * @param userIdGroupPairs * The security group and Amazon Web Services account ID pairs. */ public void setUserIdGroupPairs(java.util.Collection* The security group and Amazon Web Services account ID pairs. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setUserIdGroupPairs(java.util.Collection)} or {@link #withUserIdGroupPairs(java.util.Collection)} if you * want to override the existing values. *
* * @param userIdGroupPairs * The security group and Amazon Web Services account ID pairs. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withUserIdGroupPairs(UserIdGroupPair... userIdGroupPairs) { if (this.userIdGroupPairs == null) { setUserIdGroupPairs(new com.amazonaws.internal.SdkInternalList* The security group and Amazon Web Services account ID pairs. *
* * @param userIdGroupPairs * The security group and Amazon Web Services account ID pairs. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withUserIdGroupPairs(java.util.Collection* The IPv4 ranges. *
* * @return The IPv4 ranges. */ public java.util.List* The IPv4 ranges. *
* * @param ipv4Ranges * The IPv4 ranges. */ public void setIpv4Ranges(java.util.Collection* The IPv4 ranges. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setIpv4Ranges(java.util.Collection)} or {@link #withIpv4Ranges(java.util.Collection)} if you want to * override the existing values. *
* * @param ipv4Ranges * The IPv4 ranges. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withIpv4Ranges(IpRange... ipv4Ranges) { if (this.ipv4Ranges == null) { setIpv4Ranges(new com.amazonaws.internal.SdkInternalList* The IPv4 ranges. *
* * @param ipv4Ranges * The IPv4 ranges. * @return Returns a reference to this object so that method calls can be chained together. */ public IpPermission withIpv4Ranges(java.util.Collection* One or more IP ranges. *
* * @return One or more IP ranges. * @deprecated Use {@link #getIpv4Ranges()}. */ @Deprecated public java.util.List* One or more IP ranges. *
* * @param ipRanges * One or more IP ranges. * @deprecated Use {@link #setIpv4Ranges(java.util.Collection)} */ @Deprecated public void setIpRanges(java.util.Collection* One or more IP ranges. *
** 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 * One or more IP ranges. * @return Returns a reference to this object so that method calls can be chained together. * @deprecated Use {@link #withIpv4Ranges(IpRange...)} */ @Deprecated public IpPermission withIpRanges(String... ipRanges) { if (this.ipv4Ranges == null) { setIpRanges(new com.amazonaws.internal.SdkInternalList* One or more IP ranges. *
* * @param ipRanges * One or more IP ranges. * @return Returns a reference to this object so that method calls can be chained together. * @deprecated Use {@link #withIpv4Ranges(java.util.Collection)} */ @Deprecated public IpPermission withIpRanges(java.util.Collection