icehouse-right_aws 1.11.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. data/History.txt +93 -15
  2. data/Manifest.txt +15 -1
  3. data/README.txt +0 -4
  4. data/Rakefile +34 -17
  5. data/lib/acf/right_acf_interface.rb +260 -124
  6. data/lib/acf/right_acf_invalidations.rb +144 -0
  7. data/lib/acf/right_acf_origin_access_identities.rb +230 -0
  8. data/lib/acf/right_acf_streaming_interface.rb +229 -0
  9. data/lib/acw/right_acw_interface.rb +4 -5
  10. data/lib/as/right_as_interface.rb +59 -51
  11. data/lib/awsbase/benchmark_fix.rb +0 -0
  12. data/lib/awsbase/right_awsbase.rb +351 -104
  13. data/lib/awsbase/support.rb +2 -82
  14. data/lib/awsbase/version.rb +9 -0
  15. data/lib/ec2/right_ec2.rb +97 -246
  16. data/lib/ec2/right_ec2_ebs.rb +88 -68
  17. data/lib/ec2/right_ec2_images.rb +90 -50
  18. data/lib/ec2/right_ec2_instances.rb +118 -89
  19. data/lib/ec2/right_ec2_placement_groups.rb +108 -0
  20. data/lib/ec2/right_ec2_reserved_instances.rb +51 -44
  21. data/lib/ec2/right_ec2_security_groups.rb +396 -0
  22. data/lib/ec2/right_ec2_spot_instances.rb +425 -0
  23. data/lib/ec2/right_ec2_tags.rb +139 -0
  24. data/lib/ec2/right_ec2_vpc.rb +152 -140
  25. data/lib/ec2/right_ec2_windows_mobility.rb +84 -0
  26. data/lib/elb/right_elb_interface.rb +205 -39
  27. data/lib/iam/right_iam_access_keys.rb +71 -0
  28. data/lib/iam/right_iam_groups.rb +195 -0
  29. data/lib/iam/right_iam_interface.rb +341 -0
  30. data/lib/iam/right_iam_mfa_devices.rb +67 -0
  31. data/lib/iam/right_iam_users.rb +251 -0
  32. data/lib/rds/right_rds_interface.rb +591 -205
  33. data/lib/right_aws.rb +16 -12
  34. data/lib/route_53/right_route_53_interface.rb +640 -0
  35. data/lib/s3/right_s3.rb +34 -13
  36. data/lib/s3/right_s3_interface.rb +17 -14
  37. data/lib/sdb/active_sdb.rb +215 -38
  38. data/lib/sdb/right_sdb_interface.rb +93 -12
  39. data/lib/sqs/right_sqs.rb +1 -2
  40. data/lib/sqs/right_sqs_gen2.rb +0 -1
  41. data/lib/sqs/right_sqs_gen2_interface.rb +9 -9
  42. data/lib/sqs/right_sqs_interface.rb +6 -7
  43. data/right_aws.gemspec +91 -0
  44. data/test/README.mdown +39 -0
  45. data/test/acf/test_helper.rb +0 -0
  46. data/test/acf/test_right_acf.rb +10 -18
  47. data/test/awsbase/test_helper.rb +0 -0
  48. data/test/awsbase/test_right_awsbase.rb +0 -1
  49. data/test/ec2/test_helper.rb +0 -0
  50. data/test/ec2/test_right_ec2.rb +0 -1
  51. data/test/elb/test_helper.rb +2 -0
  52. data/test/elb/test_right_elb.rb +43 -0
  53. data/test/http_connection.rb +0 -0
  54. data/test/route_53/fixtures/a_record.xml +18 -0
  55. data/test/route_53/fixtures/alias_record.xml +18 -0
  56. data/test/route_53/test_helper.rb +2 -0
  57. data/test/route_53/test_right_route_53.rb +141 -0
  58. data/test/s3/test_helper.rb +0 -0
  59. data/test/s3/test_right_s3.rb +11 -9
  60. data/test/s3/test_right_s3_stubbed.rb +6 -4
  61. data/test/sdb/test_active_sdb.rb +71 -13
  62. data/test/sdb/test_batch_put_attributes.rb +54 -0
  63. data/test/sdb/test_helper.rb +0 -0
  64. data/test/sdb/test_right_sdb.rb +13 -7
  65. data/test/sqs/test_helper.rb +0 -0
  66. data/test/sqs/test_right_sqs.rb +0 -6
  67. data/test/sqs/test_right_sqs_gen2.rb +22 -34
  68. data/test/test_credentials.rb +0 -0
  69. data/test/ts_right_aws.rb +0 -0
  70. metadata +146 -16
  71. data/VERSION +0 -1
