aws-sdk-core 2.0.0.rc3 → 2.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apis/AutoScaling-2011-01-01.json +83 -3
- data/apis/Glacier-2012-06-01.json +22 -0
- data/apis/Support-2013-04-15.json +0 -2
- data/apis/source/autoscaling-2011-01-01.json +203 -80
- data/apis/source/glacier-2012-06-01.json +58 -31
- data/apis/source/support-2013-04-15.json +190 -192
- data/lib/aws/error_handler.rb +3 -3
- data/lib/aws/errors.rb +5 -11
- data/lib/aws/plugins/glacier_checksums.rb +1 -1
- data/lib/aws/plugins/s3_complete_multipart_upload_fix.rb +1 -1
- data/lib/aws/signers/base.rb +1 -1
- data/lib/aws/signers/s3.rb +1 -1
- data/lib/aws/signers/v4.rb +2 -2
- data/lib/aws/tree_hash.rb +2 -2
- data/lib/aws/version.rb +1 -1
- data/spec/aws/service_spec.rb +16 -2
- metadata +2 -2
data/lib/aws/error_handler.rb
CHANGED
@@ -24,9 +24,9 @@ module Aws
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def error(context, code, message)
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
svc = context.client.class.name.split('::')[1]
|
28
|
+
errors_module = Aws.const_get(svc).const_get(:Errors)
|
29
|
+
errors_module.error_class(code).new(context, message)
|
30
30
|
end
|
31
31
|
|
32
32
|
def empty_body?(response)
|
data/lib/aws/errors.rb
CHANGED
@@ -57,24 +57,18 @@ module Aws
|
|
57
57
|
const_set(constant, Class.new(ServiceError))
|
58
58
|
end
|
59
59
|
|
60
|
-
end
|
61
|
-
|
62
|
-
class << self
|
63
|
-
|
64
60
|
# Given the name of a service and an error code, this method
|
65
61
|
# returns an error class (that extends {ServiceError}.
|
66
62
|
#
|
67
|
-
# Aws::Errors.error_class('
|
63
|
+
# Aws::S3::Errors.error_class('NoSuchBucket').new
|
68
64
|
# #=> #<Aws::S3::Errors::NoSuchBucket>
|
69
65
|
#
|
70
66
|
# @api private
|
71
|
-
def error_class(
|
72
|
-
|
73
|
-
|
74
|
-
if errors.constants.include?(constant)
|
75
|
-
errors.const_get(constant)
|
67
|
+
def error_class(contstant)
|
68
|
+
if constants.include?(contstant.to_sym)
|
69
|
+
const_get(contstant)
|
76
70
|
else
|
77
|
-
|
71
|
+
const_set(contstant, Class.new(ServiceError))
|
78
72
|
end
|
79
73
|
end
|
80
74
|
|
@@ -56,7 +56,7 @@ module Aws
|
|
56
56
|
def compute_checksums(body, &block)
|
57
57
|
|
58
58
|
tree_hash = TreeHash.new
|
59
|
-
digest = OpenSSL::Digest
|
59
|
+
digest = OpenSSL::Digest.new('sha256')
|
60
60
|
|
61
61
|
# if the body is empty/EOF, then we should compute the
|
62
62
|
# digests of the empty string
|
@@ -21,7 +21,7 @@ module Aws
|
|
21
21
|
if xml['Error']
|
22
22
|
error_code = xml['Error']['Code']
|
23
23
|
error_message = xml['Error']['Message']
|
24
|
-
Errors.error_class(
|
24
|
+
S3::Errors.error_class(error_code).new(response.context, error_message)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
data/lib/aws/signers/base.rb
CHANGED
data/lib/aws/signers/s3.rb
CHANGED
data/lib/aws/signers/v4.rb
CHANGED
@@ -119,11 +119,11 @@ module Aws
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def hmac(key, value)
|
122
|
-
OpenSSL::HMAC.digest(OpenSSL::Digest
|
122
|
+
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key, value)
|
123
123
|
end
|
124
124
|
|
125
125
|
def hexhmac(key, value)
|
126
|
-
OpenSSL::HMAC.hexdigest(OpenSSL::Digest
|
126
|
+
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), key, value)
|
127
127
|
end
|
128
128
|
|
129
129
|
private
|
data/lib/aws/tree_hash.rb
CHANGED
@@ -31,7 +31,7 @@ module Aws
|
|
31
31
|
class TreeHash
|
32
32
|
|
33
33
|
def initialize(hashes = [])
|
34
|
-
@digest = OpenSSL::Digest
|
34
|
+
@digest = OpenSSL::Digest.new('sha256')
|
35
35
|
@hashes = hashes
|
36
36
|
end
|
37
37
|
|
@@ -49,7 +49,7 @@ module Aws
|
|
49
49
|
|
50
50
|
def digest
|
51
51
|
hashes = @hashes
|
52
|
-
digest = OpenSSL::Digest
|
52
|
+
digest = OpenSSL::Digest.new('sha256')
|
53
53
|
until hashes.count == 1
|
54
54
|
hashes = hashes.each_slice(2).map do |h1,h2|
|
55
55
|
digest.reset
|
data/lib/aws/version.rb
CHANGED
data/spec/aws/service_spec.rb
CHANGED
@@ -235,13 +235,27 @@ module Aws
|
|
235
235
|
expect(err_class.new).to be_kind_of(Errors::ServiceError)
|
236
236
|
end
|
237
237
|
|
238
|
+
end
|
239
|
+
|
240
|
+
describe 'DynamicErrors module' do
|
241
|
+
|
238
242
|
it 'allows you to create error classes named like Ruby classes' do
|
239
|
-
|
243
|
+
mod = Module.new
|
244
|
+
mod.extend(Aws::Errors::DynamicErrors)
|
245
|
+
error_class = mod.error_class('Range')
|
240
246
|
expect(error_class).not_to be(Range)
|
241
|
-
expect(error_class).to be(
|
247
|
+
expect(error_class).to be(mod::Range)
|
242
248
|
expect(error_class.ancestors).to include(Errors::ServiceError)
|
243
249
|
end
|
244
250
|
|
251
|
+
it 'always returns the same error class given the same error code' do
|
252
|
+
mod = Module.new
|
253
|
+
mod.extend(Aws::Errors::DynamicErrors)
|
254
|
+
klass2 = mod.error_class(:Range)
|
255
|
+
klass1 = mod.error_class('Range')
|
256
|
+
expect(klass1).to be(klass2)
|
257
|
+
end
|
258
|
+
|
245
259
|
end
|
246
260
|
end
|
247
261
|
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.rc4
|
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:
|
11
|
+
date: 2014-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|