Class: AWSCDK::Lightsail::CfnInstance::PortProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
lightsail/cfn_instance.rb

Overview

Port is a property of the Networking property. It describes information about ports for an instance.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_direction: nil, access_from: nil, access_type: nil, cidr_list_aliases: nil, cidrs: nil, common_name: nil, from_port: nil, ipv6_cidrs: nil, protocol: nil, to_port: nil) ⇒ PortProperty

Returns a new instance of PortProperty.

Parameters:

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

    The access direction ( inbound or outbound ).

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

    The location from which access is allowed.

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

    The type of access ( Public or Private ).

  • cidr_list_aliases (Array<String>, nil) (defaults to: nil)

    An alias that defines access for a preconfigured range of IP addresses.

  • cidrs (Array<String>, nil) (defaults to: nil)

    The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

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

    The common name of the port information.

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

    The first port in a range of open ports on an instance.

  • ipv6_cidrs (Array<String>, nil) (defaults to: nil)

    The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

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

    The IP protocol name.

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

    The last port in a range of open ports on an instance.



1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
# File 'lightsail/cfn_instance.rb', line 1164

def initialize(access_direction: nil, access_from: nil, access_type: nil, cidr_list_aliases: nil, cidrs: nil, common_name: nil, from_port: nil, ipv6_cidrs: nil, protocol: nil, to_port: nil)
  @access_direction = access_direction
  Jsii::Type.check_type(@access_direction, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "accessDirection") unless @access_direction.nil?
  @access_from = access_from
  Jsii::Type.check_type(@access_from, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "accessFrom") unless @access_from.nil?
  @access_type = access_type
  Jsii::Type.check_type(@access_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "accessType") unless @access_type.nil?
  @cidr_list_aliases = cidr_list_aliases
  Jsii::Type.check_type(@cidr_list_aliases, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "cidrListAliases") unless @cidr_list_aliases.nil?
  @cidrs = cidrs
  Jsii::Type.check_type(@cidrs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "cidrs") unless @cidrs.nil?
  @common_name = common_name
  Jsii::Type.check_type(@common_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "commonName") unless @common_name.nil?
  @from_port = from_port
  Jsii::Type.check_type(@from_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "fromPort") unless @from_port.nil?
  @ipv6_cidrs = ipv6_cidrs
  Jsii::Type.check_type(@ipv6_cidrs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "ipv6Cidrs") unless @ipv6_cidrs.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

#access_directionString? (readonly)

The access direction ( inbound or outbound ).

Lightsail currently supports only inbound access direction.



1193
1194
1195
# File 'lightsail/cfn_instance.rb', line 1193

def access_direction
  @access_direction
end

#access_fromString? (readonly)

The location from which access is allowed.

For example, Anywhere (0.0.0.0/0) , or Custom if a specific IP address or range of IP addresses is allowed.



1200
1201
1202
# File 'lightsail/cfn_instance.rb', line 1200

def access_from
  @access_from
end

#access_typeString? (readonly)

The type of access ( Public or Private ).



1205
1206
1207
# File 'lightsail/cfn_instance.rb', line 1205

def access_type
  @access_type
end

#cidr_list_aliasesArray<String>? (readonly)

An alias that defines access for a preconfigured range of IP addresses.

The only alias currently supported is lightsail-connect , which allows IP addresses of the browser-based RDP/SSH client in the Lightsail console to connect to your instance.



1212
1213
1214
# File 'lightsail/cfn_instance.rb', line 1212

def cidr_list_aliases
  @cidr_list_aliases
end

#cidrsArray<String>? (readonly)

The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

The ipv6_cidrs parameter lists the IPv6 addresses that are allowed to connect to an instance.

Examples:

  • To allow the IP address 192.0.2.44 , specify 192.0.2.44 or 192.0.2.44/32 .
  • To allow the IP addresses 192.0.2.0 to 192.0.2.255 , specify 192.0.2.0/24 .


1224
1225
1226
# File 'lightsail/cfn_instance.rb', line 1224

def cidrs
  @cidrs
end

#common_nameString? (readonly)

The common name of the port information.



1229
1230
1231
# File 'lightsail/cfn_instance.rb', line 1229

def common_name
  @common_name
end

#from_portNumeric? (readonly)

The first port in a range of open ports on an instance.

Allowed ports:

  • TCP and UDP - 0 to 65535
  • ICMP - The ICMP type for IPv4 addresses. For example, specify 8 as the from_port (ICMP type), and -1 as the to_port (ICMP code), to enable ICMP Ping.
  • ICMPv6 - The ICMP type for IPv6 addresses. For example, specify 128 as the from_port (ICMPv6 type), and 0 as to_port (ICMPv6 code).


1240
1241
1242
# File 'lightsail/cfn_instance.rb', line 1240

def from_port
  @from_port
end

#ipv6_cidrsArray<String>? (readonly)

The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

Only devices with an IPv6 address can connect to an instance through IPv6; otherwise, IPv4 should be used.

The cidrs parameter lists the IPv4 addresses that are allowed to connect to an instance.



1249
1250
1251
# File 'lightsail/cfn_instance.rb', line 1249

def ipv6_cidrs
  @ipv6_cidrs
end

#protocolString? (readonly)

The IP protocol name.

The name can be one of the following:

  • tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn't require reliable data stream service, use UDP instead.
  • all - All transport layer protocol types.
  • udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don't require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.
  • icmp - Internet Control Message Protocol (ICMP) is used to send error messages and operational information indicating success or failure when communicating with an instance. For example, an error is indicated when an instance could not be reached. When you specify icmp as the protocol , you must specify the ICMP type using the from_port parameter, and ICMP code using the to_port parameter.


1261
1262
1263
# File 'lightsail/cfn_instance.rb', line 1261

def protocol
  @protocol
end

#to_portNumeric? (readonly)

The last port in a range of open ports on an instance.

Allowed ports:

  • TCP and UDP - 0 to 65535
  • ICMP - The ICMP code for IPv4 addresses. For example, specify 8 as the from_port (ICMP type), and -1 as the to_port (ICMP code), to enable ICMP Ping.
  • ICMPv6 - The ICMP code for IPv6 addresses. For example, specify 128 as the from_port (ICMPv6 type), and 0 as to_port (ICMPv6 code).


1272
1273
1274
# File 'lightsail/cfn_instance.rb', line 1272

def to_port
  @to_port
end

Class Method Details

.jsii_propertiesObject



1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
# File 'lightsail/cfn_instance.rb', line 1274

def self.jsii_properties
  {
    :access_direction => "accessDirection",
    :access_from => "accessFrom",
    :access_type => "accessType",
    :cidr_list_aliases => "cidrListAliases",
    :cidrs => "cidrs",
    :common_name => "commonName",
    :from_port => "fromPort",
    :ipv6_cidrs => "ipv6Cidrs",
    :protocol => "protocol",
    :to_port => "toPort",
  }
end

Instance Method Details

#to_jsiiObject



1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
# File 'lightsail/cfn_instance.rb', line 1289

def to_jsii
  result = {}
  result.merge!({
    "accessDirection" => @access_direction,
    "accessFrom" => @access_from,
    "accessType" => @access_type,
    "cidrListAliases" => @cidr_list_aliases,
    "cidrs" => @cidrs,
    "commonName" => @common_name,
    "fromPort" => @from_port,
    "ipv6Cidrs" => @ipv6_cidrs,
    "protocol" => @protocol,
    "toPort" => @to_port,
  })
  result.compact
end