aws-sdk-core 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/apis/ecs/2014-11-13/api-2.json +20 -2
  3. data/apis/iam/2010-05-08/paginators-1.json +32 -0
  4. data/apis/iam/2010-05-08/resources-1.json +8 -0
  5. data/apis/iam/2010-05-08/waiters-2.json +22 -0
  6. data/bin/aws.rb +6 -0
  7. data/lib/aws-sdk-core.rb +15 -7
  8. data/lib/aws-sdk-core/api/docs/builder.rb +3 -3
  9. data/lib/aws-sdk-core/credential_provider.rb +5 -7
  10. data/lib/aws-sdk-core/dynamodb/attribute_value.rb +2 -2
  11. data/lib/aws-sdk-core/eager_loader.rb +5 -6
  12. data/lib/aws-sdk-core/iam.rb +1 -0
  13. data/lib/aws-sdk-core/instance_profile_credentials.rb +1 -1
  14. data/lib/aws-sdk-core/json/handler.rb +4 -4
  15. data/lib/aws-sdk-core/pageable_response.rb +44 -34
  16. data/lib/aws-sdk-core/pager.rb +2 -3
  17. data/lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb +2 -1
  18. data/lib/aws-sdk-core/plugins/response_paging.rb +1 -0
  19. data/lib/aws-sdk-core/shared_credentials.rb +2 -2
  20. data/lib/aws-sdk-core/signers/s3.rb +31 -3
  21. data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +3 -5
  22. data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +0 -1
  23. data/lib/aws-sdk-core/version.rb +1 -1
  24. data/lib/aws-sdk-core/xml/parser.rb +4 -1
  25. data/lib/aws-sdk-core/xml/parser/engines/oga.rb +39 -0
  26. data/lib/seahorse/client/http/request.rb +1 -1
  27. data/lib/seahorse/client/http/response.rb +5 -3
  28. metadata +5 -13
  29. data/apis/config/2014-10-17/api-2.json +0 -694
  30. data/apis/config/2014-10-17/paginators-1.json +0 -10
  31. data/apis/ec2/2014-10-01/api-2.json +0 -10267
  32. data/apis/ec2/2014-10-01/paginators-1.json +0 -125
  33. data/apis/ec2/2014-10-01/resources-1.json +0 -2289
  34. data/apis/ec2/2014-10-01/waiters-2.json +0 -453
  35. data/apis/ec2/2015-03-01/api-2.json +0 -11245
  36. data/apis/ec2/2015-03-01/paginators-1.json +0 -125
  37. data/apis/ec2/2015-03-01/resources-1.json +0 -2479
  38. data/apis/ec2/2015-03-01/waiters-2.json +0 -458
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13117254bdddddf4223c6846d2088631c80e1af4
4
- data.tar.gz: b48fa027be73b0bf52b339c4a2a1905f36468dd1
3
+ metadata.gz: e48a29b6d07bf2881c5ff4ed4192b67205f41c7b
4
+ data.tar.gz: e2cec76e3ec2e6409e4767a97b986b58096368bc
5
5
  SHA512:
6
- metadata.gz: 22e4d9b1d2e5d569043868acd8158e64dc9f6c9ad47cbfa23778d6537ee7d64457f1045e5991962fe74472d9fad31b4d815f169c6ec80e7e6ad668b79ef067ae
7
- data.tar.gz: 6c5cc908a083a5935156212d58f737d3acd5204ad75211ddcf7f6422a1d954eeb6531fcab95c516ff9f5df7ef2adea18288841b083099004b9bb179812e8e171
6
+ metadata.gz: 352e29c1deb5889f65b286e20a97106a0dc36d59390f7ec8c8666883868bf0399daf06de1a3fb53a42a6c2d0f773897b119df79e689527ca2e387668beae3d9c
7
+ data.tar.gz: b106dcab820a1d5f8c834784a732396941375167a24ba717b6f5704d7860ee24980e2fb2ec91e33f725d2c78b9fb48695d3aa79397e6fd42769cc7e5cbe883b0
@@ -854,7 +854,8 @@
854
854
  "type":"structure",
