/* * 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.securityhub.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* An IP permission for an EC2 security group. *
* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AwsEc2SecurityGroupIpPermission implements Serializable, Cloneable, StructuredPojo { /** *
* The IP protocol name (tcp
, udp
, icmp
, icmpv6
) or number.
*
* [VPC only] 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 start of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type number. *
** A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must specify all codes. *
*/ private Integer fromPort; /** ** The end of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code. *
*
* A value of -1
indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must
* specify all codes.
*
* The security group and Amazon Web Services account ID pairs. *
*/ private java.util.List* The IPv4 ranges. *
*/ private java.util.List* The IPv6 ranges. *
*/ private java.util.List* [VPC only] The prefix list IDs for an Amazon Web Services service. With outbound rules, this is the Amazon Web * Services service to access through a VPC endpoint from instances associated with the security group. *
*/ private java.util.List
* The IP protocol name (tcp
, udp
, icmp
, icmpv6
) or number.
*
* [VPC only] 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.
*
* [VPC only] 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.
*
* [VPC only] 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.
*
* [VPC only] 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.
*
* [VPC only] 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.
*
* [VPC only] 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 AwsEc2SecurityGroupIpPermission withIpProtocol(String ipProtocol) {
setIpProtocol(ipProtocol);
return this;
}
/**
*
* The start of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type number. *
** A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must specify all codes. *
* * @param fromPort * The start of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type number. ** A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must specify all * codes. */ public void setFromPort(Integer fromPort) { this.fromPort = fromPort; } /** *
* The start of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type number. *
** A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must specify all codes. *
* * @return The start of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type number. ** A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must specify all * codes. */ public Integer getFromPort() { return this.fromPort; } /** *
* The start of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type number. *
** A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must specify all codes. *
* * @param fromPort * The start of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type number. ** A value of -1 indicates all ICMP/ICMPv6 types. If you specify all ICMP/ICMPv6 types, you must specify all * codes. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsEc2SecurityGroupIpPermission withFromPort(Integer fromPort) { setFromPort(fromPort); return this; } /** *
* The end of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code. *
*
* A value of -1
indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must
* specify all codes.
*
* A value of -1
indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must
* specify all codes.
*/
public void setToPort(Integer toPort) {
this.toPort = toPort;
}
/**
*
* The end of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code. *
*
* A value of -1
indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must
* specify all codes.
*
* A value of -1
indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you
* must specify all codes.
*/
public Integer getToPort() {
return this.toPort;
}
/**
*
* The end of the port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code. *
*
* A value of -1
indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must
* specify all codes.
*
* A value of -1
indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must
* specify all codes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AwsEc2SecurityGroupIpPermission 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 AwsEc2SecurityGroupIpPermission withUserIdGroupPairs(AwsEc2SecurityGroupUserIdGroupPair... userIdGroupPairs) { if (this.userIdGroupPairs == null) { setUserIdGroupPairs(new java.util.ArrayList* 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 AwsEc2SecurityGroupIpPermission withUserIdGroupPairs(java.util.Collection* The IPv4 ranges. *
* * @return The IPv4 ranges. */ public java.util.List* The IPv4 ranges. *
* * @param ipRanges * The IPv4 ranges. */ public void setIpRanges(java.util.Collection* The IPv4 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 * The IPv4 ranges. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsEc2SecurityGroupIpPermission withIpRanges(AwsEc2SecurityGroupIpRange... ipRanges) { if (this.ipRanges == null) { setIpRanges(new java.util.ArrayList* The IPv4 ranges. *
* * @param ipRanges * The IPv4 ranges. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsEc2SecurityGroupIpPermission withIpRanges(java.util.Collection* 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 AwsEc2SecurityGroupIpPermission withIpv6Ranges(AwsEc2SecurityGroupIpv6Range... ipv6Ranges) { if (this.ipv6Ranges == null) { setIpv6Ranges(new java.util.ArrayList* The IPv6 ranges. *
* * @param ipv6Ranges * The IPv6 ranges. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsEc2SecurityGroupIpPermission withIpv6Ranges(java.util.Collection* [VPC only] The prefix list IDs for an Amazon Web Services service. With outbound rules, this is the Amazon Web * Services service to access through a VPC endpoint from instances associated with the security group. *
* * @return [VPC only] The prefix list IDs for an Amazon Web Services service. With outbound rules, this is the * Amazon Web Services service to access through a VPC endpoint from instances associated with the security * group. */ public java.util.List* [VPC only] The prefix list IDs for an Amazon Web Services service. With outbound rules, this is the Amazon Web * Services service to access through a VPC endpoint from instances associated with the security group. *
* * @param prefixListIds * [VPC only] The prefix list IDs for an Amazon Web Services service. With outbound rules, this is the Amazon * Web Services service to access through a VPC endpoint from instances associated with the security group. */ public void setPrefixListIds(java.util.Collection* [VPC only] The prefix list IDs for an Amazon Web Services service. With outbound rules, this is the Amazon Web * Services service to access through a VPC endpoint from instances associated with the security group. *
** 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 * [VPC only] The prefix list IDs for an Amazon Web Services service. With outbound rules, this is the Amazon * Web Services service to access through a VPC endpoint from instances associated with the security group. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsEc2SecurityGroupIpPermission withPrefixListIds(AwsEc2SecurityGroupPrefixListId... prefixListIds) { if (this.prefixListIds == null) { setPrefixListIds(new java.util.ArrayList* [VPC only] The prefix list IDs for an Amazon Web Services service. With outbound rules, this is the Amazon Web * Services service to access through a VPC endpoint from instances associated with the security group. *
* * @param prefixListIds * [VPC only] The prefix list IDs for an Amazon Web Services service. With outbound rules, this is the Amazon * Web Services service to access through a VPC endpoint from instances associated with the security group. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsEc2SecurityGroupIpPermission withPrefixListIds(java.util.Collection