@@ -0,0 +1,84 @@
1
+ #
2
+ # Copyright (c) 2010 RightScale Inc
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #
23
+
24
+ module RightAws
25
+
26
+ class Ec2
27
+
28
+ def describe_licenses(*license_ids)
29
+ link = generate_request("DescribeLicenses", amazonize_list('LicenseId', license_ids))
30
+ request_info(link, QEc2DescribeLicensesParser.new(:logger => @logger))
31
+ end
32
+
33
+ def activate_license(license_id, capacity)
34
+ link = generate_request("ActivateLicense", 'LicenseId' => license_id,
35
+ 'Capacity' => capacity)
36
+ request_info(link, RightBoolResponseParser.new(:logger => @logger))
37
+ end
38
+
39
+ # def get_license_capacity(license_id)
40
+ # link = generate_request("GetLicenseCapacity", 'LicenseId' => license_id)
41
+ # request_info(link, RightBoolResponseParser.new(:logger => @logger))
42
+ # end
43
+
44
+ def deactivate_license(license_id, capacity)
45
+ link = generate_request("DeactivateLicense", 'LicenseId' => license_id,
46
+ 'Capacity' => capacity)
47
+ request_info(link, RightBoolResponseParser.new(:logger => @logger))
48
+ end
49
+
50
+ #-----------------------------------------------------------------
51
+ # PARSERS: Images
52
+ #-----------------------------------------------------------------
53
+
54
+ class QEc2DescribeLicensesParser < RightAWSParser #:nodoc:
55
+ def tagstart(name, attributes)
56
+ case full_tag_name
57
+ when %r{/licenseSet/item$} then @item = { :capacities => [] }
58
+ when %r{/capacitySet/item$} then @capacity_item = {}
59
+ end
60
+ end
61
+ def tagend(name)
62
+ case name
63
+ when 'licenseId' then @item[:license_id] = @text
64
+ when 'type' then @item[:type] = @text
65
+ when 'pool' then @item[:pool] = @text
66
+ when 'capacity' then @capacity_item[:capacity] = @text.to_i
67
+ when 'instanceCapacity' then @capacity_item[:instance_capacity] = @text.to_i
68
+ when 'state' then @capacity_item[:state] = @text
69
+ when 'earliestAllowedDeactivationTime' then @capacity_item[:earliest_allowed_deactivation_time] = @text
70
+ else
71
+ case full_tag_name
72
+ when %r{/capacitySet/item$} then @item[:capacities] << @capacity_item
73
+ when %r{/licenseSet/item$} then @result << @item
74
+ end
75
+ end
76
+ end
77
+ def reset
78
+ @result = []
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ end
@@ -62,12 +62,14 @@ module RightAws
62
62
  include RightAwsBaseInterface
63
63
 
64
64
  # Amazon ELB API version being used
65
- API_VERSION = "2009-05-15"
65
+ API_VERSION = "2011-04-05"
66
66
  DEFAULT_HOST = "elasticloadbalancing.amazonaws.com"
67
67
  DEFAULT_PATH = '/'
68
68
  DEFAULT_PROTOCOL = 'https'
69
69
  DEFAULT_PORT = 443
70
70
 
71
+ LISTENER_PROTOCOLS = [ 'HTTP', 'HTTPS', 'TCP', 'SSL' ]
72
+
71
73
  @@bench = AwsBenchmarkingBlock.new
72
74
  def self.bench_xml
73
75
  @@bench.xml
@@ -83,7 +85,6 @@ module RightAws
83
85
  # * <tt>:server</tt>: ELB service host, default: DEFAULT_HOST
84
86
  # * <tt>:port</tt>: ELB service port, default: DEFAULT_PORT
85
87
  # * <tt>:protocol</tt>: 'http' or 'https', default: DEFAULT_PROTOCOL
