aws-sdk-core 2.0.0.rc5 → 2.0.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apis/Route53-2013-04-01.json +1077 -0
- data/apis/source/cloudformation-2010-05-15.json +201 -201
- data/apis/source/cloudformation-2010-05-15.paginators.json +3 -0
- data/apis/source/route53-2013-04-01.json +2134 -0
- data/apis/source/route53-2013-04-01.paginators.json +33 -0
- data/lib/aws/error_handler.rb +7 -7
- data/lib/aws/json/error_parser.rb +3 -2
- data/lib/aws/plugins/retry_errors.rb +2 -1
- data/lib/aws/plugins/s3_complete_multipart_upload_fix.rb +5 -5
- data/lib/aws/plugins/s3_get_bucket_location_fix.rb +1 -1
- data/lib/aws/plugins/s3_redirects.rb +2 -2
- data/lib/aws/version.rb +1 -1
- data/lib/aws/xml/error_parser.rb +1 -1
- data/spec/aws/operations_spec.rb +1 -1
- data/spec/aws/plugins/sqs_queue_urls_spec.rb +1 -1
- data/spec/fixtures/operations/route53/change_resource_record_sets.yml +2 -2
- data/vendor/seahorse/lib/seahorse/client/handler_builder.rb +1 -1
- data/vendor/seahorse/lib/seahorse/client/logging/formatter.rb +2 -2
- data/vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb +1 -1
- data/vendor/seahorse/lib/seahorse/client/plugins/restful_bindings.rb +3 -3
- data/vendor/seahorse/lib/seahorse/client/response.rb +0 -6
- data/vendor/seahorse/spec/seahorse/client/handler_builder_spec.rb +1 -1
- data/vendor/seahorse/spec/seahorse/client/net_http/handler_spec.rb +5 -3
- data/vendor/seahorse/spec/seahorse/client/request_spec.rb +2 -2
- data/vendor/seahorse/spec/seahorse/client/response_spec.rb +0 -22
- metadata +5 -2
@@ -0,0 +1,33 @@
|
|
1
|
+
{
|
2
|
+
"pagination": {
|
3
|
+
"ListHealthChecks": {
|
4
|
+
"input_token": "Marker",
|
5
|
+
"output_token": "NextMarker",
|
6
|
+
"more_results": "IsTruncated",
|
7
|
+
"limit_key": "MaxItems",
|
8
|
+
"result_key": "HealthChecks"
|
9
|
+
},
|
10
|
+
"ListHostedZones": {
|
11
|
+
"input_token": "Marker",
|
12
|
+
"output_token": "NextMarker",
|
13
|
+
"more_results": "IsTruncated",
|
14
|
+
"limit_key": "MaxItems",
|
15
|
+
"result_key": "HostedZones"
|
16
|
+
},
|
17
|
+
"ListResourceRecordSets": {
|
18
|
+
"more_results": "IsTruncated",
|
19
|
+
"limit_key": "MaxItems",
|
20
|
+
"result_key": "ResourceRecordSets",
|
21
|
+
"input_token": [
|
22
|
+
"StartRecordName",
|
23
|
+
"StartRecordType",
|
24
|
+
"StartRecordIdentifier"
|
25
|
+
],
|
26
|
+
"output_token": [
|
27
|
+
"NextRecordName",
|
28
|
+
"NextRecordType",
|
29
|
+
"NextRecordIdentifier"
|
30
|
+
]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
data/lib/aws/error_handler.rb
CHANGED
@@ -10,8 +10,8 @@ module Aws
|
|
10
10
|
|
11
11
|
def call(context)
|
12
12
|
@handler.call(context).on(300..599) do |response|
|
13
|
-
if empty_body?(
|
14
|
-
error_code = error_code_for_empty_response(
|
13
|
+
if empty_body?(context.http_response)
|
14
|
+
error_code = error_code_for_empty_response(context.http_response)
|
15
15
|
error_message = ''
|
16
16
|
else
|
17
17
|
error_code, error_message = @parser.extract_error(response)
|
@@ -29,19 +29,19 @@ module Aws
|
|
29
29
|
errors_module.error_class(code).new(context, message)
|
30
30
|
end
|
31
31
|
|
32
|
-
def empty_body?(
|
33
|
-
|
32
|
+
def empty_body?(http_resp)
|
33
|
+
http_resp.body_contents.empty?
|
34
34
|
end
|
35
35
|
|
36
|
-
def error_code_for_empty_response(
|
37
|
-
|
36
|
+
def error_code_for_empty_response(http_resp)
|
37
|
+
status_code = http_resp.status_code
|
38
38
|
{
|
39
39
|
302 => 'MovedTemporarily',
|
40
40
|
304 => 'NotModified',
|
41
41
|
400 => 'BadRequest',
|
42
42
|
403 => 'Forbidden',
|
43
43
|
404 => 'NotFound',
|
44
|
-
}[
|
44
|
+
}[status_code] || "#{status_code}Error"
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
@@ -3,9 +3,10 @@ module Aws
|
|
3
3
|
class ErrorParser
|
4
4
|
|
5
5
|
def extract_error(response)
|
6
|
-
|
6
|
+
context = response.context
|
7
|
+
json = MultiJson.load(context.http_response.body_contents)
|
7
8
|
error_code = json['code'] || json['__type']
|
8
|
-
error_code ||=
|
9
|
+
error_code ||= context.http_response.headers['x-amzn-errortype']
|
9
10
|
error_code = error_code.split('#').last
|
10
11
|
if error_code == 'RequestEntityTooLarge'
|
11
12
|
error_message = 'Request body must be less than 1 MB'
|
@@ -96,7 +96,8 @@ module Aws
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def error_for(response)
|
99
|
-
|
99
|
+
status_code = response.context.http_response.status_code
|
100
|
+
ErrorInspector.new(response.error, status_code)
|
100
101
|
end
|
101
102
|
|
102
103
|
def retry_request(context, error)
|
@@ -8,20 +8,20 @@ module Aws
|
|
8
8
|
|
9
9
|
def call(context)
|
10
10
|
@handler.call(context).on(200) do |response|
|
11
|
-
if error = check_for_error(
|
12
|
-
|
11
|
+
if error = check_for_error(context)
|
12
|
+
context.http_response.status_code = 500
|
13
13
|
response.data = nil
|
14
14
|
response.error = error
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def check_for_error(
|
20
|
-
xml = MultiXml.parse(
|
19
|
+
def check_for_error(context)
|
20
|
+
xml = MultiXml.parse(context.http_response.body_contents)
|
21
21
|
if xml['Error']
|
22
22
|
error_code = xml['Error']['Code']
|
23
23
|
error_message = xml['Error']['Message']
|
24
|
-
S3::Errors.error_class(error_code).new(
|
24
|
+
S3::Errors.error_class(error_code).new(context, error_message)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -6,7 +6,7 @@ module Aws
|
|
6
6
|
|
7
7
|
def call(context)
|
8
8
|
@handler.call(context).on(200) do |response|
|
9
|
-
xml = MultiXml.parse(
|
9
|
+
xml = MultiXml.parse(context.http_response.body_contents)
|
10
10
|
if xml.key?('LocationConstraint')
|
11
11
|
constraint = xml['LocationConstraint']
|
12
12
|
response.data[:location_constraint] =
|
@@ -13,8 +13,8 @@ module Aws
|
|
13
13
|
|
14
14
|
def call(context)
|
15
15
|
response = @handler.call(context)
|
16
|
-
if
|
17
|
-
endpoint =
|
16
|
+
if context.http_response.status_code == 307
|
17
|
+
endpoint = context.http_response.headers['location']
|
18
18
|
endpoint = Seahorse::Client::Http::Endpoint.new(endpoint)
|
19
19
|
context.http_request.endpoint = endpoint
|
20
20
|
context.http_response.body.truncate(0)
|
data/lib/aws/version.rb
CHANGED
data/lib/aws/xml/error_parser.rb
CHANGED
@@ -3,7 +3,7 @@ module Aws
|
|
3
3
|
class ErrorParser
|
4
4
|
|
5
5
|
def extract_error(response)
|
6
|
-
error = MultiXml.parse(response.http_response.body_contents)
|
6
|
+
error = MultiXml.parse(response.context.http_response.body_contents)
|
7
7
|
%w(Response ErrorResponse Errors Error).each do |wrapper|
|
8
8
|
error = error[wrapper] if error[wrapper]
|
9
9
|
end
|
data/spec/aws/operations_spec.rb
CHANGED
@@ -19,7 +19,7 @@ module Aws
|
|
19
19
|
|
20
20
|
it 'moves the queue url param to the http request endpoint' do
|
21
21
|
resp = send_request
|
22
|
-
expect(resp.http_request.endpoint).to eq('http://foo.com/')
|
22
|
+
expect(resp.context.http_request.endpoint).to eq('http://foo.com/')
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'resets the configured region based on the queue url' do
|
@@ -8,9 +8,9 @@ params:
|
|
8
8
|
:change_batch:
|
9
9
|
:changes: []
|
10
10
|
request:
|
11
|
-
path: '/
|
11
|
+
path: '/2013-04-01/hostedzone/ZONE-ID/rrset/'
|
12
12
|
body: |
|
13
|
-
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/
|
13
|
+
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
|
14
14
|
<ChangeBatch>
|
15
15
|
<Changes>
|
16
16
|
</Changes>
|
@@ -16,7 +16,7 @@ module Seahorse
|
|
16
16
|
def handle_response(*args, &block)
|
17
17
|
handler(*args) do |context|
|
18
18
|
resp = @handler.call(context)
|
19
|
-
block.call(resp) if resp.http_response.status_code > 0
|
19
|
+
block.call(resp) if resp.context.http_response.status_code > 0
|
20
20
|
resp
|
21
21
|
end
|
22
22
|
end
|
@@ -155,11 +155,11 @@ module Seahorse
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def _http_request_headers(response)
|
158
|
-
response.http_request.headers.inspect
|
158
|
+
response.context.http_request.headers.inspect
|
159
159
|
end
|
160
160
|
|
161
161
|
def _http_request_body(response)
|
162
|
-
summarize_value(response.http_request.body_contents)
|
162
|
+
summarize_value(response.context.http_request.body_contents)
|
163
163
|
end
|
164
164
|
|
165
165
|
def _http_response_status_code(response)
|
@@ -20,7 +20,7 @@ module Seahorse
|
|
20
20
|
def call(context)
|
21
21
|
context.http_request.body = MultiJson.dump(context.params)
|
22
22
|
@handler.call(context).on(200..299) do |resp|
|
23
|
-
resp.data = MultiJson.load(
|
23
|
+
resp.data = MultiJson.load(context.http_response.body_contents)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -78,13 +78,13 @@ module Seahorse
|
|
78
78
|
|
79
79
|
def extract_status_code(response)
|
80
80
|
if member = response.context.operation.output.status_code_member
|
81
|
-
status_code = response.http_response.status_code
|
81
|
+
status_code = response.context.http_response.status_code
|
82
82
|
response.data[member.member_name] = status_code
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
def extract_headers(response)
|
87
|
-
headers = response.http_response.headers
|
87
|
+
headers = response.context.http_response.headers
|
88
88
|
rules = response.context.operation.output.header_members
|
89
89
|
rules.each do |member_name, member|
|
90
90
|
response.data[member_name] = header_value(member, headers)
|
@@ -125,7 +125,7 @@ module Seahorse
|
|
125
125
|
def extract_body(response)
|
126
126
|
output = response.context.operation.output
|
127
127
|
if output.raw_payload?
|
128
|
-
response.data[output.payload] = response.http_response.body
|
128
|
+
response.data[output.payload] = response.context.http_response.body
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
@@ -19,12 +19,6 @@ module Seahorse
|
|
19
19
|
# @return [RequestContext]
|
20
20
|
attr_reader :context
|
21
21
|
|
22
|
-
# @return [Http::Request]
|
23
|
-
attr_reader :http_request
|
24
|
-
|
25
|
-
# @return [Http::Response]
|
26
|
-
attr_reader :http_response
|
27
|
-
|
28
22
|
# @return The response data. This may be `nil` if the response contains
|
29
23
|
# an {#error}.
|
30
24
|
attr_accessor :data
|
@@ -101,7 +101,7 @@ module Seahorse
|
|
101
101
|
it 'is called when the response is signaled complete' do
|
102
102
|
called = false
|
103
103
|
handler = obj.handle_response { |response| called = true }
|
104
|
-
handler.new(->(_) { Response.new.tap {|r| r.http_response.status_code = 200 } }).call(nil)
|
104
|
+
handler.new(->(_) { Response.new.tap {|r| r.context.http_response.status_code = 200 } }).call(nil)
|
105
105
|
expect(called).to be(true)
|
106
106
|
end
|
107
107
|
|
@@ -210,17 +210,19 @@ module Seahorse
|
|
210
210
|
|
211
211
|
it 'populates the status code' do
|
212
212
|
stub_request(:any, endpoint).to_return(status: 200)
|
213
|
-
|
213
|
+
resp = make_request
|
214
|
+
expect(resp.context.http_response.status_code).to eq(200)
|
214
215
|
end
|
215
216
|
|
216
217
|
it 'populates the headers' do
|
217
218
|
stub_request(:any, endpoint).to_return(headers: { foo: 'bar' })
|
218
|
-
|
219
|
+
resp = make_request
|
220
|
+
expect(resp.context.http_response.headers['foo']).to eq('bar')
|
219
221
|
end
|
220
222
|
|
221
223
|
it 'populates the response body' do
|
222
224
|
stub_request(:any, endpoint).to_return(body: 'response-body')
|
223
|
-
resp_body = make_request.http_response.body
|
225
|
+
resp_body = make_request.context.http_response.body
|
224
226
|
resp_body.rewind
|
225
227
|
expect(resp_body.read).to eq('response-body')
|
226
228
|
end
|
@@ -135,12 +135,12 @@ module Seahorse
|
|
135
135
|
|
136
136
|
it 'counts the bytes yielded' do
|
137
137
|
resp = request.send_request { |chunk| }
|
138
|
-
expect(resp.http_response.body.size).to eq(15)
|
138
|
+
expect(resp.context.http_response.body.size).to eq(15)
|
139
139
|
end
|
140
140
|
|
141
141
|
it 'does not buffer the response chunks' do
|
142
142
|
response = request.send_request { |chunk| }
|
143
|
-
body = response.http_response.body
|
143
|
+
body = response.context.http_response.body
|
144
144
|
expect(body.read).to eq('')
|
145
145
|
expect(body).not_to respond_to(:truncate)
|
146
146
|
end
|
@@ -57,28 +57,6 @@ module Seahorse
|
|
57
57
|
|
58
58
|
end
|
59
59
|
|
60
|
-
describe '#http_request' do
|
61
|
-
|
62
|
-
it 'returns the context #http_request' do
|
63
|
-
http_request = Http::Request.new
|
64
|
-
context = RequestContext.new(http_request: http_request)
|
65
|
-
resp = Response.new(context: context)
|
66
|
-
expect(resp.http_request).to be(http_request)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
describe '#http_response' do
|
72
|
-
|
73
|
-
it 'returns the context #http_response' do
|
74
|
-
http_response = Http::Response.new
|
75
|
-
context = RequestContext.new(http_response: http_response)
|
76
|
-
resp = Response.new(context: context)
|
77
|
-
expect(resp.http_response).to be(http_response)
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
60
|
describe 'callbacks' do
|
83
61
|
|
84
62
|
let(:http_resp) { Http::Response.new }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- apis/RDS-2013-09-09.json
|
114
114
|
- apis/Redshift-2012-12-01.json
|
115
115
|
- apis/Route53-2012-12-12.json
|
116
|
+
- apis/Route53-2013-04-01.json
|
116
117
|
- apis/S3-2006-03-01.json
|
117
118
|
- apis/SDB-2009-04-15.json
|
118
119
|
- apis/SES-2010-12-01.json
|
@@ -199,6 +200,8 @@ files:
|
|
199
200
|
- apis/source/redshift-2012-12-01.waiters.json
|
200
201
|
- apis/source/route53-2012-12-12.json
|
201
202
|
- apis/source/route53-2012-12-12.paginators.json
|
203
|
+
- apis/source/route53-2013-04-01.json
|
204
|
+
- apis/source/route53-2013-04-01.paginators.json
|
202
205
|
- apis/source/s3-2006-03-01.json
|
203
206
|
- apis/source/s3-2006-03-01.paginators.json
|
204
207
|
- apis/source/s3-2006-03-01.waiters.json
|