Class: Serverspec::Type::AWS::EC2::Subnet
- Inherits:
-
Base
- Object
- Base
- Serverspec::Type::AWS::EC2::Subnet
- Defined in:
- lib/resources/ec2/subnet.rb
Overview
The Subnet class exposes the EC2::Subnet resources
Instance Method Summary collapse
-
#availability_zone ⇒ String
The Availability Zone of the subnet.
-
#available? ⇒ Boolean
Indicates whether the state is available.
-
#available_ip_address_count ⇒ Integer
The number of unused IP addresses in the subnet.
-
#az_default? ⇒ Boolean
Indicates whether this is the default subnet for the Availability Zone.
-
#cidr_block ⇒ String
The CIDR block assigned to the subnet.
-
#initialize(subnet_id, instance = nil) ⇒ Subnet
constructor
AWS SDK for Ruby v2 Aws::EC2::Client wrapper for initializing a Subnet resource.
-
#tags ⇒ Array(Hash)
Any tags assigned to the subnet.
-
#to_s ⇒ String
Returns the string representation of EC2::Subnet.
-
#vpc_id ⇒ String
The ID of the VPC the subnet is in.
-
#with_public_ip_on_launch? ⇒ Boolean
Indicates whether instances launched in this subnet receive a public IP address.
Constructor Details
#initialize(subnet_id, instance = nil) ⇒ Subnet
AWS SDK for Ruby v2 Aws::EC2::Client wrapper for initializing a Subnet resource
15 16 17 18 19 20 |
# File 'lib/resources/ec2/subnet.rb', line 15 def initialize(subnet_id, instance = nil) check_init_arg 'subnet_id', 'EC2::Subnet', subnet_id @subnet_id = subnet_id @aws = instance.nil? ? Aws::EC2::Client.new : instance get_subnet subnet_id end |
Instance Method Details
#availability_zone ⇒ String
The Availability Zone of the subnet
66 67 68 |
# File 'lib/resources/ec2/subnet.rb', line 66 def availability_zone @subnet.availability_zone end |
#available? ⇒ Boolean
Indicates whether the state is available
29 30 31 |
# File 'lib/resources/ec2/subnet.rb', line 29 def available? @subnet.state == 'available' end |
#available_ip_address_count ⇒ Integer
The number of unused IP addresses in the subnet. Note that the IP addresses for any stopped instances are considered unavailable
60 61 62 |
# File 'lib/resources/ec2/subnet.rb', line 60 def available_ip_address_count @subnet.available_ip_address_count end |
#az_default? ⇒ Boolean
Indicates whether this is the default subnet for the Availability Zone
35 36 37 |
# File 'lib/resources/ec2/subnet.rb', line 35 def az_default? @subnet.default_for_az end |
#cidr_block ⇒ String
The CIDR block assigned to the subnet
53 54 55 |
# File 'lib/resources/ec2/subnet.rb', line 53 def cidr_block @subnet.cidr_block end |
#tags ⇒ Array(Hash)
Any tags assigned to the subnet
72 73 74 |
# File 'lib/resources/ec2/subnet.rb', line 72 def @subnet. end |
#to_s ⇒ String
Returns the string representation of EC2::Subnet
24 25 26 |
# File 'lib/resources/ec2/subnet.rb', line 24 def to_s "EC2 Subnet: #{@subnet_id}" end |
#vpc_id ⇒ String
The ID of the VPC the subnet is in
47 48 49 |
# File 'lib/resources/ec2/subnet.rb', line 47 def vpc_id @subnet.vpc_id end |
#with_public_ip_on_launch? ⇒ Boolean
Indicates whether instances launched in this subnet receive a public IP address
41 42 43 |
# File 'lib/resources/ec2/subnet.rb', line 41 def with_public_ip_on_launch? @subnet.map_public_ip_on_launch end |