fog 0.0.84 → 0.0.85

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/Gemfile +1 -0
  2. data/Gemfile.lock +47 -37
  3. data/bin/fog +9 -10
  4. data/fog.gemspec +23 -4
  5. data/lib/fog.rb +19 -1
  6. data/lib/fog/aws.rb +23 -0
  7. data/lib/fog/aws/bin.rb +4 -0
  8. data/lib/fog/aws/ec2.rb +20 -27
  9. data/lib/fog/aws/elb.rb +115 -0
  10. data/lib/fog/aws/models/ec2/server.rb +7 -1
  11. data/lib/fog/aws/models/s3/directories.rb +4 -4
  12. data/lib/fog/aws/models/s3/directory.rb +13 -11
  13. data/lib/fog/aws/parsers/elb/deregister_instances_from_load_balancer.rb +26 -0
  14. data/lib/fog/aws/parsers/elb/describe_instance_health.rb +30 -0
  15. data/lib/fog/aws/parsers/elb/describe_load_balancers.rb +101 -0
  16. data/lib/fog/aws/parsers/elb/disable_availability_zones_for_load_balancer.rb +26 -0
  17. data/lib/fog/aws/parsers/elb/enable_availability_zones_for_load_balancer.rb +26 -0
  18. data/lib/fog/aws/parsers/elb/register_instances_with_load_balancer.rb +26 -0
  19. data/lib/fog/aws/requests/ec2/detach_volume.rb +2 -2
  20. data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +45 -0
  21. data/lib/fog/aws/requests/elb/describe_instance_health.rb +44 -0
  22. data/lib/fog/aws/requests/elb/describe_load_balancers.rb +57 -0
  23. data/lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb +44 -0
  24. data/lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb +44 -0
  25. data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +45 -0
  26. data/lib/fog/aws/s3.rb +8 -1
  27. data/lib/fog/aws/simpledb.rb +9 -18
  28. data/lib/fog/bin.rb +11 -1
  29. data/lib/fog/credentials.rb +1 -0
  30. data/lib/fog/local.rb +72 -0
  31. data/lib/fog/local/bin.rb +34 -0
  32. data/lib/fog/local/models/directories.rb +43 -0
  33. data/lib/fog/local/models/directory.rb +47 -0
  34. data/lib/fog/local/models/file.rb +58 -0
  35. data/lib/fog/local/models/files.rb +74 -0
  36. data/lib/fog/model.rb +2 -8
  37. data/lib/fog/rackspace/models/files/directories.rb +3 -3
  38. data/lib/fog/rackspace/models/files/directory.rb +8 -5
  39. data/lib/fog/rackspace/models/servers/server.rb +7 -3
  40. data/lib/fog/rackspace/requests/servers/create_server.rb +1 -1
  41. data/lib/fog/ssh.rb +91 -25
  42. data/lib/fog/terremark/bin.rb +1 -8
  43. data/lib/fog/terremark/ecloud.rb +14 -5
  44. data/lib/fog/terremark/models/shared/server.rb +54 -3
  45. data/lib/fog/terremark/parsers/shared/vapp.rb +1 -1
  46. data/lib/fog/terremark/requests/shared/get_network.rb +39 -1
  47. data/lib/fog/terremark/requests/shared/get_organization.rb +45 -1
  48. data/lib/fog/terremark/requests/shared/get_organizations.rb +2 -1
  49. data/lib/fog/terremark/requests/shared/get_public_ips.rb +32 -1
  50. data/lib/fog/terremark/requests/shared/get_vdc.rb +83 -1
  51. data/lib/fog/terremark/requests/shared/{reset.rb → power_reset.rb} +1 -1
  52. data/lib/fog/terremark/requests/shared/power_shutdown.rb +32 -0
  53. data/lib/fog/terremark/shared.rb +139 -18
  54. data/lib/fog/terremark/vcloud.rb +14 -5
  55. data/spec/aws/models/ec2/address_spec.rb +1 -3
  56. data/spec/aws/models/ec2/snapshot_spec.rb +25 -49
  57. data/spec/aws/models/ec2/snapshots_spec.rb +25 -31
  58. data/spec/aws/models/ec2/volume_spec.rb +9 -3
  59. data/spec/aws/models/s3/directory_spec.rb +14 -14
  60. data/spec/aws/requests/ec2/associate_address_spec.rb +4 -5
  61. data/spec/aws/requests/ec2/attach_volume_spec.rb +14 -16
  62. data/spec/aws/requests/ec2/create_snapshot_spec.rb +2 -3
  63. data/spec/aws/requests/ec2/delete_snapshot_spec.rb +5 -6
  64. data/spec/aws/requests/ec2/describe_instances_spec.rb +3 -2
  65. data/spec/aws/requests/ec2/describe_snapshots_spec.rb +21 -25
  66. data/spec/aws/requests/ec2/detach_volume_spec.rb +14 -16
  67. data/spec/aws/requests/ec2/disassociate_address_spec.rb +3 -4
  68. data/spec/aws/requests/ec2/get_console_output_spec.rb +1 -0
  69. data/spec/aws/requests/s3/get_service_spec.rb +5 -6
  70. data/spec/spec_helper.rb +0 -20
  71. data/tests/helper.rb +0 -10
  72. data/tests/rackspace/requests/servers/create_image_tests.rb +2 -2
  73. data/tests/rackspace/requests/servers/create_server_tests.rb +3 -2
  74. data/tests/rackspace/requests/servers/delete_image_tests.rb +2 -2
  75. data/tests/rackspace/requests/servers/delete_server_tests.rb +1 -1
  76. data/tests/rackspace/requests/servers/get_server_details_tests.rb +1 -1
  77. data/tests/rackspace/requests/servers/list_addresses_tests.rb +1 -1
  78. data/tests/rackspace/requests/servers/list_private_addresses_tests.rb +1 -1
  79. data/tests/rackspace/requests/servers/list_public_addresses_tests.rb +1 -1
  80. data/tests/rackspace/requests/servers/list_servers_detail_tests.rb +1 -1
  81. data/tests/rackspace/requests/servers/list_servers_tests.rb +1 -1
  82. data/tests/rackspace/requests/servers/reboot_server_tests.rb +3 -3
  83. data/tests/rackspace/requests/servers/update_server_tests.rb +1 -1
  84. data/tests/slicehost/requests/create_slice_tests.rb +1 -1
  85. data/tests/slicehost/requests/delete_slice_tests.rb +1 -1
  86. data/tests/slicehost/requests/get_slice_tests.rb +1 -1
  87. data/tests/slicehost/requests/reboot_slice_tests.rb +2 -2
  88. metadata +24 -5
  89. data/lib/fog/terremark/requests/shared/shutdown.rb +0 -43
