amazon-ec2 0.4.8 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/ChangeLog +7 -4
  2. data/README.rdoc +12 -12
  3. data/README_dev.rdoc +6 -0
  4. data/Rakefile +2 -1
  5. data/VERSION +1 -1
  6. data/amazon-ec2.gemspec +25 -18
  7. data/bin/ec2-gem-example.rb +3 -3
  8. data/bin/ec2-gem-profile.rb +2 -2
  9. data/bin/ec2sh +4 -4
  10. data/bin/setup.rb +4 -2
  11. data/lib/{EC2.rb → AWS.rb} +33 -67
  12. data/lib/AWS/EC2.rb +67 -0
  13. data/lib/AWS/EC2/availability_zones.rb +43 -0
  14. data/lib/AWS/EC2/console.rb +46 -0
  15. data/lib/AWS/EC2/elastic_ips.rb +154 -0
  16. data/lib/AWS/EC2/image_attributes.rb +168 -0
  17. data/lib/AWS/EC2/images.rb +136 -0
  18. data/lib/AWS/EC2/instances.rb +218 -0
  19. data/lib/AWS/EC2/keypairs.rb +96 -0
  20. data/lib/AWS/EC2/products.rb +45 -0
  21. data/lib/AWS/EC2/security_groups.rb +234 -0
  22. data/lib/AWS/EC2/snapshots.rb +96 -0
  23. data/lib/AWS/EC2/volumes.rb +172 -0
  24. data/lib/AWS/ELB.rb +67 -0
  25. data/lib/AWS/ELB/load_balancers.rb +198 -0
  26. data/lib/{EC2 → AWS}/exceptions.rb +21 -2
  27. data/lib/{EC2 → AWS}/responses.rb +4 -5
  28. data/perftools/ec2prof-results.txt +4 -4
  29. data/perftools/ec2prof.symbols +4 -4
  30. data/test/test_EC2.rb +14 -14
  31. data/test/test_EC2_availability_zones.rb +2 -2
  32. data/test/test_EC2_console.rb +5 -5
  33. data/test/test_EC2_elastic_ips.rb +13 -13
  34. data/test/test_EC2_image_attributes.rb +35 -35
  35. data/test/test_EC2_images.rb +7 -7
  36. data/test/test_EC2_instances.rb +35 -35
  37. data/test/test_EC2_keypairs.rb +10 -10
  38. data/test/test_EC2_products.rb +7 -7
  39. data/test/test_EC2_responses.rb +2 -2
  40. data/test/test_EC2_s3_xmlsimple.rb +2 -2
  41. data/test/test_EC2_security_groups.rb +13 -13
  42. data/test/test_EC2_snapshots.rb +2 -2
  43. data/test/test_EC2_volumes.rb +2 -2
  44. data/test/test_ELB_load_balancers.rb +239 -0
  45. data/test/test_helper.rb +1 -1
  46. metadata +24 -17
  47. data/lib/EC2/availability_zones.rb +0 -41
  48. data/lib/EC2/console.rb +0 -44
  49. data/lib/EC2/elastic_ips.rb +0 -153
  50. data/lib/EC2/image_attributes.rb +0 -166
  51. data/lib/EC2/images.rb +0 -134
  52. data/lib/EC2/instances.rb +0 -216
  53. data/lib/EC2/keypairs.rb +0 -94
  54. data/lib/EC2/products.rb +0 -43
  55. data/lib/EC2/security_groups.rb +0 -232
  56. data/lib/EC2/snapshots.rb +0 -94
  57. data/lib/EC2/volumes.rb +0 -170
