aws-sdk 1.11.3 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/aws-rb +151 -0
- data/lib/aws/api_config/ElasticTranscoder-2012-09-25.yml +257 -0
- data/lib/aws/auto_scaling/group.rb +2 -0
- data/lib/aws/auto_scaling/group_options.rb +9 -0
- data/lib/aws/cloud_watch/metric_collection.rb +1 -3
- data/lib/aws/core.rb +107 -166
- data/lib/aws/core/configuration.rb +22 -4
- data/lib/aws/core/http/curb_handler.rb +2 -9
- data/lib/aws/core/http/net_http_handler.rb +15 -15
- data/lib/aws/core/region.rb +11 -7
- data/lib/aws/dynamo_db/client.rb +766 -400
- data/lib/aws/dynamo_db/client_v2.rb +125 -23
- data/lib/aws/elastic_transcoder/client.rb +578 -54
- data/lib/aws/iam/virtual_mfa_device.rb +1 -1
- data/lib/aws/route_53/change_batch.rb +3 -1
- data/lib/aws/route_53/resource_record_set.rb +17 -3
- data/lib/aws/s3/client.rb +10 -5
- data/lib/aws/s3/encryption_utils.rb +8 -1
- data/lib/aws/s3/object_collection.rb +7 -4
- data/lib/aws/simple_email_service.rb +5 -2
- data/lib/aws/sns.rb +1 -0
- data/lib/aws/sns/message.rb +175 -0
- data/lib/aws/sns/originators/from_auto_scaling.rb +68 -0
- data/lib/aws/version.rb +1 -1
- metadata +12 -16
@@ -61,6 +61,14 @@ module AWS
|
|
61
61
|
# Amazon EC2. For more information about cluster placement group, see
|
62
62
|
# [Using Cluster Instances](http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/using_cluster_computing.html).
|
63
63
|
#
|
64
|
+
# @option options [Array<String>] :termination_policies
|
65
|
+
# A standalone termination policy or a list of termination policies used
|
66
|
+
# to select the instance to terminate. The policies are executed in the
|
67
|
+
# order they are listed. For more information on creating a termination
|
68
|
+
# policy for your Auto Scaling group, go to
|
69
|
+
# [Instance Termination Policy for Your Auto Scaling Group](http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/us-termination-policy.html)
|
70
|
+
# in the Auto Scaling Developer Guide.
|
71
|
+
#
|
64
72
|
# @option options [Array<Hash>] :tags A list of tags to apply launched
|
65
73
|
# instances. Each tag hash may have the following keys:
|
66
74
|
#
|
@@ -102,6 +110,7 @@ module AWS
|
|
102
110
|
:desired_capacity,
|
103
111
|
:health_check_grace_period,
|
104
112
|
:placement_group,
|
113
|
+
:termination_policies,
|
105
114
|
].each do |opt|
|
106
115
|
group_opts[opt] = options[opt] if options.key?(opt)
|
107
116
|
end
|
@@ -97,9 +97,7 @@ module AWS
|
|
97
97
|
# should be a Hash with a `:name` and `:value`.
|
98
98
|
# @return [MetricCollection]
|
99
99
|
def with_dimensions *dimensions
|
100
|
-
dimensions
|
101
|
-
dimensions += dimensions.flatten
|
102
|
-
filter(:dimensions, dimensions)
|
100
|
+
filter(:dimensions, (@filters[:dimensions] || []) + dimensions.flatten )
|
103
101
|
end
|
104
102
|
|
105
103
|
protected
|
data/lib/aws/core.rb
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
# language governing permissions and limitations under the License.
|
13
13
|
|
14
14
|
require 'aws/version'
|
15
|
+
require 'set'
|
15
16
|
|
16
17
|
# AWS is the root module for all of the Amazon Web Services. It is also
|
17
18
|
# where you can configure you access to AWS.
|
@@ -32,98 +33,112 @@ require 'aws/version'
|
|
32
33
|
module AWS
|
33
34
|
|
34
35
|
# @api private
|
35
|
-
|
36
|
-
|
36
|
+
class SvcDetails
|
37
|
+
def initialize class_name, options
|
38
|
+
@class_name = class_name
|
39
|
+
@full_name = options[:full_name]
|
40
|
+
@method_name = options[:method_name]
|
41
|
+
@method_alias = options[:method_alias]
|
42
|
+
@old_name = @method_alias || @method_name
|
43
|
+
end
|
44
|
+
attr_reader :class_name, :full_name, :method_name, :method_alias, :old_name
|
45
|
+
end
|
46
|
+
|
47
|
+
# @api private
|
48
|
+
SERVICES = [
|
49
|
+
SvcDetails.new("CloudFront",
|
37
50
|
:full_name => "Amazon CloudFront",
|
38
|
-
:
|
39
|
-
"CloudSearch"
|
51
|
+
:method_name => :cloud_front),
|
52
|
+
SvcDetails.new("CloudSearch",
|
40
53
|
:full_name => "Amazon CloudSearch",
|
41
|
-
:
|
42
|
-
"CloudWatch"
|
54
|
+
:method_name => :cloud_search),
|
55
|
+
SvcDetails.new("CloudWatch",
|
43
56
|
:full_name => "Amazon CloudWatch",
|
44
|
-
:
|
45
|
-
"DynamoDB"
|
57
|
+
:method_name => :cloud_watch),
|
58
|
+
SvcDetails.new("DynamoDB",
|
46
59
|
:full_name => "Amazon DynamoDB",
|
47
|
-
:
|
48
|
-
"EC2"
|
60
|
+
:method_name => :dynamo_db),
|
61
|
+
SvcDetails.new("EC2",
|
49
62
|
:full_name => "Amazon Elastic Compute Cloud",
|
50
|
-
:
|
51
|
-
"EMR"
|
63
|
+
:method_name => :ec2),
|
64
|
+
SvcDetails.new("EMR",
|
52
65
|
:full_name => "Amazon Elastic MapReduce",
|
53
|
-
:
|
54
|
-
"ElastiCache"
|
66
|
+
:method_name => :emr),
|
67
|
+
SvcDetails.new("ElastiCache",
|
55
68
|
:full_name => "Amazon ElastiCache",
|
56
|
-
:
|
57
|
-
"Glacier"
|
69
|
+
:method_name => :elasticache),
|
70
|
+
SvcDetails.new("Glacier",
|
58
71
|
:full_name => "Amazon Glacier",
|
59
|
-
:
|
60
|
-
"RDS"
|
72
|
+
:method_name => :glacier),
|
73
|
+
SvcDetails.new("RDS",
|
61
74
|
:full_name => "Amazon Relational Database Service (Beta)",
|
62
|
-
:
|
63
|
-
"Route53"
|
75
|
+
:method_name => :rds),
|
76
|
+
SvcDetails.new("Route53",
|
64
77
|
:full_name => "Amazon Route 53",
|
65
|
-
:
|
66
|
-
"SimpleEmailService"
|
78
|
+
:method_name => :route_53),
|
79
|
+
SvcDetails.new("SimpleEmailService",
|
67
80
|
:full_name => "Amazon Simple E-mail Service",
|
68
|
-
:
|
69
|
-
|
81
|
+
:method_name => :ses,
|
82
|
+
:method_alias => :simple_email_service),
|
83
|
+
SvcDetails.new("SNS",
|
70
84
|
:full_name => "Amazon Simple Notifications Service",
|
71
|
-
:
|
72
|
-
"SQS"
|
85
|
+
:method_name => :sns),
|
86
|
+
SvcDetails.new("SQS",
|
73
87
|
:full_name => "Amazon Simple Queue Service",
|
74
|
-
:
|
75
|
-
"SimpleWorkflow"
|
88
|
+
:method_name => :sqs),
|
89
|
+
SvcDetails.new("SimpleWorkflow",
|
76
90
|
:full_name => "Amazon Simple Workflow Service",
|
77
|
-
:
|
78
|
-
|
91
|
+
:method_name => :swf,
|
92
|
+
:method_alias => :simple_workflow),
|
93
|
+
SvcDetails.new("SimpleDB",
|
79
94
|
:full_name => "Amazon SimpleDB",
|
80
|
-
:
|
81
|
-
"AutoScaling"
|
95
|
+
:method_name => :simple_db),
|
96
|
+
SvcDetails.new("AutoScaling",
|
82
97
|
:full_name => "Auto Scaling",
|
83
|
-
:
|
84
|
-
"CloudFormation"
|
98
|
+
:method_name => :auto_scaling),
|
99
|
+
SvcDetails.new("CloudFormation",
|
85
100
|
:full_name => "AWS CloudFormation",
|
86
|
-
:
|
87
|
-
"DataPipeline"
|
101
|
+
:method_name => :cloud_formation),
|
102
|
+
SvcDetails.new("DataPipeline",
|
88
103
|
:full_name => "AWS Data Pipeline",
|
89
|
-
:
|
90
|
-
"DirectConnect"
|
104
|
+
:method_name => :data_pipeline),
|
105
|
+
SvcDetails.new("DirectConnect",
|
91
106
|
:full_name => "AWS Direct Connect",
|
92
|
-
:
|
93
|
-
"ElasticBeanstalk"
|
107
|
+
:method_name => :direct_connect),
|
108
|
+
SvcDetails.new("ElasticBeanstalk",
|
94
109
|
:full_name => "AWS Elastic Beanstalk",
|
95
|
-
:
|
96
|
-
"IAM"
|
110
|
+
:method_name => :elastic_beanstalk),
|
111
|
+
SvcDetails.new("IAM",
|
97
112
|
:full_name => "AWS Identity and Access Management",
|
98
|
-
:
|
99
|
-
"ImportExport"
|
113
|
+
:method_name => :iam),
|
114
|
+
SvcDetails.new("ImportExport",
|
100
115
|
:full_name => "AWS Import/Export",
|
101
|
-
:
|
102
|
-
"OpsWorks"
|
116
|
+
:method_name => :import_export),
|
117
|
+
SvcDetails.new("OpsWorks",
|
103
118
|
:full_name => "AWS OpsWorks",
|
104
|
-
:
|
105
|
-
"STS"
|
119
|
+
:method_name => :ops_works),
|
120
|
+
SvcDetails.new("STS",
|
106
121
|
:full_name => "AWS Security Token Service",
|
107
|
-
:
|
108
|
-
"StorageGateway"
|
122
|
+
:method_name => :sts),
|
123
|
+
SvcDetails.new("StorageGateway",
|
109
124
|
:full_name => "AWS Storage Gateway",
|
110
|
-
:
|
111
|
-
"Support"
|
125
|
+
:method_name => :storage_gateway),
|
126
|
+
SvcDetails.new("Support",
|
112
127
|
:full_name => "AWS Support",
|
113
|
-
:
|
114
|
-
"ELB"
|
128
|
+
:method_name => :support),
|
129
|
+
SvcDetails.new("ELB",
|
115
130
|
:full_name => "Elastic Load Balancing",
|
116
|
-
:
|
117
|
-
"ElasticTranscoder"
|
131
|
+
:method_name => :elb),
|
132
|
+
SvcDetails.new("ElasticTranscoder",
|
118
133
|
:full_name => "Amazon Elastic Transcoder",
|
119
|
-
:
|
120
|
-
"Redshift"
|
134
|
+
:method_name => :elastic_transcoder),
|
135
|
+
SvcDetails.new("Redshift",
|
121
136
|
:full_name => "Amazon Redshift",
|
122
|
-
:
|
123
|
-
"S3"
|
137
|
+
:method_name => :redshift),
|
138
|
+
SvcDetails.new("S3",
|
124
139
|
:full_name => "Amazon Simple Storage Service",
|
125
|
-
:
|
126
|
-
}
|
140
|
+
:method_name => :s3)
|
141
|
+
].inject({}) { |h,svc| h[svc.class_name] = svc; h }
|
127
142
|
|
128
143
|
# @api private
|
129
144
|
ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
@@ -222,100 +237,11 @@ module AWS
|
|
222
237
|
|
223
238
|
class << self
|
224
239
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
# @!method cloud_search
|
229
|
-
# @return [CloudSearch]
|
230
|
-
|
231
|
-
# @!method cloud_watch
|
232
|
-
# @return [CloudWatch]
|
233
|
-
|
234
|
-
# @!method dynamo_db
|
235
|
-
# @return [DynamoDB]
|
236
|
-
|
237
|
-
# @!method ec2
|
238
|
-
# @return [EC2]
|
239
|
-
|
240
|
-
# @!method emr
|
241
|
-
# @return [EMR]
|
242
|
-
|
243
|
-
# @!method elasticache
|
244
|
-
# @return [ElastiCache]
|
245
|
-
|
246
|
-
# @!method glacier
|
247
|
-
# @return [Glacier]
|
248
|
-
|
249
|
-
# @!method rds
|
250
|
-
# @return [RDS]
|
251
|
-
|
252
|
-
# @!method route_53
|
253
|
-
# @return [Route53]
|
254
|
-
|
255
|
-
# @!method simple_email_service
|
256
|
-
# @return [SimpleEmailService]
|
257
|
-
|
258
|
-
# @!method sns
|
259
|
-
# @return [SNS]
|
260
|
-
|
261
|
-
# @!method sqs
|
262
|
-
# @return [SQS]
|
263
|
-
|
264
|
-
# @!method simple_workflow
|
265
|
-
# @return [SimpleWorkflow]
|
266
|
-
|
267
|
-
# @!method simple_db
|
268
|
-
# @return [SimpleDB]
|
269
|
-
|
270
|
-
# @!method auto_scaling
|
271
|
-
# @return [AutoScaling]
|
272
|
-
|
273
|
-
# @!method cloud_formation
|
274
|
-
# @return [CloudFormation]
|
275
|
-
|
276
|
-
# @!method data_pipeline
|
277
|
-
# @return [DataPipeline]
|
278
|
-
|
279
|
-
# @!method direct_connect
|
280
|
-
# @return [DirectConnect]
|
281
|
-
|
282
|
-
# @!method elastic_beanstalk
|
283
|
-
# @return [ElasticBeanstalk]
|
284
|
-
|
285
|
-
# @!method iam
|
286
|
-
# @return [IAM]
|
287
|
-
|
288
|
-
# @!method import_export
|
289
|
-
# @return [ImportExport]
|
290
|
-
|
291
|
-
# @!method ops_works
|
292
|
-
# @return [OpsWorks]
|
293
|
-
|
294
|
-
# @!method sts
|
295
|
-
# @return [STS]
|
296
|
-
|
297
|
-
# @!method storage_gateway
|
298
|
-
# @return [StorageGateway]
|
299
|
-
|
300
|
-
# @!method support
|
301
|
-
# @return [Support]
|
302
|
-
|
303
|
-
# @!method elb
|
304
|
-
# @return [ELB]
|
305
|
-
|
306
|
-
# @!method elastic_transcoder
|
307
|
-
# @return [ElasticTranscoder]
|
308
|
-
|
309
|
-
# @!method redshift
|
310
|
-
# @return [Redshift]
|
311
|
-
|
312
|
-
# @!method s3
|
313
|
-
# @return [S3]
|
314
|
-
|
315
|
-
SERVICES.each_pair do |klass,svc|
|
316
|
-
define_method(svc[:ruby_name]) do |*args|
|
317
|
-
AWS.const_get(klass).new(args.first || {})
|
240
|
+
SERVICES.values.each do |svc|
|
241
|
+
define_method(svc.method_name) do |*args|
|
242
|
+
AWS.const_get(svc.class_name).new(args.first || {})
|
318
243
|
end
|
244
|
+
alias_method(svc.method_alias, svc.method_name) if svc.method_alias
|
319
245
|
end
|
320
246
|
|
321
247
|
# @api private
|
@@ -568,6 +494,18 @@ module AWS
|
|
568
494
|
Core::RegionCollection.new
|
569
495
|
end
|
570
496
|
|
497
|
+
# @note Memoization is currently only supported for the EC2 APIs;
|
498
|
+
# other APIs are unaffected by the status of memoization. To
|
499
|
+
# protect your code from future changes in memoization support,
|
500
|
+
# you should not enable memoization while calling non-EC2 APIs.
|
501
|
+
#
|
502
|
+
# Resets memoizing service requests made in the current thread.
|
503
|
+
# See {memoize} for a full discussion of the memoization feature.
|
504
|
+
# This has no effect if memoization is already enabled.
|
505
|
+
def reset_memoization
|
506
|
+
Thread.current[:aws_memoization] = {}
|
507
|
+
end
|
508
|
+
|
571
509
|
# @note Memoization is currently only supported for the EC2 APIs;
|
572
510
|
# other APIs are unaffected by the status of memoization. To
|
573
511
|
# protect your code from future changes in memoization support,
|
@@ -690,13 +628,16 @@ module AWS
|
|
690
628
|
end
|
691
629
|
|
692
630
|
# Eagerly loads all AWS classes/modules registered with autoload.
|
693
|
-
# @return [
|
694
|
-
def eager_autoload! klass_or_module = AWS
|
631
|
+
# @return [void]
|
632
|
+
def eager_autoload! klass_or_module = AWS, visited = Set.new
|
695
633
|
klass_or_module.constants.each do |const_name|
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
634
|
+
path = klass_or_module.autoload?(const_name)
|
635
|
+
require(path) if path
|
636
|
+
const = klass_or_module.const_get(const_name)
|
637
|
+
if const.is_a?(Module)
|
638
|
+
unless visited.include?(const)
|
639
|
+
visited << const
|
640
|
+
eager_autoload!(const, visited)
|
700
641
|
end
|
701
642
|
end
|
702
643
|
end
|
@@ -719,13 +660,13 @@ module AWS
|
|
719
660
|
pattern = File.join(File.dirname(__FILE__), 'api_config', '*.yml')
|
720
661
|
Dir.glob(pattern).each do |path|
|
721
662
|
matches = path.match(/(\w+)-(\d{4}-\d{2}-\d{2})/)
|
722
|
-
svc = SERVICES[$1]
|
663
|
+
svc = SERVICES[$1].full_name
|
723
664
|
versions[svc] ||= []
|
724
665
|
versions[svc] << $2
|
725
666
|
end
|
726
667
|
|
727
668
|
# s3 does not have an API configuration, so we have to add it manually
|
728
|
-
versions[SERVICES['S3']
|
669
|
+
versions[SERVICES['S3'].full_name] = ['2006-03-01']
|
729
670
|
|
730
671
|
# sort the services alphabetically
|
731
672
|
versions.keys.sort_by(&:downcase).inject({}) do |hash,svc|
|
@@ -736,9 +677,9 @@ module AWS
|
|
736
677
|
end
|
737
678
|
end
|
738
679
|
|
739
|
-
SERVICES.
|
740
|
-
autoload(
|
741
|
-
require "aws/#{
|
680
|
+
SERVICES.values.each do |svc|
|
681
|
+
autoload(svc.class_name, "aws/#{svc.old_name}")
|
682
|
+
require "aws/#{svc.old_name}/config"
|
742
683
|
end
|
743
684
|
|
744
685
|
end
|
@@ -45,7 +45,7 @@ module AWS
|
|
45
45
|
# configuration values, call {#with}, passing in the updates
|
46
46
|
# and a new configuration object will be returned.
|
47
47
|
#
|
48
|
-
# config = Configuration.new(:
|
48
|
+
# config = Configuration.new(:max_retries => 3)
|
49
49
|
# new_config = config.with(:max_retries => 2)
|
50
50
|
#
|
51
51
|
# config.max_retries #=> 3
|
@@ -377,9 +377,17 @@ module AWS
|
|
377
377
|
|
378
378
|
def add_service name, ruby_name, endpoint_pattern = nil, &endpoint_builder
|
379
379
|
|
380
|
+
svc = SERVICES[name]
|
381
|
+
svc_opt = svc.method_name
|
382
|
+
ruby_name = svc.old_name
|
383
|
+
|
384
|
+
add_option(svc_opt, {})
|
385
|
+
|
380
386
|
add_option :"#{ruby_name}_endpoint" do |config,value|
|
381
387
|
if value
|
382
388
|
value
|
389
|
+
elsif endpoint = config.send(svc_opt)[:endpoint]
|
390
|
+
endpoint
|
383
391
|
elsif endpoint_pattern
|
384
392
|
endpoint_pattern % config.region
|
385
393
|
else
|
@@ -388,13 +396,23 @@ module AWS
|
|
388
396
|
end
|
389
397
|
|
390
398
|
add_option(:"#{ruby_name}_port") do |config,value|
|
391
|
-
value
|
399
|
+
if value
|
400
|
+
value
|
401
|
+
elsif port = config.send(svc_opt)[:port]
|
402
|
+
port
|
403
|
+
else
|
404
|
+
config.use_ssl? ? 443 : 80
|
405
|
+
end
|
392
406
|
end
|
393
407
|
|
394
408
|
# users only need to specify service regions when they use
|
395
409
|
# a test endpoint with a sigv4 service
|
396
410
|
add_option(:"#{ruby_name}_region") do |config,value|
|
397
|
-
value
|
411
|
+
if value
|
412
|
+
value
|
413
|
+
elsif region = config.send(svc_opt)[:region]
|
414
|
+
region
|
415
|
+
else
|
398
416
|
endpoint = config.send("#{ruby_name}_endpoint")
|
399
417
|
if endpoint =~ /us-gov/
|
400
418
|
if matches = endpoint.match(/(us-gov-west-\d+)/)
|
@@ -467,7 +485,7 @@ module AWS
|
|
467
485
|
|
468
486
|
add_option :http_continue_threshold, false
|
469
487
|
|
470
|
-
add_option :http_idle_timeout,
|
488
|
+
add_option :http_idle_timeout, 5
|
471
489
|
|
472
490
|
add_option :http_wire_trace, false, :boolean => true
|
473
491
|
|