aws-sdk 1.5.7 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -12,6 +12,8 @@
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
14
  require 'base64'
15
+ require 'date'
16
+ require 'time'
15
17
 
16
18
  module AWS
17
19
  module Core
@@ -200,7 +202,7 @@ module AWS
200
202
  end
201
203
 
202
204
  def wrapped?
203
- @rules[:wrap]
205
+ @rules[:wrap]
204
206
  end
205
207
  alias_method :wrapper, :wrapped?
206
208
 
@@ -235,7 +237,7 @@ module AWS
235
237
  klass.parse(@text)
236
238
  end
237
239
  end
238
-
240
+
239
241
  end
240
242
  end
241
243
  end
@@ -20,8 +20,8 @@ module AWS
20
20
 
21
21
  # DynamoDB attributes are all returned in UpperCamelCase, this
22
22
  # converts the :snake_case name into the correct format.
23
- unless options[:as]
24
- options[:as] = name.to_s.split(/_/).map(&:capitalize).join
23
+ unless options[:from]
24
+ options[:from] = name.to_s.split(/_/).map(&:capitalize).join
25
25
  end
26
26
 
27
27
  super(name, options)
@@ -103,25 +103,25 @@ module AWS
103
103
 
104
104
  alias_method :created_at, :creation_date_time
105
105
 
106
- attribute :status, :as => 'TableStatus', :to_sym => true
106
+ attribute :status, :from => 'TableStatus', :to_sym => true
107
107
 
108
108
  attribute :throughput_last_increased_at,
109
- :as => 'LastIncreaseDateTime',
109
+ :from => 'LastIncreaseDateTime',
110
110
  :timestamp => true
111
111
 
112
112
  attribute :throughput_last_decreased_at,
113
- :as => 'LastDecreaseDateTime',
113
+ :from => 'LastDecreaseDateTime',
114
114
  :timestamp => true
115
115
 
116
116
  attribute :read_capacity_units
117
117
 
118
118
  attribute :write_capacity_units
119
119
 
120
- attribute :hash_key, :as => "HashKeyElement", :static => true do
120
+ attribute :hash_key, :from => "HashKeyElement", :static => true do
121
121
  translates_output {|v| PrimaryKeyElement.new(v) }
122
122
  end
123
123
 
124
- attribute :range_key, :as => "RangeKeyElement", :static => true do
124
+ attribute :range_key, :from => "RangeKeyElement", :static => true do
125
125
  translates_output {|v| PrimaryKeyElement.new(v) }
126
126
  end
127
127
  alias_method :range_key_without_schema_override, :range_key
@@ -34,7 +34,6 @@ module AWS
34
34
  @name = name
35
35
  if options[:region]
36
36
  options[:region_name] = options[:region].name
37
-
38
37
  end
39
38
  super
40
39
  end
@@ -49,9 +48,9 @@ module AWS
49
48
 
50
49
  attribute :region_name, :static => true
51
50
 
52
- attribute :state, :as => :zone_state, :to_sym => true
51
+ attribute :state, :from => :zone_state, :to_sym => true
53
52
 
54
- attribute :messages, :as => :message_set do
53
+ attribute :messages, :from => :message_set do
55
54
  translates_output do |messages|
56
55
  messages ? messages.collect{|m| m.message } : []
57
56
  end
@@ -41,7 +41,7 @@ module AWS
41
41
  # the image will be exported to.
42
42
  #
43
43
  class ExportTask < Resource
44
-
44
+
45
45
  # @private
46
46
  def initialize export_task_id, options = {}
47
47
  @export_task_id = export_task_id
@@ -60,27 +60,27 @@ module AWS
60
60
  attribute :status_message
61
61
 
62
62
  attribute :instance_id,
63
- :as => [:instance_export, :instance_id],
63
+ :from => [:instance_export, :instance_id],
64
64
  :static => true
65
65
 
66
66
  attribute :target_environment,