data/Gemfile CHANGED
@@ -10,3 +10,4 @@ gem 'nokogiri', ">= 0"
10
10
  gem 'ruby-hmac', ">= 0"
11
11
  gem 'rspec', '>= 0'
12
12
  gem 'shindo', '>= 0'
13
+ gem 'fog', :path => '.'
@@ -1,69 +1,79 @@
1
1
  ---
2
+ specs:
3
+ - rake:
4
+ version: 0.8.7
5
+ - annals:
6
+ version: 0.0.3
7
+ - excon:
8
+ version: 0.0.21
9
+ - formatador:
10
+ version: 0.0.13
11
+ - json:
12
+ version: 1.4.1
13
+ - mime-types:
14
+ version: "1.16"
15
+ - net-ssh:
16
+ version: 2.0.22
17
+ - nokogiri:
18
+ version: 1.4.1
19
+ - ruby-hmac:
20
+ version: 0.4.0
21
+ - fog:
22
+ version: 0.0.84
23
+ source: 0
24
+ - rspec:
25
+ version: 1.3.0
26
+ - shindo:
27
+ version: 0.0.17
28
+ hash: 6cf30542dfb9f6105f2e82d59ca1b74d7285aa68
29
+ sources:
30
+ - Path:
31
+ path: !ruby/object:Pathname
32
+ path: .
33
+ - Rubygems:
34
+ uri: http://gemcutter.org
2
35
  dependencies:
3
36
  formatador:
37
+ version: ">= 0.0.10"
4
38
  group:
5
39
  - :default
6
- version: ">= 0.0.10"
7
- rake:
40
+ nokogiri:
41
+ version: ">= 0"
8
42
  group:
9
43
  - :default
44
+ rspec:
10
45
  version: ">= 0"
11
- ruby-hmac:
12
46
  group:
13
47
  - :default
