Class: AWSCDK::EC2::ConnectionRule

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_port:, description: nil, protocol: nil, to_port: nil) ⇒ ConnectionRule

Returns a new instance of ConnectionRule.

Parameters:

  • from_port (Numeric)

    Start of port range for the TCP and UDP protocols, or an ICMP type number.

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

    Description of this connection.

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

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

  • to_port (Numeric, nil) (defaults to: nil)

    End of port range for the TCP and UDP protocols, or an ICMP code.



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

def initialize(from_port:, description: nil, protocol: nil, to_port: nil)
  @from_port = from_port
  Jsii::Type.check_type(@from_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "fromPort")
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @protocol = protocol
  Jsii::Type.check_type(@protocol, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "protocol") unless @protocol.nil?
  @to_port = to_port
  Jsii::Type.check_type(@to_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "toPort") unless @to_port.nil?
end

Instance Attribute Details

#descriptionString? (readonly)

Note:

Default: No description

Description of this connection.

It is applied to both the ingress rule and the egress rule.

Returns:

  • (String, nil)


35
36
37
# File 'ec2/connection_rule.rb', line 35

def description
  @description
end

#from_portNumeric (readonly)

Start of port range for the TCP and UDP protocols, or an ICMP type number.

If you specify icmp for the IpProtocol property, you can specify -1 as a wildcard (i.e., any ICMP type number).

Returns:

  • (Numeric)


27
28
29
# File 'ec2/connection_rule.rb', line 27

def from_port
  @from_port
end

#protocolString? (readonly)

Note:

Default: tcp

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

Use -1 to specify all protocols. If you specify -1, or a protocol number other than tcp, udp, icmp, or 58 (ICMPv6), traffic on all ports is allowed, regardless of any ports you specify. For tcp, udp, and icmp, you must specify a port range. For protocol 58 (ICMPv6), you can optionally specify a port range; if you don't, traffic for all types and codes is allowed.

Returns:

  • (String, nil)


47
48
49
# File 'ec2/connection_rule.rb', line 47

def protocol
  @protocol
end

#to_portNumeric? (readonly)

Note:

Default: If toPort is not specified, it will be the same as fromPort.

End of port range for the TCP and UDP protocols, or an ICMP code.

If you specify icmp for the IpProtocol property, you can specify -1 as a wildcard (i.e., any ICMP code).

Returns:

  • (Numeric, nil)


55
56
57
# File 'ec2/connection_rule.rb', line 55

def to_port
  @to_port
end

Class Method Details

.jsii_propertiesObject



57
58
59
60
61
62
63
64
# File 'ec2/connection_rule.rb', line 57

def self.jsii_properties
  {
    :from_port => "fromPort",
    :description => "description",
    :protocol => "protocol",
    :to_port => "toPort",
  }
end

Instance Method Details

#to_jsiiObject



66
67
68
69
70
71
72
73
74
75
# File 'ec2/connection_rule.rb', line 66

def to_jsii
  result = {}
  result.merge!({
    "fromPort" => @from_port,
    "description" => @description,
    "protocol" => @protocol,
    "toPort" => @to_port,
  })
  result.compact
end