aws-sdk 1.5.7 → 1.5.8

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 (80) hide show
  1. data/lib/aws.rb +2 -0
  2. data/lib/aws/api_config/EMR-2009-03-31.yml +349 -0
  3. data/lib/aws/auto_scaling.rb +8 -8
  4. data/lib/aws/auto_scaling/group.rb +2 -2
  5. data/lib/aws/auto_scaling/instance.rb +1 -1
  6. data/lib/aws/auto_scaling/launch_configuration.rb +4 -4
  7. data/lib/aws/auto_scaling/launch_configuration_collection.rb +11 -11
  8. data/lib/aws/auto_scaling/scaling_policy.rb +1 -1
  9. data/lib/aws/auto_scaling/scheduled_action.rb +1 -1
  10. data/lib/aws/auto_scaling/tag.rb +3 -3
  11. data/lib/aws/cloud_formation/stack.rb +7 -7
  12. data/lib/aws/cloud_formation/stack_collection.rb +13 -13
  13. data/lib/aws/cloud_formation/stack_event_collection.rb +2 -2
  14. data/lib/aws/cloud_formation/stack_resource.rb +1 -1
  15. data/lib/aws/cloud_formation/stack_resource_summary_collection.rb +10 -18
  16. data/lib/aws/cloud_formation/stack_summary_collection.rb +12 -16
  17. data/lib/aws/core.rb +7 -1
  18. data/lib/aws/core/collection.rb +12 -12
  19. data/lib/aws/core/configuration.rb +4 -0
  20. data/lib/aws/core/credential_providers.rb +23 -23
  21. data/lib/aws/core/inflection.rb +2 -0
  22. data/lib/aws/core/model.rb +6 -6
  23. data/lib/aws/core/policy.rb +102 -102
  24. data/lib/aws/core/resource.rb +81 -80
  25. data/lib/aws/core/response.rb +23 -23
  26. data/lib/aws/core/xml/frame.rb +4 -2
  27. data/lib/aws/dynamo_db/resource.rb +2 -2
  28. data/lib/aws/dynamo_db/table.rb +5 -5
  29. data/lib/aws/ec2/availability_zone.rb +2 -3
  30. data/lib/aws/ec2/export_task.rb +7 -7
  31. data/lib/aws/ec2/image.rb +5 -5
  32. data/lib/aws/ec2/instance.rb +40 -40
  33. data/lib/aws/ec2/instance_collection.rb +5 -2
  34. data/lib/aws/ec2/key_pair.rb +1 -1
  35. data/lib/aws/ec2/network_acl.rb +1 -1
  36. data/lib/aws/ec2/network_interface.rb +2 -2
  37. data/lib/aws/ec2/region.rb +1 -1
  38. data/lib/aws/ec2/resource.rb +1 -1
  39. data/lib/aws/ec2/route_table.rb +1 -1
  40. data/lib/aws/ec2/security_group.rb +4 -4
  41. data/lib/aws/ec2/subnet.rb +1 -1
  42. data/lib/aws/ec2/volume.rb +1 -1
  43. data/lib/aws/ec2/vpn_connection.rb +1 -1
  44. data/lib/aws/ec2/vpn_gateway.rb +2 -2
  45. data/lib/aws/elb/listener_opts.rb +1 -1
  46. data/lib/aws/elb/load_balancer.rb +5 -5
  47. data/lib/aws/elb/load_balancer_collection.rb +17 -9
  48. data/lib/aws/elb/load_balancer_policy.rb +2 -2
  49. data/lib/aws/emr.rb +84 -0
  50. data/lib/aws/emr/client.rb +309 -0
  51. data/lib/aws/emr/config.rb +18 -0
  52. data/lib/aws/emr/errors.rb +22 -0
  53. data/lib/aws/emr/instance_group.rb +138 -0
  54. data/lib/aws/emr/instance_group_collection.rb +82 -0
  55. data/lib/aws/emr/job_flow.rb +296 -0
  56. data/lib/aws/emr/job_flow_collection.rb +185 -0
  57. data/lib/aws/emr/request.rb +23 -0
  58. data/lib/aws/iam/access_key.rb +1 -1
  59. data/lib/aws/iam/account_alias_collection.rb +2 -2
  60. data/lib/aws/iam/client.rb +1 -1
  61. data/lib/aws/iam/group.rb +2 -2
  62. data/lib/aws/iam/policy_collection.rb +1 -1
  63. data/lib/aws/iam/server_certificate.rb +2 -2
  64. data/lib/aws/iam/signing_certificate.rb +1 -1
  65. data/lib/aws/iam/user.rb +2 -2
  66. data/lib/aws/iam/virtual_mfa_device.rb +1 -1
  67. data/lib/aws/s3/client.rb +57 -55
  68. data/lib/aws/s3/config.rb +2 -0
  69. data/lib/aws/s3/request.rb +14 -6
  70. data/lib/aws/simple_email_service/identity.rb +9 -7
  71. data/lib/aws/simple_workflow/domain.rb +1 -1
  72. data/lib/aws/simple_workflow/resource.rb +2 -2
  73. data/lib/aws/simple_workflow/workflow_execution.rb +5 -5
  74. data/lib/aws/sns/subscription_collection.rb +33 -35
  75. data/lib/aws/sns/topic_collection.rb +13 -18
  76. data/lib/aws/sns/topic_subscription_collection.rb +8 -9
  77. data/lib/aws/sqs/queue.rb +4 -4
  78. data/lib/aws/sqs/queue_collection.rb +17 -13
  79. metadata +13 -4
  80. data/lib/aws/cloud_formation/stack_summary.rb +0 -71