86
- # * <tt>:multi_thread</tt>: true=HTTP connection per thread, false=per process
87
88
  # * <tt>:logger</tt>: for log messages, default: RAILS_DEFAULT_LOGGER else STDOUT
88
89
  # * <tt>:signature_version</tt>: The signature version : '0','1' or '2'(default)
89
90
  # * <tt>:cache</tt>: true/false(default): caching works for: describe_load_balancers
@@ -128,43 +129,71 @@ module RightAws
128
129
  # :listeners =>
129
130
  # [ { :protocol => "HTTP", :load_balancer_port => "80", :instance_port => "80" },
130
131
  # { :protocol => "TCP", :load_balancer_port => "443", :instance_port => "443" } ],
131
- # :created_time => Wed May 27 11:59:11 UTC 2009,
132
+ # :created_time => "2009-05-27T11:59:11.000Z",
132
133
  # :dns_name => "test-kd1-1519253964.us-east-1.elb.amazonaws.com",
133
134
  # :instances => [] } ]
134
135
  #
136
+ # elb.describe_load_balancers("test-kd1") #=>
137
+ # [{:load_balancer_name=>"test-kd1",
138
+ # :instances=>["i-9fc056f4", "i-b3debfd8"],
139
+ # :health_check=>
140
+ # {:interval=>30,
141
+ # :healthy_threshold=>10,
142
+ # :target=>"TCP:80",
143
+ # :unhealthy_threshold=>2,
144
+ # :timeout=>5},
145
+ # :dns_name=>"test-kd1-869291821.us-east-1.elb.amazonaws.com",
146
+ # :listeners=>
147
+ # [{:load_balancer_port=>"80",
148
+ # :policy_names=>["my-policy-1"],
149
+ # :instance_port=>"80",
150
+ # :protocol=>"HTTP"},
151
+ # {:load_balancer_port=>"8080",
152
+ # :policy_names=>["my-policy-lb-1"],
153
+ # :instance_port=>"8080",
154
+ # :protocol=>"HTTP"},
155
+ # {:load_balancer_port=>"443",
156
+ # :policy_names=>[],
157
+ # :instance_port=>"443",
158
+ # :protocol=>"TCP"}],
159
+ # :created_time=>"2010-04-15T12:04:49.000Z",
160
+ # :availability_zones=>["us-east-1a", "us-east-1b"],
161
+ # :app_cookie_stickiness_policies=>
162
+ # [{:policy_name=>"my-policy-1", :cookie_name=>"my-cookie-1"}],
163
+ # :lb_cookie_stickiness_policies=>
164
+ # [{:cookie_expiration_period=>60, :policy_name=>"my-policy-lb-1"}]}]
165
+ #
135
166
  def describe_load_balancers(*load_balancers)
136
167
  load_balancers = load_balancers.flatten.compact
137
168
  request_hash = amazonize_list("LoadBalancerNames.member", load_balancers)
138
169
  link = generate_request("DescribeLoadBalancers", request_hash)
139
- request_cache_or_info(:describe_load_balancers, link, DescribeLoadBalancersParser, @@bench, load_balancers.blank?)
170
+ request_cache_or_info(:describe_load_balancers, link, DescribeLoadBalancersParser, @@bench, load_balancers.right_blank?)
140
171
  end
141
172
 
142
173
  # Create new load balancer.
143
174
  # Returns a new load balancer DNS name.
144
175
  #
145
- # lb = elb.create_load_balancer( 'test-kd1',
146
- # ['us-east-1a', 'us-east-1b'],
147
- # [ { :protocol => :http, :load_balancer_port => 80, :instance_port => 80 },
148
- # { :protocol => :tcp, :load_balancer_port => 443, :instance_port => 443 } ])
149
- # puts lb #=> "test-kd1-1519253964.us-east-1.elb.amazonaws.com"
176
+ # Listener options: :protocol, :load_balancer_port, :instance_port and :ssl_certificate_id
177
+ # Protocols: :tcp, :http, :https or :ssl
178
+ #
179
+ # elb.create_load_balancer( 'test-kd1',
180
+ # ['us-east-1a', 'us-east-1b'],
181
+ # [ { :protocol => :http, :load_balancer_port => 80, :instance_port => 80 },
182
+ # { :protocol => :https, :load_balancer_port => 443, :instance_port => 443,
183
+ # :ssl_certificate_id => 'arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/Bob' } ])
184
+ # #=> "test-kd1-1519253964.us-east-1.elb.amazonaws.com"
150
185
  #
