Class: Serverspec::Type::AWS::EC2::Subnets
- Inherits:
-
Base
- Object
- Base
- Serverspec::Type::AWS::EC2::Subnets
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/resources/ec2/subnets.rb
Overview
The Subnets class provides serverspec expectations for a collection of EC2::Subnet resources
Instance Method Summary collapse
- #evenly_spread_across_minimum_az?(num_azs) ⇒ Boolean
-
#initialize(subnets) ⇒ Subnets
constructor
A new instance of Subnets.
-
#to_s ⇒ String
Returns the string representation of EC2::Subnet.
Constructor Details
#initialize(subnets) ⇒ Subnets
Returns a new instance of Subnets
18 19 20 |
# File 'lib/resources/ec2/subnets.rb', line 18 def initialize(subnets) @subnets = subnets end |
Instance Method Details
#evenly_spread_across_minimum_az?(num_azs) ⇒ Boolean
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/resources/ec2/subnets.rb', line 22 def evenly_spread_across_minimum_az?(num_azs) subnet_grouping_by_az = @subnets.group_by(&:availability_zone) return false if number_of_sizes_in_sub_arrays(subnet_grouping_by_az) != 1 return false if subnet_grouping_by_az.size < num_azs true end |
#to_s ⇒ String
Returns the string representation of EC2::Subnet
35 36 37 |
# File 'lib/resources/ec2/subnets.rb', line 35 def to_s "EC2 Subnets: #{@subnets.map(&:id)}" end |