data/lib/AWS/ELB.rb ADDED
@@ -0,0 +1,67 @@
1
+ #--
2
+ # Amazon Web Services EC2 Query API Ruby library
3
+ #
4
+ # Ruby Gem Name:: amazon-ec2
5
+ # Author:: Glenn Rempe (mailto:glenn@rempe.us)
6
+ # Copyright:: Copyright (c) 2007-2008 Glenn Rempe
7
+ # License:: Distributes under the same terms as Ruby
8
+ # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
+ #++
10
+
11
+ # Require any lib files that we have bundled with this Ruby Gem in the lib/EC2 directory.
12
+ # Parts of the EC2 module and Base class are broken out into separate
13
+ # files for maintainability and are organized by the functional groupings defined
14
+ # in the EC2 API developers guide.
15
+ Dir[File.join(File.dirname(__FILE__), 'ELB/**/*.rb')].sort.each { |lib| require lib }
16
+
17
+ module AWS
18
+ module ELB
19
+
20
+ # Which host FQDN will we connect to for all API calls to AWS?
21
+ # If ELB_URL is defined in the users ENV we can use that. It is
22
+ # expected that this var is set with something like:
23
+ # export ELB_URL='https://ec2.amazonaws.com'
24
+ #
25
+ if ENV['ELB_URL']
26
+ ELB_URL = ENV['ELB_URL']
27
+ VALID_HOSTS = ['elasticloadbalancing.amazonaws.com']
28
+ raise ArgumentError, "Invalid ELB_URL environment variable : #{ELB_URL}" unless VALID_HOSTS.include?(ELB_URL)
29
+ DEFAULT_HOST = URI.parse(ELB_URL).host
30
+ else
31
+ # default US host
32
+ DEFAULT_HOST = 'elasticloadbalancing.amazonaws.com'
33
+ end
34
+
35
+ # This is the version of the API as defined by Amazon Web Services
36
+ API_VERSION = '2009-05-15'
37
+
38
+ #Introduction:
39
+ #
40
+ # The library exposes one main interface class, 'AWS::ELB::Base'.
41
+ # This class provides all the methods for using the ELB service
42
+ # including the handling of header signing and other security issues .
43
+ # This class uses Net::HTTP to interface with the ELB Query API interface.
44
+ #
45
+ #Required Arguments:
46
+ #
47
+ # :access_key_id => String (default : "")
48
+ # :secret_access_key => String (default : "")
49
+ #
50
+ #Optional Arguments:
51
+ #
52
+ # :use_ssl => Boolean (default : true)
53
+ # :server => String (default : 'elasticloadbalancing.amazonaws.com')
54
+ # :proxy_server => String (default : nil)
55
+ #
56
+ class Base < AWS::Base
57
+ def api_version
58
+ API_VERSION
59
+ end
60
+
61
+ def default_host
62
+ DEFAULT_HOST
63
+ end
64
+ end
65
+
66
+ end
67
+ end
@@ -0,0 +1,198 @@
1
+ module AWS
2
+ module ELB
3
+ class Base < AWS::Base
4
+ # Amazon Developer Guide Docs:
5
+ #
6
+ # This API creates a new LoadBalancer. Once the call has completed
7
+ # successfully, a new LoadBalancer will be created, but it will not be
8
+ # usable until at least one instance has been registered. When the
9
+ # LoadBalancer creation is completed, you can check whether it is usable
10
+ # by using the DescribeInstanceHealth API. The LoadBalancer is usable as
11
+ # soon as any registered instance is InService.
12
+ #
13
+ # Required Arguments:
14
+ #
15
+ # :load_balancer_name => String
16
+ # :availability_zones => Array
17
+ # :listeners => Array of Hashes (:protocol, :load_balancer_port, :instance_port)
18
+ # :availability_zones => Array of Strings
19
+ #
20
+ def create_load_balancer( options = {} )
21
+ raise ArgumentError, "No :availability_zones provided" if options[:availability_zones].nil? || options[:availability_zones].empty?
22
+ raise ArgumentError, "No :listeners provided" if options[:listeners].nil? || options[:listeners].empty?
23
+ raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
24
+
25
+ params = {}
26
+
27
+ params.merge!(pathlist('AvailabilityZones.member', [options[:availability_zones]].flatten))
28
+ params.merge!(pathhashlist('Listeners.member', [options[:listeners]].flatten, {
29
+ :protocol => 'Protocol',
30
+ :load_balancer_port => 'LoadBalancerPort',
31
+ :instance_port => 'InstancePort'
32
+ }))
33
+ params['LoadBalancerName'] = options[:load_balancer_name]
34
+
35
+ return response_generator(:action => "CreateLoadBalancer", :params => params)
36
+ end
37
+
38
+ # Amazon Developer Guide Docs:
39
+ #
40
+ # This API deletes the specified LoadBalancer. On deletion, all of the
41
+ # configured properties of the LoadBalancer will be deleted. If you
42
+ # attempt to recreate the LoadBalancer, you need to reconfigure all the
43
+ # settings. The DNS name associated with a deleted LoadBalancer is no
44
+ # longer be usable. Once deleted, the name and associated DNS record of
45
+ # the LoadBalancer no longer exist and traffic sent to any of its IP
46
+ # addresses will no longer be delivered to your instances. You will not
47
+ # get the same DNS name even if you create a new LoadBalancer with same
48
+ # LoadBalancerName.
49
+ #
50
+ # Required Arguments:
51
+ #
52
+ # :load_balancer_name => String
53
+ #
54
+ def delete_load_balancer( options = {} )
55
+ raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
56
+
57
+ params = { 'LoadBalancerName' => options[:load_balancer_name] }
58
+
59
+ return response_generator(:action => "DeleteLoadBalancer", :params => params)
60
+ end
61
+
62
+ # Amazon Developer Guide Docs:
63
+ #
64
+ # This API returns detailed configuration information for the specified
65
+ # LoadBalancers, or if no LoadBalancers are specified, then the API
66
+ # returns configuration information for all LoadBalancers created by the
67
+ # caller. For more information, please see LoadBalancer.
68
+ #
69
+ # You must have created the specified input LoadBalancers in order to
70
+ # retrieve this information. In other words, in order to successfully call
71
+ # this API, you must provide the same account credentials as those that
72
+ # were used to create the LoadBalancer.
73
+ #
74
+ # Optional Arguments:
75
+ #
76
+ # :load_balancer_names => String
77
+ #
78
+ def describe_load_balancers( options = {} )
79
+ options = { :load_balancer_names => [] }.merge(options)
80
+
81
+ params = pathlist("LoadBalancerName.member", options[:load_balancer_names])
82
+
83
+ return response_generator(:action => "DescribeLoadBalancers", :params => params)
84
+ end
85
+
86
+ # Amazon Developer Guide Docs:
87
+ #
88
+ # This API adds new instances to the LoadBalancer.
89
+ #
90
+ # Once the instance is registered, it starts receiving traffic and
91
+ # requests from the LoadBalancer. Any instance that is not in any of the
92
+ # Availability Zones registered for the LoadBalancer will be moved to
93
+ # the OutOfService state. It will move to the InService state when the
94
+ # Availability Zone is added to the LoadBalancer.
95
+ #
96
+ # You must have been the one who created the LoadBalancer. In other
97
+ # words, in order to successfully call this API, you must provide the
98
+ # same account credentials as those that were used to create the
99
+ # LoadBalancer.
100
+ #
101
+ # NOTE: Completion of this API does not guarantee that operation has
102
+ # completed. Rather, it means that the request has been registered and
103
+ # the changes will happen shortly.
104
+ #
105
+ # Required Arguments:
106
+ #
107
+ # :instances => Array of Strings
108
+ # :load_balancer_name => String
109
+ #
110
+ def register_instances_with_load_balancer( options = {} )
111
+ raise ArgumentError, "No :instances provided" if options[:instances].nil? || options[:instances].empty?
112
+ raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
113
+
114
+ params = {}
115
+
116
+ params.merge!(pathlist('Instances.member', [options[:instances]].flatten))
117
+ params['LoadBalancerName'] = options[:load_balancer_name]
118
+
119
+ return response_generator(:action => "RegisterInstancesWithLoadBalancer", :params => params)
120
+ end
121
+
122
+ # Amazon Developer Guide Docs:
123
+ #
124
+ # This API deregisters instances from the LoadBalancer. Trying to
125
+ # deregister an instance that is not registered with the LoadBalancer
126
+ # does nothing.
127
+ #
128
+ # In order to successfully call this API, you must provide the same
129
+ # account credentials as those that were used to create the
130
+ # LoadBalancer.
131
+ #
132
+ # Once the instance is deregistered, it will stop receiving traffic from
133
+ # the LoadBalancer.
134
+ #
135
+ # Required Arguments:
136
+ #
137
+ # :instances => Array of Strings
138
+ # :load_balancer_name => String
139
+ #
140
+ def deregister_instances_from_load_balancer( options = {} )
141
+ raise ArgumentError, "No :instances provided" if options[:instances].nil? || options[:instances].empty?
142
+ raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
143
+
144
+ params = {}
145
+
146
+ params.merge!(pathlist('Instances.member', [options[:instances]].flatten))
147
+ params['LoadBalancerName'] = options[:load_balancer_name]
148
+
149
+ return response_generator(:action => "DeregisterInstancesFromLoadBalancer", :params => params)
150
+ end
151
+
152
+ # Amazon Developer Guide Docs:
153
+ #
154
+ # This API enables you to define an application healthcheck for the
155
+ # instances.
156
+ #
157
+ # Note: Completion of this API does not guarantee that operation has completed. Rather, it means that the request has been registered and the changes will happen shortly.
158
+ #
159
+ # Required Arguments
160
+ #
161
+ # :health_check => Hash (:timeout, :interval, :unhealthy_threshold, :healthy_threshold)
162
+ # :load_balancer_name => String
163
+ #
164
+ def configure_health_check( options = {} )
165
+ raise ArgumentError, "No :health_check provided" if options[:health_check].nil? || options[:health_check].empty?
166
+ raise ArgumentError, "No :health_check => :target provided" if options[:health_check][:target].nil? || options[:health_check][:target].empty?
167
+ raise ArgumentError, "No :health_check => :timeout provided" if options[:health_check][:timeout].nil? || options[:health_check][:timeout].empty?
168
+ raise ArgumentError, "No :health_check => :interval provided" if options[:health_check][:interval].nil? || options[:health_check][:interval].empty?
169
+ raise ArgumentError, "No :health_check => :unhealthy_threshold provided" if options[:health_check][:unhealthy_threshold].nil? || options[:health_check][:unhealthy_threshold].empty?
170
+ raise ArgumentError, "No :health_check => :healthy_threshold provided" if options[:health_check][:healthy_threshold].nil? || options[:health_check][:healthy_threshold].empty?
171
+ raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
172
+
173
+ params = {}
174
+
175
+ params['LoadBalancerName'] = options[:load_balancer_name]
176
+ params['HealthCheck.Target'] = options[:health_check][:target]
177
+ params['HealthCheck.Timeout'] = options[:health_check][:timeout]
178
+ params['HealthCheck.Interval'] = options[:health_check][:interval]
179
+ params['HealthCheck.UnhealthyThreshold'] = options[:health_check][:unhealthy_threshold]
180
+ params['HealthCheck.HealthyThreshold'] = options[:health_check][:healthy_threshold]
181
+
182
+ return response_generator(:action => "ConfigureHealthCheck", :params => params)
183
+ end
184
+
185
+ def describe_intance_health( options = {} )
186
+ raise "Not yet implemented"
187
+ end
188
+
189
+ def disable_availability_zones_for_load_balancer( options = {} )
190
+ raise "Not yet implemented"
191
+ end
192
+
193
+ def enable_availability_zones_for_load_balancer( options = {} )
194
+ raise "Not yet implemented"
195
+ end
196
+ end
197
+ end
198
+ end
@@ -8,8 +8,7 @@
8
8
  # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
