Class: Serverspec::Type::AWS::EC2::VPC
- Inherits:
-
Base
- Object
- Base
- Serverspec::Type::AWS::EC2::VPC
- Defined in:
- lib/resources/ec2/vpc.rb
Overview
The VPC class exposes the EC2::VPC resources
Instance Method Summary collapse
-
#available? ⇒ Boolean
Indicates whether the state is available.
-
#cidr_block ⇒ String
The CIDR block for the VPC.
-
#default? ⇒ Boolean
Indicates whether the VPC is the default VPC.
-
#default_tenancy? ⇒ Boolean
Indicates whether the instance_tenancy is default.
-
#dhcp_options_id ⇒ String
The ID of the set of DHCP options you've associated with the VPC (or default if the default options are associated with the VPC).
-
#initialize(vpc_id, instance = nil) ⇒ VPC
constructor
AWS SDK for Ruby v2 Aws::EC2::Client wrapper for initializing a VPC resource.
-
#subnets ⇒ Object
Get the subnets associated with the VPC.
-
#tags ⇒ Array(Hash)
Any tags assigned to the VPC.
-
#to_s ⇒ String
Returns the string representation of EC2::VPC.
Constructor Details
#initialize(vpc_id, instance = nil) ⇒ VPC
AWS SDK for Ruby v2 Aws::EC2::Client wrapper for initializing a VPC resource
15 16 17 18 19 20 |
# File 'lib/resources/ec2/vpc.rb', line 15 def initialize(vpc_id, instance = nil) check_init_arg 'vpc_id', 'EC2::VPC', vpc_id @vpc_id = vpc_id @aws = instance.nil? ? Aws::EC2::Client.new : instance get_vpc vpc_id end |
Instance Method Details
#available? ⇒ Boolean
Indicates whether the state is available
29 30 31 |
# File 'lib/resources/ec2/vpc.rb', line 29 def available? @vpc.state == 'available' end |
#cidr_block ⇒ String
The CIDR block for the VPC
45 46 47 |
# File 'lib/resources/ec2/vpc.rb', line 45 def cidr_block @vpc.cidr_block end |
#default? ⇒ Boolean
Indicates whether the VPC is the default VPC
34 35 36 |
# File 'lib/resources/ec2/vpc.rb', line 34 def default? @vpc.is_default end |
#default_tenancy? ⇒ Boolean
Indicates whether the instance_tenancy is default
39 40 41 |
# File 'lib/resources/ec2/vpc.rb', line 39 def default_tenancy? @vpc.instance_tenancy == 'default' end |
#dhcp_options_id ⇒ String
The ID of the set of DHCP options you've associated with the VPC (or default if the default options are associated with the VPC)
52 53 54 |
# File 'lib/resources/ec2/vpc.rb', line 52 def @vpc. end |
#subnets ⇒ Object
Get the subnets associated with the VPC
63 64 65 |
# File 'lib/resources/ec2/vpc.rb', line 63 def subnets Subnets.new Aws::EC2::Vpc.new(@vpc_id, client: @aws).subnets end |
#tags ⇒ Array(Hash)
Any tags assigned to the VPC
58 59 60 |
# File 'lib/resources/ec2/vpc.rb', line 58 def @vpc. end |
#to_s ⇒ String
Returns the string representation of EC2::VPC
24 25 26 |
# File 'lib/resources/ec2/vpc.rb', line 24 def to_s "EC2 VPC: #{@vpc_id}" end |