151
186
  def create_load_balancer(load_balancer_name, availability_zones=[], listeners=[])
152
187
  request_hash = { 'LoadBalancerName' => load_balancer_name }
153
188
  # merge zones
154
- request_hash.merge!( amazonize_list("AvailabilityZones.member", availability_zones.to_a) )
189
+ request_hash.merge!( amazonize_list("AvailabilityZones.member", availability_zones) )
155
190
  # merge listeners
156
- if listeners.blank?
191
+ if listeners.right_blank?
157
192
  listeners = { :protocol => :http,
158
193
  :load_balancer_port => 80,
159
194
  :instance_port => 80 }
160
195
  end
161
- listeners = [listeners] unless listeners.is_a?(Array)
162
- request_hash.merge!( amazonize_list( ['Listeners.member.?.Protocol',
163
- 'Listeners.member.?.LoadBalancerPort',
164
- 'Listeners.member.?.InstancePort'],
165
- listeners.map{|i| [ (i[:protocol] || 'HTTP').to_s.upcase,
166
- (i[:load_balancer_port] || 80),
167
- (i[:instance_port] || 80) ] } ) )
196
+ request_hash = merge_listeners_into_request_hash(request_hash, listeners)
168
197
  link = generate_request("CreateLoadBalancer", request_hash)
169
198
  request_info(link, CreateLoadBalancerParser.new(:logger => @logger))
170
199
  end
@@ -182,6 +211,37 @@ module RightAws
182
211
  request_info(link, DeleteLoadBalancerParser.new(:logger => @logger))
183
212
  end
184
213
 
214
+ # Creates one or more new listeners on a LoadBalancer for the specified port. If a listener with the given
215
+ # port does not already exist, it will be created; otherwise, the properties of the new listener must match
216
+ # the the properties of the existing listener.
217
+ #
218
+ # Listener options: :protocol, :load_balancer_port, :instance_port and :ssl_certificate_id
219
+ # Protocols: :tcp, :http, :https or :ssl
220
+ #
221
+ # elb.create_load_balancer_listeners( 'test-kd1',
222
+ # [ { :protocol => :http, :load_balancer_port => 80, :instance_port => 80 },
223
+ # { :protocol => :https, :load_balancer_port => 443, :instance_port => 443,
224
+ # :ssl_certificate_id => 'arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/Bob' } ]) #=> true
225
+ #
226
+ def create_load_balancer_listeners(load_balancer_name, listeners)
227
+ request_hash = { 'LoadBalancerName' => load_balancer_name }
228
+ request_hash = merge_listeners_into_request_hash(request_hash, listeners)
229
+ link = generate_request("CreateLoadBalancerListeners", request_hash)
230
+ request_info(link, RightHttp2xxParser.new(:logger => @logger))
231
+ end
232
+
233
+ # Removes listeners from the load balancer for the specified port number.
234
+ #
235
+ # elb.delete_load_balancer_listeners( 'kd_test', 80, 443) #=> true
236
+ #
237
+ def delete_load_balancer_listeners(load_balancer_name, *load_balancer_ports)
238
+ load_balancer_ports.flatten!
239
+ request_hash = { 'LoadBalancerName' => load_balancer_name }
240
+ request_hash.merge!( amazonize_list("LoadBalancerPorts.member", load_balancer_ports ) )
241
+ link = generate_request("DeleteLoadBalancerListeners", request_hash )
242
+ request_info(link, DeleteLoadBalancerParser.new(:logger => @logger))
243
+ end
244
+
185
245
  # Add one or more zones to a load balancer.
186
246
  # Returns a list of updated availability zones for the load balancer.
187
247
  #
@@ -221,7 +281,7 @@ module RightAws
221
281
  #
222
282
  def configure_health_check(load_balancer_name, health_check)
223
283
  request_hash = { 'LoadBalancerName' => load_balancer_name }
224
- health_check.each{ |key, value| request_hash["HealthCheck.#{key.to_s.camelize}"] = value }
284
+ health_check.each{ |key, value| request_hash["HealthCheck.#{key.to_s.right_camelize}"] = value }
225
285
  link = generate_request("ConfigureHealthCheck", request_hash)