9
  #++
10
10
 
11
- module EC2
12
-
11
+ module AWS
13
12
  # OUR CUSTOM ERROR CODES
14
13
 
15
14
  # All of our errors are superclassed by Error < RuntimeError
@@ -127,6 +126,26 @@ module EC2
127
126
  class InvalidAMIAttributeItemValue < Error #:nodoc:
128
127
  end
129
128
 
129
+ # ELB ERRORS
130
+
131
+ class LoadBalancerNotFound < Error #:nodoc:
132
+ end
133
+
134
+ class ValidationError < Error #:nodoc:
135
+ end
136
+
137
+ class DuplicateLoadBalancerName < Error #:nodoc:
138
+ end
139
+
140
+ class TooManyLoadBalancers < Error #:nodoc:
141
+ end
142
+
143
+ class InvalidInstance < Error #:nodoc:
144
+ end
145
+
146
+ class InvalidConfigurationRequest < Error #:nodoc:
147
+ end
148
+
130
149
  # AWS EC2 SERVER ERROR CODES
131
150
 
132
151
  # Internal AWS EC2 Error.
@@ -19,9 +19,9 @@ class Hash
19
19
  end
20
20
  end
21
21
 
22
- module EC2
22
+ module AWS
23
23
 
24
- # The make_request() and ec2_error? methods, which are shared by all, will raise any
24
+ # The make_request() and aws_error? methods, which are shared by all, will raise any
25
25
  # exceptions encountered along the way as it converses with EC2.
