Class: AWSCDK::EC2::PortProps

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

Overview

Properties to create a port range.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(protocol:, string_representation:, from_port: nil, to_port: nil) ⇒ PortProps

Returns a new instance of PortProps.

Parameters:

  • protocol (AWSCDK::EC2::Protocol)

    The protocol for the range.

  • string_representation (String)

    String representation for this object.

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

    The starting port for the range.

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

    The ending port for the range.



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

def initialize(protocol:, string_representation:, from_port: nil, to_port: nil)
  @protocol = protocol
  Jsii::Type.check_type(@protocol, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlByb3RvY29sIn0=")), "protocol")
  @string_representation = string_representation
  Jsii::Type.check_type(@string_representation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stringRepresentation")
  @from_port = from_port
  Jsii::Type.check_type(@from_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "fromPort") unless @from_port.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

#from_portNumeric? (readonly)

Note:

Default: - Not included in the rule

The starting port for the range.

Returns:

  • (Numeric, nil)


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

def from_port
  @from_port
end

#protocolAWSCDK::EC2::Protocol (readonly)

The protocol for the range.



25
26
27
# File 'ec2/port_props.rb', line 25

def protocol
  @protocol
end

#string_representationString (readonly)

String representation for this object.

Returns:

  • (String)


29
30
31
# File 'ec2/port_props.rb', line 29

def string_representation
  @string_representation
end

#to_portNumeric? (readonly)

Note:

Default: - Not included in the rule

The ending port for the range.

Returns:

  • (Numeric, nil)


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

def to_port
  @to_port
end

Class Method Details

.jsii_propertiesObject



41
42
43
44
45
46
47
48
# File 'ec2/port_props.rb', line 41

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

Instance Method Details

#to_jsiiObject



50
51
52
53
54
55
56
57
58
59
# File 'ec2/port_props.rb', line 50

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