48
+ rake:
14
49
  version: ">= 0"
15
- mime-types:
16
50
  group:
17
51
  - :default
52
+ mime-types:
18
53
  version: ">= 0"
19
- rspec:
20
54
  group:
21
55
  - :default
56
+ ruby-hmac:
22
57
  version: ">= 0"
23
- net-ssh:
24
58
  group:
25
59
  - :default
60
+ net-ssh:
26
61
  version: ">= 0"
27
- json:
28
62
  group:
29
63
  - :default
64
+ fog:
30
65
  version: ">= 0"
31
- excon:
32
66
  group:
33
67
  - :default
68
+ excon:
34
69
  version: ">= 0.0.21"
35
- shindo:
36
70
  group:
37
71
  - :default
72
+ json:
38
73
  version: ">= 0"
39
- nokogiri:
40
74
  group:
41
75
  - :default
76
+ shindo:
42
77
  version: ">= 0"
43
- specs:
44
- - rake:
45
- version: 0.8.7
46
- - annals:
47
- version: 0.0.3
48
- - excon:
49
- version: 0.0.21
50
- - formatador:
51
- version: 0.0.13
52
- - json:
53
- version: 1.4.1
54
- - mime-types:
55
- version: "1.16"
56
- - net-ssh:
57
- version: 2.0.22
58
- - nokogiri:
59
- version: 1.4.1
60
- - rspec:
61
- version: 1.3.0
62
- - ruby-hmac:
63
- version: 0.4.0
64
- - shindo:
65
- version: 0.0.17
66
- hash: e443f12a9a7794f2ff4fc8e8d201b12b1e8b30bb
67
- sources:
68
- - Rubygems:
69
- uri: http://gemcutter.org
78
+ group:
79
+ - :default
data/bin/fog CHANGED
@@ -1,21 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
- lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
3
- require File.join(lib_dir, 'fog')
2
+ require 'fog'
4
3
  require 'irb'
5
4
  require 'yaml'
6
-
7
- require File.join(lib_dir, 'fog', 'credentials')
8
- require File.join(lib_dir, 'fog', 'bin')
5
+ require 'fog/credentials'
6
+ require 'fog/bin'
9
7
 
10
8
  Fog.credential = (ARGV.first && :"#{ARGV.first}") || :default
11
9
  unless Fog.credentials
12
10
  exit
13
11
  end
14
12
 
15
- require File.join(lib_dir, 'fog', 'aws', 'bin')
16
- require File.join(lib_dir, 'fog', 'rackspace', 'bin')
17
- require File.join(lib_dir, 'fog', 'slicehost', 'bin')
18
- require File.join(lib_dir, 'fog', 'terremark', 'bin')
13
+ require 'fog/aws/bin'
14
+ require 'fog/local/bin'
15
+ require 'fog/rackspace/bin'
16
+ require 'fog/slicehost/bin'
17
+ require 'fog/terremark/bin'
19
18
 
20
19
  if ARGV.length > 1
21
20
  print(instance_eval(ARGV[1..-1].join(' ')).to_json)
@@ -41,4 +40,4 @@ else
41
40
 
42
41
  catch(:IRB_EXIT) { @irb.eval_input }
43
42
 
44
- end
43
+ end
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'fog'
10
- s.version = '0.0.84'
11
- s.date = '2010-04-28'
10
+ s.version = '0.0.85'
11
+ s.date = '2010-05-02'
12
12
  s.rubyforge_project = 'fog'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
@@ -73,6 +73,7 @@ Gem::Specification.new do |s|
73
73
  lib/fog/aws.rb
74
74
  lib/fog/aws/bin.rb
75
75
  lib/fog/aws/ec2.rb
76
+ lib/fog/aws/elb.rb
76
77
  lib/fog/aws/models/ec2/address.rb
77
78
  lib/fog/aws/models/ec2/addresses.rb
78
79
  lib/fog/aws/models/ec2/flavor.rb
@@ -113,6 +114,12 @@ Gem::Specification.new do |s|
113
114
  lib/fog/aws/parsers/ec2/get_console_output.rb
114
115
  lib/fog/aws/parsers/ec2/run_instances.rb
115
116
  lib/fog/aws/parsers/ec2/terminate_instances.rb
