aws-sdk-core 2.0.48 → 2.1.0
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/autoscaling/2011-01-01/api-2.json +636 -33
- data/apis/cloudhsm/2014-05-30/api-2.json +3 -6
- data/apis/ec2/2014-10-01/api-2.json +10267 -0
- data/apis/ec2/2014-10-01/paginators-1.json +125 -0
- data/apis/ec2/2014-10-01/resources-1.json +2289 -0
- data/apis/ec2/2014-10-01/waiters-2.json +453 -0
- data/apis/ec2/2015-03-01/api-2.json +11245 -0
- data/apis/ec2/2015-03-01/paginators-1.json +125 -0
- data/apis/ec2/2015-03-01/resources-1.json +2479 -0
- data/apis/ec2/2015-03-01/waiters-2.json +458 -0
- data/apis/ec2/2015-04-15/api-2.json +182 -2
- data/apis/ecs/2014-11-13/api-2.json +316 -7
- data/apis/ecs/2014-11-13/paginators-1.json +40 -0
- data/apis/ecs/2014-11-13/waiters-2.json +93 -0
- data/apis/redshift/2012-12-01/waiters-2.json +19 -0
- data/apis/s3/2006-03-01/api-2.json +1 -2
- data/apis/sqs/2012-11-05/api-2.json +5 -6
- data/ca-bundle.crt +3554 -0
- data/lib/aws-sdk-core.rb +127 -44
- data/lib/aws-sdk-core/api/builder.rb +95 -0
- data/lib/aws-sdk-core/api/customizations.rb +152 -0
- data/lib/aws-sdk-core/api/docs/builder.rb +220 -0
- data/lib/aws-sdk-core/api/docs/client_type_documenter.rb +109 -0
- data/lib/aws-sdk-core/api/docs/docstring_provider.rb +66 -0
- data/lib/aws-sdk-core/api/docs/operation_documenter.rb +107 -0
- data/lib/aws-sdk-core/api/docs/param_formatter.rb +163 -0
- data/lib/aws-sdk-core/api/docs/request_syntax_example.rb +22 -0
- data/lib/aws-sdk-core/api/docs/response_structure_example.rb +91 -0
- data/lib/aws-sdk-core/api/docs/utils.rb +133 -0
- data/lib/aws-sdk-core/api/shape_map.rb +140 -0
- data/lib/aws-sdk-core/assume_role_credentials.rb +9 -6
- data/lib/aws-sdk-core/client.rb +9 -6
- data/lib/aws-sdk-core/client_stubs.rb +127 -133
- data/lib/aws-sdk-core/client_waiters.rb +1 -1
- data/lib/aws-sdk-core/credential_provider.rb +44 -0
- data/lib/aws-sdk-core/credential_provider_chain.rb +3 -2
- data/lib/aws-sdk-core/credentials.rb +5 -0
- data/lib/aws-sdk-core/deprecations.rb +69 -0
- data/lib/aws-sdk-core/dynamodb.rb +12 -0
- data/lib/aws-sdk-core/eager_loader.rb +31 -0
- data/lib/aws-sdk-core/ecs.rb +2 -0
- data/lib/aws-sdk-core/empty_structure.rb +1 -82
- data/lib/aws-sdk-core/endpoint_provider.rb +1 -1
- data/lib/aws-sdk-core/instance_profile_credentials.rb +9 -10
- data/lib/aws-sdk-core/json.rb +56 -0
- data/lib/aws-sdk-core/json/builder.rb +33 -34
- data/lib/aws-sdk-core/json/error_handler.rb +2 -2
- data/lib/aws-sdk-core/json/handler.rb +67 -0
- data/lib/aws-sdk-core/json/json_engine.rb +15 -0
- data/lib/aws-sdk-core/json/oj_engine.rb +15 -0
- data/lib/aws-sdk-core/json/parser.rb +30 -38
- data/lib/aws-sdk-core/pageable_response.rb +9 -12
- data/lib/aws-sdk-core/pager.rb +69 -0
- data/lib/aws-sdk-core/param_converter.rb +203 -0
- data/lib/aws-sdk-core/param_validator.rb +148 -0
- data/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb +21 -18
- data/lib/aws-sdk-core/plugins/glacier_account_id.rb +9 -1
- data/lib/aws-sdk-core/plugins/glacier_checksums.rb +2 -3
- data/lib/aws-sdk-core/plugins/param_converter.rb +27 -0
- data/lib/aws-sdk-core/plugins/param_validator.rb +28 -0
- data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +3 -7
- data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +1 -2
- data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +1 -1
- data/lib/aws-sdk-core/plugins/regional_endpoint.rb +1 -1
- data/lib/aws-sdk-core/plugins/request_signer.rb +5 -5
- data/lib/aws-sdk-core/plugins/response_paging.rb +20 -11
- data/lib/aws-sdk-core/plugins/s3_get_bucket_location_fix.rb +1 -1
- data/lib/aws-sdk-core/plugins/s3_request_signer.rb +1 -2
- data/lib/aws-sdk-core/plugins/stub_responses.rb +25 -27
- data/lib/aws-sdk-core/query/ec2_param_builder.rb +29 -34
- data/lib/aws-sdk-core/query/handler.rb +32 -18
- data/lib/aws-sdk-core/query/param_builder.rb +45 -53
- data/lib/aws-sdk-core/refreshing_credentials.rb +3 -15
- data/lib/aws-sdk-core/rest/handler.rb +22 -0
- data/lib/aws-sdk-core/rest/request/body.rb +58 -0
- data/lib/aws-sdk-core/rest/request/builder.rb +50 -0
- data/lib/aws-sdk-core/rest/request/endpoint.rb +70 -0
- data/lib/aws-sdk-core/rest/request/headers.rb +48 -0
- data/lib/aws-sdk-core/rest/response/body.rb +43 -0
- data/lib/aws-sdk-core/rest/response/headers.rb +60 -0
- data/lib/aws-sdk-core/rest/response/parser.rb +47 -0
- data/lib/aws-sdk-core/rest/response/status_code.rb +24 -0
- data/lib/aws-sdk-core/shared_credentials.rb +11 -6
- data/lib/aws-sdk-core/signers/base.rb +1 -1
- data/lib/aws-sdk-core/signers/s3.rb +2 -3
- data/lib/aws-sdk-core/signers/v2.rb +7 -4
- data/lib/aws-sdk-core/signers/v4.rb +11 -22
- data/lib/aws-sdk-core/structure.rb +26 -145
- data/lib/aws-sdk-core/stubbing/data_applicator.rb +46 -0
- data/lib/aws-sdk-core/stubbing/empty_stub.rb +53 -0
- data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +49 -0
- data/lib/aws-sdk-core/stubbing/protocols/json.rb +40 -0
- data/lib/aws-sdk-core/stubbing/protocols/query.rb +40 -0
- data/lib/aws-sdk-core/stubbing/protocols/rest.rb +67 -0
- data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +25 -0
- data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +38 -0
- data/lib/aws-sdk-core/stubbing/stub_data.rb +34 -0
- data/lib/aws-sdk-core/version.rb +1 -1
- data/lib/aws-sdk-core/xml/builder.rb +58 -52
- data/lib/aws-sdk-core/xml/default_map.rb +10 -0
- data/lib/aws-sdk-core/xml/doc_builder.rb +86 -0
- data/lib/aws-sdk-core/xml/error_handler.rb +7 -2
- data/lib/aws-sdk-core/xml/parser.rb +4 -4
- data/lib/aws-sdk-core/xml/parser/frame.rb +75 -70
- data/lib/aws-sdk-core/xml/parser/stack.rb +4 -4
- data/lib/seahorse.rb +0 -11
- data/lib/seahorse/client/base.rb +3 -12
- data/lib/seahorse/client/http/request.rb +9 -5
- data/lib/seahorse/client/plugins/endpoint.rb +5 -56
- data/lib/seahorse/client/plugins/restful_bindings.rb +38 -31
- data/lib/seahorse/client/request_context.rb +2 -2
- data/lib/seahorse/client/response.rb +6 -5
- data/lib/seahorse/model/api.rb +18 -61
- data/lib/seahorse/model/operation.rb +24 -54
- data/lib/seahorse/model/shapes.rb +120 -364
- data/lib/seahorse/util.rb +2 -6
- metadata +56 -109
- data/apis/autoscaling/2011-01-01/docs-2.json +0 -1246
- data/apis/cloudformation/2010-05-15/docs-2.json +0 -725
- data/apis/cloudfront/2014-11-06/docs-2.json +0 -1125
- data/apis/cloudhsm/2014-05-30/docs-2.json +0 -472
- data/apis/cloudsearch/2013-01-01/docs-2.json +0 -865
- data/apis/cloudsearchdomain/2013-01-01/docs-2.json +0 -311
- data/apis/cloudtrail/2013-11-01/docs-2.json +0 -328
- data/apis/codedeploy/2014-10-06/docs-2.json +0 -1261
- data/apis/cognito-identity/2014-06-30/docs-2.json +0 -506
- data/apis/cognito-sync/2014-06-30/docs-2.json +0 -582
- data/apis/config/2014-10-17/docs-2.json +0 -513
- data/apis/config/2014-11-12/docs-2.json +0 -514
- data/apis/datapipeline/2012-10-29/docs-2.json +0 -607
- data/apis/directconnect/2012-10-25/docs-2.json +0 -494
- data/apis/ds/2015-04-16/docs-2.json +0 -753
- data/apis/dynamodb/2011-12-05/api-2.json +0 -949
- data/apis/dynamodb/2011-12-05/docs-2.json +0 -606
- data/apis/dynamodb/2011-12-05/paginators-1.json +0 -26
- data/apis/dynamodb/2011-12-05/waiters-2.json +0 -35
- data/apis/dynamodb/2012-08-10/docs-2.json +0 -977
- data/apis/ec2/2015-04-15/docs-2.json +0 -5368
- data/apis/ecs/2014-11-13/docs-2.json +0 -791
- data/apis/elasticache/2015-02-02/docs-2.json +0 -1390
- data/apis/elasticbeanstalk/2010-12-01/docs-2.json +0 -1114
- data/apis/elasticfilesystem/2015-02-01/docs-2.json +0 -414
- data/apis/elasticloadbalancing/2012-06-01/docs-2.json +0 -1078
- data/apis/elasticmapreduce/2009-03-31/docs-2.json +0 -969
- data/apis/elastictranscoder/2012-09-25/docs-2.json +0 -1152
- data/apis/email/2010-12-01/docs-2.json +0 -441
- data/apis/glacier/2012-06-01/docs-2.json +0 -575
- data/apis/iam/2010-05-08/docs-2.json +0 -2138
- data/apis/importexport/2010-06-01/docs-2.json +0 -432
- data/apis/kinesis/2013-12-02/docs-2.json +0 -424
- data/apis/kms/2014-11-01/docs-2.json +0 -628
- data/apis/lambda/2014-11-11/docs-2.json +0 -303
- data/apis/lambda/2015-03-31/docs-2.json +0 -490
- data/apis/logs/2014-03-28/docs-2.json +0 -599
- data/apis/machinelearning/2014-12-12/docs-2.json +0 -1034
- data/apis/monitoring/2010-08-01/docs-2.json +0 -514
- data/apis/opsworks/2013-02-18/docs-2.json +0 -1592
- data/apis/rds/2014-10-31/docs-2.json +0 -2074
- data/apis/redshift/2012-12-01/docs-2.json +0 -1890
- data/apis/route53/2013-04-01/docs-2.json +0 -1159
- data/apis/route53domains/2014-05-15/docs-2.json +0 -620
- data/apis/s3/2006-03-01/docs-2.json +0 -2213
- data/apis/sdb/2009-04-15/docs-2.json +0 -339
- data/apis/sns/2010-03-31/docs-2.json +0 -564
- data/apis/sqs/2012-11-05/docs-2.json +0 -503
- data/apis/ssm/2014-11-06/docs-2.json +0 -440
- data/apis/storagegateway/2013-06-30/docs-2.json +0 -1331
- data/apis/sts/2011-06-15/docs-2.json +0 -351
- data/apis/support/2013-04-15/docs-2.json +0 -680
- data/apis/swf/2012-01-25/docs-2.json +0 -1569
- data/apis/workspaces/2015-04-08/docs-2.json +0 -457
- data/lib/aws-sdk-core/api/customizer.rb +0 -75
- data/lib/aws-sdk-core/api/docstrings.rb +0 -38
- data/lib/aws-sdk-core/api/documenter.rb +0 -241
- data/lib/aws-sdk-core/api/operation_documenter.rb +0 -173
- data/lib/aws-sdk-core/api/operation_example.rb +0 -133
- data/lib/aws-sdk-core/api/service_customizations.rb +0 -140
- data/lib/aws-sdk-core/client_paging.rb +0 -31
- data/lib/aws-sdk-core/json/rest_handler.rb +0 -20
- data/lib/aws-sdk-core/json/rpc_body_handler.rb +0 -38
- data/lib/aws-sdk-core/json/rpc_headers_handler.rb +0 -34
- data/lib/aws-sdk-core/json/simple_body_handler.rb +0 -34
- data/lib/aws-sdk-core/paging/null_pager.rb +0 -20
- data/lib/aws-sdk-core/paging/null_provider.rb +0 -13
- data/lib/aws-sdk-core/paging/pager.rb +0 -70
- data/lib/aws-sdk-core/paging/provider.rb +0 -22
- data/lib/aws-sdk-core/rest_body_handler.rb +0 -111
- data/lib/aws-sdk-core/signers/handler.rb +0 -18
- data/lib/aws-sdk-core/xml/rest_handler.rb +0 -20
- data/lib/seahorse/client/param_converter.rb +0 -207
- data/lib/seahorse/client/param_validator.rb +0 -139
- data/lib/seahorse/client/plugins/json_simple.rb +0 -33
- data/lib/seahorse/client/plugins/param_conversion.rb +0 -29
- data/lib/seahorse/client/plugins/param_validation.rb +0 -30
- data/lib/seahorse/client/xml/builder.rb +0 -91
- data/lib/seahorse/model/shape_map.rb +0 -47
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
module Aws
|
|
2
|
+
# @api private
|
|
3
|
+
class ParamValidator
|
|
4
|
+
|
|
5
|
+
include Seahorse::Model::Shapes
|
|
6
|
+
|
|
7
|
+
# @param [Seahorse::Model::Shapes::ShapeRef] rules
|
|
8
|
+
# @param [Hash] params
|
|
9
|
+
# @return [void]
|
|
10
|
+
def self.validate!(rules, params)
|
|
11
|
+
new(rules).validate!(params)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @param [Seahorse::Model::Shapes::ShapeRef] rules
|
|
15
|
+
# @option options [Boolean] :validate_required (true)
|
|
16
|
+
def initialize(rules, options = {})
|
|
17
|
+
@rules = rules
|
|
18
|
+
@validate_required = options[:validate_required] != false
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# @param [Hash] params
|
|
22
|
+
# @return [void]
|
|
23
|
+
def validate!(params)
|
|
24
|
+
errors = []
|
|
25
|
+
structure(@rules, params, errors, 'params') if @rules
|
|
26
|
+
raise ArgumentError, error_messages(errors) unless errors.empty?
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def structure(ref, values, errors, context)
|
|
32
|
+
# ensure the value is hash like
|
|
33
|
+
return unless correct_type?(ref, values, errors, context)
|
|
34
|
+
|
|
35
|
+
shape = ref.shape
|
|
36
|
+
|
|
37
|
+
# ensure required members are present
|
|
38
|
+
if @validate_required
|
|
39
|
+
shape.required.each do |member_name|
|
|
40
|
+
if values[member_name].nil?
|
|
41
|
+
param = "#{context}[#{member_name.inspect}]"
|
|
42
|
+
errors << "missing required parameter #{param}"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# validate non-nil members
|
|
48
|
+
values.each_pair do |name, value|
|
|
49
|
+
unless value.nil?
|
|
50
|
+
if shape.member?(name)
|
|
51
|
+
member_ref = shape.member(name)
|
|
52
|
+
shape(member_ref, value, errors, context + "[#{name.inspect}]")
|
|
53
|
+
else
|
|
54
|
+
errors << "unexpected value at #{context}[#{name.inspect}]"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def list(ref, values, errors, context)
|
|
61
|
+
# ensure the value is an array
|
|
62
|
+
unless values.is_a?(Array)
|
|
63
|
+
errors << "expected #{context} to be an array"
|
|
64
|
+
return
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# validate members
|
|
68
|
+
member_ref = ref.shape.member
|
|
69
|
+
values.each.with_index do |value, index|
|
|
70
|
+
shape(member_ref, value, errors, context + "[#{index}]")
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def map(ref, values, errors, context)
|
|
75
|
+
|
|
76
|
+
return unless correct_type?(ref, values, errors, context)
|
|
77
|
+
|
|
78
|
+
key_ref = ref.shape.key
|
|
79
|
+
value_ref = ref.shape.value
|
|
80
|
+
|
|
81
|
+
values.each do |key, value|
|
|
82
|
+
shape(key_ref, key, errors, "#{context} #{key.inspect} key")
|
|
83
|
+
shape(value_ref, value, errors, context + "[#{key.inspect}]")
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def shape(ref, value, errors, context)
|
|
88
|
+
case ref.shape
|
|
89
|
+
when StructureShape then structure(ref, value, errors, context)
|
|
90
|
+
when ListShape then list(ref, value, errors, context)
|
|
91
|
+
when MapShape then map(ref, value, errors, context)
|
|
92
|
+
when StringShape
|
|
93
|
+
unless value.is_a?(String)
|
|
94
|
+
errors << "expected #{context} to be a string"
|
|
95
|
+
end
|
|
96
|
+
when IntegerShape
|
|
97
|
+
unless value.is_a?(Integer)
|
|
98
|
+
errors << "expected #{context} to be an integer"
|
|
99
|
+
end
|
|
100
|
+
when FloatShape
|
|
101
|
+
unless value.is_a?(Float)
|
|
102
|
+
errors << "expected #{context} to be a float"
|
|
103
|
+
end
|
|
104
|
+
when TimestampShape
|
|
105
|
+
unless value.is_a?(Time)
|
|
106
|
+
errors << "expected #{context} to be a Time object"
|
|
107
|
+
end
|
|
108
|
+
when BooleanShape
|
|
109
|
+
unless [true, false].include?(value)
|
|
110
|
+
errors << "expected #{context} to be true or false"
|
|
111
|
+
end
|
|
112
|
+
when BlobShape
|
|
113
|
+
unless io_like?(value) or value.is_a?(String)
|
|
114
|
+
errors << "expected #{context} to be a string or IO object"
|
|
115
|
+
end
|
|
116
|
+
else
|
|
117
|
+
raise "unhandled shape type: #{ref.shape.class.name}"
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def correct_type?(ref, value, errors, context)
|
|
122
|
+
case value
|
|
123
|
+
when Hash then true
|
|
124
|
+
when ref[:struct_class] then true
|
|
125
|
+
else
|
|
126
|
+
errors << "expected #{context} to be a hash"
|
|
127
|
+
false
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def io_like?(value)
|
|
132
|
+
value.respond_to?(:read) &&
|
|
133
|
+
value.respond_to?(:rewind) &&
|
|
134
|
+
value.respond_to?(:size)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def error_messages(errors)
|
|
138
|
+
if errors.size == 1
|
|
139
|
+
errors.first
|
|
140
|
+
else
|
|
141
|
+
prefix = "\n - "
|
|
142
|
+
"parameter validator found #{errors.size} errors:" +
|
|
143
|
+
prefix + errors.join(prefix)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
end
|
|
148
|
+
end
|
|
@@ -137,20 +137,21 @@ module Aws
|
|
|
137
137
|
# @api private
|
|
138
138
|
class ValueTranslator
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
def initialize(
|
|
143
|
-
@
|
|
140
|
+
include Seahorse::Model::Shapes
|
|
141
|
+
|
|
142
|
+
def initialize(rules, mode)
|
|
143
|
+
@rules = rules
|
|
144
144
|
@mode = mode
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
def apply(values)
|
|
148
|
-
structure(@
|
|
148
|
+
structure(@rules, values) if @rules
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
private
|
|
152
152
|
|
|
153
|
-
def structure(
|
|
153
|
+
def structure(ref, values)
|
|
154
|
+
shape = ref.shape
|
|
154
155
|
if values.is_a?(Struct)
|
|
155
156
|
values.members.each do |key|
|
|
156
157
|
values[key] = translate(shape.member(key), values[key])
|
|
@@ -165,33 +166,35 @@ module Aws
|
|
|
165
166
|
end
|
|
166
167
|
end
|
|
167
168
|
|
|
168
|
-
def list(
|
|
169
|
+
def list(ref, values)
|
|
169
170
|
return values unless values.is_a?(Array)
|
|
171
|
+
member_ref = ref.shape.member
|
|
170
172
|
values.inject([]) do |list, value|
|
|
171
|
-
list << translate(
|
|
173
|
+
list << translate(member_ref, value)
|
|
172
174
|
end
|
|
173
175
|
end
|
|
174
176
|
|
|
175
|
-
def map(
|
|
177
|
+
def map(ref, values)
|
|
176
178
|
return values unless values.is_a?(Hash)
|
|
179
|
+
value_ref = ref.shape.value
|
|
177
180
|
values.each.with_object({}) do |(key, value), hash|
|
|
178
|
-
hash[key] = translate(
|
|
181
|
+
hash[key] = translate(value_ref, value)
|
|
179
182
|
end
|
|
180
183
|
end
|
|
181
184
|
|
|
182
|
-
def translate(
|
|
183
|
-
if shape.name == 'AttributeValue'
|
|
185
|
+
def translate(ref, value)
|
|
186
|
+
if ref.shape.name == 'AttributeValue'
|
|
184
187
|
DynamoDB::AttributeValue.new.send(@mode, value)
|
|
185
188
|
else
|
|
186
|
-
translate_complex(
|
|
189
|
+
translate_complex(ref, value)
|
|
187
190
|
end
|
|
188
191
|
end
|
|
189
192
|
|
|
190
|
-
def translate_complex(
|
|
191
|
-
case shape
|
|
192
|
-
when
|
|
193
|
-
when
|
|
194
|
-
when
|
|
193
|
+
def translate_complex(ref, value)
|
|
194
|
+
case ref.shape
|
|
195
|
+
when StructureShape then structure(ref, value)
|
|
196
|
+
when ListShape then list(ref, value)
|
|
197
|
+
when MapShape then map(ref, value)
|
|
195
198
|
else value
|
|
196
199
|
end
|
|
197
200
|
end
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
module Aws
|
|
2
2
|
module Plugins
|
|
3
|
+
|
|
4
|
+
# @seahorse.client.option [String] :account_id ('-')
|
|
5
|
+
# The default Glacier AWS account ID to use for all glacier
|
|
6
|
+
# operations. The default value of `-` uses the account
|
|
7
|
+
# your `:credentials` belong to.
|
|
8
|
+
#
|
|
3
9
|
class GlacierAccountId < Seahorse::Client::Plugin
|
|
10
|
+
|
|
4
11
|
option :account_id, '-'
|
|
5
12
|
|
|
6
|
-
handle_request(step: :
|
|
13
|
+
handle_request(step: :initialize) do |context|
|
|
7
14
|
context.params[:account_id] ||= context.config.account_id
|
|
8
15
|
end
|
|
16
|
+
|
|
9
17
|
end
|
|
10
18
|
end
|
|
11
19
|
end
|
|
@@ -30,6 +30,7 @@ module Aws
|
|
|
30
30
|
class Handler < Seahorse::Client::Handler
|
|
31
31
|
|
|
32
32
|
HASH = 'X-Amz-Content-Sha256'
|
|
33
|
+
|
|
33
34
|
TREE_HASH = 'X-Amz-Sha256-Tree-Hash'
|
|
34
35
|
|
|
35
36
|
def call(context)
|
|
@@ -65,12 +66,10 @@ module Aws
|
|
|
65
66
|
digest.update('')
|
|
66
67
|
end
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
chunk = body.read(1024 * 1024) # read 1MB
|
|
69
|
+
while chunk = body.read(1024 * 1024) # read 1MB
|
|
70
70
|
tree_hash.update(chunk)
|
|
71
71
|
digest.update(chunk)
|
|
72
72
|
end
|
|
73
|
-
|
|
74
73
|
body.rewind
|
|
75
74
|
|
|
76
75
|
yield(digest.to_s, tree_hash)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Aws
|
|
2
|
+
module Plugins
|
|
3
|
+
|
|
4
|
+
# @seahorse.client.option [Boolean] :convert_params (true)
|
|
5
|
+
# When `true`, an attempt is made to coerce request parameters
|
|
6
|
+
# into the required types.
|
|
7
|
+
class ParamConverter < Seahorse::Client::Plugin
|
|
8
|
+
|
|
9
|
+
option(:convert_params, true)
|
|
10
|
+
|
|
11
|
+
def add_handlers(handlers, config)
|
|
12
|
+
handlers.add(Handler, step: :initialize) if config.convert_params
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class Handler < Seahorse::Client::Handler
|
|
16
|
+
|
|
17
|
+
def call(context)
|
|
18
|
+
if input = context.operation.input
|
|
19
|
+
context.params = Aws::ParamConverter.convert(input, context.params)
|
|
20
|
+
end
|
|
21
|
+
@handler.call(context)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Aws
|
|
2
|
+
module Plugins
|
|
3
|
+
|
|
4
|
+
# @seahorse.client.option [Boolean] :validate_params (true)
|
|
5
|
+
# When `true`, request parameters are validated before
|
|
6
|
+
# sending the request.
|
|
7
|
+
class ParamValidator < Seahorse::Client::Plugin
|
|
8
|
+
|
|
9
|
+
option(:validate_params, true)
|
|
10
|
+
|
|
11
|
+
def add_handlers(handlers, config)
|
|
12
|
+
if config.validate_params
|
|
13
|
+
handlers.add(Handler, step: :validate, priority: 50)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Handler < Seahorse::Client::Handler
|
|
18
|
+
|
|
19
|
+
def call(context)
|
|
20
|
+
Aws::ParamValidator.validate!(context.operation.input, context.params)
|
|
21
|
+
@handler.call(context)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -20,13 +20,9 @@ module Aws
|
|
|
20
20
|
|
|
21
21
|
option(:convert_params) { |config| !config.simple_json }
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
handlers.add(config.simple_json ?
|
|
27
|
-
Json::SimpleBodyHandler :
|
|
28
|
-
Json::RpcBodyHandler)
|
|
29
|
-
end
|
|
23
|
+
handler(Json::Handler)
|
|
24
|
+
|
|
25
|
+
handler(Json::ErrorHandler, step: :sign)
|
|
30
26
|
|
|
31
27
|
end
|
|
32
28
|
end
|
|
@@ -40,15 +40,15 @@ module Aws
|
|
|
40
40
|
# Intentionally not documented - this should go away when all
|
|
41
41
|
# services support signature version 4 in every region.
|
|
42
42
|
option(:signature_version) do |cfg|
|
|
43
|
-
cfg.api.metadata
|
|
43
|
+
cfg.api.metadata['signatureVersion']
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
option(:sigv4_name) do |cfg|
|
|
47
|
-
cfg.api.metadata
|
|
47
|
+
cfg.api.metadata['signingName'] || cfg.api.metadata['endpointPrefix']
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
option(:sigv4_region) do |cfg|
|
|
51
|
-
prefix = cfg.api.metadata
|
|
51
|
+
prefix = cfg.api.metadata['endpointPrefix']
|
|
52
52
|
endpoint = cfg.endpoint.to_s
|
|
53
53
|
if matches = endpoint.match(/#{prefix}[.-](.+)\.amazonaws\.com/)
|
|
54
54
|
matches[1] == 'us-gov' ? 'us-gov-west-1' : matches[1]
|
|
@@ -101,9 +101,9 @@ module Aws
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
def unsigned_request?(context)
|
|
104
|
-
if context.config.api.metadata
|
|
104
|
+
if context.config.api.metadata['endpointPrefix'] == 'sts'
|
|
105
105
|
STS_UNSIGNED_REQUESTS.include?(context.operation.name)
|
|
106
|
-
elsif context.config.api.metadata
|
|
106
|
+
elsif context.config.api.metadata['endpointPrefix'] == 'cloudsearchdomain'
|
|
107
107
|
context.config.credentials.nil? || !context.config.credentials.set?
|
|
108
108
|
else
|
|
109
109
|
false
|
|
@@ -2,24 +2,33 @@ module Aws
|
|
|
2
2
|
module Plugins
|
|
3
3
|
class ResponsePaging < Seahorse::Client::Plugin
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
def add_handlers(handlers, config)
|
|
6
|
+
handlers.add(Handler,
|
|
7
|
+
operations: pageable_operations(config),
|
|
8
|
+
step: :initialize,
|
|
9
|
+
priority: 90)
|
|
10
|
+
end
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def pageable_operations(config)
|
|
15
|
+
config.api.operations.inject([]) do |pageable, (name, operation)|
|
|
16
|
+
pageable << name if operation[:pager]
|
|
17
|
+
pageable
|
|
11
18
|
end
|
|
19
|
+
end
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
# @api private
|
|
22
|
+
class Handler < Seahorse::Client::Handler
|
|
14
23
|
|
|
15
|
-
def
|
|
16
|
-
|
|
24
|
+
def call(context)
|
|
25
|
+
resp = @handler.call(context)
|
|
26
|
+
resp.extend(PageableResponse)
|
|
27
|
+
resp.pager = context.operation[:pager]
|
|
28
|
+
resp
|
|
17
29
|
end
|
|
18
30
|
|
|
19
31
|
end
|
|
20
|
-
|
|
21
|
-
handler(Handler, step: :initialize, priority: 90)
|
|
22
|
-
|
|
23
32
|
end
|
|
24
33
|
end
|
|
25
34
|
end
|