@@ -17,69 +17,69 @@ module AWS
17
17
 
18
18
  # @private
19
19
  class Resource
20
-
20
+
21
21
  include Model
22
22
  include Cacheable
23
-
23
+
24
24
  # @private
25
25
  class NotFound < StandardError; end
26
-
26
+
27
27
  # @private
28
28
  def initialize *args
29
-
29
+
30
30
  super
31
-
31
+
32
32
  # cache static attributes passed into options
33
-
33
+
34
34
  options = args.last.is_a?(Hash) ? args.last : {}
35
35
  options.each_pair do |opt_name,opt_value|
36
- if
36
+ if
37
37
  self.class.attributes.has_key?(opt_name) and
38
38
  self.class.attributes[opt_name].static?
39
39
  then
40
40
  static_attributes[opt_name] = opt_value
41
41
  end
42
42
  end
43
-
43
+
44
44
  end
45
-
45
+
46
46
  # @return [String] Returns a simple string representation of this resource.
47
47
  def inspect
48
-
48
+
49
49
  identifiers = []
50
50
  resource_identifiers.each do |key, value|
51
- if attr = self.class.attributes.values.find{|a| a.get_as == key }
51
+ if attr = self.class.attributes.values.find{|a| a.from == key }
52
52
  identifiers << "#{attr.name}:#{value}"
53
53
  else
54
54
  identifiers << "#{key}:#{value}"
55
55
  end
56
56
  end
57
-
57
+
58
58
  "<#{self::class} #{identifiers.join(' ')}>"
59
-
59
+
60
60
  end
61
-
61
+
62
62
  # @return [Boolean] Returns true if the objects references the same
63
63
  # AWS resource.
64
64
  def eql? other
65
- other.kind_of?(self.class) and
65
+ other.kind_of?(self.class) and
66
66
  other.resource_identifiers == resource_identifiers
67
67
  end
68
68
  alias_method :==, :eql?
69
-
69
+
70
70
  # @private
71
71
  protected
72
72
  def get_resource attr_name
73
73
  raise NotImplementedError
74
74
  end
75
-
75
+
76
76
  # @private
77
77
  protected
78
78
  def update_resource attr, value
79
79
  raise NotImplementedError
80
80
  end
81
-
82
- # Overide this method is subclasses of Resource. This method should
81
+
82
+ # Overide this method is subclasses of Resource. This method should
83
83
  # return an array of identifying key/value pairs.
84
84
  #
85
85
  # # @private
@@ -87,37 +87,37 @@ module AWS
87
87
  # def resource_identifiers
88
88
  # [[:user_name, name]]
89
89
  # end
90
- #
90
+ #
91
91
  # @private
92
92
  protected
93
93
  def resource_identifiers
94
94
  raise NotImplementedError
95
95
  end
96
-
96
+
97
97
  # @protected
98
98
  protected
99
99
  def resource_options(additional = {})
100
100
  Hash[resource_identifiers].merge(additional)
101
101
  end
102
-
102
+
103
103
  # @private
104
104
  protected
105
105
  def local_cache_key
106
106
  resource_identifiers.collect{|name,value| value.to_s }.join(":")
107
107
  end
108
-
108
+
109
109
  # @private
110
110
  protected
111
111
  def static_attributes
112
112
  @static_attributes ||= {}
113
113
  end
114
-
114
+
115
115
  # @private
116
116
  protected
117
117
  def ruby_name
118
118
  @ruby_name ||= Inflection.ruby_name(self.class.name)