117
+ lib/fog/aws/parsers/elb/deregister_instances_from_load_balancer.rb
118
+ lib/fog/aws/parsers/elb/describe_instance_health.rb
119
+ lib/fog/aws/parsers/elb/describe_load_balancers.rb
120
+ lib/fog/aws/parsers/elb/disable_availability_zones_for_load_balancer.rb
121
+ lib/fog/aws/parsers/elb/enable_availability_zones_for_load_balancer.rb
122
+ lib/fog/aws/parsers/elb/register_instances_with_load_balancer.rb
116
123
  lib/fog/aws/parsers/s3/copy_object.rb
117
124
  lib/fog/aws/parsers/s3/get_bucket.rb
118
125
  lib/fog/aws/parsers/s3/get_bucket_location.rb
@@ -153,6 +160,12 @@ Gem::Specification.new do |s|
153
160
  lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb
154
161
  lib/fog/aws/requests/ec2/run_instances.rb
155
162
  lib/fog/aws/requests/ec2/terminate_instances.rb
163
+ lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb
164
+ lib/fog/aws/requests/elb/describe_instance_health.rb
165
+ lib/fog/aws/requests/elb/describe_load_balancers.rb
166
+ lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb
167
+ lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb
168
+ lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb
156
169
  lib/fog/aws/requests/s3/copy_object.rb
157
170
  lib/fog/aws/requests/s3/delete_bucket.rb
158
171
  lib/fog/aws/requests/s3/delete_object.rb
@@ -181,6 +194,12 @@ Gem::Specification.new do |s|
181
194
  lib/fog/connection.rb
182
195
  lib/fog/credentials.rb
183
196
  lib/fog/deprecation.rb
197
+ lib/fog/local.rb
198
+ lib/fog/local/bin.rb
199
+ lib/fog/local/models/directories.rb
200
+ lib/fog/local/models/directory.rb
201
+ lib/fog/local/models/file.rb
202
+ lib/fog/local/models/files.rb
184
203
  lib/fog/model.rb
185
204
  lib/fog/parser.rb
186
205
  lib/fog/rackspace.rb
@@ -310,8 +329,8 @@ Gem::Specification.new do |s|
310
329
  lib/fog/terremark/requests/shared/instantiate_vapp_template.rb
311
330
  lib/fog/terremark/requests/shared/power_off.rb
312
331
  lib/fog/terremark/requests/shared/power_on.rb
313
- lib/fog/terremark/requests/shared/reset.rb
314
- lib/fog/terremark/requests/shared/shutdown.rb
332
+ lib/fog/terremark/requests/shared/power_reset.rb
333
+ lib/fog/terremark/requests/shared/power_shutdown.rb
315
334
  lib/fog/terremark/shared.rb
316
335
  lib/fog/terremark/vcloud.rb
317
336
  spec/aws/models/ec2/address_spec.rb
data/lib/fog.rb CHANGED
@@ -24,14 +24,18 @@ require 'fog/deprecation'
24
24
  require 'fog/model'
25
25
  require 'fog/parser'
26
26
  require 'fog/ssh'
27
+
27
28
  require 'fog/aws'
29
+ require 'fog/local'
28
30
  require 'fog/rackspace'
29
31
  require 'fog/slicehost'
30
32
  require 'fog/terremark'
31
33
 
32
34
  module Fog
33
35
 
34
- VERSION = '0.0.84'
36
+ unless VERSION
37
+ VERSION = '0.0.85'
38
+ end
35
39
 
36
40
  module Mock
37
41
  @delay = 1
@@ -55,4 +59,18 @@ module Fog
55
59
  !!@mocking
56
60
  end
57
61
 
62
+ def self.wait_for(timeout = 600, &block)
63
+ duration = 0
64
+ start = Time.now
65
+ until yield || duration > timeout
66
+ sleep(1)
67
+ duration = Time.now - start
68
+ end
69
+ if duration > timeout
70
+ false
71
+ else
72
+ { :duration => duration }
73
+ end
74
+ end
75
+
58
76
  end
@@ -1,4 +1,5 @@
1
1
  require 'fog/aws/ec2.rb'
2
+ require 'fog/aws/elb.rb'
2
3
  require 'fog/aws/s3'
3
4
  require 'fog/aws/simpledb'
4
5
 
@@ -13,6 +14,28 @@ module Fog
13
14
  params
14
15
  end
15
16
 