67
- :as => [:instance_export, :target_environment],
67
+ :from => [:instance_export, :target_environment],
68
68
  :static => true
69
69
 
70
70
  attribute :disk_image_format,
71
- :as => [:export_to_s3, :disk_image_format],
71
+ :from => [:export_to_s3, :disk_image_format],
72
72
  :static => true
73
73
 
74
74
  attribute :container_format,
75
- :as => [:export_to_s3, :container_format],
75
+ :from => [:export_to_s3, :container_format],
76
76
  :static => true
77
77
 
78
78
  attribute :s3_bucket_name,
79
- :as => [:export_to_s3, :s3_bucket],
79
+ :from => [:export_to_s3, :s3_bucket],
80
80
  :static => true
81
81
 
82
82
  attribute :s3_key,
83
- :as => [:export_to_s3, :s3_key],
83
+ :from => [:export_to_s3, :s3_key],
84
84
  :static => true
85
85
 
86
86
  populates_from(:create_instance_export_task) do |resp|
@@ -99,17 +99,17 @@ module AWS
99
99
 
100
100
  mutable_attribute :description
101
101
 
102
- attribute :location, :as => :image_location, :static => true
102
+ attribute :location, :from => :image_location, :static => true
103
103
 
104
- attribute :state, :as => :image_state, :to_sym => true
104
+ attribute :state, :from => :image_state, :to_sym => true
105
105
 
106
- attribute :owner_id, :as => :image_owner_id, :static => true
106
+ attribute :owner_id, :from => :image_owner_id, :static => true
107
107
 
108
- attribute :owner_alias, :as => :image_owner_alias, :static => true
108
+ attribute :owner_alias, :from => :image_owner_alias, :static => true
109
109
 
110
110
  attribute :architecture, :to_sym => true, :static => true
111
111
 
112
- attribute :type, :as => :image_type, :to_sym => true, :static => true
112
+ attribute :type, :from => :image_type, :to_sym => true, :static => true
113
113
 
114
114
  attribute :kernel_id, :static => true
115
115
 
@@ -175,7 +175,7 @@ module AWS
175
175
  attr = attribute(name, options, &block)
176
176
  reservation_attributes[attr.name] = attr
177
177
  end
178
-
178
+
179
179
  # @private
180
180
  def self.describe_call_attributes
181
181
  @describe_call_attributes ||= {}
@@ -220,7 +220,7 @@ module AWS
220
220
 
221
221
  describe_call_attribute :ami_launch_index, :static => true
222
222
 
223
- describe_call_attribute :monitoring do
223
+ describe_call_attribute :monitoring do
224
224
  translates_output {|v| v.state.to_sym }
225
225
  end
226
226
 
@@ -239,7 +239,7 @@ module AWS
239
239
  describe_call_attribute :block_device_mapping
240
240
 
241
241
  protected :block_device_mapping
242
-
242
+
243
243
  describe_call_attribute :instance_lifecycle, :to_sym => true
244
244
 
245
245
  describe_call_attribute :virtualization_type, :to_sym => true, :static => true
@@ -248,7 +248,7 @@ module AWS
248
248
 
249
249
  describe_call_attribute :placement, :static => true
250
250
 
251
- describe_call_attribute :state_transition_reason, :get_as => :reason
251
+ describe_call_attribute :state_transition_reason, :from => :reason
252
252
 
253
253
  describe_call_attribute :launch_time, :static => true
254
254
 
@@ -264,14 +264,14 @@ module AWS
264
264
 
265
265
  describe_call_attribute :subnet_id, :static => true
266
266
 
267
- describe_call_attribute :iam_instance_profile_id,
268
- :as => :iam_instance_profile,
267
+ describe_call_attribute :iam_instance_profile_id,
268
+ :from => :iam_instance_profile,
269
269
  :static => true do
270
270
  translates_output{|profile| profile[:id] }
271
271
  end