226
286
  request_info(link, HealthCheckParser.new(:logger => @logger))
227
287
  end
@@ -277,28 +337,120 @@ module RightAws
277
337
  request_info(link, InstancesWithLoadBalancerParser.new(:logger => @logger))
278
338
  end
279
339
 
340
+ #-----------------------------------------------------------------
341
+ # Cookies
342
+ #-----------------------------------------------------------------
343
+
344
+ # Generates a stickiness policy with sticky session lifetimes that follow
345
+ # that of an application-generated cookie.
346
+ # This policy can only be associated with HTTP listeners.
347
+ #
348
+ # elb.create_app_cookie_stickiness_policy('my-load-balancer', 'MyLoadBalancerPolicy', 'MyCookie') #=> true
349
+ #
350
+ def create_app_cookie_stickiness_policy(load_balancer_name, policy_name, cookie_name)
351
+ request_hash = { 'LoadBalancerName' => load_balancer_name,
352
+ 'PolicyName' => policy_name,
353
+ 'CookieName' => cookie_name }
354
+ link = generate_request("CreateAppCookieStickinessPolicy", request_hash)
355
+ request_info(link, RightHttp2xxParser.new(:logger => @logger))
356
+ end
357
+
358
+ # Generates a stickiness policy with sticky session lifetimes controlled by the
359
+ # lifetime of the browser (user-agent) or a specified expiration period.
360
+ # This policy can only be associated only with HTTP listeners.
361
+ #
362
+ # elb.create_lb_cookie_stickiness_policy('my-load-balancer', 'MyLoadBalancerPolicy', 60) #=> true
363
+ #
364
+ def create_lb_cookie_stickiness_policy(load_balancer_name, policy_name, cookie_expiration_period)
365
+ request_hash = { 'LoadBalancerName' => load_balancer_name,
366
+ 'PolicyName' => policy_name,
367
+ 'CookieExpirationPeriod' => cookie_expiration_period }
368
+ link = generate_request("CreateLBCookieStickinessPolicy", request_hash)
369
+ request_info(link, RightHttp2xxParser.new(:logger => @logger))
370
+ end
371
+
372
+ # Associates, updates, or disables a policy with a listener on the load balancer.
373
+ # Only zero(0) or one(1) policy can be associated with a listener.
374
+ #
375
+ # elb.set_load_balancer_policies_of_listener('my-load-balancer', 80, 'MyLoadBalancerPolicy') #=> true
376
+ #
377
+ def set_load_balancer_policies_of_listener(load_balancer_name, load_balancer_port, *policy_names)
378
+ policy_names.flatten!
379
+ request_hash = { 'LoadBalancerName' => load_balancer_name,
380
+ 'LoadBalancerPort' => load_balancer_port }
381
+ if policy_names.right_blank?
382
+ request_hash['PolicyNames'] = ''
383
+ else
384
+ request_hash.merge!(amazonize_list('PolicyNames.member', policy_names))
385
+ end
386
+ link = generate_request("SetLoadBalancerPoliciesOfListener", request_hash)
387
+ request_info(link, RightHttp2xxParser.new(:logger => @logger))
388
+ end
389
+
390
+ # Deletes a policy from the load balancer. The specified policy must not be enabled for any listeners.
391
+ #
392
+ # elb.delete_load_balancer_policy('my-load-balancer', 'MyLoadBalancerPolicy') #=> true
393
+ #
394
+ def delete_load_balancer_policy(load_balancer_name, policy_name)
395
+ request_hash = { 'LoadBalancerName' => load_balancer_name,
396
+ 'PolicyName' => policy_name }
397
+ link = generate_request("DeleteLoadBalancerPolicy", request_hash)
398
+ request_info(link, RightHttp2xxParser.new(:logger => @logger))
399
+ end
400
+
401
+ def set_load_balancer_listener_ssl_certificate(load_balancer_name, load_balancer_port, ssl_sertificate_id)
402
+ request_hash = { 'LoadBalancerName' => load_balancer_name,
403
+ 'LoadBalancerPort' => load_balancer_port,
404
+ 'SSLCertificateId' => ssl_sertificate_id }
405
+ link = generate_request("SetLoadBalancerListenerSSLCertificate", request_hash)
406
+ request_info(link, RightHttp2xxParser.new(:logger => @logger))
407
+ end
408
+
409
+ #-----------------------------------------------------------------
410
+ # Helpers
411
+ #-----------------------------------------------------------------
412
+
413
+ def merge_listeners_into_request_hash(request_hash, listeners) # :nodoc:
414
+ listeners = [listeners] unless listeners.is_a?(Array)
415
+ request_hash.merge(amazonize_list( ['Listeners.member.?.Protocol',
416
+ 'Listeners.member.?.LoadBalancerPort',
417
+ 'Listeners.member.?.InstancePort',
418
+ 'Listeners.member.?.SSLCertificateId'],
419
+ listeners.map{ |i|
420
+ [ (i[:protocol] || 'HTTP').to_s.upcase,
421
+ i[:load_balancer_port] || 80,
422
+ i[:instance_port] || 80,
423
+ i[:ssl_certificate_id]]
424
+ },
425
+ :default => :skip_nils
426
+ )
427
+ )
428
+ end
429
+
280
430
  #-----------------------------------------------------------------