119
119
  end
120
-
120
+
121
121
  # @private
122
122
  public
123
123
  def attributes_from_response resp
@@ -137,7 +137,7 @@ module AWS
137
137
 
138
138
  # merge the attributes together into a single hash
139
139
  attributes = attributes.inject({}) {|hash,attribs| hash.merge(attribs) }
140
-
140
+
141
141
  # cache static attributes
142
142
  attributes.each_pair do |attr_name,value|
143
143
  if self.class.attributes[attr_name].static?
@@ -146,9 +146,9 @@ module AWS
146
146
  end
147
147
 
148
148
  attributes
149
-
149
+
150
150
  end
151
-
151
+
152
152
  # @private
153
153
  protected
154
154
  def cache_static_attributes request_type, resp_obj
@@ -161,7 +161,7 @@ module AWS
161
161
  end
162
162
  end
163
163
  end
164
-
164
+
165
165
  class << self
166
166
 
167
167
  # @private
@@ -169,7 +169,7 @@ module AWS
169
169
  class_eval <<-METHODS
170
170
 
171
171
  def self.#{type_name}_attributes
172
- @#{type_name}_attributes ||= {}
172
+ @#{type_name}_attributes ||= {}
173
173
  end
174
174
 
175
175
  def self.#{type_name}_attribute name, options = {}, &block
@@ -179,33 +179,33 @@ module AWS
179
179
 
180
180
  METHODS
181
181
  end
182
-
182
+
183
183
  # @private
184
184
  def new_from request_type, resp_obj, *args
185
- resource = new(*args)
185
+ resource = new(*args)
186
186
  resource.send(:cache_static_attributes, request_type, resp_obj)
187
187
  resource
188
188
  end
189
-
189
+
190
190
  # @private
191
191
  def attributes
192
192
  @attributes ||= Hash.new do |hash,attr_name|
193
193
  raise "uknown attribute #{attr_name}"
194
194
  end
195
195
  end
196
-
196
+
197
197
  # @private
198
198
  def attribute_providers
199
199
  @attribute_providers ||= []
200
200
  end
201
-
201
+
202
202
  # @private
203
203
  def attribute_providers_for request_type
204
204
  attribute_providers.select do |provider|
205
205
  provider.request_types.include?(request_type)
206
206
  end
207
207
  end
208
-
208
+
209
209
  # @private
210
210
  protected
211
211
  def attribute name, options = {}, &block
@@ -213,33 +213,34 @@ module AWS
213
213
  attr.instance_eval(&block) if block_given?
214
214
  define_attribute_getter(attr)
215
215
  define_attribute_setter(attr) if attr.mutable?
216
+ alias_method(options[:alias], name) if options[:alias]
216
217
  attributes[attr.name] = attr
217
218
  end
218
-
219
+
219
220
  # @private
220
221
  protected
221
222
  def mutable_attribute name, options = {}, &block
222
223
  attribute(name, options.merge(:mutable => true), &block)
223
224
  end
224
-
225
+
225
226
  # @private
226
227
  protected
227
228
  def define_attribute_getter attribute
228
229
  define_method(attribute.name) do
229
-
230
- return static_attributes[attribute.name] if
230
+
231
+ return static_attributes[attribute.name] if
231
232
  static_attributes.has_key?(attribute.name)
232
-
233
+
233
234
  begin
234
235
  retrieve_attribute(attribute) { get_resource(attribute) }
235
236
  rescue Cacheable::NoData => e
236
237
  name = ruby_name.tr("_", " ")
237
238
  raise NotFound, "unable to find the #{name}"
238
239
  end
239
-
240
+
240
241
  end
241
242
  end
242
-
243
+
243
244
  # @private
244
245
  protected
245
246
  def define_attribute_setter attribute
@@ -253,7 +254,7 @@ module AWS
253
254
  value
254
255
  end
255
256
  end
256
-
257
+
257
258
  # @private
258
259
  protected
259
260
  def populates_from *request_types, &block
@@ -262,7 +263,7 @@ module AWS
262
263
  provider.provides(*attributes.keys)
263
264
  provider
264
265
  end
265
-
266
+
266
267
  # @private
267
268
  protected
268
269
  def provider *request_types, &block
@@ -270,100 +271,100 @@ module AWS
270
271
  if block_given?
271
272
  yield(provider)
272
273
  end
273
- attribute_providers << provider
274
+ attribute_providers << provider
274
275
  provider
275
276
  end
276
-
277
+
277
278
  end
278
-
279
+
279
280
  # @private
280
281
  class Attribute