272
272
 
273
- describe_call_attribute :iam_instance_profile_arn,
274
- :as => :iam_instance_profile,
273
+ describe_call_attribute :iam_instance_profile_arn,
274
+ :from => :iam_instance_profile,
275
275
  :static => true do
276
276
  translates_output{|profile| profile[:arn] }
277
277
  end
@@ -280,9 +280,9 @@ module AWS
280
280
  translates_output{|state| state.name.tr("-","_").to_sym }
281
281
  end
282
282
 
283
- attribute :status_code do
284
- translates_output{|state| state.code }
285
- end
283
+ attribute :status, :from => [:instance_state, :name], :to_sym => true
284
+
285
+ attribute :status_code, :from => [:instance_state, :code]
286
286
 
287
287
  mutable_describe_call_attribute :instance_type
288
288
 
@@ -306,7 +306,7 @@ module AWS
306
306
  end
307
307
 
308
308
  mutable_describe_attribute :api_termination_disabled?,
309
- :as => :disable_api_termination
309
+ :from => :disable_api_termination
310
310
 
311
311
  mutable_describe_attribute :instance_initiated_shutdown_behavior
312
312
 
@@ -318,15 +318,15 @@ module AWS
318
318
  provider(:describe_instances) do |provider|
319
319
  provider.find {|resp| resp.instance_index[id] }
320
320
  provider.provides *describe_call_attributes.keys
321
- provider.provides :status, :get_as => :instance_state
322
- provider.provides :status_code, :get_as => :instance_state
321
+ provider.provides :status
322
+ provider.provides :status_code
323
323
  end
324
324
 
325
325
  provider(:run_instances) do |provider|
326
326
  provider.find {|resp| resp.instances_set.find{|i| i.instance_id == id } }
327
327
  provider.provides *describe_call_attributes.keys
328
- provider.provides :status, :get_as => :instance_state
329
- provider.provides :status_code, :get_as => :instance_state
328
+ provider.provides :status
329
+ provider.provides :status_code
330
330
  end
331
331
 
332
332
  provider(:run_instances) do |provider|
@@ -334,13 +334,13 @@ module AWS
334
334
  provider.provides *reservation_attributes.keys
335
335
  end
336
336
 
337
- # These are the few attributes that are only returned by
337
+ # These are the few attributes that are only returned by
338
338
  # :desribe_instance_attribute and are *NOT* returned by
339
339
  # :describe_instances. To make matters worse, only one of
340
340
  # them is returned per :describe_instance_attribute call.
341
341
  mutable_describe_attributes.values.each do |attr|
342
342
 
343
- attr_opt_name = Core::Inflection.class_name(attr.get_as.to_s)
343
+ attr_opt_name = Core::Inflection.class_name(attr.from.to_s)
344
344
  attr_opt_name = attr_opt_name[0,1].downcase + attr_opt_name[1..-1]
345
345
 
346
346
  provider(:describe_instance_attribute) do |provider|
@@ -358,13 +358,13 @@ module AWS
358
358
  end
359
359
 
360
360
  provider(:terminate_instances, :start_instances, :stop_instances) do |provider|
361
- provider.find do |resp|
361
+ provider.find do |resp|
362
362
  resp.instances_set.find {|i| i.instance_id == id }
363
363
  end
364
- provider.provides :status, :get_as => :current_state
365
- provider.provides :status_code, :get_as => :current_state
364
+ provider.provides :status, :from => [:current_state, :name]
365
+ provider.provides :status_code, :from => [:current_state, :code]
366
366
  end
367
-
367
+
368
368
  provider(:monitor_instances, :unmonitor_instances) do |provider|
369
369
  provider.find do |resp|
370
370
  resp.instances_set.find {|i| i.instance_id == id }
@@ -384,7 +384,7 @@ module AWS
384
384
  VPC.new(vpc_id, :config => config)
385
385
  end
386
386
  end