26
26
  #
27
27
  # Exception Handling: If for some reason an error occurrs when executing a method
@@ -45,13 +45,12 @@ module EC2
45
45
  def self.parse(options = {})
46
46
  options = {
47
47
  :xml => "",
48
- :parse_options => { 'forcearray' => ['item'], 'suppressempty' => nil, 'keeproot' => false }
48
+ :parse_options => { 'forcearray' => ['item', 'member'], 'suppressempty' => nil, 'keeproot' => false }
49
49
  }.merge(options)
50
50
 
51
51
  # NOTE: Parsing the response as a nested set of Response objects was extremely
52
52
  # memory intensive and appeared to leak (the memory was not freed on subsequent requests).
53
53
  # It was changed to return the raw XmlSimple response.
54
-
55
54
  response = XmlSimple.xml_in(options[:xml], options[:parse_options])
56
55
 
57
56
  return response
@@ -59,4 +58,4 @@ module EC2
59
58
 
60
59
  end # class Response
61
60
 
62
- end # module EC2
61
+ end # module AWS
@@ -99,7 +99,7 @@ Total: 2178 samples
99
99
  0 0.0% 99.6% 32 1.5% Net::HTTPResponse#read_chunked
100
100
  0 0.0% 99.6% 12 0.6% REXML::Parsers::XPathParser#LocationPath