281
-
282
+
282
283
  def initialize name, options = {}
283
284
  @name = name
284
285
  @options = options
285
286
  @request_types = []
286
287
  end
287
-
288
+
288
289
  attr_reader :name
289
-
290
+
290
291
  attr_reader :request_types
291
-
292
- def get_as
293
- @get_as ||= (@options[:get_as] || @options[:as] || name)
292
+
293
+ def from
294
+ @from ||= (@options[:from] || name)
294
295
  end
295
-
296
+
296
297
  def set_as
297
- @set_as ||= (@options[:set_as] || @options[:as] || name)
298
+ @set_as ||= (@options[:set_as] || @options[:from] || name)
298
299
  end
299
-
300
+
300
301
  def mutable?
301
302
  @options[:mutable] == true
302
303
  end
303
-
304
+
304
305
  def static?
305
306
  @options[:static] == true
306
307
  end
307
-
308
+
308
309
  def translates_input &block
309
310
  @input_translator = block
310
311
  end
311
-
312
+
312
313
  def translates_output options = {}, &block
313
314
  @translates_nil = options[:nil]
314
315
  @output_translator = block
315
316
  end
316
-
317
+
317
318
  def translate_input_value value
318
319
  @input_translator ? @input_translator.call(value) : value
319
320
  end
320
-
321
+
321
322
  def translate_output_value value
322
-
323
+
323
324
  # by default nil values are not translated
324
325
  return nil if value.nil? and @translates_nil != true
325
-
326
+
326
327
  case
327
328
  when @options[:to_sym] then value.tr('-','_').downcase.to_sym
328
329
  when @options[:timestamp] then Time.at(value.to_i)
329
330
  when @output_translator then @output_translator.call(value)
330
331
  else value
331
332
  end
332
-
333
+
333
334
  end
334
-
335
+
335
336
  end
336
-
337
+
337
338
  # @private
338
339
  class AttributeProvider
339
-
340
+
340
341
  def initialize klass, request_types
341
342
  @klass = klass
342
343
  @id = klass.attribute_providers.length
343
344
  @request_types = request_types
344
345
  @provides = {}
345
346
  end
346
-
347
+
347
348
  attr_reader :request_types
348
-
349
+
349
350
  def find &block
350
351
  @klass.send(:define_method, finder_method, &block)
351
352
  end
352
-
353
+
353
354
  def finder_method
354
355
  "_find_in_#{request_types.join('_or_')}_response_#{@id}"
355
356
  end
356
-
357
+
357
358
  # Indicates that all of the the named attributes can be retrieved
358
359
  # from an appropriate response object.
359
- #
360
+ #
360
361
  # @overload provides(*attr_names, options = {})
361
362
  # @param [Symbol] attr_names A list of attributes provided
362
363
  # @param [Hash] options
363
364
  # @option options [Boolean] :value_wrapped (false) If true, then
364
365
  # the value returned by the response object will also receive
365
366
  # the message :value before it is translated and returned.
366
- # @option options [Symbol] :get_as Defaults to the method named
367
+ # @option options [Symbol] :from Defaults to the method named
367
368
  # by the attribute. This is useful when you have two providers
368
369
  # for the same attribute but their response object name
369
370
  # them differently.
@@ -375,7 +376,7 @@ module AWS
375
376
  @provides[attr_name] = options
376
377
  end
377
378
  end
378
-
379
+
379
380
  def attributes_from_response resource, response
380
381
  if response_object = resource.send(finder_method, response)
381
382
  attributes_from_response_object(response_object)
@@ -383,14 +384,14 @@ module AWS
383
384
  nil
384
385
  end
385
386
  end
386
-
387
+
387
388
  def attributes_from_response_object resp_obj
388
-
389
+
389
390
  @provides.inject({}) do |attributes,(attr_name,options)|
390
391
 
391
392
  attr = @klass.attributes[attr_name]
392
393
 
393
- methods = [options[:get_as] || attr.get_as].flatten
394
+ methods = [options[:from] || attr.from].flatten
394
395
 
395
396
  v = resp_obj
396
397
  methods.each do |method|
@@ -403,9 +404,9 @@ module AWS
403
404
  attributes.merge(attr_name => v)
404
405
 
405
406
  end
406
-
407
+
407
408
  end
408
-
409
+
409
410
  end
410
411
  end
411
412
  end
@@ -34,7 +34,7 @@ module AWS
34
34
  # instance = response.data[:reservation_set].first[:instance_set].first
35
35
  #
36
36
  # instance[:status] #=> 'running'
37
- #
37
+ #
38
38
  # == Response Metadata