387
-
387
+
388
388
  # @return [Subnet,nil] Returns the VPC subnet this instance was
389
389
  # launched in. Returns nil if this was not launched in a VPC.
390
390
  def subnet
@@ -415,7 +415,7 @@ module AWS
415
415
  # @return [nil]
416
416
  #
417
417
  def attach_network_interface network_interface, options = {}
418
- if network_interface.is_a?(NetworkInterface)
418
+ if network_interface.is_a?(NetworkInterface)
419
419
  network_interface.attach(self, options)
420
420
  else
421
421
  i = NetworkInterface.new(network_interface, :config => config)
@@ -424,8 +424,8 @@ module AWS
424
424
  nil
425
425
  end
426
426
 
427
- # @return [Array<SecurityGroup>] Returns a list of security
428
- # groups the instance belongs to.
427
+ # @return [Array<SecurityGroup>] Returns a list of security
428
+ # groups the instance belongs to.
429
429
  def security_groups
430
430
  (group_set || []).collect do |g|
431
431
  SecurityGroup.new(g.group_id, :name => g.group_name, :config => config)
@@ -468,7 +468,7 @@ module AWS
468
468
  state ? enable_monitoring : disable_monitoring
469
469
  end
470
470
 
471
- # @return [Booelan] Returns +true+ if CloudWatch monitoring is
471
+ # @return [Booelan] Returns +true+ if CloudWatch monitoring is
472
472
  # enabled for this instance.
473
473
  def monitoring_enabled?
474
474
  monitoring == :enabled
@@ -595,7 +595,7 @@ module AWS
595
595
  ips.filter('instance-id', id).first
596
596
  end
597
597
 
598
- # @return [Boolean] Returns true if an elastic IP address is
598
+ # @return [Boolean] Returns true if an elastic IP address is
599
599
  # associated with this instance, false otherwise.
600
600
  def has_elastic_ip?
601
601
  !elastic_ip.nil?
@@ -649,7 +649,7 @@ module AWS
649
649
 
650
650
  # This produces an image of an EC2 instance for use in another
651
651
  # virtualization environment and then writes the image to a
652
- # S3 bucket.
652
+ # S3 bucket.
653
653
  #
654
654
  # == Granting EC2 write access to your bucket
655
655
  #
@@ -675,29 +675,29 @@ module AWS
675
675
  # File.open('image.ova', 'w') {|f| f.write(task.s3_object.read) }
676
676
  #
677
677
  # @param [S3::Bucket,String] bucket The destination bucket. May
678
- # be the name of the bucket (string) or a {S3::Bucket} object. The
678
+ # be the name of the bucket (string) or a {S3::Bucket} object. The
679
679
  # bucket must exist and grant write permissiosn to the AWS account
680
680
  # 'vm-import-export@amazon.com.'.
681
681
  #
682
682
  # @param [Hash] options
683
683
  #
684
- # @option options [String] :target_environment ('vmware') The target
684
+ # @option options [String] :target_environment ('vmware') The target
685
685
  # virtualization environment. Valid values include: 'vmware', 'citrix'
686
686
  # and 'microsoft'.
687
687
  #
688
688
  # @option options [String] :disk_image_format The format for the exported
689
- # image. Defaults to 'vmdk' if +:target_environemnt+ is 'vmware',
689
+ # image. Defaults to 'vmdk' if +:target_environemnt+ is 'vmware',
690
690
  # otherwise, 'vhd'.
691
691
  #
692
- # @option options [String] :container_format The container format used to
692
+ # @option options [String] :container_format The container format used to
693
693
  # combine disk images with metadata (such as OVF). If absent, only
694
- # the disk image will be exported. Defaults to 'ova' if
694
+ # the disk image will be exported. Defaults to 'ova' if
695
695
  # +:target_environment+ is 'vmware', otherwise ommited.
696
696
  #
