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

Describes a set of permissions for a security group rule.

See * Also:

AWS * API Reference

*/ class IpPermission { public: AWS_EC2_API IpPermission(); AWS_EC2_API IpPermission(const Aws::Utils::Xml::XmlNode& xmlNode); AWS_EC2_API IpPermission& 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; /** *

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 IpPermission& WithFromPort(int value) { SetFromPort(value); 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.

*/ 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. 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.

*/ 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. 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.

*/ 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. 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.

*/ 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. 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.

*/ 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. 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.

*/ inline IpPermission& 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. 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.

*/ inline IpPermission& 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. 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.

*/ inline IpPermission& WithIpProtocol(const char* value) { SetIpProtocol(value); return *this;} /** *

The IPv4 ranges.

*/ inline const Aws::Vector& GetIpRanges() const{ return m_ipRanges; } /** *

The IPv4 ranges.

*/ inline bool IpRangesHasBeenSet() const { return m_ipRangesHasBeenSet; } /** *

The IPv4 ranges.

*/ inline void SetIpRanges(const Aws::Vector& value) { m_ipRangesHasBeenSet = true; m_ipRanges = value; } /** *

The IPv4 ranges.

*/ inline void SetIpRanges(Aws::Vector&& value) { m_ipRangesHasBeenSet = true; m_ipRanges = std::move(value); } /** *

The IPv4 ranges.

*/ inline IpPermission& WithIpRanges(const Aws::Vector& value) { SetIpRanges(value); return *this;} /** *

The IPv4 ranges.

*/ inline IpPermission& WithIpRanges(Aws::Vector&& value) { SetIpRanges(std::move(value)); return *this;} /** *

The IPv4 ranges.

*/ inline IpPermission& AddIpRanges(const IpRange& value) { m_ipRangesHasBeenSet = true; m_ipRanges.push_back(value); return *this; } /** *

The IPv4 ranges.

*/ inline IpPermission& AddIpRanges(IpRange&& value) { m_ipRangesHasBeenSet = true; m_ipRanges.push_back(std::move(value)); return *this; } /** *

The IPv6 ranges.

*/ inline const Aws::Vector& GetIpv6Ranges() const{ return m_ipv6Ranges; } /** *

The IPv6 ranges.

*/ inline bool Ipv6RangesHasBeenSet() const { return m_ipv6RangesHasBeenSet; } /** *

The IPv6 ranges.

*/ inline void SetIpv6Ranges(const Aws::Vector& value) { m_ipv6RangesHasBeenSet = true; m_ipv6Ranges = value; } /** *

The IPv6 ranges.

*/ inline void SetIpv6Ranges(Aws::Vector&& value) { m_ipv6RangesHasBeenSet = true; m_ipv6Ranges = std::move(value); } /** *

The IPv6 ranges.

*/ inline IpPermission& WithIpv6Ranges(const Aws::Vector& value) { SetIpv6Ranges(value); return *this;} /** *

The IPv6 ranges.

*/ inline IpPermission& WithIpv6Ranges(Aws::Vector&& value) { SetIpv6Ranges(std::move(value)); return *this;} /** *

The IPv6 ranges.

*/ inline IpPermission& AddIpv6Ranges(const Ipv6Range& value) { m_ipv6RangesHasBeenSet = true; m_ipv6Ranges.push_back(value); return *this; } /** *

The IPv6 ranges.

*/ inline IpPermission& AddIpv6Ranges(Ipv6Range&& value) { m_ipv6RangesHasBeenSet = true; m_ipv6Ranges.push_back(std::move(value)); return *this; } /** *

The prefix list IDs.

*/ inline const Aws::Vector& GetPrefixListIds() const{ return m_prefixListIds; } /** *

The prefix list IDs.

*/ inline bool PrefixListIdsHasBeenSet() const { return m_prefixListIdsHasBeenSet; } /** *

The prefix list IDs.

*/ inline void SetPrefixListIds(const Aws::Vector& value) { m_prefixListIdsHasBeenSet = true; m_prefixListIds = value; } /** *

The prefix list IDs.

*/ inline void SetPrefixListIds(Aws::Vector&& value) { m_prefixListIdsHasBeenSet = true; m_prefixListIds = std::move(value); } /** *

The prefix list IDs.

*/ inline IpPermission& WithPrefixListIds(const Aws::Vector& value) { SetPrefixListIds(value); return *this;} /** *

The prefix list IDs.

*/ inline IpPermission& WithPrefixListIds(Aws::Vector&& value) { SetPrefixListIds(std::move(value)); return *this;} /** *

The prefix list IDs.

*/ inline IpPermission& AddPrefixListIds(const PrefixListId& value) { m_prefixListIdsHasBeenSet = true; m_prefixListIds.push_back(value); return *this; } /** *

The prefix list IDs.

*/ inline IpPermission& AddPrefixListIds(PrefixListId&& value) { m_prefixListIdsHasBeenSet = true; m_prefixListIds.push_back(std::move(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 IpPermission& WithToPort(int value) { SetToPort(value); return *this;} /** *

The security group and Amazon Web Services account ID pairs.

*/ inline const Aws::Vector& GetUserIdGroupPairs() const{ return m_userIdGroupPairs; } /** *

The security group and Amazon Web Services account ID pairs.

*/ inline bool UserIdGroupPairsHasBeenSet() const { return m_userIdGroupPairsHasBeenSet; } /** *

The security group and Amazon Web Services account ID pairs.

*/ inline void SetUserIdGroupPairs(const Aws::Vector& value) { m_userIdGroupPairsHasBeenSet = true; m_userIdGroupPairs = value; } /** *

The security group and Amazon Web Services account ID pairs.

*/ inline void SetUserIdGroupPairs(Aws::Vector&& value) { m_userIdGroupPairsHasBeenSet = true; m_userIdGroupPairs = std::move(value); } /** *

The security group and Amazon Web Services account ID pairs.

*/ inline IpPermission& WithUserIdGroupPairs(const Aws::Vector& value) { SetUserIdGroupPairs(value); return *this;} /** *

The security group and Amazon Web Services account ID pairs.

*/ inline IpPermission& WithUserIdGroupPairs(Aws::Vector&& value) { SetUserIdGroupPairs(std::move(value)); return *this;} /** *

The security group and Amazon Web Services account ID pairs.

*/ inline IpPermission& AddUserIdGroupPairs(const UserIdGroupPair& value) { m_userIdGroupPairsHasBeenSet = true; m_userIdGroupPairs.push_back(value); return *this; } /** *

The security group and Amazon Web Services account ID pairs.

*/ inline IpPermission& AddUserIdGroupPairs(UserIdGroupPair&& value) { m_userIdGroupPairsHasBeenSet = true; m_userIdGroupPairs.push_back(std::move(value)); return *this; } private: int m_fromPort; bool m_fromPortHasBeenSet = false; Aws::String m_ipProtocol; bool m_ipProtocolHasBeenSet = false; Aws::Vector m_ipRanges; bool m_ipRangesHasBeenSet = false; Aws::Vector m_ipv6Ranges; bool m_ipv6RangesHasBeenSet = false; Aws::Vector m_prefixListIds; bool m_prefixListIdsHasBeenSet = false; int m_toPort; bool m_toPortHasBeenSet = false; Aws::Vector m_userIdGroupPairs; bool m_userIdGroupPairsHasBeenSet = false; }; } // namespace Model } // namespace EC2 } // namespace Aws