Module: Serverspec::Type::AWS

Defined in:
lib/resources/common.rb,
lib/resources/ec2/vpc.rb,
lib/resources/ec2/image.rb,
lib/resources/ec2/subnet.rb,
lib/resources/ec2/subnets.rb,
lib/resources/ec2/instance.rb,
lib/resources/dynamodb/table.rb,
lib/resources/ec2/route_table.rb,
lib/resources/rds/db_instance.rb,
lib/resources/cloudwatch/alarm.rb,
lib/resources/redshift/cluster.rb,
lib/resources/autoscaling/group.rb,
lib/resources/ec2/security_group.rb,
lib/resources/cloudformation/stack.rb,
lib/resources/ec2/internet_gateway.rb,
lib/resources/ec2/network_interface.rb,
lib/resources/autoscaling/launch_configuration.rb,
lib/resources/elasticloadbalancing/load_balancer.rb

Overview

The AWS module contains all the AWS API resources

Defined Under Namespace

Modules: AutoScaling, CloudFormation, CloudWatch, DynamoDB, EC2, ElasticLoadBalancing, RDS, Redshift

Constant Summary

VERSION =

The Serverspec::Type::AWS::VERSION constant actually sets this library version in the format: major.minor.patch.build

'0.1.2'.freeze

Instance Method Summary collapse

Instance Method Details

#check_init_arg(arg_name, class_name, arg) ⇒ Object

Check if the initialization argument of an AWS resource class is present

Parameters:

  • arg_name (String)
    • The name of the init argument

  • class_name (String)
    • The name of the AWS resource class

  • arg (String)
    • The arg passed to the class constructor

Raises:

  • (RuntimeError)

    if arg.nil?



16
17
18
# File 'lib/resources/common.rb', line 16

def check_init_arg(arg_name, class_name, arg)
  raise "Must specify #{arg_name} for #{class_name}" if arg.nil?
end

#check_length(item_name, item) ⇒ Object

Check the length for operations that should return only one resource

Parameters:

  • item_name (String)
    • The name of the item to check

  • item (Array)
    • The actual item for checking the length

Raises:

  • (RuntimeError)

    if item.length == 0

  • (RuntimeError)

    if item.length > 1



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/resources/common.rb', line 25

def check_length(item_name, item)
  return if item.length == 1

  if item.empty?
    raise "No #{item_name} with the specified name were"\
      'returned'
  else
    raise "Multiple #{item_name} with the same name "\
         'were returned'
  end
end