/* * 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 security group rule. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SecurityGroupRule implements Serializable, Cloneable { /** ** The ID of the security group rule. *
*/ private String securityGroupRuleId; /** ** The ID of the security group. *
*/ private String groupId; /** ** The ID of the Amazon Web Services account that owns the security group. *
*/ private String groupOwnerId; /** ** Indicates whether the security group rule is an outbound rule. *
*/ private Boolean isEgress; /** *
* The IP protocol name (tcp
, udp
, icmp
, icmpv6
) or number (see
* Protocol Numbers).
*
* Use -1
to specify all protocols.
*
* 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; /** ** 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 * type number. 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 IPv4 CIDR range. *
*/ private String cidrIpv4; /** ** The IPv6 CIDR range. *
*/ private String cidrIpv6; /** ** The ID of the prefix list. *
*/ private String prefixListId; /** ** Describes the security group that is referenced in the rule. *
*/ private ReferencedSecurityGroup referencedGroupInfo; /** ** The security group rule description. *
*/ private String description; /** ** The tags applied to the security group rule. *
*/ private com.amazonaws.internal.SdkInternalList* The ID of the security group rule. *
* * @param securityGroupRuleId * The ID of the security group rule. */ public void setSecurityGroupRuleId(String securityGroupRuleId) { this.securityGroupRuleId = securityGroupRuleId; } /** ** The ID of the security group rule. *
* * @return The ID of the security group rule. */ public String getSecurityGroupRuleId() { return this.securityGroupRuleId; } /** ** The ID of the security group rule. *
* * @param securityGroupRuleId * The ID of the security group rule. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withSecurityGroupRuleId(String securityGroupRuleId) { setSecurityGroupRuleId(securityGroupRuleId); 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 SecurityGroupRule withGroupId(String groupId) { setGroupId(groupId); return this; } /** ** The ID of the Amazon Web Services account that owns the security group. *
* * @param groupOwnerId * The ID of the Amazon Web Services account that owns the security group. */ public void setGroupOwnerId(String groupOwnerId) { this.groupOwnerId = groupOwnerId; } /** ** The ID of the Amazon Web Services account that owns the security group. *
* * @return The ID of the Amazon Web Services account that owns the security group. */ public String getGroupOwnerId() { return this.groupOwnerId; } /** ** The ID of the Amazon Web Services account that owns the security group. *
* * @param groupOwnerId * The ID of the Amazon Web Services account that owns the security group. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withGroupOwnerId(String groupOwnerId) { setGroupOwnerId(groupOwnerId); return this; } /** ** Indicates whether the security group rule is an outbound rule. *
* * @param isEgress * Indicates whether the security group rule is an outbound rule. */ public void setIsEgress(Boolean isEgress) { this.isEgress = isEgress; } /** ** Indicates whether the security group rule is an outbound rule. *
* * @return Indicates whether the security group rule is an outbound rule. */ public Boolean getIsEgress() { return this.isEgress; } /** ** Indicates whether the security group rule is an outbound rule. *
* * @param isEgress * Indicates whether the security group rule is an outbound rule. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withIsEgress(Boolean isEgress) { setIsEgress(isEgress); return this; } /** ** Indicates whether the security group rule is an outbound rule. *
* * @return Indicates whether the security group rule is an outbound rule. */ public Boolean isEgress() { return this.isEgress; } /** *
* The IP protocol name (tcp
, udp
, icmp
, icmpv6
) or number (see
* Protocol Numbers).
*
* Use -1
to specify all protocols.
*
tcp
, udp
, icmp
, icmpv6
) or
* number (see Protocol
* Numbers).
*
* Use -1
to specify all protocols.
*/
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.
*
tcp
, udp
, icmp
, icmpv6
) or
* number (see Protocol
* Numbers).
*
* Use -1
to specify all protocols.
*/
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.
*
tcp
, udp
, icmp
, icmpv6
) or
* number (see Protocol
* Numbers).
*
* Use -1
to specify all protocols.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SecurityGroupRule withIpProtocol(String ipProtocol) {
setIpProtocol(ipProtocol);
return this;
}
/**
*
* 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 SecurityGroupRule withFromPort(Integer fromPort) { setFromPort(fromPort); return this; } /** ** 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 * type number. 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 type number. 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 * type number. 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 type number. 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 * type number. 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 type number. 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 SecurityGroupRule withToPort(Integer toPort) { setToPort(toPort); return this; } /** ** The IPv4 CIDR range. *
* * @param cidrIpv4 * The IPv4 CIDR range. */ public void setCidrIpv4(String cidrIpv4) { this.cidrIpv4 = cidrIpv4; } /** ** The IPv4 CIDR range. *
* * @return The IPv4 CIDR range. */ public String getCidrIpv4() { return this.cidrIpv4; } /** ** The IPv4 CIDR range. *
* * @param cidrIpv4 * The IPv4 CIDR range. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withCidrIpv4(String cidrIpv4) { setCidrIpv4(cidrIpv4); return this; } /** ** The IPv6 CIDR range. *
* * @param cidrIpv6 * The IPv6 CIDR range. */ public void setCidrIpv6(String cidrIpv6) { this.cidrIpv6 = cidrIpv6; } /** ** The IPv6 CIDR range. *
* * @return The IPv6 CIDR range. */ public String getCidrIpv6() { return this.cidrIpv6; } /** ** The IPv6 CIDR range. *
* * @param cidrIpv6 * The IPv6 CIDR range. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withCidrIpv6(String cidrIpv6) { setCidrIpv6(cidrIpv6); return this; } /** ** The ID of the prefix list. *
* * @param prefixListId * The ID of the prefix list. */ public void setPrefixListId(String prefixListId) { this.prefixListId = prefixListId; } /** ** The ID of the prefix list. *
* * @return The ID of the prefix list. */ public String getPrefixListId() { return this.prefixListId; } /** ** The ID of the prefix list. *
* * @param prefixListId * The ID of the prefix list. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withPrefixListId(String prefixListId) { setPrefixListId(prefixListId); return this; } /** ** Describes the security group that is referenced in the rule. *
* * @param referencedGroupInfo * Describes the security group that is referenced in the rule. */ public void setReferencedGroupInfo(ReferencedSecurityGroup referencedGroupInfo) { this.referencedGroupInfo = referencedGroupInfo; } /** ** Describes the security group that is referenced in the rule. *
* * @return Describes the security group that is referenced in the rule. */ public ReferencedSecurityGroup getReferencedGroupInfo() { return this.referencedGroupInfo; } /** ** Describes the security group that is referenced in the rule. *
* * @param referencedGroupInfo * Describes the security group that is referenced in the rule. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withReferencedGroupInfo(ReferencedSecurityGroup referencedGroupInfo) { setReferencedGroupInfo(referencedGroupInfo); return this; } /** ** The security group rule description. *
* * @param description * The security group rule description. */ public void setDescription(String description) { this.description = description; } /** ** The security group rule description. *
* * @return The security group rule description. */ public String getDescription() { return this.description; } /** ** The security group rule description. *
* * @param description * The security group rule description. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withDescription(String description) { setDescription(description); return this; } /** ** The tags applied to the security group rule. *
* * @return The tags applied to the security group rule. */ public java.util.List* The tags applied to the security group rule. *
* * @param tags * The tags applied to the security group rule. */ public void setTags(java.util.Collection* The tags applied to the security group rule. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the * existing values. *
* * @param tags * The tags applied to the security group rule. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withTags(Tag... tags) { if (this.tags == null) { setTags(new com.amazonaws.internal.SdkInternalList* The tags applied to the security group rule. *
* * @param tags * The tags applied to the security group rule. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityGroupRule withTags(java.util.Collection