diff --git a/ChangeLog b/ChangeLog index 2b884da..d94908c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +=== 0.9.18 2012-01-26 + * Changed top-level namespace from AWS to AWSAPI, as it was conflicting with the official Amazon aws-sdk gem, which also defines AWS::EC2 but as a class rather than a module. === 0.9.17 2010-11-21 * Converted from Jeweler to Bundler, 'bundle install' to install dependencies diff --git a/README.rdoc b/README.rdoc index 74ac5a4..7fec654 100644 --- a/README.rdoc +++ b/README.rdoc @@ -50,9 +50,9 @@ To install from git for adding features or fixing bugs, you'll need to clone and == Using amazon-ec2 -The library exposes one main interface class AWS::EC2::Base. It is through an instance of this class that you will perform all the operations for using the EC2 service including query string header signing. +The library exposes one main interface class AWSAPI::EC2::Base. It is through an instance of this class that you will perform all the operations for using the EC2 service including query string header signing. -The public methods on AWS::EC2::Base closely mirror the EC2 Query API, and as such the Query API Reference in the EC2 Developer Guide ( http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=84 ) will prove helpful. +The public methods on AWSAPI::EC2::Base closely mirror the EC2 Query API, and as such the Query API Reference in the EC2 Developer Guide ( http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=84 ) will prove helpful. === Setting up @@ -82,11 +82,11 @@ You can verify that this setup is complete by running the 'set' in a command win The library exposes one main interface module - AWS::EC2::Base + AWSAPI::EC2::Base This method requires arguments which include your AWS credentials and it will return an object that you can use to make method calls directly against EC2. All the operations for using the EC2 service, including query string header signing, are handled automatically for you. The connection string will look something like this: - @ec2 = AWS::EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) + @ec2 = AWSAPI::EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) I've tried to keep the public methods on 'amazon-ec2' as close as possible to the AWS EC2 Query API. This similarity allows you to reference the Query API Reference in the EC2 Developer Guide and be able to get started right away. In most cases the methods names only differ in how they are presented. e.g. 'DescribeImages' becomes '#describe_images()' in Ruby. Feel free to browse the full RDoc documentation for all classes and methods of 'amazon-ec2' if you want more details. @@ -131,28 +131,28 @@ If you're not in front of a terminal shell now (perhaps you're browsing this sit returns : a string representation of ALL images >> @ec2.describe_images.to_s - returns : an Array of AWS::Response objects, each an EC2 image and its data + returns : an Array of AWSAPI::Response objects, each an EC2 image and its data >> @ec2.describe_images.imagesSet.item >> @ec2.describe_images.imagesSet.item[0] (a hash representing a single item in that array) >> @ec2.describe_images.imagesSet.item[0].to_s (a String representation of that item) >> @ec2.describe_images.imagesSet.item[0].to_s - => "#>" + => "#>" === Ruby script usage example: -Try out the following bit of code. This should walk through each image returned by a call to #describe_images and print out its key data. Note in the example below that you cannot walk through the results of the #describe_images call with the '.each' iterator (You'll get errors if you try). You need to instead walk through the Array of items which are in the 'imagesSet' embedded in the response. This reflects exactly the XML hierarchy of data returned from EC2 which we parse to Ruby OpenStruct objects (AWS::Response). +Try out the following bit of code. This should walk through each image returned by a call to #describe_images and print out its key data. Note in the example below that you cannot walk through the results of the #describe_images call with the '.each' iterator (You'll get errors if you try). You need to instead walk through the Array of items which are in the 'imagesSet' embedded in the response. This reflects exactly the XML hierarchy of data returned from EC2 which we parse to Ruby OpenStruct objects (AWSAPI::Response). #!/usr/bin/env ruby require 'rubygems' - require 'AWS' + require 'AWSAPI' ACCESS_KEY_ID = '--YOUR AWS ACCESS KEY ID--' SECRET_ACCESS_KEY = '--YOUR AWS SECRET ACCESS KEY--' - ec2 = AWS::EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) + ec2 = AWSAPI::EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) puts "----- listing images owned by 'amazon' -----" ec2.describe_images(:owner_id => "amazon").imagesSet.item.each do |image| @@ -184,7 +184,7 @@ Try out the following bit of code. This should walk through each image returned [some controller code ...] - ec2 = AWS::EC2::Base.new(:access_key_id => "YOUR_AWS_ACCESS_KEY_ID", :secret_access_key => "YOUR_AWS_SECRET_ACCESS_KEY") + ec2 = AWSAPI::EC2::Base.new(:access_key_id => "YOUR_AWS_ACCESS_KEY_ID", :secret_access_key => "YOUR_AWS_SECRET_ACCESS_KEY") # get ALL public images @ec2_images = ec2.describe_images().imagesSet.item @@ -237,7 +237,7 @@ Try out the following bit of code. This should walk through each image returned <% end %> -=== Important notes regarding the structure of AWS::Response Objects +=== Important notes regarding the structure of AWSAPI::Response Objects One of the key benefits of this new version of the library is that all responses from EC2 are bundled up in a real data structure and no longer require parsing of text. The hash returned is populated directly from the XML given to us by EC2 in response to any command we issue. This means that future changes to the API and what is returned by EC2 will be handled transparently by the gem. This is a huge benefit. What this means though, is that you may have to do a little homework on what actually gets returned by EC2 as XML. For example, when you make a #describe_images call in 'awshell' what AWS returns behind the scenes looks like: @@ -296,7 +296,7 @@ So, for example, if you wanted to get the image ID of the third image listed in >> puts @ec2.describe_images(:owner_id => 'amazon').imagesSet.item[2].imageId ami-23b6534a -EC2 will typically return sets of things (imagesSet, reservationSet, etc.) which we map to ruby Arrays (.imagesSet.item in the example above). If you want to iterate over a response set you will need to iterate over this array. The Arrays will typically contain additional AWS::Response objects that represent each individual item. You'll find that you can use the 'awshell' to help you understand the structure more completely if you try issuing commands there as a way to practice seeing what will be returned and making sure you get exactly what you want. +EC2 will typically return sets of things (imagesSet, reservationSet, etc.) which we map to ruby Arrays (.imagesSet.item in the example above). If you want to iterate over a response set you will need to iterate over this array. The Arrays will typically contain additional AWSAPI::Response objects that represent each individual item. You'll find that you can use the 'awshell' to help you understand the structure more completely if you try issuing commands there as a way to practice seeing what will be returned and making sure you get exactly what you want. === Handling Exceptions If for some reason an error occurs when executing a method (e.g. its arguments were diff --git a/amazon-ec2.gemspec b/amazon-ec2.gemspec index 835ac37..19f4df0 100644 --- a/amazon-ec2.gemspec +++ b/amazon-ec2.gemspec @@ -1,10 +1,10 @@ # -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) -require "AWS/version" +require "AWSAPI/version" Gem::Specification.new do |s| s.name = "amazon-ec2" - s.version = AWS::VERSION + s.version = AWSAPI::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Glenn Rempe"] s.email = ["glenn@rempe.us"] diff --git a/bin/awshell b/bin/awshell index 0961f65..3e663bd 100755 --- a/bin/awshell +++ b/bin/awshell @@ -15,7 +15,7 @@ require 'irb' # CREDITS : Credit for this bit of shameful ripoff coolness # goes to Marcel Molina and his AWS::S3 gem. Thanks! -require File.dirname(__FILE__) + '/../lib/AWS' +require File.dirname(__FILE__) + '/../lib/AWSAPI' setup = File.dirname(__FILE__) + '/setup' @@ -69,7 +69,7 @@ def welcome! returns : Pretty Print a Hash describing your EC2 images >> @ec2.describe_images(:owner_id => ['self']) - returns : an Array of AWS::Response objects, each an EC2 image and its data + returns : an Array of AWSAPI::Response objects, each an EC2 image and its data >> @ec2.describe_images(:owner_id => ['self']).imagesSet.item >> @ec2.describe_images(:owner_id => ['self']).imagesSet.item[0] MESSAGE diff --git a/bin/ec2-gem-example.rb b/bin/ec2-gem-example.rb index 761e041..f22b061 100755 --- a/bin/ec2-gem-example.rb +++ b/bin/ec2-gem-example.rb @@ -34,10 +34,10 @@ # test different servers by running something like: # export EC2_URL='https://ec2.amazonaws.com';./bin/ec2-gem-example.rb if ENV['EC2_URL'] - ec2 = AWS::EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['EC2_URL']).host ) + ec2 = AWSAPI::EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['EC2_URL']).host ) else # default server is US ec2.amazonaws.com - ec2 = AWS::EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY ) + ec2 = AWSAPI::EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY ) end puts "----- ec2.methods.sort -----" @@ -68,9 +68,9 @@ # ELB examples # Autoscaling examples if ENV['ELB_URL'] - elb = AWS::ELB::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['ELB_URL']).host ) + elb = AWSAPI::ELB::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['ELB_URL']).host ) else - elb = AWS::ELB::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) + elb = AWSAPI::ELB::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) end puts "----- creating an elastic load balancer -----" @@ -88,9 +88,9 @@ # Autoscaling examples if ENV['AS_URL'] - as = AWS::Autoscaling::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['AS_URL']).host ) + as = AWSAPI::Autoscaling::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['AS_URL']).host ) else - as = AWS::Autoscaling::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) + as = AWSAPI::Autoscaling::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) end puts "---- creating a launch configuration group -----" diff --git a/bin/ec2-gem-profile.rb b/bin/ec2-gem-profile.rb index 573a047..cc22179 100755 --- a/bin/ec2-gem-profile.rb +++ b/bin/ec2-gem-profile.rb @@ -6,6 +6,6 @@ ACCESS_KEY_ID = ENV['AWS_ACCESS_KEY_ID'] || ENV['AMAZON_ACCESS_KEY_ID'] SECRET_ACCESS_KEY = ENV['AWS_SECRET_ACCESS_KEY'] || ENV['AMAZON_SECRET_ACCESS_KEY'] -ec2 = AWS::EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY ) +ec2 = AWSAPI::EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY ) @images = ec2.describe_images diff --git a/bin/setup.rb b/bin/setup.rb index c9ffcef..b125d34 100755 --- a/bin/setup.rb +++ b/bin/setup.rb @@ -11,11 +11,11 @@ -if(AWS::ACCESS_KEY_ID and AWS::SECRET_ACCESS_KEY) +if(AWSAPI::ACCESS_KEY_ID and AWSAPI::SECRET_ACCESS_KEY) opts = { - :access_key_id => AWS::ACCESS_KEY_ID, - :secret_access_key => AWS::SECRET_ACCESS_KEY + :access_key_id => AWSAPI::ACCESS_KEY_ID, + :secret_access_key => AWSAPI::SECRET_ACCESS_KEY } if ENV['EC2_URL'] @@ -30,37 +30,37 @@ opts[:use_ssl] = false end end - @ec2 = AWS::EC2::Base.new(opts) + @ec2 = AWSAPI::EC2::Base.new(opts) else - @ec2 = AWS::EC2::Base.new(opts) + @ec2 = AWSAPI::EC2::Base.new(opts) end if ENV['ELB_URL'] opts[:server] = URI.parse(ENV['ELB_URL']).host - @elb = AWS::ELB::Base.new(opts) + @elb = AWSAPI::ELB::Base.new(opts) else - @elb = AWS::ELB::Base.new(opts) + @elb = AWSAPI::ELB::Base.new(opts) end if ENV['AS_URL'] opts[:server] = URI.parse(ENV['AS_URL']).host - @as = AWS::Autoscaling::Base.new(opts) + @as = AWSAPI::Autoscaling::Base.new(opts) else - @as = AWS::Autoscaling::Base.new(opts) + @as = AWSAPI::Autoscaling::Base.new(opts) end if ENV['RDS_URL'] opts[:server] = URI.parse(ENV['RDS_URL']).host - @rds = AWS::RDS::Base.new(opts) + @rds = AWSAPI::RDS::Base.new(opts) else - @rds = AWS::RDS::Base.new(opts) + @rds = AWSAPI::RDS::Base.new(opts) end if ENV['AWS_CLOUDWATCH_URL'] opts[:server] = URI.parse(ENV['AWS_CLOUDWATCH_URL']).host - @cw = AWS::Cloudwatch::Base.new(opts) + @cw = AWSAPI::Cloudwatch::Base.new(opts) else - @cw = AWS::Cloudwatch::Base.new(opts) + @cw = AWSAPI::Cloudwatch::Base.new(opts) end puts "" diff --git a/lib/AWS/version.rb b/lib/AWS/version.rb deleted file mode 100644 index 32062d4..0000000 --- a/lib/AWS/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module AWS - VERSION = "0.9.17" -end diff --git a/lib/AWS.rb b/lib/AWSAPI.rb similarity index 94% rename from lib/AWS.rb rename to lib/AWSAPI.rb index 23afd2c..0c5df50 100644 --- a/lib/AWS.rb +++ b/lib/AWSAPI.rb @@ -49,7 +49,7 @@ def does_not_have?(key) end -module AWS +module AWSAPI ACCESS_KEY_ID = ENV['AWS_ACCESS_KEY_ID'] || ENV['AMAZON_ACCESS_KEY_ID'] || "" SECRET_ACCESS_KEY = ENV['AWS_SECRET_ACCESS_KEY'] || ENV['AMAZON_SECRET_ACCESS_KEY'] || "" @@ -62,7 +62,7 @@ module AWS # @param [String] method the HTTP method that will be used to submit the params. # @param [String] base the URI path that this information will be submitted to. # @return [String] the canonical request description string. - def AWS.canonical_string(params, host, method="POST", base="/") + def AWSAPI.canonical_string(params, host, method="POST", base="/") # Sort, and encode parameters into a canonical string. sorted_params = params.sort {|x,y| x[0] <=> y[0]} encoded_params = sorted_params.collect do |p| @@ -94,7 +94,7 @@ def AWS.canonical_string(params, host, method="POST", base="/") # @param [String] str the string to be hashed and encoded. # @param [Boolean] urlencode whether or not to url encode the result., true or false # @return [String] the signed and encoded string. - def AWS.encode(secret_access_key, str, urlencode=true) + def AWSAPI.encode(secret_access_key, str, urlencode=true) digest = OpenSSL::Digest::Digest.new('sha256') b64_hmac = Base64.encode64( @@ -111,7 +111,7 @@ def AWS.encode(secret_access_key, str, urlencode=true) # including the handling of header signing and other security concerns. # This class uses the Net::HTTP library to interface with the AWS Query API # interface. You should not instantiate this directly, instead - # you should setup an instance of 'AWS::EC2::Base' or 'AWS::ELB::Base'. + # you should setup an instance of 'AWSAPI::EC2::Base' or 'AWSAPI::ELB::Base'. class Base attr_reader :use_ssl, :server, :proxy_server, :port @@ -307,12 +307,12 @@ def make_request(action, params, data='') # Set the Authorization header using AWS signed header authentication def get_aws_auth_param(params, secret_access_key, server) - canonical_string = AWS.canonical_string(params, server,"POST", @path) - encoded_canonical = AWS.encode(secret_access_key, canonical_string) + canonical_string = AWSAPI.canonical_string(params, server,"POST", @path) + encoded_canonical = AWSAPI.encode(secret_access_key, canonical_string) end # allow us to have a one line call in each method which will do all of the work - # in making the actual request to AWS. + # in making the actual request to AWSAPI. def response_generator( options = {} ) options = { @@ -339,7 +339,7 @@ def aws_error?(response) # exceptions.rb return false if response.is_a?(Net::HTTPSuccess) - raise AWS::Error, "Unexpected server error. response.body is: #{response.body}" if response.is_a?(Net::HTTPServerError) + raise AWSAPI::Error, "Unexpected server error. response.body is: #{response.body}" if response.is_a?(Net::HTTPServerError) # parse the XML document so we can walk through it doc = REXML::Document.new(response.body) @@ -360,10 +360,10 @@ def aws_error?(response) # Raise one of our specific error classes if it exists. # otherwise, throw a generic EC2 Error with a few details. - if AWS.const_defined?(error_code) - raise AWS.const_get(error_code), error_message + if AWSAPI.const_defined?(error_code) + raise AWSAPI.const_get(error_code), error_message else - raise AWS::Error, error_message + raise AWSAPI::Error, error_message end end @@ -371,5 +371,5 @@ def aws_error?(response) end end -Dir[File.join(File.dirname(__FILE__), 'AWS/**/*.rb')].sort.each { |lib| require lib } +Dir[File.join(File.dirname(__FILE__), 'AWSAPI/**/*.rb')].sort.each { |lib| require lib } diff --git a/lib/AWS/Autoscaling.rb b/lib/AWSAPI/Autoscaling.rb similarity index 92% rename from lib/AWS/Autoscaling.rb rename to lib/AWSAPI/Autoscaling.rb index 0d78b2a..0810d42 100644 --- a/lib/AWS/Autoscaling.rb +++ b/lib/AWSAPI/Autoscaling.rb @@ -1,4 +1,4 @@ -module AWS +module AWSAPI module Autoscaling # Which host FQDN will we connect to for all API calls to AWS? # If AS_URL is defined in the users ENV we can override the default with that. @@ -15,7 +15,7 @@ module Autoscaling API_VERSION = '2009-05-15' - class Base < AWS::Base + class Base < AWSAPI::Base def api_version API_VERSION end @@ -54,10 +54,10 @@ def aws_error?(response) # Raise one of our specific error classes if it exists. # otherwise, throw a generic EC2 Error with a few details. - if AWS.const_defined?(error_code) - raise AWS.const_get(error_code), error_message + if AWSAPI.const_defined?(error_code) + raise AWSAPI.const_get(error_code), error_message else - raise AWS::Error, error_message + raise AWSAPI::Error, error_message end end diff --git a/lib/AWS/Autoscaling/autoscaling.rb b/lib/AWSAPI/Autoscaling/autoscaling.rb similarity index 99% rename from lib/AWS/Autoscaling/autoscaling.rb rename to lib/AWSAPI/Autoscaling/autoscaling.rb index c916ea4..8655ead 100644 --- a/lib/AWS/Autoscaling/autoscaling.rb +++ b/lib/AWSAPI/Autoscaling/autoscaling.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module Autoscaling - class Base < AWS::Base + class Base < AWSAPI::Base # Create a launch configuration # Creates a new Launch Configuration. Please note that the launch configuration name used must be unique, within the scope of your AWS account, and the maximum limit of launch configurations must not yet have been met, or else the call will fail. diff --git a/lib/AWS/Cloudwatch.rb b/lib/AWSAPI/Cloudwatch.rb similarity index 93% rename from lib/AWS/Cloudwatch.rb rename to lib/AWSAPI/Cloudwatch.rb index 1db4266..68e0888 100644 --- a/lib/AWS/Cloudwatch.rb +++ b/lib/AWSAPI/Cloudwatch.rb @@ -1,4 +1,4 @@ -module AWS +module AWSAPI module Cloudwatch # Which host FQDN will we connect to for all API calls to AWS? @@ -16,7 +16,7 @@ module Cloudwatch API_VERSION = '2009-05-15' - class Base < AWS::Base + class Base < AWSAPI::Base def api_version API_VERSION end diff --git a/lib/AWS/Cloudwatch/monitoring.rb b/lib/AWSAPI/Cloudwatch/monitoring.rb similarity index 99% rename from lib/AWS/Cloudwatch/monitoring.rb rename to lib/AWSAPI/Cloudwatch/monitoring.rb index 538debe..1702d3f 100644 --- a/lib/AWS/Cloudwatch/monitoring.rb +++ b/lib/AWSAPI/Cloudwatch/monitoring.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module Cloudwatch - class Base < AWS::Base + class Base < AWSAPI::Base # This method call lists available Cloudwatch metrics attached to your EC2 # account. To get further information from the metrics, you'll then need to diff --git a/lib/AWS/EC2.rb b/lib/AWSAPI/EC2.rb similarity index 93% rename from lib/AWS/EC2.rb rename to lib/AWSAPI/EC2.rb index 5850b28..41a69b2 100644 --- a/lib/AWS/EC2.rb +++ b/lib/AWSAPI/EC2.rb @@ -1,4 +1,4 @@ -module AWS +module AWSAPI module EC2 # Which host FQDN will we connect to for all API calls to AWS? @@ -16,7 +16,7 @@ module EC2 API_VERSION = '2010-08-31' - class Base < AWS::Base + class Base < AWSAPI::Base def api_version API_VERSION end diff --git a/lib/AWS/EC2/availability_zones.rb b/lib/AWSAPI/EC2/availability_zones.rb similarity index 94% rename from lib/AWS/EC2/availability_zones.rb rename to lib/AWSAPI/EC2/availability_zones.rb index 6775120..3248c8f 100644 --- a/lib/AWS/EC2/availability_zones.rb +++ b/lib/AWSAPI/EC2/availability_zones.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The DescribeAvailabilityZones operation describes availability zones that are currently # available to the account and their states. diff --git a/lib/AWS/EC2/console.rb b/lib/AWSAPI/EC2/console.rb similarity index 95% rename from lib/AWS/EC2/console.rb rename to lib/AWSAPI/EC2/console.rb index 99078e3..0dd0d64 100644 --- a/lib/AWS/EC2/console.rb +++ b/lib/AWSAPI/EC2/console.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The GetConsoleOutput operation retrieves console output that has been posted for the specified instance. diff --git a/lib/AWS/EC2/devpay.rb b/lib/AWSAPI/EC2/devpay.rb similarity index 82% rename from lib/AWS/EC2/devpay.rb rename to lib/AWSAPI/EC2/devpay.rb index 3587648..a531c17 100644 --- a/lib/AWS/EC2/devpay.rb +++ b/lib/AWSAPI/EC2/devpay.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # Not yet implemented diff --git a/lib/AWS/EC2/elastic_ips.rb b/lib/AWSAPI/EC2/elastic_ips.rb similarity index 98% rename from lib/AWS/EC2/elastic_ips.rb rename to lib/AWSAPI/EC2/elastic_ips.rb index e117dde..703164c 100644 --- a/lib/AWS/EC2/elastic_ips.rb +++ b/lib/AWSAPI/EC2/elastic_ips.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The AllocateAddress operation acquires an elastic IP address for use with your account. diff --git a/lib/AWS/EC2/image_attributes.rb b/lib/AWSAPI/EC2/image_attributes.rb similarity index 99% rename from lib/AWS/EC2/image_attributes.rb rename to lib/AWSAPI/EC2/image_attributes.rb index f232d9c..22049a7 100644 --- a/lib/AWS/EC2/image_attributes.rb +++ b/lib/AWSAPI/EC2/image_attributes.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The ModifyImageAttribute operation modifies an attribute of an AMI. The following attributes may # currently be modified: diff --git a/lib/AWS/EC2/images.rb b/lib/AWSAPI/EC2/images.rb similarity index 99% rename from lib/AWS/EC2/images.rb rename to lib/AWSAPI/EC2/images.rb index e579af9..425eddf 100644 --- a/lib/AWS/EC2/images.rb +++ b/lib/AWSAPI/EC2/images.rb @@ -1,7 +1,7 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # Creates an AMI that uses an Amazon EBS root device from a "running" or "stopped" instance. # diff --git a/lib/AWS/EC2/instances.rb b/lib/AWSAPI/EC2/instances.rb similarity index 99% rename from lib/AWS/EC2/instances.rb rename to lib/AWSAPI/EC2/instances.rb index 71f7653..138d365 100644 --- a/lib/AWS/EC2/instances.rb +++ b/lib/AWSAPI/EC2/instances.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # Launches a specified number of instances of an AMI for which you have permissions. # @@ -265,7 +265,7 @@ def purchase_reserved_instances_offering( options = {} ) # Note : This can ONLY be run on an actual running EC2 instance. # # Example Class Method Usage : - # instance_id = AWS::EC2::Instance.local_instance_id + # instance_id = AWSAPI::EC2::Instance.local_instance_id # class Instance diff --git a/lib/AWS/EC2/keypairs.rb b/lib/AWSAPI/EC2/keypairs.rb similarity index 97% rename from lib/AWS/EC2/keypairs.rb rename to lib/AWSAPI/EC2/keypairs.rb index ff58f17..2ce95a0 100644 --- a/lib/AWS/EC2/keypairs.rb +++ b/lib/AWSAPI/EC2/keypairs.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The CreateKeyPair operation creates a new 2048 bit RSA keypair and returns a unique ID that can be diff --git a/lib/AWS/EC2/password.rb b/lib/AWSAPI/EC2/password.rb similarity index 93% rename from lib/AWS/EC2/password.rb rename to lib/AWSAPI/EC2/password.rb index 06c9d16..5561269 100644 --- a/lib/AWS/EC2/password.rb +++ b/lib/AWSAPI/EC2/password.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The GetPasswordData operation retrieves the encrypted administrator password for the instances running Window. diff --git a/lib/AWS/EC2/products.rb b/lib/AWSAPI/EC2/products.rb similarity index 95% rename from lib/AWS/EC2/products.rb rename to lib/AWSAPI/EC2/products.rb index 88ad654..d06bf44 100644 --- a/lib/AWS/EC2/products.rb +++ b/lib/AWSAPI/EC2/products.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The ConfirmProductInstance operation returns true if the given product code is attached to the instance # with the given instance id. False is returned if the product code is not attached to the instance. diff --git a/lib/AWS/EC2/security_groups.rb b/lib/AWSAPI/EC2/security_groups.rb similarity index 99% rename from lib/AWS/EC2/security_groups.rb rename to lib/AWSAPI/EC2/security_groups.rb index 53073f9..27a0147 100644 --- a/lib/AWS/EC2/security_groups.rb +++ b/lib/AWSAPI/EC2/security_groups.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The CreateSecurityGroup operation creates a new security group. Every instance is launched diff --git a/lib/AWS/EC2/snapshots.rb b/lib/AWSAPI/EC2/snapshots.rb similarity index 99% rename from lib/AWS/EC2/snapshots.rb rename to lib/AWSAPI/EC2/snapshots.rb index e339517..a3d84df 100644 --- a/lib/AWS/EC2/snapshots.rb +++ b/lib/AWSAPI/EC2/snapshots.rb @@ -1,7 +1,7 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The DescribeSnapshots operation describes the status of Amazon EBS snapshots. diff --git a/lib/AWS/EC2/spot_instance_requests.rb b/lib/AWSAPI/EC2/spot_instance_requests.rb similarity index 99% rename from lib/AWS/EC2/spot_instance_requests.rb rename to lib/AWSAPI/EC2/spot_instance_requests.rb index 52cc1cc..418b88f 100644 --- a/lib/AWS/EC2/spot_instance_requests.rb +++ b/lib/AWSAPI/EC2/spot_instance_requests.rb @@ -1,7 +1,7 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # Creates a Spot Instance request. Spot Instances are instances that Amazon EC2 starts on your behalf # when the maximum price that you specify exceeds the current Spot Price. Amazon EC2 periodically sets diff --git a/lib/AWS/EC2/spot_prices.rb b/lib/AWSAPI/EC2/spot_prices.rb similarity index 97% rename from lib/AWS/EC2/spot_prices.rb rename to lib/AWSAPI/EC2/spot_prices.rb index c0c9c7f..ecd1c18 100644 --- a/lib/AWS/EC2/spot_prices.rb +++ b/lib/AWSAPI/EC2/spot_prices.rb @@ -1,7 +1,7 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # This method returns historical information about spot prices. # diff --git a/lib/AWS/EC2/subnets.rb b/lib/AWSAPI/EC2/subnets.rb similarity index 93% rename from lib/AWS/EC2/subnets.rb rename to lib/AWSAPI/EC2/subnets.rb index bdba2f8..88c9508 100644 --- a/lib/AWS/EC2/subnets.rb +++ b/lib/AWSAPI/EC2/subnets.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The DescribeSubnets operation returns information about subnets available for use by the user # making the request. Selected subnets may be specified or the list may be left empty if information for diff --git a/lib/AWS/EC2/tags.rb b/lib/AWSAPI/EC2/tags.rb similarity index 98% rename from lib/AWS/EC2/tags.rb rename to lib/AWSAPI/EC2/tags.rb index 632ab04..dde0100 100644 --- a/lib/AWS/EC2/tags.rb +++ b/lib/AWSAPI/EC2/tags.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The CreateTags operation adds or overwrites tags for the specified resource(s). # diff --git a/lib/AWS/EC2/volumes.rb b/lib/AWSAPI/EC2/volumes.rb similarity index 98% rename from lib/AWS/EC2/volumes.rb rename to lib/AWSAPI/EC2/volumes.rb index dfdbece..5368156 100644 --- a/lib/AWS/EC2/volumes.rb +++ b/lib/AWSAPI/EC2/volumes.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module EC2 - class Base < AWS::Base + class Base < AWSAPI::Base # The DescribeVolumes operation lists one or more Amazon EBS volumes that you own, If you do not specify any volumes, Amazon EBS returns all volumes that you own. diff --git a/lib/AWS/ELB.rb b/lib/AWSAPI/ELB.rb similarity index 92% rename from lib/AWS/ELB.rb rename to lib/AWSAPI/ELB.rb index dfe613a..08a17c4 100644 --- a/lib/AWS/ELB.rb +++ b/lib/AWSAPI/ELB.rb @@ -1,4 +1,4 @@ -module AWS +module AWSAPI module ELB # Which host FQDN will we connect to for all API calls to AWS? @@ -16,7 +16,7 @@ module ELB API_VERSION = '2009-05-15' - class Base < AWS::Base + class Base < AWSAPI::Base def api_version API_VERSION end @@ -55,10 +55,10 @@ def aws_error?(response) # Raise one of our specific error classes if it exists. # otherwise, throw a generic EC2 Error with a few details. - if AWS.const_defined?(error_code) - raise AWS.const_get(error_code), error_message + if AWSAPI.const_defined?(error_code) + raise AWSAPI.const_get(error_code), error_message else - raise AWS::Error, error_message + raise AWSAPI::Error, error_message end end diff --git a/lib/AWS/ELB/load_balancers.rb b/lib/AWSAPI/ELB/load_balancers.rb similarity index 99% rename from lib/AWS/ELB/load_balancers.rb rename to lib/AWSAPI/ELB/load_balancers.rb index cc04ee4..f851854 100644 --- a/lib/AWS/ELB/load_balancers.rb +++ b/lib/AWSAPI/ELB/load_balancers.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module ELB - class Base < AWS::Base + class Base < AWSAPI::Base # This API creates a new LoadBalancer. Once the call has completed # successfully, a new LoadBalancer will be created, but it will not be diff --git a/lib/AWS/RDS.rb b/lib/AWSAPI/RDS.rb similarity index 92% rename from lib/AWS/RDS.rb rename to lib/AWSAPI/RDS.rb index 2fdc4ad..201e2b5 100644 --- a/lib/AWS/RDS.rb +++ b/lib/AWSAPI/RDS.rb @@ -1,4 +1,4 @@ -module AWS +module AWSAPI module RDS # Which host FQDN will we connect to for all API calls to AWS? @@ -16,7 +16,7 @@ module RDS API_VERSION = '2009-10-16' - class Base < AWS::Base + class Base < AWSAPI::Base def api_version API_VERSION end @@ -55,10 +55,10 @@ def aws_error?(response) # Raise one of our specific error classes if it exists. # otherwise, throw a generic EC2 Error with a few details. - if AWS.const_defined?(error_code) - raise AWS.const_get(error_code), error_message + if AWSAPI.const_defined?(error_code) + raise AWSAPI.const_get(error_code), error_message else - raise AWS::Error, error_message + raise AWSAPI::Error, error_message end end diff --git a/lib/AWS/RDS/rds.rb b/lib/AWSAPI/RDS/rds.rb similarity index 99% rename from lib/AWS/RDS/rds.rb rename to lib/AWSAPI/RDS/rds.rb index 2539e52..d817753 100644 --- a/lib/AWS/RDS/rds.rb +++ b/lib/AWSAPI/RDS/rds.rb @@ -1,6 +1,6 @@ -module AWS +module AWSAPI module RDS - class Base < AWS::Base + class Base < AWSAPI::Base # This API creates a new DB instance. Once the call has completed # successfully, a new DB instance will be created, but it will not be diff --git a/lib/AWS/exceptions.rb b/lib/AWSAPI/exceptions.rb similarity index 99% rename from lib/AWS/exceptions.rb rename to lib/AWSAPI/exceptions.rb index 7054100..9df3ebe 100644 --- a/lib/AWS/exceptions.rb +++ b/lib/AWSAPI/exceptions.rb @@ -6,7 +6,7 @@ # the granularity of the exception. #++ -module AWS +module AWSAPI # All AWS errors are superclassed by Error < RuntimeError class Error < RuntimeError; end diff --git a/lib/AWS/responses.rb b/lib/AWSAPI/responses.rb similarity index 94% rename from lib/AWS/responses.rb rename to lib/AWSAPI/responses.rb index 669f418..3300bcf 100644 --- a/lib/AWS/responses.rb +++ b/lib/AWSAPI/responses.rb @@ -1,4 +1,4 @@ -module AWS +module AWSAPI class Response @@ -17,5 +17,5 @@ def self.parse(options = {}) end # class Response -end # module AWS +end # module AWSAPI diff --git a/lib/AWSAPI/version.rb b/lib/AWSAPI/version.rb new file mode 100644 index 0000000..483df83 --- /dev/null +++ b/lib/AWSAPI/version.rb @@ -0,0 +1,3 @@ +module AWSAPI + VERSION = "0.9.18" +end diff --git a/test/test_Autoscaling_groups.rb b/test/test_Autoscaling_groups.rb index 70ce3e1..d96b176 100644 --- a/test/test_Autoscaling_groups.rb +++ b/test/test_Autoscaling_groups.rb @@ -2,7 +2,7 @@ context "autoscaling " do before do - @as = AWS::Autoscaling::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @as = AWSAPI::Autoscaling::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @valid_create_launch_configuration_params = { :image_id => "ami-ed46a784", @@ -42,7 +42,7 @@ " end - specify "AWS::Autoscaling::Base should give back a nice response if there is an error" do + specify "AWSAPI::Autoscaling::Base should give back a nice response if there is an error" do @as.stubs(:make_request).with('CreateLaunchConfiguration', { 'ImageId' => 'ami-ed46a784', 'LaunchConfigurationName' => 'TestAutoscalingGroupName', @@ -54,7 +54,7 @@ response["Error"]["Message"].should.equal "Launch Configuration by this name already exists - A launch configuration already exists with the name TestAutoscalingGroupName" end - specify "AWS::Autoscaling::Base should destroy a launch configuration just fine" do + specify "AWSAPI::Autoscaling::Base should destroy a launch configuration just fine" do @as.stubs(:make_request).with('DeleteLaunchConfiguration', { 'LaunchConfigurationName' => 'TestAutoscalingGroupName1' }).returns stub(:body => @delete_launch_configuration_response, :is_a? => true) @@ -63,7 +63,7 @@ response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should create a launch configuration" do + specify "AWSAPI::Autoscaling::Base should create a launch configuration" do @as.stubs(:make_request).with('CreateLaunchConfiguration', { 'ImageId' => 'ami-ed46a784', 'LaunchConfigurationName' => 'CustomTestAutoscalingGroupName', @@ -74,7 +74,7 @@ response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should be able to create a new autoscaling group" do + specify "AWSAPI::Autoscaling::Base should be able to create a new autoscaling group" do @as.stubs(:make_request).with("CreateAutoScalingGroup", { 'AutoScalingGroupName' => 'CloudteamTestAutoscalingGroup1', 'AvailabilityZones.member.1' => 'us-east-1a', @@ -87,7 +87,7 @@ response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should destroy an autoscaling group" do + specify "AWSAPI::Autoscaling::Base should destroy an autoscaling group" do @as.stubs(:make_request).with('DeleteAutoScalingGroup', { 'AutoScalingGroupName' => 'TestAutoscalingGroupName1' }).returns stub(:body => @delete_autoscaling_group, :is_a? => true) @@ -96,7 +96,7 @@ response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should be able to create a new scaling trigger" do + specify "AWSAPI::Autoscaling::Base should be able to create a new scaling trigger" do @as.stubs(:make_request).with("CreateOrUpdateScalingTrigger", { 'AutoScalingGroupName' => 'AutoScalingGroupName', 'Unit' => "Seconds", @@ -117,14 +117,14 @@ valid_create_or_update_scaling_trigger_params = {:autoscaling_group_name => "AutoScalingGroupName", :dimensions => {:name => "AutoScalingGroupName", :value => "Bob"}, :unit => "Seconds", :measure_name => "CPUUtilization", :namespace => "AWS/EC2", :statistic => "Average", :period => 120, :trigger_name => "AFunNameForATrigger", :lower_threshold => 0.2, :lower_breach_scale_increment => "-1", :upper_threshold => 1.5, :upper_breach_scale_increment => 1, :breach_duration => 120} %w(dimensions autoscaling_group_name measure_name statistic period trigger_name lower_threshold lower_breach_scale_increment upper_threshold upper_breach_scale_increment breach_duration).each do |meth_str| - lambda { @as.create_or_updated_scaling_trigger(valid_create_or_update_scaling_trigger_params.merge(meth_str.to_sym=>nil)) }.should.raise(AWS::ArgumentError) + lambda { @as.create_or_updated_scaling_trigger(valid_create_or_update_scaling_trigger_params.merge(meth_str.to_sym=>nil)) }.should.raise(AWSAPI::ArgumentError) end response = @as.create_or_updated_scaling_trigger(valid_create_or_update_scaling_trigger_params) response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should destroy a launch configuration group" do + specify "AWSAPI::Autoscaling::Base should destroy a launch configuration group" do @as.stubs(:make_request).with('DeleteLaunchConfiguration', { 'LaunchConfigurationName' => 'LaunchConfiguration' }).returns stub(:body => " @@ -135,7 +135,7 @@ response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should destroy a scaling trigger" do + specify "AWSAPI::Autoscaling::Base should destroy a scaling trigger" do @as.stubs(:make_request).with('DeleteTrigger', { 'TriggerName' => 'DeletingTrigger', 'AutoScalingGroupName' => "Name" }).returns stub(:body => " @@ -148,7 +148,7 @@ response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should describe the autoscaling groups" do + specify "AWSAPI::Autoscaling::Base should describe the autoscaling groups" do @as.stubs(:make_request).with('DescribeAutoScalingGroups', { 'AutoScalingGroupNames.member.1' => "webtier" }).returns stub(:body => " @@ -184,7 +184,7 @@ response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should describe the launch configurations" do + specify "AWSAPI::Autoscaling::Base should describe the launch configurations" do @as.stubs(:make_request).with('DescribeLaunchConfigurations', { 'AutoScalingGroupNames.member.1' => "webtier" }).returns stub(:body => " @@ -214,7 +214,7 @@ end - specify "AWS::Autoscaling::Base should describe the launch configurations" do + specify "AWSAPI::Autoscaling::Base should describe the launch configurations" do @as.stubs(:make_request).with('DescribeScalingActivities', { 'AutoScalingGroupName' => "webtier" }).returns stub(:body => " @@ -239,7 +239,7 @@ response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should describe triggers" do + specify "AWSAPI::Autoscaling::Base should describe triggers" do @as.stubs(:make_request).with('DescribeTriggers', { 'AutoScalingGroupName' => "webtier" }).returns stub(:body => " @@ -279,7 +279,7 @@ response.should.be.an.instance_of Hash end - specify "AWS::Autoscaling::Base should describe triggers" do + specify "AWSAPI::Autoscaling::Base should describe triggers" do @as.stubs(:make_request).with('SetDesiredCapacity', { 'AutoScalingGroupName' => "name", 'DesiredCapacity' => '10' }).returns stub(:body => " @@ -294,7 +294,7 @@ end - specify "AWS::Autoscaling::Base should terminate an instance in an autoscaling group" do + specify "AWSAPI::Autoscaling::Base should terminate an instance in an autoscaling group" do @as.stubs(:make_request).with('TerminateInstanceInAutoScalingGroup', { 'InstanceId' => "i-instance1" }).returns stub(:body => " diff --git a/test/test_EC2.rb b/test/test_EC2.rb index 96d4cc9..5093ee1 100644 --- a/test/test_EC2.rb +++ b/test/test_EC2.rb @@ -15,8 +15,8 @@ before do end - specify "AWS::EC2::Base attribute readers should be available" do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", + specify "AWSAPI::EC2::Base attribute readers should be available" do + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret", :use_ssl => true, :server => "foo.example.com" ) @@ -26,8 +26,8 @@ @ec2.server.should.equal "foo.example.com" end - specify "AWS::EC2::Base should work with insecure connections as well" do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", + specify "AWSAPI::EC2::Base should work with insecure connections as well" do + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret", :use_ssl => false, :server => "foo.example.com" ) @@ -37,8 +37,8 @@ @ec2.server.should.equal "foo.example.com" end - specify "AWS::EC2::Base should allow specification of port" do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", + specify "AWSAPI::EC2::Base should allow specification of port" do + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret", :use_ssl => true, :server => "foo.example.com", @@ -49,20 +49,20 @@ @ec2.server.should.equal "foo.example.com" end - specify "AWS.canonical_string(path) should conform to Amazon's requirements " do + specify "AWSAPI.canonical_string(path) should conform to Amazon's requirements " do path = {"name1" => "value1", "name2" => "value2 has spaces", "name3" => "value3~"} if ENV['EC2_URL'].nil? || ENV['EC2_URL'] == 'https://ec2.amazonaws.com' - AWS.canonical_string(path, 'ec2.amazonaws.com').should.equal "POST\nec2.amazonaws.com\n/\nname1=value1&name2=value2%20has%20spaces&name3=value3~" + AWSAPI.canonical_string(path, 'ec2.amazonaws.com').should.equal "POST\nec2.amazonaws.com\n/\nname1=value1&name2=value2%20has%20spaces&name3=value3~" elsif ENV['EC2_URL'] == 'https://us-east-1.ec2.amazonaws.com' - AWS.canonical_string(path, 'ec2.amazonaws.com').should.equal "POST\nus-east-1.ec2.amazonaws.com\n/\nname1=value1&name2=value2%20has%20spaces&name3=value3~" + AWSAPI.canonical_string(path, 'ec2.amazonaws.com').should.equal "POST\nus-east-1.ec2.amazonaws.com\n/\nname1=value1&name2=value2%20has%20spaces&name3=value3~" elsif ENV['EC2_URL'] == 'https://eu-west-1.ec2.amazonaws.com' - AWS.canonical_string(path, 'ec2.amazonaws.com').should.equal "POST\neu-west-1.ec2.amazonaws.com\n/\nname1=value1&name2=value2%20has%20spaces&name3=value3~" + AWSAPI.canonical_string(path, 'ec2.amazonaws.com').should.equal "POST\neu-west-1.ec2.amazonaws.com\n/\nname1=value1&name2=value2%20has%20spaces&name3=value3~" end end - specify "AWS.encode should return the expected string" do - AWS.encode("secretaccesskey", "foobar123", urlencode=true).should.equal "CPzGGhtvlG3P3yp88fPZp0HKouUV8mQK1ZcdFGQeAug%3D" - AWS.encode("secretaccesskey", "foobar123", urlencode=false).should.equal "CPzGGhtvlG3P3yp88fPZp0HKouUV8mQK1ZcdFGQeAug=" + specify "AWSAPI.encode should return the expected string" do + AWSAPI.encode("secretaccesskey", "foobar123", urlencode=true).should.equal "CPzGGhtvlG3P3yp88fPZp0HKouUV8mQK1ZcdFGQeAug%3D" + AWSAPI.encode("secretaccesskey", "foobar123", urlencode=false).should.equal "CPzGGhtvlG3P3yp88fPZp0HKouUV8mQK1ZcdFGQeAug=" end end diff --git a/test/test_EC2_availability_zones.rb b/test/test_EC2_availability_zones.rb index 2c3ae7d..22fe5cc 100644 --- a/test/test_EC2_availability_zones.rb +++ b/test/test_EC2_availability_zones.rb @@ -13,7 +13,7 @@ context "EC2 availability zones" do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @describe_availability_zones_response_body = <<-RESPONSE diff --git a/test/test_EC2_console.rb b/test/test_EC2_console.rb index 00b16ec..45d8f9f 100644 --- a/test/test_EC2_console.rb +++ b/test/test_EC2_console.rb @@ -13,7 +13,7 @@ context "The EC2 console " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @get_console_output_response_body = <<-RESPONSE @@ -45,9 +45,9 @@ specify "method get_console_output should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.get_console_output() }.should.raise(AWS::ArgumentError) - lambda { @ec2.get_console_output(:instance_id => nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.get_console_output(:instance_id => "") }.should.raise(AWS::ArgumentError) + lambda { @ec2.get_console_output() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.get_console_output(:instance_id => nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.get_console_output(:instance_id => "") }.should.raise(AWSAPI::ArgumentError) end diff --git a/test/test_EC2_elastic_ips.rb b/test/test_EC2_elastic_ips.rb index 337f135..89c63be 100644 --- a/test/test_EC2_elastic_ips.rb +++ b/test/test_EC2_elastic_ips.rb @@ -13,7 +13,7 @@ context "EC2 elastic IP addresses " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @allocate_address_body = <<-RESPONSE @@ -68,10 +68,10 @@ # @ec2.stubs(:make_request).with('CreateKeyPair', {"KeyName"=>"example-key-name"}). # returns stub(:body => @create_keypair_response_body, :is_a? => true) # - # lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError) - # lambda { @ec2.create_keypair() }.should.raise(AWS::ArgumentError) - # lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError) - # lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError) + # lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWSAPI::ArgumentError) + # lambda { @ec2.create_keypair() }.should.raise(AWSAPI::ArgumentError) + # lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(AWSAPI::ArgumentError) + # lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(AWSAPI::ArgumentError) #end @@ -113,10 +113,10 @@ @ec2.stubs(:make_request).with('AssociateAddress', {"InstanceId" => "i-2ea64347", "PublicIp"=>"67.202.55.255"}). returns stub(:body => @associate_address_response_body, :is_a? => true) - lambda { @ec2.associate_address( :instance_id => "i-2ea64347", :public_ip => "67.202.55.255" ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.associate_address() }.should.raise(AWS::ArgumentError) - lambda { @ec2.associate_address( :instance_id => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.associate_address( :public_ip => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.associate_address( :instance_id => "i-2ea64347", :public_ip => "67.202.55.255" ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.associate_address() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.associate_address( :instance_id => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.associate_address( :public_ip => "" ) }.should.raise(AWSAPI::ArgumentError) end @@ -135,9 +135,9 @@ @ec2.stubs(:make_request).with('DisassociateAddress', {'PublicIp' => '67.202.55.255'}). returns stub(:body => @disassociate_address_response_body, :is_a? => true) - lambda { @ec2.disassociate_address( :public_ip => "67.202.55.255" ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.disassociate_address() }.should.raise(AWS::ArgumentError) - lambda { @ec2.disassociate_address( :public_ip => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.disassociate_address( :public_ip => "67.202.55.255" ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.disassociate_address() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.disassociate_address( :public_ip => "" ) }.should.raise(AWSAPI::ArgumentError) end diff --git a/test/test_EC2_image_attributes.rb b/test/test_EC2_image_attributes.rb index 3946c90..11eca23 100644 --- a/test/test_EC2_image_attributes.rb +++ b/test/test_EC2_image_attributes.rb @@ -13,7 +13,7 @@ context "EC2 image_attributes " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @modify_image_attribute_response_body = <<-RESPONSE @@ -130,33 +130,33 @@ specify "should raise an exception when modify_image_attribute is called with incorrect arguments" do # method args can't be nil or empty - lambda { @ec2.modify_image_attribute() }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError) + lambda { @ec2.modify_image_attribute() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"") }.should.raise(AWSAPI::ArgumentError) # :image_id option must be not be empty or nil - lambda { @ec2.modify_image_attribute(:image_id=>nil, :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"", :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>nil, :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"", :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWSAPI::ArgumentError) # :attribute currently has two options which are 'launchPermission' and 'productCodes, it should fail with any other value, nil, or empty - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil, :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil, :operation_type=>"add", :group=>["all"]) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"", :operation_type=>"add", :group=>["all"]) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo", :operation_type=>"add", :group=>["all"]) }.should.raise(AWSAPI::ArgumentError) # :attribute => 'launchPermission' option should fail if neither :group nor :user_id are also provided - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add") }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => "") }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => "") }.should.raise(AWS::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => "") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => "") }.should.raise(AWSAPI::ArgumentError) # :attribute => 'productCodes' option should fail if :product_code isn't also provided - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>"") }.should.raise(AWS::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>"") }.should.raise(AWSAPI::ArgumentError) # :operation_type currently has two options which are 'add' and 'remove', and it should fail with any other, nil or empty - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>nil, :group=>["all"]) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"", :group=>["all"]) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"foo", :group=>["all"]) }.should.raise(AWS::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>nil, :group=>["all"]) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"", :group=>["all"]) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"foo", :group=>["all"]) }.should.raise(AWSAPI::ArgumentError) end @@ -191,22 +191,22 @@ specify "should raise an exception when describe_image_attribute is called with incorrect arguments" do # method args can't be nil or empty - lambda { @ec2.describe_image_attribute() }.should.raise(AWS::ArgumentError) - lambda { @ec2.describe_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_image_attribute() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.describe_image_attribute(:image_id=>"") }.should.raise(AWSAPI::ArgumentError) # :image_id option must be not be empty or nil w/ launchPermission - lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError) - lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWSAPI::ArgumentError) # :image_id option must be not be empty or nil w/ productCodes - lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"productCodes") }.should.raise(AWS::ArgumentError) - lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"productCodes") }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"productCodes") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"productCodes") }.should.raise(AWSAPI::ArgumentError) # :attribute currently has two options which are 'launchPermission' and 'productCodes', it should fail with any other values, # nil, or empty - lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWS::ArgumentError) - lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWSAPI::ArgumentError) end @@ -221,17 +221,17 @@ specify "should raise an exception when reset_image_attribute is called with incorrect arguments" do # method args can't be nil or empty - lambda { @ec2.reset_image_attribute() }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError) + lambda { @ec2.reset_image_attribute() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_image_attribute(:image_id=>"") }.should.raise(AWSAPI::ArgumentError) # :image_id option must be not be empty or nil - lambda { @ec2.reset_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError) + lambda { @ec2.reset_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWSAPI::ArgumentError) # :attribute currently has one option which is 'launchPermission', it should fail with any other value, nil, or empty - lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWS::ArgumentError) + lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWSAPI::ArgumentError) end diff --git a/test/test_EC2_images.rb b/test/test_EC2_images.rb index 8ca481f..3b7f609 100644 --- a/test/test_EC2_images.rb +++ b/test/test_EC2_images.rb @@ -13,7 +13,7 @@ context "An EC2 image " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @create_image_response_body = <<-RESPONSE @@ -71,20 +71,20 @@ specify "method create_image should raise an exception when called with nil/empty string arguments" do - lambda { @ec2.create_image() }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_image(:instance_id => "", :name => "fooname") }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_image(:instance_id => "fooid", :name => "") }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_image(:instance_id => nil, :name => "fooname") }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_image(:instance_id => "fooid", :name => nil) }.should.raise(AWS::ArgumentError) + lambda { @ec2.create_image() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_image(:instance_id => "", :name => "fooname") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_image(:instance_id => "fooid", :name => "") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_image(:instance_id => nil, :name => "fooname") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_image(:instance_id => "fooid", :name => nil) }.should.raise(AWSAPI::ArgumentError) end specify "method create_image should raise an exception when called with bad arguments" do - lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*2) }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*129) }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*128, :description => "f"*256) }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*128, :no_reboot => "true") }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*128, :no_reboot => "false") }.should.raise(AWS::ArgumentError) + lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*2) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*129) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*128, :description => "f"*256) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*128, :no_reboot => "true") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_image(:instance_id => "fooid", :name => "f"*128, :no_reboot => "false") }.should.raise(AWSAPI::ArgumentError) end @@ -125,8 +125,8 @@ specify "method register_image should raise an exception when called without :name or :root_device_name" do - lambda { @ec2.register_image() }.should.raise(AWS::ArgumentError) - lambda { @ec2.register_image(:image_location => "", :root_device_name => "") }.should.raise(AWS::ArgumentError) + lambda { @ec2.register_image() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.register_image(:image_location => "", :root_device_name => "") }.should.raise(AWSAPI::ArgumentError) end @@ -248,9 +248,9 @@ specify "method deregister_image should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.deregister_image() }.should.raise(AWS::ArgumentError) - lambda { @ec2.deregister_image( :image_id => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.deregister_image( :image_id => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.deregister_image() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.deregister_image( :image_id => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.deregister_image( :image_id => "" ) }.should.raise(AWSAPI::ArgumentError) end diff --git a/test/test_EC2_instances.rb b/test/test_EC2_instances.rb index 2d771d4..f837a76 100644 --- a/test/test_EC2_instances.rb +++ b/test/test_EC2_instances.rb @@ -13,7 +13,7 @@ context "EC2 instances " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @run_instances_response_body = <<-RESPONSE @@ -296,99 +296,99 @@ @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances() }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances() }.should.raise(AWSAPI::ArgumentError) # :addressing_type is deprecated - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => nil ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "" ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "foo" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => nil ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "" ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "foo" ) }.should.raise(AWSAPI::ArgumentError) # :group_id is deprecated - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :group_id => nil ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :group_id => "" ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :group_id => "foo" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :group_id => nil ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :group_id => "" ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :group_id => "foo" ) }.should.raise(AWSAPI::ArgumentError) # :image_id - lambda { @ec2.run_instances( :image_id => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "" ) }.should.raise(AWSAPI::ArgumentError) # :min_count - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1 ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 0 ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "" ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "foo" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1 ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 0 ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "" ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "foo" ) }.should.raise(AWSAPI::ArgumentError) # :max_count - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 1 ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 0 ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "" ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "foo" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 1 ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 0 ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "" ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "foo" ) }.should.raise(AWSAPI::ArgumentError) # :min_count & :max_count - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1 ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 2, :max_count => 1 ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1 ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 2, :max_count => 1 ) }.should.raise(AWSAPI::ArgumentError) # :instance_type ["t1.micro", "m1.small", "m1.large", "m1.xlarge", "m2.xlarge", "c1.medium", "c1.xlarge", "m2.2xlarge", "m2.4xlarge", "cc1.4xlarge"].each do |type| @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceType" => type). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_type => type ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_type => type ) }.should.not.raise(AWSAPI::ArgumentError) end - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_type => "m1.notarealsize" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_type => "m1.notarealsize" ) }.should.raise(AWSAPI::ArgumentError) # :monitoring_enabled @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "Monitoring.Enabled" => 'true'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => true ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => true ) }.should.not.raise(AWSAPI::ArgumentError) @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "Monitoring.Enabled" => 'false'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => false ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => false ) }.should.not.raise(AWSAPI::ArgumentError) @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "Monitoring.Enabled" => 'false'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => "foo" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => "foo" ) }.should.raise(AWSAPI::ArgumentError) # :disable_api_termination @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "DisableApiTermination" => 'true'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => true ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => true ) }.should.not.raise(AWSAPI::ArgumentError) @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "DisableApiTermination" => 'false'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => false ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => false ) }.should.not.raise(AWSAPI::ArgumentError) @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "DisableApiTermination" => 'false'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => "foo" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => "foo" ) }.should.raise(AWSAPI::ArgumentError) # :instance_initiated_shutdown_behavior @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceInitiatedShutdownBehavior" => 'stop'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => 'stop' ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => 'stop' ) }.should.not.raise(AWSAPI::ArgumentError) @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceInitiatedShutdownBehavior" => 'terminate'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => 'terminate' ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => 'terminate' ) }.should.not.raise(AWSAPI::ArgumentError) @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceInitiatedShutdownBehavior" => 'stop'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => "foo" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => "foo" ) }.should.raise(AWSAPI::ArgumentError) @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceInitiatedShutdownBehavior" => 'stop'). returns stub(:body => @run_instances_response_body, :is_a? => true) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => true ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => true ) }.should.raise(AWSAPI::ArgumentError) # :base64_encoded - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => true ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => false ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "" ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "foo" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => true ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => false ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "" ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "foo" ) }.should.raise(AWSAPI::ArgumentError) end specify "should be able specify a key_name" do @@ -534,9 +534,9 @@ specify "method reboot_instances should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.reboot_instances() }.should.raise(AWS::ArgumentError) - lambda { @ec2.reboot_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.reboot_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.reboot_instances() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reboot_instances( :instance_id => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reboot_instances( :instance_id => "" ) }.should.raise(AWSAPI::ArgumentError) end @@ -548,9 +548,9 @@ specify "method start_instances should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.start_instances() }.should.raise(AWS::ArgumentError) - lambda { @ec2.start_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.start_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.start_instances() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.start_instances( :instance_id => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.start_instances( :instance_id => "" ) }.should.raise(AWSAPI::ArgumentError) end @@ -562,9 +562,9 @@ specify "method stop_instances should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.stop_instances() }.should.raise(AWS::ArgumentError) - lambda { @ec2.stop_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.stop_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.stop_instances() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.stop_instances( :instance_id => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.stop_instances( :instance_id => "" ) }.should.raise(AWSAPI::ArgumentError) end specify "should be able to be stopped when provided with an :instance_id" do @@ -574,9 +574,9 @@ end specify "method terminate_instances should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.terminate_instances() }.should.raise(AWS::ArgumentError) - lambda { @ec2.terminate_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.terminate_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.terminate_instances() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.terminate_instances( :instance_id => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.terminate_instances( :instance_id => "" ) }.should.raise(AWSAPI::ArgumentError) end specify "should be able to be terminated when provided with an :instance_id" do @@ -600,9 +600,9 @@ end specify "method monitor_instances should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.monitor_instances() }.should.raise(AWS::ArgumentError) - lambda { @ec2.monitor_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.monitor_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.monitor_instances() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.monitor_instances( :instance_id => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.monitor_instances( :instance_id => "" ) }.should.raise(AWSAPI::ArgumentError) end specify "should be able to be monitored when provided with an :instance_id" do @@ -620,9 +620,9 @@ end specify "method unmonitor_instances should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.unmonitor_instances() }.should.raise(AWS::ArgumentError) - lambda { @ec2.unmonitor_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.unmonitor_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.unmonitor_instances() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.unmonitor_instances( :instance_id => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.unmonitor_instances( :instance_id => "" ) }.should.raise(AWSAPI::ArgumentError) end specify "should be able to be unmonitored when provided with an :instance_id" do @@ -640,47 +640,47 @@ end specify "should get an ArgumentError when trying to describe/modify/reset an instance attribute without an istance id" do - lambda { @ec2.describe_instance_attribute(:attribute => "ramdisk") }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_instance_attribute(:attribute => "ramdisk") }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_instance_attribute(:attribute => "ramdisk") }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_instance_attribute(:attribute => "ramdisk") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_instance_attribute(:attribute => "ramdisk") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_instance_attribute(:attribute => "ramdisk") }.should.raise(AWSAPI::ArgumentError) - lambda { @ec2.describe_instance_attribute(:attribute => "ramdisk", :instance_id => nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_instance_attribute(:attribute => "ramdisk", :instance_id => nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_instance_attribute(:attribute => "ramdisk", :instance_id => nil) }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_instance_attribute(:attribute => "ramdisk", :instance_id => nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_instance_attribute(:attribute => "ramdisk", :instance_id => nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_instance_attribute(:attribute => "ramdisk", :instance_id => nil) }.should.raise(AWSAPI::ArgumentError) - lambda { @ec2.describe_instance_attribute(:attribute => "ramdisk", :instance_id => "") }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_instance_attribute(:attribute => "ramdisk", :instance_id => "") }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_instance_attribute(:attribute => "ramdisk", :instance_id => "") }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_instance_attribute(:attribute => "ramdisk", :instance_id => "") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_instance_attribute(:attribute => "ramdisk", :instance_id => "") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_instance_attribute(:attribute => "ramdisk", :instance_id => "") }.should.raise(AWSAPI::ArgumentError) end specify "should get an ArgumentError when trying to describe/modify/reset an instance attribute without an attribute" do - lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a") }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a") }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a") }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a") }.should.raise(AWSAPI::ArgumentError) - lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a", :attribute => nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a", :attribute => nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a", :attribute => nil) }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a", :attribute => nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a", :attribute => nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a", :attribute => nil) }.should.raise(AWSAPI::ArgumentError) - lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a", :attribute => "") }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a", :attribute => "") }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a", :attribute => "") }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a", :attribute => "") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a", :attribute => "") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a", :attribute => "") }.should.raise(AWSAPI::ArgumentError) end specify "should get an ArgumentError when trying to describe/modify/reset an instance attribute without a valid attribute" do - lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWS::ArgumentError) - lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWS::ArgumentError) - lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWSAPI::ArgumentError) end specify "should not get an ArgumentError when trying to describe/modify/reset an instance attribute with a valid attribute" do @ec2.stubs(:make_request).returns stub(:body => @describe_instance_attribute_response_body, :is_a? => true) %w(instanceType kernel ramdisk userData disableApiTermination instanceInitiatedShutdownBehavior rootDevice blockDeviceMapping).each do |a| - lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a", :attribute => a) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_instance_attribute(:instance_id => "i-33457a5a", :attribute => a) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.modify_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWSAPI::ArgumentError) end %w(kernel ramdisk).each do |a| - lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWS::ArgumentError) + lambda { @ec2.reset_instance_attribute(:instance_id => "i-33457a5a", :attribute => 'party') }.should.raise(AWSAPI::ArgumentError) end end diff --git a/test/test_EC2_keypairs.rb b/test/test_EC2_keypairs.rb index f56254b..8534249 100644 --- a/test/test_EC2_keypairs.rb +++ b/test/test_EC2_keypairs.rb @@ -13,7 +13,7 @@ context "EC2 keypairs " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @create_keypair_response_body = <<-RESPONSE @@ -83,10 +83,10 @@ @ec2.stubs(:make_request).with('CreateKeyPair', {"KeyName"=>"example-key-name"}). returns stub(:body => @create_keypair_response_body, :is_a? => true) - lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.create_keypair() }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_keypair() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(AWSAPI::ArgumentError) end @@ -113,10 +113,10 @@ @ec2.stubs(:make_request).with('DeleteKeyPair', {"KeyName"=>"example-key-name"}). returns stub(:body => @delete_keypair_body, :is_a? => true) - lambda { @ec2.delete_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.delete_keypair() }.should.raise(AWS::ArgumentError) - lambda { @ec2.delete_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.delete_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.delete_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.delete_keypair() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.delete_keypair( :key_name => nil ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.delete_keypair( :key_name => "" ) }.should.raise(AWSAPI::ArgumentError) end diff --git a/test/test_EC2_password.rb b/test/test_EC2_password.rb index 64cad38..bc85186 100644 --- a/test/test_EC2_password.rb +++ b/test/test_EC2_password.rb @@ -13,7 +13,7 @@ context "The EC2 password " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @get_password_data_response_body = <<-RESPONSE @@ -37,9 +37,9 @@ specify "method get_password_data should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.get_password_data() }.should.raise(AWS::ArgumentError) - lambda { @ec2.get_password_data(:instance_id => nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.get_password_data(:instance_id => "") }.should.raise(AWS::ArgumentError) + lambda { @ec2.get_password_data() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.get_password_data(:instance_id => nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.get_password_data(:instance_id => "") }.should.raise(AWSAPI::ArgumentError) end diff --git a/test/test_EC2_products.rb b/test/test_EC2_products.rb index bf7c178..d89877f 100644 --- a/test/test_EC2_products.rb +++ b/test/test_EC2_products.rb @@ -13,7 +13,7 @@ context "An EC2 instance " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @confirm_product_instance_response_body = <<-RESPONSE @@ -37,11 +37,11 @@ specify "method get_console_output should raise an exception when called without nil/empty string arguments" do - lambda { @ec2.confirm_product_instance() }.should.raise(AWS::ArgumentError) - lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => nil) }.should.raise(AWS::ArgumentError) - lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => "") }.should.raise(AWS::ArgumentError) - lambda { @ec2.confirm_product_instance(:product_code => nil, :instance_id => "i-10a64379") }.should.raise(AWS::ArgumentError) - lambda { @ec2.confirm_product_instance(:product_code => "", :instance_id => "i-10a64379") }.should.raise(AWS::ArgumentError) + lambda { @ec2.confirm_product_instance() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => nil) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => "") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.confirm_product_instance(:product_code => nil, :instance_id => "i-10a64379") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.confirm_product_instance(:product_code => "", :instance_id => "i-10a64379") }.should.raise(AWSAPI::ArgumentError) end diff --git a/test/test_EC2_responses.rb b/test/test_EC2_responses.rb index 999c4b8..f394a59 100644 --- a/test/test_EC2_responses.rb +++ b/test/test_EC2_responses.rb @@ -20,7 +20,7 @@ RESPONSE - @response = AWS::Response.parse(:xml => @http_xml) + @response = AWSAPI::Response.parse(:xml => @http_xml) end diff --git a/test/test_EC2_s3_xmlsimple.rb b/test/test_EC2_s3_xmlsimple.rb index 4ebe156..4aa48fe 100644 --- a/test/test_EC2_s3_xmlsimple.rb +++ b/test/test_EC2_s3_xmlsimple.rb @@ -17,7 +17,7 @@ context "EC2 aws-s3 compat test" do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @describe_instances_response_body = <<-RESPONSE diff --git a/test/test_EC2_security_groups.rb b/test/test_EC2_security_groups.rb index d44235b..e4d103e 100644 --- a/test/test_EC2_security_groups.rb +++ b/test/test_EC2_security_groups.rb @@ -13,7 +13,7 @@ context "EC2 security groups " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @create_security_group_response_body = <<-RESPONSE @@ -92,16 +92,16 @@ @ec2.stubs(:make_request).with('CreateSecurityGroup', {"GroupName"=>"WebServers", "GroupDescription"=>"Web"}). returns stub(:body => @create_security_group_response_body, :is_a? => true) - lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => "Web" ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.create_security_group() }.should.raise(AWS::ArgumentError) + lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => "Web" ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_security_group() }.should.raise(AWSAPI::ArgumentError) # :group_name can't be nil or empty - lambda { @ec2.create_security_group( :group_name => "", :group_description => "Web" ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_security_group( :group_name => nil, :group_description => "Web" ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.create_security_group( :group_name => "", :group_description => "Web" ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_security_group( :group_name => nil, :group_description => "Web" ) }.should.raise(AWSAPI::ArgumentError) # :group_description can't be nil or empty - lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => "" ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => nil ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => "" ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => nil ) }.should.raise(AWSAPI::ArgumentError) end @@ -116,12 +116,12 @@ @ec2.stubs(:make_request).with('DeleteSecurityGroup', {"GroupName"=>"WebServers"}). returns stub(:body => @delete_security_group_response_body, :is_a? => true) - lambda { @ec2.delete_security_group( :group_name => "WebServers" ) }.should.not.raise(AWS::ArgumentError) - lambda { @ec2.delete_security_group() }.should.raise(AWS::ArgumentError) + lambda { @ec2.delete_security_group( :group_name => "WebServers" ) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @ec2.delete_security_group() }.should.raise(AWSAPI::ArgumentError) # :group_name can't be nil or empty - lambda { @ec2.delete_security_group( :group_name => "" ) }.should.raise(AWS::ArgumentError) - lambda { @ec2.delete_security_group( :group_name => nil ) }.should.raise(AWS::ArgumentError) + lambda { @ec2.delete_security_group( :group_name => "" ) }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.delete_security_group( :group_name => nil ) }.should.raise(AWSAPI::ArgumentError) end @@ -156,7 +156,7 @@ @ec2.stubs(:make_request).with('DescribeSecurityGroups', {"GroupName.1"=>"WebServers"}). returns stub(:body => @describe_security_groups_response_body, :is_a? => true) - lambda { @ec2.describe_security_groups( :group_name => "WebServers" ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.describe_security_groups( :group_name => "WebServers" ) }.should.not.raise(AWSAPI::ArgumentError) end diff --git a/test/test_EC2_snapshots.rb b/test/test_EC2_snapshots.rb index 1a13513..41f1747 100644 --- a/test/test_EC2_snapshots.rb +++ b/test/test_EC2_snapshots.rb @@ -13,7 +13,7 @@ context "EC2 snaphots " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @describe_snapshots_response_body = <<-RESPONSE diff --git a/test/test_EC2_spot_instance_requests.rb b/test/test_EC2_spot_instance_requests.rb index c751ac0..a16c8ba 100644 --- a/test/test_EC2_spot_instance_requests.rb +++ b/test/test_EC2_spot_instance_requests.rb @@ -13,7 +13,7 @@ context "An EC2 spot instances request " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @create_spot_instances_request_response_body = <<-RESPONSE @@ -111,12 +111,12 @@ ["t1.micro", "m1.small", "m1.large", "m1.xlarge", "m2.xlarge", "c1.medium", "c1.xlarge", "m2.2xlarge", "m2.4xlarge", "cc1.4xlarge"].each do |type| @ec2.stubs(:make_request).with('RequestSpotInstances', {"SpotPrice"=>"0.50", 'LaunchSpecification.InstanceType' => type, 'LaunchSpecification.ImageId' => 'ami-60a54009', "InstanceCount"=>"1"}). returns stub(:body => @create_spot_instances_request_response_body, :is_a? => true) - lambda { @ec2.request_spot_instances( :image_id => "ami-60a54009", :instance_type => type, :spot_price => '0.50' ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.request_spot_instances( :image_id => "ami-60a54009", :instance_type => type, :spot_price => '0.50' ) }.should.not.raise(AWSAPI::ArgumentError) end end specify "should raise an exception with a bad instance type" do - lambda { @ec2.request_spot_instances({"SpotPrice"=>"0.50", 'LaunchSpecification.InstanceType' => 'm1.notarealsize', "InstanceCount"=>"1"}) }.should.raise(AWS::ArgumentError) + lambda { @ec2.request_spot_instances({"SpotPrice"=>"0.50", 'LaunchSpecification.InstanceType' => 'm1.notarealsize', "InstanceCount"=>"1"}) }.should.raise(AWSAPI::ArgumentError) end specify "should be able to be created" do @@ -128,9 +128,9 @@ specify "method create_spot_instances_request should raise an exception when called with nil/empty string arguments" do - lambda { @ec2.request_spot_instances() }.should.raise(AWS::ArgumentError) - lambda { @ec2.request_spot_instances(:spot_price => "") }.should.raise(AWS::ArgumentError) - lambda { @ec2.request_spot_instances(:spot_price => nil) }.should.raise(AWS::ArgumentError) + lambda { @ec2.request_spot_instances() }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.request_spot_instances(:spot_price => "") }.should.raise(AWSAPI::ArgumentError) + lambda { @ec2.request_spot_instances(:spot_price => nil) }.should.raise(AWSAPI::ArgumentError) end diff --git a/test/test_EC2_spot_prices.rb b/test/test_EC2_spot_prices.rb index ec9b63d..8aa404c 100644 --- a/test/test_EC2_spot_prices.rb +++ b/test/test_EC2_spot_prices.rb @@ -3,7 +3,7 @@ context "Spot price history " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @describe_spot_price_history_response_body = <<-RESPONSE @@ -33,27 +33,27 @@ end specify "should reject a start_time which is not a Time object" do - lambda { @ec2.describe_spot_price_history(:start_time => "foo") }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_spot_price_history(:start_time => "foo") }.should.raise(AWSAPI::ArgumentError) end specify "should reject an end_time which is not a Time object" do - lambda { @ec2.describe_spot_price_history(:end_time => 42) }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_spot_price_history(:end_time => 42) }.should.raise(AWSAPI::ArgumentError) end specify "should be able to be requested with various instance types" do ["t1.micro", "m1.small", "m1.large", "m1.xlarge", "m2.xlarge", "c1.medium", "c1.xlarge", "m2.2xlarge", "m2.4xlarge", "cc1.4xlarge", "cg1.4xlarge"].each do |type| @ec2.stubs(:make_request).with('DescribeSpotPriceHistory', {'InstanceType' => type}). returns stub(:body => @describe_spot_price_history_response_body, :is_a? => true) - lambda { @ec2.describe_spot_price_history( :instance_type => type ) }.should.not.raise(AWS::ArgumentError) + lambda { @ec2.describe_spot_price_history( :instance_type => type ) }.should.not.raise(AWSAPI::ArgumentError) end end specify "should reject an invalid instance type" do - lambda { @ec2.describe_spot_price_history(:instance_type => 'm1.tiny') }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_spot_price_history(:instance_type => 'm1.tiny') }.should.raise(AWSAPI::ArgumentError) end specify "should reject an invalid product description" do - lambda { @ec2.describe_spot_price_history(:product_description => 'Solaris') }.should.raise(AWS::ArgumentError) + lambda { @ec2.describe_spot_price_history(:product_description => 'Solaris') }.should.raise(AWSAPI::ArgumentError) end end diff --git a/test/test_EC2_subnets.rb b/test/test_EC2_subnets.rb index 19ece5e..a4804b0 100644 --- a/test/test_EC2_subnets.rb +++ b/test/test_EC2_subnets.rb @@ -13,7 +13,7 @@ context "The EC2 subnets " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @describe_subnets_response_body = <<-RESPONSE diff --git a/test/test_EC2_volumes.rb b/test/test_EC2_volumes.rb index c118ca1..e0ed99e 100644 --- a/test/test_EC2_volumes.rb +++ b/test/test_EC2_volumes.rb @@ -13,7 +13,7 @@ context "EC2 volumes " do before do - @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @ec2 = AWSAPI::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @describe_volumes_response_body = <<-RESPONSE diff --git a/test/test_ELB_load_balancers.rb b/test/test_ELB_load_balancers.rb index 48fa12d..e167e67 100644 --- a/test/test_ELB_load_balancers.rb +++ b/test/test_ELB_load_balancers.rb @@ -2,7 +2,7 @@ context "elb load balancers " do before do - @elb = AWS::ELB::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @elb = AWSAPI::ELB::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @valid_create_load_balancer_params = { :load_balancer_name => 'Test Name', @@ -132,13 +132,13 @@ 'Listeners.member.1.InstancePort' => '80' }).returns stub(:body => @create_load_balancer_response_body, :is_a? => true) - lambda { @elb.create_load_balancer(@valid_create_load_balancer_params) }.should.not.raise(AWS::ArgumentError) - lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:load_balancer_name=>nil)) }.should.raise(AWS::ArgumentError) - lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:load_balancer_name=>'')) }.should.raise(AWS::ArgumentError) - lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:availability_zones=>'')) }.should.raise(AWS::ArgumentError) - lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:availability_zones=>[])) }.should.raise(AWS::ArgumentError) - lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:listeners=>[])) }.should.raise(AWS::ArgumentError) - lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:listeners=>nil)) }.should.raise(AWS::ArgumentError) + lambda { @elb.create_load_balancer(@valid_create_load_balancer_params) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:load_balancer_name=>nil)) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:load_balancer_name=>'')) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:availability_zones=>'')) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:availability_zones=>[])) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:listeners=>[])) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.create_load_balancer(@valid_create_load_balancer_params.merge(:listeners=>nil)) }.should.raise(AWSAPI::ArgumentError) end specify "should be able to be deleted with delete_load_balancer" do @@ -178,10 +178,10 @@ 'Instances.member.1.InstanceId' => 'i-6055fa09' }).returns stub(:body => @register_instances_with_load_balancer_response_body, :is_a? => true) - lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params) }.should.not.raise(AWS::ArgumentError) - lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params.merge(:load_balancer_name=>nil)) }.should.raise(AWS::ArgumentError) - lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params.merge(:instances=>nil)) }.should.raise(AWS::ArgumentError) - lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params.merge(:instances=>[])) }.should.raise(AWS::ArgumentError) + lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params.merge(:load_balancer_name=>nil)) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params.merge(:instances=>nil)) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params.merge(:instances=>[])) }.should.raise(AWSAPI::ArgumentError) end specify "should be able to deregister instances from load balancers with deregister_instances_from_load_balancer" do @@ -200,10 +200,10 @@ 'Instances.member.1.InstanceId' => 'i-6055fa09' }).returns stub(:body => @deregister_instances_from_load_balancer_response_body, :is_a? => true) - lambda { @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params) }.should.not.raise(AWS::ArgumentError) - lambda { @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params.merge(:load_balancer_name=>nil)) }.should.raise(AWS::ArgumentError) - lambda { @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params.merge(:instances=>nil)) }.should.raise(AWS::ArgumentError) - lambda { @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params.merge(:instances=>[])) }.should.raise(AWS::ArgumentError) + lambda { @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params.merge(:load_balancer_name=>nil)) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params.merge(:instances=>nil)) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.deregister_instances_from_load_balancer(@valid_deregister_instances_from_load_balancer_params.merge(:instances=>[])) }.should.raise(AWSAPI::ArgumentError) end specify "should be able to configure_health_check for instances from load balancers" do @@ -219,12 +219,12 @@ response = @elb.configure_health_check(@valid_configure_health_check_params) response.should.be.an.instance_of Hash - lambda { @elb.configure_health_check(@valid_configure_health_check_params) }.should.not.raise(AWS::ArgumentError) - lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:load_balancer_name => nil)) }.should.raise(AWS::ArgumentError) - lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:load_balancer_name => "")) }.should.raise(AWS::ArgumentError) + lambda { @elb.configure_health_check(@valid_configure_health_check_params) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:load_balancer_name => nil)) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:load_balancer_name => "")) }.should.raise(AWSAPI::ArgumentError) - lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:health_check => nil)) }.should.raise(AWS::ArgumentError) - lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:health_check => "")) }.should.raise(AWS::ArgumentError) + lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:health_check => nil)) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:health_check => "")) }.should.raise(AWSAPI::ArgumentError) end @@ -267,9 +267,9 @@ 'HealthCheck.UnhealthyThreshold' => '2' }).returns stub(:body => @configure_health_check_response_body, :is_a? => true) - lambda { @elb.configure_health_check(@valid_configure_health_check_params) }.should.not.raise(AWS::ArgumentError) - lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:load_balancer_name=>nil)) }.should.raise(AWS::ArgumentError) - lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:health_check=>nil)) }.should.raise(AWS::ArgumentError) + lambda { @elb.configure_health_check(@valid_configure_health_check_params) }.should.not.raise(AWSAPI::ArgumentError) + lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:load_balancer_name=>nil)) }.should.raise(AWSAPI::ArgumentError) + lambda { @elb.configure_health_check(@valid_configure_health_check_params.merge(:health_check=>nil)) }.should.raise(AWSAPI::ArgumentError) end end diff --git a/test/test_RDS.rb b/test/test_RDS.rb index 083071d..e6a8838 100644 --- a/test/test_RDS.rb +++ b/test/test_RDS.rb @@ -2,7 +2,7 @@ context "rds databases " do before do - @rds = AWS::RDS::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) + @rds = AWSAPI::RDS::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" ) @create_db_instance_body = <<-RESPONSE diff --git a/test/test_helper.rb b/test/test_helper.rb index 14562e1..f5e8c0c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -19,5 +19,5 @@ end } -require File.dirname(__FILE__) + '/../lib/AWS' +require File.dirname(__FILE__) + '/../lib/AWSAPI'