101
101
  0 0.0% 99.6% 152 7.0% Array#map
102
- 0 0.0% 99.6% 945 43.4% EC2::Base#response_generator
102
+ 0 0.0% 99.6% 945 43.4% AWS::EC2::Base#response_generator
103
103
  0 0.0% 99.6% 1 0.0% Net::HTTPResponse.read_status_line
104
104
  0 0.0% 99.6% 34 1.6% Net::HTTP#request
105
105
  0 0.0% 99.6% 275 12.6% Array#each
@@ -109,7 +109,7 @@ Total: 2178 samples
109
109
  0 0.0% 99.6% 32 1.5% Net::HTTPResponse#reading_body
110
110
  0 0.0% 99.6% 1 0.0% Net::HTTPResponse.each_response_header
111
111
  0 0.0% 99.6% 801 36.8% REXML::Document#build
112
- 0 0.0% 99.6% 34 1.6% EC2::Base#make_request
112
+ 0 0.0% 99.6% 34 1.6% AWS::EC2::Base#make_request
113
113
  0 0.0% 99.6% 32 1.5% Net::HTTPResponse#body
114
114
  0 0.0% 99.6% 32 1.5% Array#delete_if
115
115
  0 0.0% 99.6% 1 0.0% REXML::XPathParser#namespaces=
@@ -117,8 +117,8 @@ Total: 2178 samples
117
117
  0 0.0% 99.6% 1113 51.1% XmlSimple#xml_in
118
118
  0 0.0% 99.6% 27 1.2% Object#timeout
119
119
  0 0.0% 99.6% 801 36.8% XmlSimple#parse
120
- 0 0.0% 99.6% 918 42.1% EC2::Base#describe_images
121
- 0 0.0% 99.6% 934 42.9% EC2::Response.parse
120
+ 0 0.0% 99.6% 918 42.1% AWS::EC2::Base#describe_images
121
+ 0 0.0% 99.6% 934 42.9% AWS::Response.parse
122
122
  0 0.0% 99.6% 801 36.8% REXML::Document#initialize
123
123
  0 0.0% 99.6% 22 1.0% Array#join
124
124
  0 0.0% 99.6% 1 0.0% Net::BufferedIO#readline
@@ -7,9 +7,9 @@
7
7
  01222665: REXML::Element#each_element
8
8
  011249a9: XmlSimple#xml_in
9
9
  0223eb95: XmlSimple.xml_in
10
- 022884f1: EC2::Response.parse
11
- 011ba34d: EC2::Base#response_generator
12
- 011ba17d: EC2::Base#describe_images
10
+ 022884f1: AWS::Response.parse
11
+ 011ba34d: AWS::EC2::Base#response_generator
12
+ 011ba17d: AWS::EC2::Base#describe_images
13
13
  01124af1: XmlSimple#get_attributes
14
14
  012219b1: REXML::Attributes#each_attribute
15
15
  01219c51: REXML::Attributes#each
@@ -48,7 +48,7 @@
48
48
  025a912d: Net::HTTPResponse.each_response_header
49
49
  025a8bfd: Net::HTTPResponse.read_new
50
50
  012d8c71: Net::HTTP#request
51
- 011ba2e5: EC2::Base#make_request
51
+ 011ba2e5: AWS::EC2::Base#make_request
52
52
  012d4611: Net::HTTP#start
53
53
  005067ad: Net::BufferedIO#read
