/** * 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 namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace SecurityHub { namespace Model { /** *

An IP permission for an EC2 security group.

See Also:

AWS * API Reference

*/ class AwsEc2SecurityGroupIpPermission { public: AWS_SECURITYHUB_API AwsEc2SecurityGroupIpPermission(); AWS_SECURITYHUB_API AwsEc2SecurityGroupIpPermission(Aws::Utils::Json::JsonView jsonValue); AWS_SECURITYHUB_API AwsEc2SecurityGroupIpPermission& operator=(Aws::Utils::Json::JsonView jsonValue); AWS_SECURITYHUB_API Aws::Utils::Json::JsonValue Jsonize() const; /** *

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.

*/ inline const Aws::String& GetIpProtocol() const{ return m_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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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

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

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.

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

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.

*/ inline AwsEc2SecurityGroupIpPermission& WithFromPort(int value) { SetFromPort(value); 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.

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

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

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.

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

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.

*/ inline AwsEc2SecurityGroupIpPermission& 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 AwsEc2SecurityGroupIpPermission& WithUserIdGroupPairs(const Aws::Vector& value) { SetUserIdGroupPairs(value); return *this;} /** *

The security group and Amazon Web Services account ID pairs.

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

The security group and Amazon Web Services account ID pairs.

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

The security group and Amazon Web Services account ID pairs.

*/ inline AwsEc2SecurityGroupIpPermission& AddUserIdGroupPairs(AwsEc2SecurityGroupUserIdGroupPair&& value) { m_userIdGroupPairsHasBeenSet = true; m_userIdGroupPairs.push_back(std::move(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 AwsEc2SecurityGroupIpPermission& WithIpRanges(const Aws::Vector& value) { SetIpRanges(value); return *this;} /** *

The IPv4 ranges.

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

The IPv4 ranges.

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

The IPv4 ranges.

*/ inline AwsEc2SecurityGroupIpPermission& AddIpRanges(AwsEc2SecurityGroupIpRange&& 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 AwsEc2SecurityGroupIpPermission& WithIpv6Ranges(const Aws::Vector& value) { SetIpv6Ranges(value); return *this;} /** *

The IPv6 ranges.

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

The IPv6 ranges.

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

The IPv6 ranges.

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

[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.

*/ inline const Aws::Vector& GetPrefixListIds() const{ return m_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.

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

[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.

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

[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.

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

[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.

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

[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.

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

[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.

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

[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.

*/ inline AwsEc2SecurityGroupIpPermission& AddPrefixListIds(AwsEc2SecurityGroupPrefixListId&& value) { m_prefixListIdsHasBeenSet = true; m_prefixListIds.push_back(std::move(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::Vector m_userIdGroupPairs; bool m_userIdGroupPairsHasBeenSet = 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; }; } // namespace Model } // namespace SecurityHub } // namespace Aws