17
+ def self.signed_params(params, options = {})
18
+ params.merge!({
19
+ 'AWSAccessKeyId' => options[:aws_access_key_id],
20
+ 'SignatureMethod' => 'HmacSHA256',
21
+ 'SignatureVersion' => '2',
22
+ 'Timestamp' => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"),
23
+ 'Version' => options[:version]
24
+ })
25
+
26
+ body = ''
27
+ for key in params.keys.sort
28
+ unless (value = params[key]).nil?
29
+ body << "#{key}=#{CGI.escape(value.to_s).gsub(/\+/, '%20')}&"
30
+ end
31
+ end
32
+ string_to_sign = "POST\n#{options[:host]}\n/\n" << body.chop
33
+ hmac = options[:hmac].update(string_to_sign)
34
+ body << "Signature=#{CGI.escape(Base64.encode64(hmac.digest).chomp!).gsub(/\+/, '%20')}"
35
+
36
+ body
37
+ end
38
+
16
39
  class Mock
17
40
 
18
41
  def self.availability_zone
@@ -15,6 +15,10 @@ module AWS
15
15
  hash[key] = case key
16
16
  when :ec2
17
17
  Fog::AWS::EC2.new(credentials)
18
+ when :elb
19
+ Fog::AWS::ELB.new(credentials)
20
+ when :simpledb
21
+ Fog::AWS::SimpleDB.new(credentials)
18
22
  when :s3
19
23
  Fog::AWS::S3.new(credentials)
20
24
  end
@@ -176,15 +176,17 @@ module Fog
176
176
  @aws_secret_access_key = options[:aws_secret_access_key]
177
177
  @hmac = HMAC::SHA256.new(@aws_secret_access_key)
178
178
  @host = options[:host] || case options[:region]
179
- when 'eu-west-1'
180
- 'ec2.eu-west-1.amazonaws.com'
181
- when 'us-east-1'
182
- 'ec2.us-east-1.amazonaws.com'
183
- when 'us-west-1'
184
- 'ec2.us-west-1.amazonaws.com'
185
- else
186
- 'ec2.amazonaws.com'
187
- end
179
+ when 'ap-southeast-1'
180
+ 'ec2.ap-southeast-1.amazonaws.com'
181
+ when 'eu-west-1'
182
+ 'ec2.eu-west-1.amazonaws.com'
183
+ when 'us-east-1'
184
+ 'ec2.us-east-1.amazonaws.com'
185
+ when 'us-west-1'
186
+ 'ec2.us-west-1.amazonaws.com'
187
+ else
188
+ 'ec2.amazonaws.com'
189
+ end
188
190
  @port = options[:port] || 443
189
191
  @scheme = options[:scheme] || 'https'
190
192
  end
@@ -197,24 +199,15 @@ module Fog
197
199
  idempotent = params.delete(:idempotent)
198
200
  parser = params.delete(:parser)
199
201
 
200
- params.merge!({
201
- 'AWSAccessKeyId' => @aws_access_key_id,
202
- 'SignatureMethod' => 'HmacSHA256',
203
- 'SignatureVersion' => '2',
204
- 'Timestamp' => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"),
205
- 'Version' => '2009-11-30'
206
- })
207
-
208
- body = ''
209
- for key in params.keys.sort
210
- unless (value = params[key]).nil?
211
- body << "#{key}=#{CGI.escape(value.to_s).gsub(/\+/, '%20')}&"
212
- end
213
- end
214
-
215
- string_to_sign = "POST\n#{@host}\n/\n" << body.chop
216
- hmac = @hmac.update(string_to_sign)
217
- body << "Signature=#{CGI.escape(Base64.encode64(hmac.digest).chomp!).gsub(/\+/, '%20')}"
202
+ body = AWS.signed_params(
203
+ params,
204
+ {
205
+ :aws_access_key_id => @aws_access_key_id,
206
+ :hmac => @hmac,
207
+ :host => @host,
208
+ :version => '2009-11-30'
209
+ }
210
+ )
218
211
 
