Class: AWSCDK::EC2::AclTrafficConfig

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

Overview

Acl Configuration for traffic.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(protocol:, icmp: nil, port_range: nil) ⇒ AclTrafficConfig

Returns a new instance of AclTrafficConfig.

Parameters:

  • protocol (Numeric)

    The protocol number.

  • icmp (AWSCDK::EC2::AclIcmp, nil) (defaults to: nil)

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

  • port_range (AWSCDK::EC2::AclPortRange, nil) (defaults to: nil)

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



10
11
12
13
14
15
16
17
# File 'ec2/acl_traffic_config.rb', line 10

def initialize(protocol:, icmp: nil, port_range: nil)
  @protocol = protocol
  Jsii::Type.check_type(@protocol, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "protocol")
  @icmp = icmp.is_a?(Hash) ? ::AWSCDK::EC2::AclIcmp.new(**icmp.transform_keys(&:to_sym)) : icmp
  Jsii::Type.check_type(@icmp, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkFjbEljbXAifQ==")), "icmp") unless @icmp.nil?
  @port_range = port_range.is_a?(Hash) ? ::AWSCDK::EC2::AclPortRange.new(**port_range.transform_keys(&:to_sym)) : port_range
  Jsii::Type.check_type(@port_range, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkFjbFBvcnRSYW5nZSJ9")), "portRange") unless @port_range.nil?
end

Instance Attribute Details

#icmpAWSCDK::EC2::AclIcmp? (readonly)

Note:

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

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

Returns:



39
40
41
# File 'ec2/acl_traffic_config.rb', line 39

def icmp
  @icmp
end

#port_rangeAWSCDK::EC2::AclPortRange? (readonly)

Note:

Default: - Required if specifying 6 (TCP) or 17 (UDP) for the protocol parameter

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

Returns:



44
45
46
# File 'ec2/acl_traffic_config.rb', line 44

def port_range
  @port_range
end

#protocolNumeric (readonly)

Note:

Default: 17

The protocol number.

A value of "-1" means all protocols.

If you specify "-1" or a protocol number other than "6" (TCP), "17" (UDP), or "1" (ICMP), traffic on all ports is allowed, regardless of any ports or ICMP types or codes that you specify.

If you specify protocol "58" (ICMPv6) and specify an IPv4 CIDR block, traffic for all ICMP types and codes allowed, regardless of any that you specify. If you specify protocol "58" (ICMPv6) and specify an IPv6 CIDR block, you must specify an ICMP type and code.

Returns:

  • (Numeric)


34
35
36
# File 'ec2/acl_traffic_config.rb', line 34

def protocol
  @protocol
end

Class Method Details

.jsii_propertiesObject



46
47
48
49
50
51
52
# File 'ec2/acl_traffic_config.rb', line 46

def self.jsii_properties
  {
    :protocol => "protocol",
    :icmp => "icmp",
    :port_range => "portRange",
  }
end

Instance Method Details

#to_jsiiObject



54
55
56
57
58
59
60
61
62
# File 'ec2/acl_traffic_config.rb', line 54

def to_jsii
  result = {}
  result.merge!({
    "protocol" => @protocol,
    "icmp" => @icmp,
    "portRange" => @port_range,
  })
  result.compact
end