Class: AWSCDK::EC2::SubnetSelection

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

Overview

Customize subnets that are selected for placement of ENIs.

Constructs that allow customization of VPC placement use parameters of this type to provide placement settings.

By default, the instances are placed in the private subnets.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(availability_zones: nil, one_per_az: nil, subnet_filters: nil, subnet_group_name: nil, subnets: nil, subnet_type: nil) ⇒ SubnetSelection

Returns a new instance of SubnetSelection.

Parameters:

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

    Select subnets only in the given AZs.

  • one_per_az (Boolean, nil) (defaults to: nil)

    If true, return at most one subnet per AZ.

  • subnet_filters (Array<AWSCDK::EC2::SubnetFilter>, nil) (defaults to: nil)

    List of provided subnet filters.

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

    Select the subnet group with the given name.

  • subnets (Array<AWSCDK::EC2::ISubnet>, nil) (defaults to: nil)

    Explicitly select individual subnets.

  • subnet_type (AWSCDK::EC2::SubnetType, nil) (defaults to: nil)

    Select all subnets of the given type.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'ec2/subnet_selection.rb', line 18

def initialize(availability_zones: nil, one_per_az: nil, subnet_filters: nil, subnet_group_name: nil, subnets: nil, subnet_type: nil)
  @availability_zones = availability_zones
  Jsii::Type.check_type(@availability_zones, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "availabilityZones") unless @availability_zones.nil?
  @one_per_az = one_per_az
  Jsii::Type.check_type(@one_per_az, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "onePerAz") unless @one_per_az.nil?
  @subnet_filters = subnet_filters
  Jsii::Type.check_type(@subnet_filters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuU3VibmV0RmlsdGVyIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "subnetFilters") unless @subnet_filters.nil?
  @subnet_group_name = subnet_group_name
  Jsii::Type.check_type(@subnet_group_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "subnetGroupName") unless @subnet_group_name.nil?
  @subnets = subnets
  Jsii::Type.check_type(@subnets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVN1Ym5ldCJ9LCJraW5kIjoiYXJyYXkifX0=")), "subnets") unless @subnets.nil?
  @subnet_type = subnet_type
  Jsii::Type.check_type(@subnet_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFR5cGUifQ==")), "subnetType") unless @subnet_type.nil?
end

Instance Attribute Details

#availability_zonesArray<String>? (readonly)

Note:

Default: no filtering on AZs is done

Select subnets only in the given AZs.

Returns:

  • (Array<String>, nil)


37
38
39
# File 'ec2/subnet_selection.rb', line 37

def availability_zones
  @availability_zones
end

#one_per_azBoolean? (readonly)

Note:

Default: false

If true, return at most one subnet per AZ.

Returns:

  • (Boolean, nil)


42
43
44
# File 'ec2/subnet_selection.rb', line 42

def one_per_az
  @one_per_az
end

#subnet_filtersArray<AWSCDK::EC2::SubnetFilter>? (readonly)

Note:

Default: - none

List of provided subnet filters.

Returns:



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

def subnet_filters
  @subnet_filters
end

#subnet_group_nameString? (readonly)

Note:

Default: - Selection by type instead of by name

Select the subnet group with the given name.

Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer subnet_type.

This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in subnet_configuration.

At most one of subnet_type and subnet_group_name can be supplied.

Returns:

  • (String, nil)


63
64
65
# File 'ec2/subnet_selection.rb', line 63

def subnet_group_name
  @subnet_group_name
end

#subnet_typeAWSCDK::EC2::SubnetType? (readonly)

Note:

Default: SubnetType.PRIVATE_WITH_EGRESS (or ISOLATED or PUBLIC if there are no PRIVATE_WITH_EGRESS subnets)

Select all subnets of the given type.

At most one of subnet_type and subnet_group_name can be supplied.

Returns:



81
82
83
# File 'ec2/subnet_selection.rb', line 81

def subnet_type
  @subnet_type
end

#subnetsArray<AWSCDK::EC2::ISubnet>? (readonly)

Note:

Default: - Use all subnets in a selected group (all private subnets by default)

Explicitly select individual subnets.

Use this if you don't want to automatically use all subnets in a group, but have a need to control selection down to individual subnets.

Cannot be specified together with subnet_type or subnet_group_name.

Returns:



74
75
76
# File 'ec2/subnet_selection.rb', line 74

def subnets
  @subnets
end

Class Method Details

.jsii_propertiesObject



83
84
85
86
87
88
89
90
91
92
# File 'ec2/subnet_selection.rb', line 83

def self.jsii_properties
  {
    :availability_zones => "availabilityZones",
    :one_per_az => "onePerAz",
    :subnet_filters => "subnetFilters",
    :subnet_group_name => "subnetGroupName",
    :subnets => "subnets",
    :subnet_type => "subnetType",
  }
end

Instance Method Details

#to_jsiiObject



94
95
96
97
98
99
100
101
102
103
104
105
# File 'ec2/subnet_selection.rb', line 94

def to_jsii
  result = {}
  result.merge!({
    "availabilityZones" => @availability_zones,
    "onePerAz" => @one_per_az,
    "subnetFilters" => @subnet_filters,
    "subnetGroupName" => @subnet_group_name,
    "subnets" => @subnets,
    "subnetType" => @subnet_type,
  })
  result.compact
end