855
855
  "members":{
856
856
  "name":{"shape":"String"},
857
- "command":{"shape":"StringList"}
857
+ "command":{"shape":"StringList"},
858
+ "environment":{"shape":"EnvironmentVariables"}
858
859
  }
859
860
  },
860
861
  "ContainerOverrides":{
@@ -1164,6 +1165,8 @@
1164
1165
  "type":"structure",
1165
1166
  "members":{
1166
1167
  "familyPrefix":{"shape":"String"},
1168
+ "status":{"shape":"TaskDefinitionStatus"},
1169
+ "sort":{"shape":"SortOrder"},
1167
1170
  "nextToken":{"shape":"String"},
1168
1171
  "maxResults":{"shape":"BoxedInteger"}
1169
1172
  }
@@ -1377,6 +1380,13 @@
1377
1380
  "type":"list",
1378
1381
  "member":{"shape":"Service"}
1379
1382
  },
1383
+ "SortOrder":{
1384
+ "type":"string",
1385
+ "enum":[
1386
+ "ASC",
1387
+ "DESC"
1388
+ ]
1389
+ },
1380
1390
  "StartTaskRequest":{
1381
1391
  "type":"structure",
1382
1392
  "required":[
@@ -1471,9 +1481,17 @@
1471
1481
  "containerDefinitions":{"shape":"ContainerDefinitions"},
1472
1482
  "family":{"shape":"String"},
1473
1483
  "revision":{"shape":"Integer"},
1474
- "volumes":{"shape":"VolumeList"}
1484
+ "volumes":{"shape":"VolumeList"},
1485
+ "status":{"shape":"TaskDefinitionStatus"}
1475
1486
  }
1476
1487
  },
1488
+ "TaskDefinitionStatus":{
1489
+ "type":"string",
1490
+ "enum":[
1491
+ "ACTIVE",
1492
+ "INACTIVE"
1493
+ ]
1494
+ },
1477
1495
  "TaskOverride":{
1478
1496
  "type":"structure",
1479
1497
  "members":{
@@ -21,6 +21,38 @@
21
21
  "limit_key": "MaxItems",
22
22
  "result_key": "AccountAliases"
23
23
  },
24
+ "ListAttachedGroupPolicies": {
25
+ "input_token": "Marker",
26
+ "output_token": "Marker",
27
+ "more_results": "IsTruncated",
28
+ "limit_key": "MaxItems",
29
+ "result_key": "AttachedPolicies"
30
+ },
31
+ "ListAttachedRolePolicies": {
32
+ "input_token": "Marker",
33
+ "output_token": "Marker",
34
+ "more_results": "IsTruncated",
35
+ "limit_key": "MaxItems",
36
+ "result_key": "AttachedPolicies"
37
+ },
38
+ "ListAttachedUserPolicies": {
39
+ "input_token": "Marker",
40
+ "output_token": "Marker",
41
+ "more_results": "IsTruncated",
42
+ "limit_key": "MaxItems",
43
+ "result_key": "AttachedPolicies"
44
+ },
45
+ "ListEntitiesForPolicy": {
46
+ "input_token": "Marker",
47
+ "output_token": "Marker",
48
+ "more_results": "IsTruncated",
49
+ "limit_key": "MaxItems",
50
+ "result_key": [
51
+ "PolicyGroups",
52
+ "PolicyUsers",
53
+ "PolicyRoles"
54
+ ]
55
+ },
24
56
  "ListGroupPolicies": {
25
57
  "input_token": "Marker",
26
58
  "output_token": "Marker",
@@ -1497,6 +1497,14 @@
1497
1497
  }
1498
1498
  }
1499
1499
  },
