/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include namespace Aws { namespace Utils { namespace Xml { class XmlNode; } // namespace Xml } // namespace Utils namespace EC2 { namespace Model { /** *

Describes a security group rule.

You must specify exactly one of the * following parameters, based on the rule type:

  • CidrIpv4

    *
  • CidrIpv6

  • PrefixListId

  • *

    ReferencedGroupId

When you modify a rule, you cannot * change the rule type. For example, if the rule uses an IPv4 address range, you * must use CidrIpv4 to specify a new IPv4 address * range.

See Also:

AWS * API Reference

*/ class SecurityGroupRuleRequest { public: AWS_EC2_API SecurityGroupRuleRequest(); AWS_EC2_API SecurityGroupRuleRequest(const Aws::Utils::Xml::XmlNode& xmlNode); AWS_EC2_API SecurityGroupRuleRequest& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); AWS_EC2_API void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; AWS_EC2_API void OutputToStream(Aws::OStream& oStream, const char* location) const; /** *

The IP protocol name (tcp, udp, icmp, * icmpv6) or number (see Protocol * Numbers).

Use -1 to specify all protocols.

*/ inline const Aws::String& GetIpProtocol() const{ return m_ipProtocol; } /** *

The IP protocol name (tcp, udp, icmp, * icmpv6) or number (see Protocol * Numbers).

Use -1 to specify all protocols.

*/ inline bool IpProtocolHasBeenSet() const { return m_ipProtocolHasBeenSet; } /** *

The IP protocol name (tcp, udp, icmp, * icmpv6) or number (see Protocol * Numbers).

Use -1 to specify all protocols.

*/ inline void SetIpProtocol(const Aws::String& value) { m_ipProtocolHasBeenSet = true; m_ipProtocol = value; } /** *

The IP protocol name (tcp, udp, icmp, * icmpv6) or number (see Protocol * Numbers).

Use -1 to specify all protocols.

*/ inline void SetIpProtocol(Aws::String&& value) { m_ipProtocolHasBeenSet = true; m_ipProtocol = std::move(value); } /** *

The IP protocol name (tcp, udp, icmp, * icmpv6) or number (see Protocol * Numbers).

Use -1 to specify all protocols.

*/ inline void SetIpProtocol(const char* value) { m_ipProtocolHasBeenSet = true; m_ipProtocol.assign(value); } /** *

The IP protocol name (tcp, udp, icmp, * icmpv6) or number (see Protocol * Numbers).

Use -1 to specify all protocols.

*/ inline SecurityGroupRuleRequest& WithIpProtocol(const Aws::String& value) { SetIpProtocol(value); return *this;} /** *

The IP protocol name (tcp, udp, icmp, * icmpv6) or number (see Protocol * Numbers).

Use -1 to specify all protocols.

*/ inline SecurityGroupRuleRequest& WithIpProtocol(Aws::String&& value) { SetIpProtocol(std::move(value)); return *this;} /** *

The IP protocol name (tcp, udp, icmp, * icmpv6) or number (see Protocol * Numbers).

Use -1 to specify all protocols.

*/ inline SecurityGroupRuleRequest& WithIpProtocol(const char* value) { SetIpProtocol(value); 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.

*/ inline int GetFromPort() const{ return m_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.

*/ inline bool FromPortHasBeenSet() const { return m_fromPortHasBeenSet; } /** *

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.

*/ inline void SetFromPort(int value) { m_fromPortHasBeenSet = true; m_fromPort = value; } /** *

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.

*/ inline SecurityGroupRuleRequest& WithFromPort(int value) { SetFromPort(value); 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 code. A value of -1 indicates all * ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 types, you must specify all * ICMP/ICMPv6 codes.

*/ inline int GetToPort() const{ return m_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.

*/ inline bool ToPortHasBeenSet() const { return m_toPortHasBeenSet; } /** *

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.

*/ inline void SetToPort(int value) { m_toPortHasBeenSet = true; m_toPort = value; } /** *

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.

*/ inline SecurityGroupRuleRequest& WithToPort(int value) { SetToPort(value); return *this;} /** *

The IPv4 CIDR range. To specify a single IPv4 address, use the /32 prefix * length.

*/ inline const Aws::String& GetCidrIpv4() const{ return m_cidrIpv4; } /** *

The IPv4 CIDR range. To specify a single IPv4 address, use the /32 prefix * length.

*/ inline bool CidrIpv4HasBeenSet() const { return m_cidrIpv4HasBeenSet; } /** *

The IPv4 CIDR range. To specify a single IPv4 address, use the /32 prefix * length.

*/ inline void SetCidrIpv4(const Aws::String& value) { m_cidrIpv4HasBeenSet = true; m_cidrIpv4 = value; } /** *

The IPv4 CIDR range. To specify a single IPv4 address, use the /32 prefix * length.

*/ inline void SetCidrIpv4(Aws::String&& value) { m_cidrIpv4HasBeenSet = true; m_cidrIpv4 = std::move(value); } /** *

The IPv4 CIDR range. To specify a single IPv4 address, use the /32 prefix * length.

*/ inline void SetCidrIpv4(const char* value) { m_cidrIpv4HasBeenSet = true; m_cidrIpv4.assign(value); } /** *

The IPv4 CIDR range. To specify a single IPv4 address, use the /32 prefix * length.

*/ inline SecurityGroupRuleRequest& WithCidrIpv4(const Aws::String& value) { SetCidrIpv4(value); return *this;} /** *

The IPv4 CIDR range. To specify a single IPv4 address, use the /32 prefix * length.

*/ inline SecurityGroupRuleRequest& WithCidrIpv4(Aws::String&& value) { SetCidrIpv4(std::move(value)); return *this;} /** *

The IPv4 CIDR range. To specify a single IPv4 address, use the /32 prefix * length.

*/ inline SecurityGroupRuleRequest& WithCidrIpv4(const char* value) { SetCidrIpv4(value); return *this;} /** *

The IPv6 CIDR range. To specify a single IPv6 address, use the /128 prefix * length.

*/ inline const Aws::String& GetCidrIpv6() const{ return m_cidrIpv6; } /** *

The IPv6 CIDR range. To specify a single IPv6 address, use the /128 prefix * length.

*/ inline bool CidrIpv6HasBeenSet() const { return m_cidrIpv6HasBeenSet; } /** *

The IPv6 CIDR range. To specify a single IPv6 address, use the /128 prefix * length.

*/ inline void SetCidrIpv6(const Aws::String& value) { m_cidrIpv6HasBeenSet = true; m_cidrIpv6 = value; } /** *

The IPv6 CIDR range. To specify a single IPv6 address, use the /128 prefix * length.

*/ inline void SetCidrIpv6(Aws::String&& value) { m_cidrIpv6HasBeenSet = true; m_cidrIpv6 = std::move(value); } /** *

The IPv6 CIDR range. To specify a single IPv6 address, use the /128 prefix * length.

*/ inline void SetCidrIpv6(const char* value) { m_cidrIpv6HasBeenSet = true; m_cidrIpv6.assign(value); } /** *

The IPv6 CIDR range. To specify a single IPv6 address, use the /128 prefix * length.

*/ inline SecurityGroupRuleRequest& WithCidrIpv6(const Aws::String& value) { SetCidrIpv6(value); return *this;} /** *

The IPv6 CIDR range. To specify a single IPv6 address, use the /128 prefix * length.

*/ inline SecurityGroupRuleRequest& WithCidrIpv6(Aws::String&& value) { SetCidrIpv6(std::move(value)); return *this;} /** *

The IPv6 CIDR range. To specify a single IPv6 address, use the /128 prefix * length.

*/ inline SecurityGroupRuleRequest& WithCidrIpv6(const char* value) { SetCidrIpv6(value); return *this;} /** *

The ID of the prefix list.

*/ inline const Aws::String& GetPrefixListId() const{ return m_prefixListId; } /** *

The ID of the prefix list.

*/ inline bool PrefixListIdHasBeenSet() const { return m_prefixListIdHasBeenSet; } /** *

The ID of the prefix list.

*/ inline void SetPrefixListId(const Aws::String& value) { m_prefixListIdHasBeenSet = true; m_prefixListId = value; } /** *

The ID of the prefix list.

*/ inline void SetPrefixListId(Aws::String&& value) { m_prefixListIdHasBeenSet = true; m_prefixListId = std::move(value); } /** *

The ID of the prefix list.

*/ inline void SetPrefixListId(const char* value) { m_prefixListIdHasBeenSet = true; m_prefixListId.assign(value); } /** *

The ID of the prefix list.

*/ inline SecurityGroupRuleRequest& WithPrefixListId(const Aws::String& value) { SetPrefixListId(value); return *this;} /** *

The ID of the prefix list.

*/ inline SecurityGroupRuleRequest& WithPrefixListId(Aws::String&& value) { SetPrefixListId(std::move(value)); return *this;} /** *

The ID of the prefix list.

*/ inline SecurityGroupRuleRequest& WithPrefixListId(const char* value) { SetPrefixListId(value); return *this;} /** *

The ID of the security group that is referenced in the security group * rule.

*/ inline const Aws::String& GetReferencedGroupId() const{ return m_referencedGroupId; } /** *

The ID of the security group that is referenced in the security group * rule.

*/ inline bool ReferencedGroupIdHasBeenSet() const { return m_referencedGroupIdHasBeenSet; } /** *

The ID of the security group that is referenced in the security group * rule.

*/ inline void SetReferencedGroupId(const Aws::String& value) { m_referencedGroupIdHasBeenSet = true; m_referencedGroupId = value; } /** *

The ID of the security group that is referenced in the security group * rule.

*/ inline void SetReferencedGroupId(Aws::String&& value) { m_referencedGroupIdHasBeenSet = true; m_referencedGroupId = std::move(value); } /** *

The ID of the security group that is referenced in the security group * rule.

*/ inline void SetReferencedGroupId(const char* value) { m_referencedGroupIdHasBeenSet = true; m_referencedGroupId.assign(value); } /** *

The ID of the security group that is referenced in the security group * rule.

*/ inline SecurityGroupRuleRequest& WithReferencedGroupId(const Aws::String& value) { SetReferencedGroupId(value); return *this;} /** *

The ID of the security group that is referenced in the security group * rule.

*/ inline SecurityGroupRuleRequest& WithReferencedGroupId(Aws::String&& value) { SetReferencedGroupId(std::move(value)); return *this;} /** *

The ID of the security group that is referenced in the security group * rule.

*/ inline SecurityGroupRuleRequest& WithReferencedGroupId(const char* value) { SetReferencedGroupId(value); return *this;} /** *

The description of the security group rule.

*/ inline const Aws::String& GetDescription() const{ return m_description; } /** *

The description of the security group rule.

*/ inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } /** *

The description of the security group rule.

*/ inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } /** *

The description of the security group rule.

*/ inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } /** *

The description of the security group rule.

*/ inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } /** *

The description of the security group rule.

*/ inline SecurityGroupRuleRequest& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} /** *

The description of the security group rule.

*/ inline SecurityGroupRuleRequest& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} /** *

The description of the security group rule.

*/ inline SecurityGroupRuleRequest& WithDescription(const char* value) { SetDescription(value); return *this;} private: Aws::String m_ipProtocol; bool m_ipProtocolHasBeenSet = false; int m_fromPort; bool m_fromPortHasBeenSet = false; int m_toPort; bool m_toPortHasBeenSet = false; Aws::String m_cidrIpv4; bool m_cidrIpv4HasBeenSet = false; Aws::String m_cidrIpv6; bool m_cidrIpv6HasBeenSet = false; Aws::String m_prefixListId; bool m_prefixListIdHasBeenSet = false; Aws::String m_referencedGroupId; bool m_referencedGroupIdHasBeenSet = false; Aws::String m_description; bool m_descriptionHasBeenSet = false; }; } // namespace Model } // namespace EC2 } // namespace Aws