Class: AWSCDK::EC2::VPCLookupOptions

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

Overview

Properties for looking up an existing VPC.

The combination of properties must specify filter down to exactly one non-default VPC, otherwise an error is raised.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(is_default: nil, owner_account_id: nil, region: nil, return_vpn_gateways: nil, subnet_group_name_tag: nil, tags: nil, vpc_id: nil, vpc_name: nil) ⇒ VPCLookupOptions

Returns a new instance of VPCLookupOptions.

Parameters:

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

    Whether to match the default VPC.

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

    The ID of the AWS account that owns the VPC.

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

    Optional to override inferred region.

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

    Whether to look up whether a VPN Gateway is attached to the looked up VPC.

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

    Optional tag for subnet group name.

  • tags (Hash{String => String}, nil) (defaults to: nil)

    Tags on the VPC.

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

    The ID of the VPC.

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

    The name of the VPC.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'ec2/vpc_lookup_options.rb', line 18

def initialize(is_default: nil, owner_account_id: nil, region: nil, return_vpn_gateways: nil, subnet_group_name_tag: nil, tags: nil, vpc_id: nil, vpc_name: nil)
  @is_default = is_default
  Jsii::Type.check_type(@is_default, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "isDefault") unless @is_default.nil?
  @owner_account_id = 
  Jsii::Type.check_type(@owner_account_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ownerAccountId") unless @owner_account_id.nil?
  @region = region
  Jsii::Type.check_type(@region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region") unless @region.nil?
  @return_vpn_gateways = return_vpn_gateways
  Jsii::Type.check_type(@return_vpn_gateways, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "returnVpnGateways") unless @return_vpn_gateways.nil?
  @subnet_group_name_tag = subnet_group_name_tag
  Jsii::Type.check_type(@subnet_group_name_tag, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "subnetGroupNameTag") unless @subnet_group_name_tag.nil?
  @tags = tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "tags") unless @tags.nil?
  @vpc_id = vpc_id
  Jsii::Type.check_type(@vpc_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "vpcId") unless @vpc_id.nil?
  @vpc_name = vpc_name
  Jsii::Type.check_type(@vpc_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "vpcName") unless @vpc_name.nil?
end

Instance Attribute Details

#is_defaultBoolean? (readonly)

Note:

Default: Don't care whether we return the default VPC

Whether to match the default VPC.

Returns:

  • (Boolean, nil)


41
42
43
# File 'ec2/vpc_lookup_options.rb', line 41

def is_default
  @is_default
end

#owner_account_idString? (readonly)

Note:

Default: the account id of the parent stack

The ID of the AWS account that owns the VPC.

Returns:

  • (String, nil)


46
47
48
# File 'ec2/vpc_lookup_options.rb', line 46

def 
  @owner_account_id
end

#regionString? (readonly)

Note:

Default: Current stack's environment region

Optional to override inferred region.

Returns:

  • (String, nil)


51
52
53
# File 'ec2/vpc_lookup_options.rb', line 51

def region
  @region
end

#return_vpn_gatewaysBoolean? (readonly)

Note:

Default: true

Whether to look up whether a VPN Gateway is attached to the looked up VPC.

You can set this to false if you know the VPC does not have a VPN Gateway attached, in order to avoid an API call.

If you change this property from false to true or undefined, you may need to clear the corresponding context entry in cdk.context.json in order to trigger a new lookup.

Returns:

  • (Boolean, nil)


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

def return_vpn_gateways
  @return_vpn_gateways
end

#subnet_group_name_tagString? (readonly)

Note:

Default: aws-cdk:subnet-name

Optional tag for subnet group name.

If not provided, we'll look at the aws-cdk:subnet-name tag. If the subnet does not have the specified tag, we'll use its type as the name.

Returns:

  • (String, nil)


72
73
74
# File 'ec2/vpc_lookup_options.rb', line 72

def subnet_group_name_tag
  @subnet_group_name_tag
end

#tagsHash{String => String}? (readonly)

Note:

Default: Don't filter on tags

Tags on the VPC.

The VPC must have all of these tags

Returns:

  • (Hash{String => String}, nil)


79
80
81
# File 'ec2/vpc_lookup_options.rb', line 79

def tags
  @tags
end

#vpc_idString? (readonly)

Note:

Default: Don't filter on vpcId

The ID of the VPC.

If given, will import exactly this VPC.

Returns:

  • (String, nil)


86
87
88
# File 'ec2/vpc_lookup_options.rb', line 86

def vpc_id
  @vpc_id
end

#vpc_nameString? (readonly)

Note:

Default: Don't filter on vpcName

The name of the VPC.

If given, will import the VPC with this name.

Returns:

  • (String, nil)


93
94
95
# File 'ec2/vpc_lookup_options.rb', line 93

def vpc_name
  @vpc_name
end

Class Method Details

.jsii_propertiesObject



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

def self.jsii_properties
  {
    :is_default => "isDefault",
    :owner_account_id => "ownerAccountId",
    :region => "region",
    :return_vpn_gateways => "returnVpnGateways",
    :subnet_group_name_tag => "subnetGroupNameTag",
    :tags => "tags",
    :vpc_id => "vpcId",
    :vpc_name => "vpcName",
  }
end

Instance Method Details

#to_jsiiObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'ec2/vpc_lookup_options.rb', line 108

def to_jsii
  result = {}
  result.merge!({
    "isDefault" => @is_default,
    "ownerAccountId" => @owner_account_id,
    "region" => @region,
    "returnVpnGateways" => @return_vpn_gateways,
    "subnetGroupNameTag" => @subnet_group_name_tag,
    "tags" => @tags,
    "vpcId" => @vpc_id,
    "vpcName" => @vpc_name,
  })
  result.compact
end