aws-sdk-core 2.0.0.rc8 → 2.0.0.rc9
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.
- checksums.yaml +4 -4
- data/apis/DynamoDB-2012-08-10.json +1 -0
- data/apis/EC2-2014-05-01.json +15232 -0
- data/apis/ElasticBeanstalk-2010-12-01.json +17 -0
- data/apis/OpsWorks-2013-02-18.json +215 -0
- data/apis/Redshift-2012-12-01.json +72 -0
- data/apis/S3-2006-03-01.json +271 -15
- data/apis/SNS-2010-03-31.json +27 -0
- data/apis/source/ec2-2014-05-01.json +20662 -0
- data/apis/source/ec2-2014-05-01.paginators.json +112 -0
- data/apis/source/ec2-2014-05-01.waiters.json +146 -0
- data/apis/source/elasticbeanstalk-2010-12-01.json +26 -0
- data/apis/source/opsworks-2013-02-18.json +383 -8
- data/apis/source/redshift-2012-12-01.json +187 -60
- data/apis/source/s3-2006-03-01.json +372 -21
- data/apis/source/sns-2010-03-31.json +83 -36
- data/features/s3/objects.feature +10 -0
- data/features/s3/step_definitions.rb +33 -1
- data/features/step_definitions.rb +2 -1
- data/lib/aws.rb +3 -0
- data/lib/aws/api/service_translators/ec2.rb +11 -0
- data/lib/aws/api/service_translators/s3.rb +1 -0
- data/lib/aws/credential_provider_chain.rb +1 -2
- data/lib/aws/error_handler.rb +2 -1
- data/lib/aws/plugins/ec2_copy_encrypted_snapshot.rb +86 -0
- data/lib/aws/plugins/s3_md5s.rb +11 -8
- data/lib/aws/plugins/s3_sse_cpk.rb +42 -0
- data/lib/aws/query/builder.rb +4 -0
- data/lib/aws/query/param.rb +1 -1
- data/lib/aws/signers/base.rb +2 -0
- data/lib/aws/signers/s3.rb +0 -1
- data/lib/aws/signers/v4.rb +73 -22
- data/lib/aws/version.rb +1 -1
- data/spec/aws/operations_spec.rb +19 -15
- data/spec/aws/plugins/s3_md5s_spec.rb +84 -0
- data/spec/aws/query/builder_spec.rb +40 -0
- data/spec/aws/query/param_spec.rb +5 -0
- data/spec/aws/s3_spec.rb +27 -0
- data/spec/aws/signers/v4_spec.rb +1 -1
- data/spec/fixtures/operations/s3/412_response_head.yml +10 -0
- data/spec/spec_helper.rb +7 -0
- data/vendor/seahorse/lib/seahorse/client/handler_list.rb +3 -2
- data/vendor/seahorse/lib/seahorse/client/http/headers.rb +4 -0
- data/vendor/seahorse/lib/seahorse/client/net_http/handler.rb +1 -0
- data/vendor/seahorse/lib/seahorse/client/plugins/operation_methods.rb +4 -2
- data/vendor/seahorse/spec/seahorse/client/handler_list_spec.rb +2 -13
- metadata +15 -2
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Plugins
|
5
|
+
describe S3Md5s do
|
6
|
+
|
7
|
+
let(:plugin) { S3Md5s.new }
|
8
|
+
|
9
|
+
let(:config) { Seahorse::Client::Configuration.new }
|
10
|
+
|
11
|
+
let(:handlers) { Seahorse::Client::HandlerList.new }
|
12
|
+
|
13
|
+
it 'adds a :compute_checksums option that defaults to true' do
|
14
|
+
S3Md5s.new.add_options(config)
|
15
|
+
expect(config.build!.compute_checksums).to be(true)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'adds a handler when compute_checkums is true' do
|
19
|
+
plugin.add_options(config)
|
20
|
+
plugin.add_handlers(handlers, config.build!)
|
21
|
+
expect(handlers.count).to eq(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'adds a handler when compute_checkums is true' do
|
25
|
+
plugin.add_options(config)
|
26
|
+
plugin.add_handlers(handlers, config.build!)
|
27
|
+
expect(handlers.count).to eq(1)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'adds a limited handler when compute_checkums is false' do
|
31
|
+
plugin.add_options(config)
|
32
|
+
plugin.add_handlers(handlers, config.build!(compute_checksums:false))
|
33
|
+
expect(handlers.count).to eq(0)
|
34
|
+
S3Md5s::REQUIRED_OPERATIONS.each do |operation|
|
35
|
+
expect(handlers.for(operation).count).to eq(1)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'handler' do
|
40
|
+
|
41
|
+
let(:context) { Seahorse::Client::RequestContext.new }
|
42
|
+
|
43
|
+
before(:each) do
|
44
|
+
plugin.add_options(config)
|
45
|
+
plugin.add_handlers(handlers, config.build!)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'computes the Content-MD5 header from the body' do
|
49
|
+
context.http_request.body = 'abc'
|
50
|
+
handlers.add(NoSendHandler, step: :send)
|
51
|
+
handlers.to_stack.call(context)
|
52
|
+
expect(context.http_request.headers['Content-Md5']).to(
|
53
|
+
eq('kAFQmDzST7DWlj99KOF/cg==')
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'computes the md5 in 1MB chunks for IO objects' do
|
58
|
+
chunk = '.' * 1024 * 1024
|
59
|
+
body = double('io-object', size: 5 * 1024 * 1024)
|
60
|
+
expect(body).to receive(:read).
|
61
|
+
with(1024 * 1024).
|
62
|
+
exactly(6).times.
|
63
|
+
and_return(chunk, chunk, chunk, chunk, chunk, nil)
|
64
|
+
expect(body).to receive(:rewind)
|
65
|
+
|
66
|
+
context.http_request.body = body
|
67
|
+
handlers.add(NoSendHandler, step: :send)
|
68
|
+
handlers.to_stack.call(context)
|
69
|
+
expect(context.http_request.headers['Content-Md5']).to(
|
70
|
+
eq("+kDD2/74SZx+Rz+/Dw7I1Q==")
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'skips the md5 when the body is empty' do
|
75
|
+
context.http_request.body = ''
|
76
|
+
handlers.add(NoSendHandler, step: :send)
|
77
|
+
handlers.to_stack.call(context)
|
78
|
+
expect(context.http_request.headers['Content-Md5']).to be(nil)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -132,6 +132,26 @@ module Aws
|
|
132
132
|
])
|
133
133
|
end
|
134
134
|
|
135
|
+
it 'serializes empty lists' do
|
136
|
+
rules['members'] = {
|
137
|
+
'config' => {
|
138
|
+
'type' => 'structure',
|
139
|
+
'members' => {
|
140
|
+
'items' => {
|
141
|
+
'type' => 'flat_list',
|
142
|
+
'members' => {
|
143
|
+
'type' => 'string'
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
params = { config: { items: [] }}
|
150
|
+
expect(query_params(params)).to eq([
|
151
|
+
['config.items', ''],
|
152
|
+
])
|
153
|
+
end
|
154
|
+
|
135
155
|
end
|
136
156
|
|
137
157
|
describe 'non-flattened lists' do
|
@@ -192,6 +212,26 @@ module Aws
|
|
192
212
|
])
|
193
213
|
end
|
194
214
|
|
215
|
+
it 'serializes empty lists' do
|
216
|
+
rules['members'] = {
|
217
|
+
'config' => {
|
218
|
+
'type' => 'structure',
|
219
|
+
'members' => {
|
220
|
+
'items' => {
|
221
|
+
'type' => 'list',
|
222
|
+
'members' => {
|
223
|
+
'type' => 'string'
|
224
|
+
}
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
229
|
+
params = { config: { items: [] }}
|
230
|
+
expect(query_params(params)).to eq([
|
231
|
+
['config.items', ''],
|
232
|
+
])
|
233
|
+
end
|
234
|
+
|
195
235
|
end
|
196
236
|
|
197
237
|
describe 'flattened maps' do
|
data/spec/aws/s3_spec.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
module Aws
|
5
|
+
describe S3 do
|
6
|
+
|
7
|
+
let(:s3) {
|
8
|
+
Aws::S3.new(
|
9
|
+
credentials: Credentials.new('akid', 'secret'),
|
10
|
+
region: 'us-east-1',
|
11
|
+
retry_limit: 0,
|
12
|
+
)
|
13
|
+
}
|
14
|
+
|
15
|
+
it 'creates an error class from empty body responses' do
|
16
|
+
s3.handle(step: :send) do |context|
|
17
|
+
context.http_response.status_code = 500
|
18
|
+
context.http_response.body = StringIO.new('')
|
19
|
+
Seahorse::Client::Response.new(context: context)
|
20
|
+
end
|
21
|
+
expect {
|
22
|
+
s3.head_bucket(bucket:'aws-sdk')
|
23
|
+
}.to raise_error(S3::Errors::Http500Error)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/spec/aws/signers/v4_spec.rb
CHANGED
@@ -9,7 +9,7 @@ module Aws
|
|
9
9
|
let(:service_name) { 'SERVICE' }
|
10
10
|
let(:region) { 'REGION' }
|
11
11
|
let(:endpoint) { URI.parse('https://domain.com') }
|
12
|
-
let(:signer) { V4.new(
|
12
|
+
let(:signer) { V4.new(service_name, credentials, region) }
|
13
13
|
let(:sign) { signer.sign(http_request) }
|
14
14
|
let(:http_request) do
|
15
15
|
req = Seahorse::Client::Http::Request.new(endpoint: endpoint)
|
data/spec/spec_helper.rb
CHANGED
@@ -21,6 +21,13 @@ def dummy_credentials
|
|
21
21
|
@dummy_credentials ||= Aws::Credentials.new('akid', 'secret')
|
22
22
|
end
|
23
23
|
|
24
|
+
# Simply returns the request context without any http response info.
|
25
|
+
class NoSendHandler < Seahorse::Client::Handler
|
26
|
+
def call(context)
|
27
|
+
Seahorse::Client::Response.new(context: context)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
24
31
|
# A helper :send_handler that does not send the request, it simply
|
25
32
|
# returns an empty response.
|
26
33
|
class DummySendHandler < Seahorse::Client::Handler
|
@@ -7,8 +7,8 @@ module Seahorse
|
|
7
7
|
|
8
8
|
class InvalidStepError < ArgumentError
|
9
9
|
def initialize(step)
|
10
|
-
msg = "invalid :step `%s', must be one of :
|
11
|
-
msg << ":sign or :send"
|
10
|
+
msg = "invalid :step `%s', must be one of :initialize, :validate, "
|
11
|
+
msg << ":build, :sign or :send"
|
12
12
|
super(msg % step.inspect)
|
13
13
|
end
|
14
14
|
end
|
@@ -246,6 +246,7 @@ module Seahorse
|
|
246
246
|
if handler.is_a?(Class)
|
247
247
|
handler = handler.new(stack)
|
248
248
|
else
|
249
|
+
handler = handler.dup
|
249
250
|
handler.handler = stack
|
250
251
|
handler
|
251
252
|
end
|
@@ -28,13 +28,14 @@ module Seahorse
|
|
28
28
|
def after_initialize(client)
|
29
29
|
unless client.respond_to?(:operation_names)
|
30
30
|
client.class.mutex.synchronize do
|
31
|
-
|
31
|
+
unless client.respond_to?(:operation_names)
|
32
|
+
add_operation_helpers(client, client.config.api.operations.keys)
|
33
|
+
end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
36
38
|
def add_operation_helpers(client, operations)
|
37
|
-
client.class.send(:define_method, :operation_names) { operations }
|
38
39
|
operations.each do |name|
|
39
40
|
client.class.send(:define_method, name) do |*args, &block|
|
40
41
|
params = args[0] || {}
|
@@ -42,6 +43,7 @@ module Seahorse
|
|
42
43
|
build_request(name, params).send_request(send_options, &block)
|
43
44
|
end
|
44
45
|
end
|
46
|
+
client.class.send(:define_method, :operation_names) { operations }
|
45
47
|
end
|
46
48
|
|
47
49
|
end
|
@@ -86,8 +86,8 @@ module Seahorse
|
|
86
86
|
describe 'errors' do
|
87
87
|
|
88
88
|
it 'raises an error if :step is not valid' do
|
89
|
-
msg = "invalid :step `:bogus', must be one of :
|
90
|
-
msg << ":sign or :send"
|
89
|
+
msg = "invalid :step `:bogus', must be one of :initialize, "
|
90
|
+
msg << ":validate, :build, :sign or :send"
|
91
91
|
expect {
|
92
92
|
handlers.add('handler', step: :bogus)
|
93
93
|
}.to raise_error(ArgumentError, msg)
|
@@ -226,18 +226,7 @@ module Seahorse
|
|
226
226
|
expect(handlers.to_stack).to eq(3)
|
227
227
|
end
|
228
228
|
|
229
|
-
it 'does not construct handlers that are not classes' do
|
230
|
-
handler1 = double('handler1')
|
231
|
-
handler2 = double('handler2')
|
232
|
-
expect(handler2).to receive(:handler=).with(nil)
|
233
|
-
expect(handler1).to receive(:handler=).with(handler2)
|
234
|
-
handlers.add(handler1)
|
235
|
-
handlers.add(handler2)
|
236
|
-
handlers.to_stack
|
237
|
-
end
|
238
|
-
|
239
229
|
end
|
240
|
-
|
241
230
|
end
|
242
231
|
end
|
243
232
|
end
|
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.rc9
|
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-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- apis/EC2-2013-10-01.json
|
102
102
|
- apis/EC2-2013-10-15.json
|
103
103
|
- apis/EC2-2014-02-01.json
|
104
|
+
- apis/EC2-2014-05-01.json
|
104
105
|
- apis/EMR-2009-03-31.json
|
105
106
|
- apis/ElastiCache-2012-11-15.json
|
106
107
|
- apis/ElastiCache-2013-06-15.json
|
@@ -178,6 +179,9 @@ files:
|
|
178
179
|
- apis/source/ec2-2014-02-01.json
|
179
180
|
- apis/source/ec2-2014-02-01.paginators.json
|
180
181
|
- apis/source/ec2-2014-02-01.waiters.json
|
182
|
+
- apis/source/ec2-2014-05-01.json
|
183
|
+
- apis/source/ec2-2014-05-01.paginators.json
|
184
|
+
- apis/source/ec2-2014-05-01.waiters.json
|
181
185
|
- apis/source/elasticache-2012-11-15.json
|
182
186
|
- apis/source/elasticache-2012-11-15.paginators.json
|
183
187
|
- apis/source/elasticache-2013-06-15.json
|
@@ -334,6 +338,7 @@ files:
|
|
334
338
|
- lib/aws/api/service_namer.rb
|
335
339
|
- lib/aws/api/service_translators/cloud_front.rb
|
336
340
|
- lib/aws/api/service_translators/dynamo_db.rb
|
341
|
+
- lib/aws/api/service_translators/ec2.rb
|
337
342
|
- lib/aws/api/service_translators/glacier.rb
|
338
343
|
- lib/aws/api/service_translators/import_export.rb
|
339
344
|
- lib/aws/api/service_translators/route53.rb
|
@@ -355,6 +360,7 @@ files:
|
|
355
360
|
- lib/aws/pageable_response.rb
|
356
361
|
- lib/aws/plugins/credentials.rb
|
357
362
|
- lib/aws/plugins/dynamodb_extended_retries.rb
|
363
|
+
- lib/aws/plugins/ec2_copy_encrypted_snapshot.rb
|
358
364
|
- lib/aws/plugins/glacier_account_id.rb
|
359
365
|
- lib/aws/plugins/glacier_api_version.rb
|
360
366
|
- lib/aws/plugins/glacier_checksums.rb
|
@@ -373,6 +379,7 @@ files:
|
|
373
379
|
- lib/aws/plugins/s3_redirects.rb
|
374
380
|
- lib/aws/plugins/s3_regional_endpoint.rb
|
375
381
|
- lib/aws/plugins/s3_signer.rb
|
382
|
+
- lib/aws/plugins/s3_sse_cpk.rb
|
376
383
|
- lib/aws/plugins/signature_v2.rb
|
377
384
|
- lib/aws/plugins/signature_v3.rb
|
378
385
|
- lib/aws/plugins/signature_v4.rb
|
@@ -416,11 +423,13 @@ files:
|
|
416
423
|
- spec/aws/plugins/region_endpoint_spec.rb
|
417
424
|
- spec/aws/plugins/retry_errors_spec.rb
|
418
425
|
- spec/aws/plugins/s3_location_constraint_spec.rb
|
426
|
+
- spec/aws/plugins/s3_md5s_spec.rb
|
419
427
|
- spec/aws/plugins/signature_v4_spec.rb
|
420
428
|
- spec/aws/plugins/sqs_queue_urls_spec.rb
|
421
429
|
- spec/aws/query/builder_spec.rb
|
422
430
|
- spec/aws/query/param_list_spec.rb
|
423
431
|
- spec/aws/query/param_spec.rb
|
432
|
+
- spec/aws/s3_spec.rb
|
424
433
|
- spec/aws/service_spec.rb
|
425
434
|
- spec/aws/shared_credentials_spec.rb
|
426
435
|
- spec/aws/signers/v4_spec.rb
|
@@ -446,6 +455,7 @@ files:
|
|
446
455
|
- spec/fixtures/operations/s3/400_response.yml
|
447
456
|
- spec/fixtures/operations/s3/403_response.yml
|
448
457
|
- spec/fixtures/operations/s3/404_response.yml
|
458
|
+
- spec/fixtures/operations/s3/412_response_head.yml
|
449
459
|
- spec/fixtures/operations/s3/comlete_multipart_upload_error.yml
|
450
460
|
- spec/fixtures/operations/s3/content_type_header.yml
|
451
461
|
- spec/fixtures/operations/s3/create_bucket_with_implied_location_constraint.yml
|
@@ -675,11 +685,13 @@ test_files:
|
|
675
685
|
- spec/aws/plugins/region_endpoint_spec.rb
|
676
686
|
- spec/aws/plugins/retry_errors_spec.rb
|
677
687
|
- spec/aws/plugins/s3_location_constraint_spec.rb
|
688
|
+
- spec/aws/plugins/s3_md5s_spec.rb
|
678
689
|
- spec/aws/plugins/signature_v4_spec.rb
|
679
690
|
- spec/aws/plugins/sqs_queue_urls_spec.rb
|
680
691
|
- spec/aws/query/builder_spec.rb
|
681
692
|
- spec/aws/query/param_list_spec.rb
|
682
693
|
- spec/aws/query/param_spec.rb
|
694
|
+
- spec/aws/s3_spec.rb
|
683
695
|
- spec/aws/service_spec.rb
|
684
696
|
- spec/aws/shared_credentials_spec.rb
|
685
697
|
- spec/aws/signers/v4_spec.rb
|
@@ -705,6 +717,7 @@ test_files:
|
|
705
717
|
- spec/fixtures/operations/s3/400_response.yml
|
706
718
|
- spec/fixtures/operations/s3/403_response.yml
|
707
719
|
- spec/fixtures/operations/s3/404_response.yml
|
720
|
+
- spec/fixtures/operations/s3/412_response_head.yml
|
708
721
|
- spec/fixtures/operations/s3/comlete_multipart_upload_error.yml
|
709
722
|
- spec/fixtures/operations/s3/content_type_header.yml
|
710
723
|
- spec/fixtures/operations/s3/create_bucket_with_implied_location_constraint.yml
|