39
39
  #
40
40
  # In addition to the response data, there is additional information
@@ -53,34 +53,34 @@ module AWS
53
53
  # response.http_response #=> #<AWS::Core::Http::Response>
54
54
  #
55
55
  class Response
56
-
56
+
57
57
  include AsyncHandle
58
58
 
59
59
  # @return [Hash] Returns the response data as a hash.
60
60
  attr_accessor :data
61
-
62
- # @return [Symbol] The name of the client request method that
61
+
62
+ # @return [Symbol] The name of the client request method that
63
63
  # returned this response.
64
64
  attr_accessor :request_type
65
-
65
+
66
66
  # @return [Hash] Returns the hash of options passed to the client
67
67
  # request method that generated this response.
68
68
  attr_accessor :request_options
69
-
69
+
70
70
  # @return [Core::Http::Request]
71
71
  attr_accessor :http_request
72
-
72
+
73
73
  # @return [Core::Http::Response]
74
74
  attr_accessor :http_response
75
-
75
+
76
76
  # @return [Boolean] true if the response was generated from a
77
77
  # another cached response.
78
78
  attr_accessor :cached
79
79
 
80
80
  alias_method :cached?, :cached
81
-
81
+
82
82
  # @return [AWS::Error,nil] Returns nil unless the request failed.
83
- # Normally this will be nil unless you are using the Asynchronous
83
+ # Normally this will be nil unless you are using the Asynchronous
84
84
  # interface.
85
85
  attr_accessor :error
86
86
 
@@ -91,7 +91,7 @@ module AWS
91
91
  # @return [Float] The total number of seconds taken to make the
92
92
  # request and return the response.
93
93
  attr_accessor :duration
94
-
94
+
95
95
  # @param [Http::Request] http_request
96
96
  # @param [Http::Response] http_response
97
97
  def initialize http_request = nil, http_response = nil, &block
@@ -112,12 +112,12 @@ module AWS
112
112
  def [] key
113
113
  data[key]
114
114
  end
115
-
115
+
116
116
  # @return [Boolean] Returns true if there is no response error.
117
117
  def successful?
118
118
  error.nil?
119
119
  end
120
-
120
+
121
121
  # @return [Boolean] Returns true if the http request was throttled
122
122
  # by AWS.
123
123
  def throttled?
@@ -129,18 +129,18 @@ module AWS
129
129
  false
130
130
  end
131
131
  end
132
-
132
+
133
133
  # @return [Boolean] Returns true if the http request timed out.
134
134
  def timeout?
135
135
  http_response.timeout?
136
136
  end
137
-
137
+
138
138
  # @return [String]
139
139
  # @private
140
140
  def inspect
141
141
  data.inspect
142
142
  end
143
-
143
+
144
144
  # @return [String]
145
145
  # @private
146
146
  def cache_key
@@ -151,7 +151,7 @@ module AWS
151
151
  serialized_options
152
152
  ].join(":")
153
153
  end
154
-
154
+
155
155
  # Rebuilds the HTTP request using the block passed to the initializer.
156
156
  # This is primarily used by the client when a request must be retried
157
157
  # (throttling, server errors, socket errors, etc).
@@ -163,7 +163,7 @@ module AWS
163
163
  protected
164
164
 
165
165
  # @note The prefered method to get as response data is to use {#[]}.
166
- #
166
+ #
167
167
  # This provides a backwards-compat layer to the old response objects
168
168
  # where each response value had a method extended onto this object.
169
169
  # Now all response data is accessible as a hash.
@@ -174,17 +174,17 @@ module AWS
174
174
  def method_missing *args, &block
175
175
  Core::Data.new(data).send(*args, &block)
176
176
  end
177
-
177
+
178
178
  def serialized_options
179
179
  serialize_options_hash(request_options)
180
180
  end
181
-
181
+
182
182
  def serialize_options_hash(hash)
183
183
  "(" + hash.keys.sort_by(&:to_s).map do |key|
184
184
  "#{key}=#{serialize_options_value(hash[key])}"
185
185
  end.join(" ") + ")"
186
186
  end
187
-
187
+
188
188
  def serialize_options_value(value)
189
189
  case value
190
190
  when Hash then serialize_options_hash(value)
@@ -192,11 +192,11 @@ module AWS
192
192
  else value.inspect
193
193
  end
194
194
  end
195
-
195
+
196
196
  def serialize_options_array array
197
197
  "[" + array.map{|v| serialize_options_value(v) }.join(" ") + "]"
198
198
  end
199
-
199
+
200
200
  end
201
201
  end
202
202
  end