281
431
  # PARSERS: Load Balancers
282
432
  #-----------------------------------------------------------------
283
433
 
284
434
  class DescribeLoadBalancersParser < RightAWSParser #:nodoc:
285
435
  def tagstart(name, attributes)
286
- case name
287
- when 'member'
288
- case @xmlpath
289
- when @p then @item = { :availability_zones => [],
290
- :health_check => {},
291
- :listeners => [],
292
- :instances => [] }
293
- when "#@p/member/Listeners" then @listener = {}
294
- end
436
+ case full_tag_name
437
+ when %r{LoadBalancerDescriptions/member$}
438
+ @item = { :availability_zones => [],
439
+ :health_check => {},
440
+ :listeners => [],
441
+ :instances => [],
442
+ :app_cookie_stickiness_policies => [],
443
+ :lb_cookie_stickiness_policies => []}
444
+ when %r{ListenerDescriptions/member$} then @listener = {:policy_names => []}
445
+ when %r{AppCookieStickinessPolicies/member$} then @app_cookie_stickiness_policy = {}
446
+ when %r{LBCookieStickinessPolicies/member$} then @lb_cookie_stickiness_policy = {}
295
447
  end
296
448
  end
297
449
  def tagend(name)
298
450
  case name
299
451
  when 'LoadBalancerName' then @item[:load_balancer_name] = @text
300
452
  when 'DNSName' then @item[:dns_name] = @text
301
- when 'CreatedTime' then @item[:created_time] = Time::parse(@text)
453
+ when 'CreatedTime' then @item[:created_time] = @text
302
454
  when 'Interval' then @item[:health_check][:interval] = @text.to_i
303
455
  when 'Target' then @item[:health_check][:target] = @text
304
456
  when 'HealthyThreshold' then @item[:health_check][:healthy_threshold] = @text.to_i
@@ -307,20 +459,34 @@ module RightAws
307
459
  when 'Protocol' then @listener[:protocol] = @text
308
460
  when 'LoadBalancerPort' then @listener[:load_balancer_port] = @text
309
461
  when 'InstancePort' then @listener[:instance_port] = @text
310
- when 'member'
311
- case @xmlpath
312
- when @p then
313
- @item[:availability_zones].sort!
314
- @item[:instances].sort!
315
- @result << @item
316
- when "#@p/member/AvailabilityZones" then @item[:availability_zones] << @text
317
- when "#@p/member/Instances" then @item[:instances] << @text
318
- when "#@p/member/Listeners" then @item[:listeners] << @listener
462
+ when 'SSLCertificateId' then @listener[:ssl_certificate_id] = @text
463
+ when 'CanonicalHostedZoneName' then @item[:canonical_hosted_zone_name] = @text
464
+ when 'CanonicalHostedZoneNameID' then @item[:canonical_hosted_zone_name_id] = @text
465
+ end
466
+ case full_tag_name
467
+ when %r{AvailabilityZones/member$} then @item[:availability_zones] << @text
468
+ when %r{Instances/member/InstanceId$} then @item[:instances] << @text
469
+ when %r{ListenerDescriptions/member$} then @item[:listeners] << @listener
470
+ when %r{ListenerDescriptions/member/PolicyNames/member$} then @listener[:policy_names] << @text
471
+ when %r{AppCookieStickinessPolicies/member}
472
+ case name
473
+ when 'PolicyName' then @app_cookie_stickiness_policy[:policy_name] = @text
474
+ when 'CookieName' then @app_cookie_stickiness_policy[:cookie_name] = @text
475
+ when 'member' then @item[:app_cookie_stickiness_policies] << @app_cookie_stickiness_policy
476
+ end
477
+ when %r{LBCookieStickinessPolicies/member}
478
+ case name
479
+ when 'PolicyName' then @lb_cookie_stickiness_policy[:policy_name] = @text
480
+ when 'CookieExpirationPeriod' then @lb_cookie_stickiness_policy[:cookie_expiration_period] = @text.to_i
481
+ when 'member' then @item[:lb_cookie_stickiness_policies] << @lb_cookie_stickiness_policy
319
482
  end