219
212
  response = @connection.request({
220
213
  :body => body,
@@ -0,0 +1,115 @@
1
+ module Fog
2
+ module AWS
3
+ module ELB
4
+
5
+ def self.new(options={})
6
+
7
+ unless @required
8
+ require 'fog/aws/parsers/elb/deregister_instances_from_load_balancer'
9
+ require 'fog/aws/parsers/elb/describe_instance_health'
10
+ require 'fog/aws/parsers/elb/describe_load_balancers'
11
+ require 'fog/aws/parsers/elb/disable_availability_zones_for_load_balancer'
12
+ require 'fog/aws/parsers/elb/enable_availability_zones_for_load_balancer'
13
+ require 'fog/aws/parsers/elb/register_instances_with_load_balancer'
14
+ require 'fog/aws/requests/elb/deregister_instances_from_load_balancer'
15
+ require 'fog/aws/requests/elb/describe_instance_health'
16
+ require 'fog/aws/requests/elb/describe_load_balancers'
17
+ require 'fog/aws/requests/elb/disable_availability_zones_for_load_balancer'
18
+ require 'fog/aws/requests/elb/enable_availability_zones_for_load_balancer'
19
+ require 'fog/aws/requests/elb/register_instances_with_load_balancer'
20
+ @required = true
21
+ end
22
+
23
+ unless options[:aws_access_key_id]
24
+ raise ArgumentError.new('aws_access_key_id is required to access elb')
25
+ end
26
+ unless options[:aws_secret_access_key]
27
+ raise ArgumentError.new('aws_secret_access_key is required to access elb')
28
+ end
29
+ Fog::AWS::ELB::Real.new(options)
30
+ end
31
+
32
+ def self.indexed_param(key, values, idx_offset = 0)
33
+ params = {}
34
+ key.concat(".%") unless key.include?("%")
35
+ [*values].each_with_index do |value, index|
36
+ params["#{key.gsub("%", (index + idx_offset).to_s)}"] = value
37
+ end
38
+ return params
39
+ end
40
+
41
+ class Real
42
+
43
+ # Initialize connection to ELB
44
+ #
45
+ # ==== Notes
46
+ # options parameter must include values for :aws_access_key_id and
47
+ # :aws_secret_access_key in order to create a connection
48
+ #
49
+ # ==== Examples
50
+ # elb = ELB.new(
51
+ # :aws_access_key_id => your_aws_access_key_id,
52
+ # :aws_secret_access_key => your_aws_secret_access_key
53
+ # )
54
+ #
55
+ # ==== Parameters
56
+ # * options<~Hash> - config arguments for connection. Defaults to {}.
57
+ # * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1'i, 'ap-southeast-1']
58
+ #
59
+ # ==== Returns
60
+ # * ELB object with connection to AWS.
61
+ def initialize(options={})
62
+ @aws_access_key_id = options[:aws_access_key_id]
63
+ @aws_secret_access_key = options[:aws_secret_access_key]
64
+ @hmac = HMAC::SHA256.new(@aws_secret_access_key)
65
+ @host = options[:host] || case options[:region]
66
+ when 'ap-southeast-1'
67
+ 'elasticloadbalancing.ap-southeast-1.amazonaws.com'
68
+ when 'eu-west-1'
69
+ 'elasticloadbalancing.eu-west-1.amazonaws.com'
70
+ when 'us-east-1'
71
+ 'elasticloadbalancing.us-east-1.amazonaws.com'
72
+ when 'us-west-1'
73
+ 'elasticloadbalancing.us-west-1.amazonaws.com'
74
+ else
75
+ 'elasticloadbalancing.amazonaws.com'
76
+ end
77
+ @port = options[:port] || 443
78
+ @scheme = options[:scheme] || 'https'
79
+ end
80
+
81
+ private
82
+
83
+ def request(params)
84
+ @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
85
+
86
+ idempotent = params.delete(:idempotent)
87
+ parser = params.delete(:parser)
88
+
89
+ body = AWS.signed_params(
90
+ params,
91
+ {
92
+ :aws_access_key_id => @aws_access_key_id,
93
+ :hmac => @hmac,
94
+ :host => @host,
95
+ :version => '2009-11-25'
96
+ }
97
+ )
98
+
99
+ response = @connection.request({
100
+ :body => body,
101
+ :expects => 200,
102
+ :headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
103
+ :idempotent => idempotent,
104
+ :host => @host,
105
+ :method => 'POST',
106
+ :parser => parser
107
+ })
108
+
109
+ response
110
+ end
111
+
112
+ end
113
+ end
114
+ end
115
+ end