697
- # @option options [String] :description Description of the conversion
697
+ # @option options [String] :description Description of the conversion
698
698
  # task or the resource being exported.
699
699
  #
700
- # @option options [String] :prefix (nil) The image is written to a
700
+ # @option options [String] :prefix (nil) The image is written to a
701
701
  # single object in the bucket at the key:
702
702
  #
703
703
  # "#{prefix}#{export_task_id}.#{disk_image_format}"
@@ -721,9 +721,9 @@ module AWS
721
721
  resp = client.create_instance_export_task(opts)
722
722
 
723
723
  ExportTask.new_from(
724
- :create_instance_export_task,
724
+ :create_instance_export_task,
725
725
  resp[:export_task],
726
- resp[:export_task][:export_task_id],
726
+ resp[:export_task][:export_task_id],
727
727
  :config => config)
728
728
 
729
729
  end
@@ -734,7 +734,7 @@ module AWS
734
734
  resp.instance_index[id]
735
735
  end
736
736
 
737
- def instance_action name
737
+ def instance_action name
738
738
  client.send("#{name}_instances", :instance_ids => [id])
739
739
  nil
740
740
  end
@@ -750,7 +750,7 @@ module AWS
750
750
  def attributes_from_response_object(obj)
751
751
  if atts = super(obj)
752
752
  if obj[:instance_state]
753
- atts[:status] = obj[:instance_state].name.tr("-","_").to_sym
753
+ atts[:status] = obj[:instance_state].name.tr("-","_").to_sym
754
754
  end
755
755
  atts
756
756
  end
@@ -113,8 +113,8 @@ module AWS
113
113
  # to delete the volume when the
114
114
  # instance is terminated.
115
115
  #
116
- # @option options [Boolean] :monitoring Setting this to true
117
- # enables CloudWatch monitoring on the instances once they
116
+ # @option options [Boolean] :monitoring_enabled Setting this to
117
+ # +true+ enables CloudWatch monitoring on the instances once they
118
118
  # are started.
119
119
  #
120
120
  # @option options [String] :availability_zone Specifies the
@@ -128,6 +128,9 @@ module AWS
128
128
  # use. Note: Launching public images without a key pair ID
129
129
  # will leave them inaccessible.
130
130
  #
131
+ # @option options [KeyPair] :key_pair A {KeyPair} that should
132
+ # be used when launching an instance.
133
+ #
131
134
  # @option options [Array] :security_groups Security groups are used
132
135
  # to determine network access rules for the instances.
133
136
  # +:security_groups+ can be a single value or an array of values.
@@ -28,7 +28,7 @@ module AWS
28
28
  # @return [String] The name of the key pair.
29
29
  attr_reader :name
30
30
 
31
- attribute :fingerprint, :as => :key_fingerprint, :static => true
31
+ attribute :fingerprint, :from => :key_fingerprint, :static => true
32
32
 
33
33
  populates_from(:create_key_pair, :import_key_pair) do |resp|
34
34
  resp if resp.key_name == name
@@ -37,7 +37,7 @@ module AWS
37
37
  attr_reader :network_acl_id
38
38
 
39
39
  alias_method :id, :network_acl_id
40
-
40
+
41
41
  attribute :vpc_id, :static => true
42
42
 
43
43
  attribute :default, :static => true
@@ -75,7 +75,7 @@ module AWS
75
75
  attribute :mac_address, :static => true
76
76
 
77
77
  attribute :availability_zone_name,
78
- :as => :availability_zone,
78
+ :from => :availability_zone,
79
79
  :static => true
80
80
 
81
81
  mutable_attribute :source_dest_check
@@ -90,7 +90,7 @@ module AWS
90
90
  translates_output {|assoc| assoc.to_hash }
91
91
  end
92
92
 
93
- attribute :attachment_details, :as => :attachment
93
+ attribute :attachment_details, :from => :attachment
94
94
 
95
95
  protected :attachment_details
96
96