Module: Serverspec::Type::AWS

Defined in:
lib/resources/common.rb

Overview

The AWS module contains all the AWS API resources

Constant Summary collapse

VERSION =

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

'0.1.0'.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

Raises:

  • (RuntimeError)

    if arg.nil?



18
19
20
# File 'lib/resources/common.rb', line 18

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

Raises:

  • (RuntimeError)

    if item.length == 0

  • (RuntimeError)

    if item.length > 1



27
28
29
30
31
32
# File 'lib/resources/common.rb', line 27

def check_length(item_name, item)
  raise "No #{item_name} with the specified name were "\
       'returned' if item.empty?
  raise "Multiple #{item_name} with the same name "\
       'were returned' if item.length > 1
end