aws-sdk 1.13.0 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +3 -3
- data/lib/aws/api_config/OpsWorks-2013-02-18.yml +55 -0
- data/lib/aws/api_config/SNS-2010-03-31.yml +0 -3
- data/lib/aws/api_config/SimpleWorkflow-2012-01-25.yml +30 -0
- data/lib/aws/auto_scaling/client.rb +0 -530
- data/lib/aws/cloud_formation/client.rb +0 -356
- data/lib/aws/cloud_front/client.rb +0 -1567
- data/lib/aws/cloud_search/client.rb +0 -578
- data/lib/aws/cloud_watch/client.rb +0 -445
- data/lib/aws/data_pipeline/client.rb +0 -396
- data/lib/aws/direct_connect/client.rb +0 -248
- data/lib/aws/dynamo_db.rb +0 -1
- data/lib/aws/dynamo_db/client.rb +70 -1
- data/lib/aws/dynamo_db/client_v2.rb +1 -1
- data/lib/aws/ec2/client.rb +0 -3942
- data/lib/aws/ec2/reserved_instances_offering_collection.rb +9 -3
- data/lib/aws/ec2/tag_collection.rb +1 -1
- data/lib/aws/elastic_beanstalk/client.rb +0 -898
- data/lib/aws/elastic_transcoder/client.rb +0 -1755
- data/lib/aws/elasticache/client.rb +0 -947
- data/lib/aws/elb/client.rb +0 -509
- data/lib/aws/emr/client.rb +0 -314
- data/lib/aws/glacier/client.rb +0 -278
- data/lib/aws/iam/client.rb +0 -1155
- data/lib/aws/import_export/client.rb +0 -96
- data/lib/aws/ops_works/client.rb +0 -1255
- data/lib/aws/rds/client.rb +0 -2367
- data/lib/aws/redshift/client.rb +0 -1458
- data/lib/aws/route_53/client.rb +0 -420
- data/lib/aws/simple_db/client.rb +2 -250
- data/lib/aws/simple_email_service/client.rb +0 -282
- data/lib/aws/simple_workflow/client.rb +0 -1248
- data/lib/aws/sns/client.rb +0 -283
- data/lib/aws/sns/message.rb +1 -1
- data/lib/aws/sqs/client.rb +0 -255
- data/lib/aws/storage_gateway/client.rb +0 -582
- data/lib/aws/sts/client.rb +0 -183
- data/lib/aws/support/client.rb +0 -232
- data/lib/aws/version.rb +1 -1
- metadata +2 -3
- data/lib/aws/dynamo_db/client_base.rb +0 -92
@@ -1,92 +0,0 @@
|
|
1
|
-
# Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
-
# may not use this file except in compliance with the License. A copy of
|
5
|
-
# the License is located at
|
6
|
-
#
|
7
|
-
# http://aws.amazon.com/apache2.0/
|
8
|
-
#
|
9
|
-
# or in the "license" file accompanying this file. This file is
|
10
|
-
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
-
# ANY KIND, either express or implied. See the License for the specific
|
12
|
-
# language governing permissions and limitations under the License.
|
13
|
-
|
14
|
-
require 'zlib'
|
15
|
-
|
16
|
-
module AWS
|
17
|
-
class DynamoDB
|
18
|
-
|
19
|
-
# Client class for Amazon DynamoDB.
|
20
|
-
# @api private
|
21
|
-
class ClientBase < Core::JSONClient
|
22
|
-
|
23
|
-
# @private
|
24
|
-
REGION_US_E1 = 'dynamodb.us-east-1.amazonaws.com'
|
25
|
-
|
26
|
-
# @private
|
27
|
-
CACHEABLE_REQUESTS = Set[:list_tables, :describe_table]
|
28
|
-
|
29
|
-
protected
|
30
|
-
|
31
|
-
def extract_error_details response
|
32
|
-
if response.http_response.status == 413
|
33
|
-
['RequestEntityTooLarge', 'Request entity too large']
|
34
|
-
elsif crc32_is_valid?(response) == false
|
35
|
-
['CRC32CheckFailed', 'CRC32 integrity check failed']
|
36
|
-
else
|
37
|
-
super
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def retryable_error? response
|
42
|
-
case response.error
|
43
|
-
when Errors::ProvisionedThroughputExceededException
|
44
|
-
config.dynamo_db_retry_throughput_errors?
|
45
|
-
when Errors::CRC32CheckFailed
|
46
|
-
true
|
47
|
-
else
|
48
|
-
super
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def sleep_durations response
|
53
|
-
|
54
|
-
retry_count =
|
55
|
-
if expired_credentials?(response)
|
56
|
-
config.max_retries == 0 ? 0 : 1
|
57
|
-
else
|
58
|
-
config.max_retries { 10 }
|
59
|
-
end
|
60
|
-
|
61
|
-
# given a retry_count of 10, the sleep durations will look like:
|
62
|
-
# 0, 50, 100, 200, 400, 800, 1600, 3200, 6400, 12800 (milliseconds)
|
63
|
-
(0...retry_count).map do |n|
|
64
|
-
if n == 0
|
65
|
-
0
|
66
|
-
else
|
67
|
-
50 * (2 ** (n - 1)) / 1000.0
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
|
75
|
-
# @return [Boolean] whether the CRC32 response header matches the body.
|
76
|
-
# @return [nil] if no CRC32 header is present or we are not verifying CRC32
|
77
|
-
def crc32_is_valid? response
|
78
|
-
return nil unless config.dynamo_db_crc32
|
79
|
-
if crcs = response.http_response.headers['x-amz-crc32']
|
80
|
-
crcs[0].to_i == calculate_crc32(response)
|
81
|
-
else
|
82
|
-
nil
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def calculate_crc32 response
|
87
|
-
Zlib.crc32(response.http_response.body)
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|