Class: AWSCDK::EC2::CfnNetworkAclEntryProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ec2/cfn_network_acl_entry_props.rb

Overview

Properties for defining a CfnNetworkAclEntry.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(network_acl_id:, protocol:, rule_action:, rule_number:, cidr_block: nil, egress: nil, icmp: nil, ipv6_cidr_block: nil, port_range: nil) ⇒ CfnNetworkAclEntryProps

Returns a new instance of CfnNetworkAclEntryProps.

Parameters:

  • network_acl_id (String)

    The ID of the ACL for the entry.

  • protocol (Numeric)

    The IP protocol that the rule applies to.

  • rule_action (String)

    Whether to allow or deny traffic that matches the rule;

  • rule_number (Numeric)

    Rule number to assign to the entry, such as 100.

  • cidr_block (String, nil) (defaults to: nil)

    The IPv4 CIDR range to allow or deny, in CIDR notation (for example, 172.16.0.0/24). You must specify an IPv4 CIDR block or an IPv6 CIDR block.

  • egress (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Whether this rule applies to egress traffic from the subnet ( true ) or ingress traffic to the subnet ( false ).

  • icmp (AWSCDK::IResolvable, AWSCDK::EC2::CfnNetworkAclEntry::IcmpProperty, nil) (defaults to: nil)

    The Internet Control Message Protocol (ICMP) code and type.

  • ipv6_cidr_block (String, nil) (defaults to: nil)

    The IPv6 network range to allow or deny, in CIDR notation.

  • port_range (AWSCDK::IResolvable, AWSCDK::EC2::CfnNetworkAclEntry::PortRangeProperty, nil) (defaults to: nil)

    The range of port numbers for the UDP/TCP protocol.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'ec2/cfn_network_acl_entry_props.rb', line 18

def initialize(network_acl_id:, protocol:, rule_action:, rule_number:, cidr_block: nil, egress: nil, icmp: nil, ipv6_cidr_block: nil, port_range: nil)
  @network_acl_id = network_acl_id
  Jsii::Type.check_type(@network_acl_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "networkAclId")
  @protocol = protocol
  Jsii::Type.check_type(@protocol, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "protocol")
  @rule_action = rule_action
  Jsii::Type.check_type(@rule_action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ruleAction")
  @rule_number = rule_number
  Jsii::Type.check_type(@rule_number, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "ruleNumber")
  @cidr_block = cidr_block
  Jsii::Type.check_type(@cidr_block, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cidrBlock") unless @cidr_block.nil?
  @egress = egress
  Jsii::Type.check_type(@egress, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "egress") unless @egress.nil?
  @icmp = icmp.is_a?(Hash) ? ::AWSCDK::EC2::CfnNetworkAclEntry::IcmpProperty.new(**icmp.transform_keys(&:to_sym)) : icmp
  Jsii::Type.check_type(@icmp, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuTmV0d29ya0FjbEVudHJ5LkljbXBQcm9wZXJ0eSJ9XX19")), "icmp") unless @icmp.nil?
  @ipv6_cidr_block = ipv6_cidr_block
  Jsii::Type.check_type(@ipv6_cidr_block, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ipv6CidrBlock") unless @ipv6_cidr_block.nil?
  @port_range = port_range.is_a?(Hash) ? ::AWSCDK::EC2::CfnNetworkAclEntry::PortRangeProperty.new(**port_range.transform_keys(&:to_sym)) : port_range
  Jsii::Type.check_type(@port_range, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuTmV0d29ya0FjbEVudHJ5LlBvcnRSYW5nZVByb3BlcnR5In1dfX0=")), "portRange") unless @port_range.nil?
end

Instance Attribute Details

#cidr_blockString? (readonly)

The IPv4 CIDR range to allow or deny, in CIDR notation (for example, 172.16.0.0/24). You must specify an IPv4 CIDR block or an IPv6 CIDR block.



71
72
73
# File 'ec2/cfn_network_acl_entry_props.rb', line 71

def cidr_block
  @cidr_block
end

#egressBoolean, ... (readonly)

Whether this rule applies to egress traffic from the subnet ( true ) or ingress traffic to the subnet ( false ).

By default, AWS CloudFormation specifies false .



78
79
80
# File 'ec2/cfn_network_acl_entry_props.rb', line 78

def egress
  @egress
end

#icmpAWSCDK::IResolvable, ... (readonly)

The Internet Control Message Protocol (ICMP) code and type.

Required if specifying 1 (ICMP) for the protocol parameter.



85
86
87
# File 'ec2/cfn_network_acl_entry_props.rb', line 85

def icmp
  @icmp
end

#ipv6_cidr_blockString? (readonly)

The IPv6 network range to allow or deny, in CIDR notation.

You must specify an IPv4 CIDR block or an IPv6 CIDR block.



92
93
94
# File 'ec2/cfn_network_acl_entry_props.rb', line 92

def ipv6_cidr_block
  @ipv6_cidr_block
end

#network_acl_idString (readonly)

The ID of the ACL for the entry.



43
44
45
# File 'ec2/cfn_network_acl_entry_props.rb', line 43

def network_acl_id
  @network_acl_id
end

#port_rangeAWSCDK::IResolvable, ... (readonly)

The range of port numbers for the UDP/TCP protocol.

Required if specifying 6 (TCP) or 17 (UDP) for the protocol parameter.



99
100
101
# File 'ec2/cfn_network_acl_entry_props.rb', line 99

def port_range
  @port_range
end

#protocolNumeric (readonly)

The IP protocol that the rule applies to.

You must specify -1 or a protocol number. You can specify -1 for all protocols.

If you specify -1, all ports are opened and the PortRange property is ignored.



52
53
54
# File 'ec2/cfn_network_acl_entry_props.rb', line 52

def protocol
  @protocol
end

#rule_actionString (readonly)

Whether to allow or deny traffic that matches the rule;

valid values are "allow" or "deny".



59
60
61
# File 'ec2/cfn_network_acl_entry_props.rb', line 59

def rule_action
  @rule_action
end

#rule_numberNumeric (readonly)

Rule number to assign to the entry, such as 100.

ACL entries are processed in ascending order by rule number. Entries can't use the same rule number unless one is an egress rule and the other is an ingress rule.



66
67
68
# File 'ec2/cfn_network_acl_entry_props.rb', line 66

def rule_number
  @rule_number
end

Class Method Details

.jsii_propertiesObject



101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'ec2/cfn_network_acl_entry_props.rb', line 101

def self.jsii_properties
  {
    :network_acl_id => "networkAclId",
    :protocol => "protocol",
    :rule_action => "ruleAction",
    :rule_number => "ruleNumber",
    :cidr_block => "cidrBlock",
    :egress => "egress",
    :icmp => "icmp",
    :ipv6_cidr_block => "ipv6CidrBlock",
    :port_range => "portRange",
  }
end

Instance Method Details

#to_jsiiObject



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'ec2/cfn_network_acl_entry_props.rb', line 115

def to_jsii
  result = {}
  result.merge!({
    "networkAclId" => @network_acl_id,
    "protocol" => @protocol,
    "ruleAction" => @rule_action,
    "ruleNumber" => @rule_number,
    "cidrBlock" => @cidr_block,
    "egress" => @egress,
    "icmp" => @icmp,
    "ipv6CidrBlock" => @ipv6_cidr_block,
    "portRange" => @port_range,
  })
  result.compact
end