1500
+ "waiters": {
1501
+ "Exists": {
1502
+ "waiterName": "UserExists",
1503
+ "params": [
1504
+ { "target": "UserName", "source": "identifier", "name": "Name" }
1505
+ ]
1506
+ }
1507
+ },
1500
1508
  "has": {
1501
1509
  "AccessKey": {
1502
1510
  "resource": {
@@ -0,0 +1,22 @@
1
+ {
2
+ "version": 2,
3
+ "waiters": {
4
+ "UserExists": {
5
+ "delay": 1,
6
+ "operation": "GetUser",
7
+ "maxAttempts": 20,
8
+ "acceptors": [
9
+ {
10
+ "state": "success",
11
+ "matcher": "status",
12
+ "expected": 200
13
+ },
14
+ {
15
+ "state": "retry",
16
+ "matcher": "error",
17
+ "expected": "NoSuchEntity"
18
+ }
19
+ ]
20
+ }
21
+ }
22
+ }
data/bin/aws.rb CHANGED
@@ -102,6 +102,12 @@ module Aws
102
102
  end
103
103
  end
104
104
  end
105
+ class Client
106
+ def resource
107
+ namespace = Aws.const_get(self.class.name.split('::')[1])
108
+ namespace::Resource.new(client: self)
109
+ end
110
+ end
105
111
  end
106
112
 
107
113
  begin
@@ -191,7 +191,6 @@ module Aws
191
191
  # @api private
192
192
  module Signers
193
193
  autoload :Base, 'aws-sdk-core/signers/base'
194
- autoload :Handler, 'aws-sdk-core/signers/handler'
195
194
  autoload :S3, 'aws-sdk-core/signers/s3'
196
195
  autoload :V2, 'aws-sdk-core/signers/v2'
197
196
  autoload :V3, 'aws-sdk-core/signers/v3'
@@ -285,16 +284,25 @@ module Aws
285
284
  eager_loader = EagerLoader.new
286
285
  eager_loader.load(JMESPath)
287
286
  eager_loader.load(Seahorse)
288
- (options[:services] || SERVICE_MODULE_NAMES).each do |svc_name|
289
- begin
290
- eager_loader.load(Aws.const_get(svc_name))
291
- rescue NameError
292
- raise ArgumentError, "invalid service Aws::#{svc_name}"
293
- end
287
+ sub_modules(options).each do |module_or_class|
288
+ eager_loader.load(module_or_class)
294
289
  end
295
290
  eager_loader
296
291
  end
297
292
 
293
+ def sub_modules(options = {})
294
+ constants = Aws.constants.map(&:to_s)
295
+ if options[:services]
296
+ constants -= SERVICE_MODULE_NAMES
297
+ constants += options[:services] || SERVICE_MODULE_NAMES
298
+ end
299
+ constants.inject([]) do |modules, const_name|
300
+ constant = Aws.const_get(const_name)
301
+ modules << constant if Module === constant
302
+ modules
303
+ end
304
+ end
305
+
298
306
  # Yields to the given block for each service that has already been
299
307
  # defined via {add_service}. Also yields to the given block for
300
308
  # each new service added after the callback is registered.
@@ -38,7 +38,7 @@ module Aws
38
38
 
39
39
  def service_docstring
40
40
  path = "doc-src/services/#{@svc_name}/service.md"
41
- path = 'doc-src/services/default/service.md' unless File.exists?(path)
41
+ path = 'doc-src/services/default/service.md' unless File.exist?(path)
42
42
  template = read(path)
43
43
  svc_name = @svc_name
44
44
  api = @api
@@ -62,7 +62,7 @@ module Aws
62
62
 
63
63
  def errors_docstring
64
64
  path = "doc-src/services/#{@svc_name}/errors.md"
65
- path = 'doc-src/services/default/errors.md' unless File.exists?(path)
65
+ path = 'doc-src/services/default/errors.md' unless File.exist?(path)
66
66
  template = read(path)
67
67
  svc_name = @svc_name
68
68
  api = @api
@@ -90,7 +90,7 @@ module Aws
90
90
 
91
91
  def client_docstring
92
92
  path = "doc-src/services/#{@svc_name}/client.md"
93
- path = 'doc-src/services/default/client.md' unless File.exists?(path)
93
+ path = 'doc-src/services/default/client.md' unless File.exist?(path)
94
94
  render(path)
95
95
  end
96
96
 
@@ -4,13 +4,11 @@ module Aws
4
4
  extend Deprecations
5
5
 
6
6
  # @return [Credentials]
7
- def credentials
8
- @credentials
9
- end
7
+ attr_reader :credentials
10
8
 
11
9
  # @return [Boolean]
12
10
  def set?
13
- !!@credentials && @credentials.set?
11
+ !!credentials && credentials.set?
14
12
  end
15
13
 
16
14
  # @deprecated Deprecated in 2.1.0. This method is subject to errors
@@ -18,7 +16,7 @@ module Aws
18
16
  # objects. Will be removed in 2.2.0.
19
17
  # @see #credentials
20
18
  def access_key_id
21
- @credentials ? @credentials.access_key_id : nil
19
+ credentials ? credentials.access_key_id : nil
22
20
  end
23
21
  deprecated(:access_key_id, use: '#credentials')
24
22
 
@@ -27,7 +25,7 @@ module Aws
27
25
  # objects. Will be removed in 2.2.0.
28
26
  # @see #credentials
29
27
  def secret_access_key
30
- @credentials ? @credentials.secret_access_key : nil
28
+ credentials ? credentials.secret_access_key : nil
31
29
  end
32
30
  deprecated(:secret_access_key, use: '#credentials')
33
31
 
@@ -36,7 +34,7 @@ module Aws
36
34
  # objects. Will be removed in 2.2.0.
37
35
  # @see #credentials
38
36
  def session_token
39
- @credentials ? @credentials.session_token : nil
37
+ credentials ? credentials.session_token : nil
40
38
  end
41
39
  deprecated(:session_token, use: '#credentials')
42
40
 
@@ -66,8 +66,8 @@ module Aws
66
66
  type, value = extract_type_and_value(obj)
67
67
  case type
68
68
  when :m
69
- value.each.with_object({}) do |(key, value), map|
70
- map[key] = format(value)
69
+ value.each.with_object({}) do |(k, v), map|
70
+ map[k] = format(v)
71
71
  end
72
72
  when :l then value.map { |v| format(v) }
73
73
  when :s then value
@@ -17,12 +17,11 @@ module Aws
17
17
  @loaded << klass_or_module
18
18
  klass_or_module.constants.each do |const_name|
19
19
  path = klass_or_module.autoload?(const_name)
20
- require(path) if path
21
- const = klass_or_module.const_get(const_name)
22
- if const.is_a?(Module)
23
- unless @loaded.include?(const)
24
- load(const)
25
- end
20
+ begin
21
+ require(path) if path
22
+ const = klass_or_module.const_get(const_name)
23
+ self.load(const) if Module === const && !@loaded.include?(const)
24
+ rescue LoadError
26
25
  end
27
26
  end
28
27
  self
@@ -3,4 +3,5 @@ Aws.add_service(:IAM, {
3
3
  docs: "#{Aws::API_DIR}/iam/2010-05-08/docs-2.json",
4
4
  paginators: "#{Aws::API_DIR}/iam/2010-05-08/paginators-1.json",
5
5
  resources: "#{Aws::API_DIR}/iam/2010-05-08/resources-1.json",
6
+ waiters: "#{Aws::API_DIR}/iam/2010-05-08/waiters-2.json",
6
7
  })
@@ -82,7 +82,7 @@ module Aws
82
82
  profile_name = http_get(conn, path).lines.first.strip
83
83
  http_get(conn, path + profile_name)
84
84
  end
85
- rescue *FAILURES => e
85
+ rescue *FAILURES
86
86
  if failed_attempts < @retries
87
87
  @backoff.call(failed_attempts)
88
88
  failed_attempts += 1
@@ -8,10 +8,10 @@ module Aws
8
8
  # @return [Seahorse::Client::Response]
9
9
  def call(context)
10
10
  build_request(context)
11
- resp = @handler.call(context)
12
- resp.on(200..299) { |resp| parse_response(resp) }
13
- resp.on(200..599) { |resp| apply_request_id(context) }
14
- resp
11
+ response = @handler.call(context)
12
+ response.on(200..299) { |resp| parse_response(resp) }
13
+ response.on(200..599) { |resp| apply_request_id(context) }
14
+ response
15
15
  end
16
16
 
17
17
  private
@@ -2,38 +2,39 @@ module Aws
2
2
 
3
3
  # Decorates a {Seahorse::Client::Response} with paging methods:
4
4
  #
5
- # page = PageableResponse.new(response, pager)
6
- # page.last_page?
5
+ # resp = s3.list_objects(params)
6
+ # resp.last_page?
7
7
  # #=> false
8
8
  #
9
9
  # # sends a request to receive the next response page
10
- # page = page.next_page
11
- # page.last_page?
10
+ # resp = resp.next_page
11
+ # resp.last_page?
12
12
  # #=> true
13
13
  #
14
- # page.next_page
14
+ # resp.next_page
15
15
  # #=> raises PageableResponse::LastPageError
16
16
  #
17
17
  # You can enumerate all response pages with a block
18
18
  #
19
- # page = PageableResponse.new(response, pager)
20
- # page.each do |page|
19
+ # ec2.describe_instances(params).each do |page|
21
20
  # # yields once per page
21
+ # page.reservations.each do |r|
22
+ # # ...
23
+ # end
22
24
  # end
23
25
  #
24
26
  # Or using {#next_page} and {#last_page?}:
25
27
  #
26
- # page = PageableResponse.new(response, pager)
27
- # page = page.next_page until page.last_page?
28
- #
29
- # @note Normally you should not need to construct a {PageableResponse}
30
- # directly. The {Plugins::ResponsePaging} plugin automatically
31
- # decorates all responses with a {PageableResponse}.
28
+ # resp.last_page?
29
+ # resp = resp.next_page until resp.last_page?
32
30
  #
33
31
  module PageableResponse
34
32
 
35
- def self.included(base)
36
- base.send(:include, Enumerable)
33
+ def self.extended(base)
34
+ base.send(:extend, Enumerable)
35
+ base.send(:extend, UnsafeEnumerableMethods)
36
+ base.instance_variable_set("@last_page", nil)
37
+ base.instance_variable_set("@more_results", nil)
37
38
  end
38
39
 
39
40
  # @return [Paging::Pager]
@@ -79,24 +80,6 @@ module Aws
79
80
  end
80
81
  alias each_page each
81
82
 
82
- # @api private
83
- def count
84
- if respond_to?(:count)
85
- data.count
86
- else
87
- raise NotImplementedError
88
- end
89
- end
90
-
91
- # @api private
92
- def respond_to?(method_name, *args)
93
- if method_name == :count
94
- data.respond_to?(:count)
95
- else
96
- super
97
- end
98
- end
99
-
100
83
  private
101
84
 
102
85
  # @param [Hash] params A hash of additional request params to
@@ -114,7 +97,7 @@ module Aws
114
97
  # @return [Hash] Returns the hash of request parameters for the
115
98
  # next page, merging any given params.
116
99
  def next_page_params(params)
117
- context.params.merge(@pager.next_tokens(self).merge(params))
100
+ context[:original_params].merge(@pager.next_tokens(self).merge(params))
118
101
  end
119
102
 
120
103
  # Raised when calling {PageableResponse#next_page} on a pager that
@@ -133,5 +116,32 @@ module Aws
133
116
 
134
117
  end
135
118
 
119
+ # A handful of Enumerable methods, such as #count are not safe
120
+ # to call on a pageable response, as this would trigger n api calls
121
+ # simply to count the number of response pages, when likely what is
122
+ # wanted is to access count on the data. Same for #to_h.
123
+ module UnsafeEnumerableMethods
124
+
125
+ def count
126
+ if data.respond_to?(:count)
127
+ data.count
128
+ else
129
+ raise NoMethodError, "undefined method `count'"
130
+ end
131
+ end
132
+
133
+ def respond_to?(method_name, *args)
134
+ if method_name == :count
135
+ data.respond_to?(:count)
136
+ else
137
+ false
138
+ end
139
+ end
140
+
141
+ def to_h
142
+ data.to_h
143
+ end
144
+
145
+ end
136
146
  end
137
147
  end