483
+ when %r{LoadBalancerDescriptions/member$}
484
+ @item[:availability_zones].sort!
485
+ @item[:instances].sort!
486
+ @result << @item
320
487
  end
321
488
  end
322
489
  def reset
323
- @p = 'DescribeLoadBalancersResponse/DescribeLoadBalancersResult/LoadBalancerDescriptions'
324
490
  @result = []
325
491
  end
326
492
  end
@@ -0,0 +1,71 @@
1
+ module RightAws
2
+
3
+ class IamInterface < RightAwsBase
4
+
5
+ #-----------------------------------------------------------------
6
+ # Access Keys
7
+ #-----------------------------------------------------------------
8
+
9
+ # Returns information about the Access Key IDs associated with the specified User.
10
+ #
11
+ # Options: :user_name, :max_items, :marker
12
+ #
13
+ # iam.list_access_keys #=>
14
+ # [{:create_date=>"2007-01-09T06:16:30Z",
15
+ # :status=>"Active",
16
+ # :access_key_id=>"00000000000000000000"}]
17
+ #
18
+ def list_access_keys(options={}, &block)
19
+ incrementally_list_iam_resources('ListAccessKeys', options, &block)
20
+ end
21
+
22
+ # Creates a new AWS Secret Access Key and corresponding AWS Access Key ID for the specified User.
23
+ #
24
+ # Options: :user_name
25
+ #
26
+ # iam.create_access_key(:user_name => 'kd1') #=>
27
+ # {:access_key_id=>"AK0000000000000000ZQ",
28
+ # :status=>"Active",
29
+ # :secret_access_key=>"QXN0000000000000000000000000000000000Ioj",
30
+ # :create_date=>"2010-10-29T07:16:32.210Z",
31
+ # :user_name=>"kd1"}
32
+ #
33
+ def create_access_key(options={})
34
+ request_hash = {}
35
+ request_hash['UserName'] = options[:user_name] unless options[:user_name].right_blank?
36
+ link = generate_request("CreateAccessKey", request_hash)
37
+ request_info(link, CreateAccessKeyParser.new(:logger => @logger))
38
+ end
39
+
40
+ # Deletes the access key associated with the specified User.
41
+ #
42
+ # Options: :user_name
43
+ #
44
+ # iam.delete_access_key('AK00000000000000006A', :user_name => 'kd1') #=> true
45
+ #
46
+ def delete_access_key(access_key_id, options={})
47
+ request_hash = { 'AccessKeyId' => access_key_id }
48
+ request_hash['UserName'] = options[:user_name] unless options[:user_name].right_blank?
49
+ link = generate_request("DeleteAccessKey", request_hash)
50
+ request_info(link, RightHttp2xxParser.new(:logger => @logger))
51
+ end
52
+
53
+ #-----------------------------------------------------------------
54
+ # PARSERS
55
+ #-----------------------------------------------------------------
56
+
57
+ class ListAccessKeysParser < BasicIamListParser #:nodoc:
58
+ def reset
59
+ @expected_tags = %w{ AccessKeyId CreateDate Status UserName }
60
+ end
61
+ end
62
+
63
+ class CreateAccessKeyParser < BasicIamParser #:nodoc:
64
+ def reset
65
+ @expected_tags = %w{ AccessKeyId CreateDate SecretAccessKey Status UserName }
66
+ end
67
+ end
68
+
69
+ end
70
+
71
+ end