54
54
  012d87bd: Net::HTTPResponse#read_chunked
data/test/test_EC2.rb CHANGED
@@ -12,11 +12,11 @@ require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "The EC2 method " do
14
14
 
15
- setup do
15
+ before do
16
16
  end
17
17
 
18
- specify "EC2::Base attribute readers should be available" do
19
- @ec2 = EC2::Base.new( :access_key_id => "not a key",
18
+ specify "AWS::EC2::Base attribute readers should be available" do
19
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key",
20
20
  :secret_access_key => "not a secret",
21
21
  :use_ssl => true,
22
22
  :server => "foo.example.com" )
@@ -26,8 +26,8 @@ context "The EC2 method " do
26
26
  @ec2.server.should.equal "foo.example.com"
27
27
  end
28
28
 
29
- specify "EC2::Base should work with insecure connections as well" do
30
- @ec2 = EC2::Base.new( :access_key_id => "not a key",
29
+ specify "AWS::EC2::Base should work with insecure connections as well" do
30
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key",
31
31
  :secret_access_key => "not a secret",
32
32
  :use_ssl => false,
33
33
  :server => "foo.example.com" )
@@ -37,8 +37,8 @@ context "The EC2 method " do
37
37
  @ec2.server.should.equal "foo.example.com"
38
38
  end
39
39
 
40
- specify "EC2::Base should allow specification of port" do
41
- @ec2 = EC2::Base.new( :access_key_id => "not a key",
40
+ specify "AWS::EC2::Base should allow specification of port" do
41
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key",
42
42
  :secret_access_key => "not a secret",
43
43
  :use_ssl => true,
44
44
  :server => "foo.example.com",
@@ -49,20 +49,20 @@ context "The EC2 method " do
49
49
  @ec2.server.should.equal "foo.example.com"
50
50
  end
51
51
 
52
- specify "EC2.canonical_string(path) should conform to Amazon's requirements " do
52
+ specify "AWS.canonical_string(path) should conform to Amazon's requirements " do
53
53
  path = {"name1" => "value1", "name2" => "value2", "name3" => "value3"}
54
54
  if ENV['EC2_URL'].nil? || ENV['EC2_URL'] == 'https://ec2.amazonaws.com'
55
- EC2.canonical_string(path).should.equal "POST\nec2.amazonaws.com\n/\nname1=value1&name2=value2&name3=value3"
55
+ AWS.canonical_string(path, 'ec2.amazonaws.com').should.equal "POST\nec2.amazonaws.com\n/\nname1=value1&name2=value2&name3=value3"
56
56
  elsif ENV['EC2_URL'] == 'https://us-east-1.ec2.amazonaws.com'
57
- EC2.canonical_string(path).should.equal "POST\nus-east-1.ec2.amazonaws.com\n/\nname1=value1&name2=value2&name3=value3"
57
+ AWS.canonical_string(path, 'ec2.amazonaws.com').should.equal "POST\nus-east-1.ec2.amazonaws.com\n/\nname1=value1&name2=value2&name3=value3"
58
58
  elsif ENV['EC2_URL'] == 'https://eu-west-1.ec2.amazonaws.com'
59
- EC2.canonical_string(path).should.equal "POST\neu-west-1.ec2.amazonaws.com\n/\nname1=value1&name2=value2&name3=value3"
59
+ AWS.canonical_string(path, 'ec2.amazonaws.com').should.equal "POST\neu-west-1.ec2.amazonaws.com\n/\nname1=value1&name2=value2&name3=value3"
60
60
  end
61
61
  end
62
62
 
63
- specify "EC2.encode should return the expected string" do
64
- EC2.encode("secretaccesskey", "foobar123", urlencode=true).should.equal "e3jeuDc3DIX2mW8cVqWiByj4j5g%3D"
65
- EC2.encode("secretaccesskey", "foobar123", urlencode=false).should.equal "e3jeuDc3DIX2mW8cVqWiByj4j5g="
63
+ specify "AWS.encode should return the expected string" do
64
+ AWS.encode("secretaccesskey", "foobar123", urlencode=true).should.equal "e3jeuDc3DIX2mW8cVqWiByj4j5g%3D"
65
+ AWS.encode("secretaccesskey", "foobar123", urlencode=false).should.equal "e3jeuDc3DIX2mW8cVqWiByj4j5g="
66
66
  end
67
67
 
68
68
  end