aws-sdk-core 2.0.48 → 2.1.0
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/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
@@ -6,7 +6,7 @@ module Aws
|
|
6
6
|
|
7
7
|
def call(context)
|
8
8
|
@handler.call(context).on(200) do |response|
|
9
|
-
response.data =
|
9
|
+
response.data = S3::Types::GetBucketLocationOutput.new
|
10
10
|
xml = context.http_response.body_contents
|
11
11
|
matches = xml.match(/>(.+?)<\/LocationConstraint>/)
|
12
12
|
response.data[:location_constraint] = matches ? matches[1] : ''
|
@@ -91,7 +91,7 @@ module Aws
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def uploading_file?(context)
|
94
|
-
|
94
|
+
[:put_object, :upload_part].include?(context.operation_name) &&
|
95
95
|
context.http_request.body.size > 0
|
96
96
|
end
|
97
97
|
|
@@ -199,7 +199,6 @@ module Aws
|
|
199
199
|
end
|
200
200
|
|
201
201
|
def updgrade_to_v4(context, region)
|
202
|
-
bucket = context.params[:bucket]
|
203
202
|
context.http_response.body.truncate(0)
|
204
203
|
context.http_request.headers.delete('authorization')
|
205
204
|
context.http_request.headers.delete('x-amz-security-token')
|
@@ -29,7 +29,6 @@ module Aws
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def after_initialize(client)
|
32
|
-
# disable retries when stubbing responses
|
33
32
|
if client.config.stub_responses
|
34
33
|
client.handlers.remove(RetryErrors::Handler)
|
35
34
|
end
|
@@ -38,41 +37,40 @@ module Aws
|
|
38
37
|
class Handler < Seahorse::Client::Handler
|
39
38
|
|
40
39
|
def call(context)
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
stub = context.client.next_stub(context.operation_name)
|
41
|
+
resp = Seahorse::Client::Response.new(context: context)
|
42
|
+
apply_stub(stub, resp)
|
43
|
+
resp
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
resp.error = stub.new(resp.context, 'stubbed error')
|
53
|
-
elsif Class === stub && stub.ancestors.include?(Exception)
|
54
|
-
resp.error = stub.new
|
55
|
-
else
|
56
|
-
resp.data = stub
|
57
|
-
stub_http_body(resp) if streaming?(resp)
|
46
|
+
def apply_stub(stub, response)
|
47
|
+
http_resp = response.context.http_response
|
48
|
+
case
|
49
|
+
when stub[:error] then signal_error(stub[:error], http_resp)
|
50
|
+
when stub[:http] then signal_http(stub[:http], http_resp)
|
51
|
+
when stub[:data] then response.data = stub[:data]
|
58
52
|
end
|
59
53
|
end
|
60
54
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
55
|
+
# @param [Exception] stub
|
56
|
+
# @param [Seahorse::Client::Http::Response] http_resp
|
57
|
+
def signal_error(error, http_resp)
|
58
|
+
if Exception === error
|
59
|
+
http_resp.signal_error(error)
|
65
60
|
else
|
66
|
-
|
61
|
+
http_resp.signal_error(error.new)
|
67
62
|
end
|
68
63
|
end
|
69
64
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
65
|
+
# @param [Seahorse::Client::Http::Response] stub
|
66
|
+
# @param [Seahorse::Client::Http::Response] http_resp
|
67
|
+
def signal_http(stub, http_resp)
|
68
|
+
http_resp.signal_headers(stub.status_code, stub.headers.to_h)
|
69
|
+
while chunk = stub.body.read(1024 * 1024)
|
70
|
+
http_resp.signal_data(chunk)
|
71
|
+
end
|
72
|
+
stub.body.rewind
|
73
|
+
http_resp.signal_done
|
76
74
|
end
|
77
75
|
|
78
76
|
end
|
@@ -4,69 +4,55 @@ module Aws
|
|
4
4
|
module Query
|
5
5
|
class EC2ParamBuilder
|
6
6
|
|
7
|
-
|
7
|
+
include Seahorse::Model::Shapes
|
8
|
+
|
8
9
|
def initialize(param_list)
|
9
10
|
@params = param_list
|
10
11
|
end
|
11
12
|
|
12
|
-
# @return [ParamList]
|
13
13
|
attr_reader :params
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
# rules provided by `shape`.
|
18
|
-
# @param [Seahorse::Model::Shapes::Structure] shape
|
19
|
-
# @param [Hash] params
|
20
|
-
# @return [void]
|
21
|
-
def apply(shape, params)
|
22
|
-
structure(shape, params, '')
|
15
|
+
def apply(ref, params)
|
16
|
+
structure(ref, params, '')
|
23
17
|
end
|
24
18
|
|
25
19
|
private
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
# @param [String, nil] prefix
|
30
|
-
def structure(structure, values, prefix)
|
21
|
+
def structure(ref, values, prefix)
|
22
|
+
shape = ref.shape
|
31
23
|
values.each do |name, value|
|
32
24
|
unless value.nil?
|
33
|
-
|
34
|
-
format(
|
25
|
+
member_ref = shape.member(name)
|
26
|
+
format(member_ref, value, prefix + query_name(member_ref))
|
35
27
|
end
|
36
28
|
end
|
37
29
|
end
|
38
30
|
|
39
|
-
|
40
|
-
# @param [Array] values
|
41
|
-
# @param [String] prefix
|
42
|
-
def list(list, values, prefix)
|
31
|
+
def list(ref, values, prefix)
|
43
32
|
if values.empty?
|
44
33
|
set(prefix, '')
|
45
34
|
else
|
35
|
+
member_ref = ref.shape.member
|
46
36
|
values.each.with_index do |value, n|
|
47
|
-
format(
|
37
|
+
format(member_ref, value, "#{prefix}.#{n+1}")
|
48
38
|
end
|
49
39
|
end
|
50
40
|
end
|
51
41
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
when
|
58
|
-
when
|
59
|
-
when 'map' then raise NotImplementedError
|
60
|
-
when 'blob' then set(prefix, Base64.strict_encode64(value.read))
|
61
|
-
when 'timestamp'
|
62
|
-
set(prefix, shape.format_time(value, 'iso8601').to_s)
|
42
|
+
def format(ref, value, prefix)
|
43
|
+
case ref.shape
|
44
|
+
when StructureShape then structure(ref, value, prefix + '.')
|
45
|
+
when ListShape then list(ref, value, prefix)
|
46
|
+
when MapShape then raise NotImplementedError
|
47
|
+
when BlobShape then set(prefix, blob(value))
|
48
|
+
when TimestampShape then set(prefix, timestamp(value))
|
63
49
|
else
|
64
50
|
set(prefix, value.to_s)
|
65
51
|
end
|
66
52
|
end
|
67
53
|
|
68
|
-
def query_name(
|
69
|
-
|
54
|
+
def query_name(ref)
|
55
|
+
ref['queryName'] || ucfirst(ref.location_name)
|
70
56
|
end
|
71
57
|
|
72
58
|
def set(name, value)
|
@@ -77,6 +63,15 @@ module Aws
|
|
77
63
|
str[0].upcase + str[1..-1]
|
78
64
|
end
|
79
65
|
|
66
|
+
def blob(value)
|
67
|
+
value = value.read unless String === value
|
68
|
+
Base64.strict_encode64(value)
|
69
|
+
end
|
70
|
+
|
71
|
+
def timestamp(value)
|
72
|
+
value.utc.iso8601
|
73
|
+
end
|
74
|
+
|
80
75
|
end
|
81
76
|
end
|
82
77
|
end
|
@@ -2,8 +2,24 @@ module Aws
|
|
2
2
|
module Query
|
3
3
|
class Handler < Seahorse::Client::Handler
|
4
4
|
|
5
|
+
include Seahorse::Model::Shapes
|
6
|
+
|
5
7
|
CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=utf-8'
|
6
8
|
|
9
|
+
WRAPPER_STRUCT = Structure.new(:result, :response_metadata)
|
10
|
+
|
11
|
+
METADATA_STRUCT = Structure.new(:request_id)
|
12
|
+
|
13
|
+
METADATA_REF = begin
|
14
|
+
request_id = ShapeRef.new(
|
15
|
+
shape: StringShape.new,
|
16
|
+
location_name: 'RequestId')
|
17
|
+
response_metadata = StructureShape.new
|
18
|
+
response_metadata[:struct_class] = METADATA_STRUCT
|
19
|
+
response_metadata.add_member(:request_id, request_id)
|
20
|
+
ShapeRef.new(shape: response_metadata, location_name: 'ResponseMetadata')
|
21
|
+
end
|
22
|
+
|
7
23
|
# @param [Seahorse::Client::RequestContext] context
|
8
24
|
# @return [Seahorse::Client::Response]
|
9
25
|
def call(context)
|
@@ -17,6 +33,7 @@ module Aws
|
|
17
33
|
private
|
18
34
|
|
19
35
|
def build_request(context)
|
36
|
+
context.http_request.http_method = 'POST'
|
20
37
|
context.http_request.headers['Content-Type'] = CONTENT_TYPE
|
21
38
|
param_list = ParamList.new
|
22
39
|
param_list.set('Version', context.config.api.version)
|
@@ -32,9 +49,9 @@ module Aws
|
|
32
49
|
end
|
33
50
|
|
34
51
|
def parse_xml(context)
|
35
|
-
if
|
36
|
-
data = Xml::Parser.new(
|
37
|
-
remove_wrapper(data, context
|
52
|
+
if context.operation.output
|
53
|
+
data = Xml::Parser.new(rules(context)).parse(xml(context))
|
54
|
+
remove_wrapper(data, context)
|
38
55
|
else
|
39
56
|
EmptyStructure.new
|
40
57
|
end
|
@@ -44,24 +61,21 @@ module Aws
|
|
44
61
|
context.http_response.body_contents
|
45
62
|
end
|
46
63
|
|
47
|
-
def
|
48
|
-
Seahorse::Model::Shapes::
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
57
|
-
}
|
58
|
-
}, shape_map: shape.shape_map)
|
64
|
+
def rules(context)
|
65
|
+
shape = Seahorse::Model::Shapes::StructureShape.new
|
66
|
+
shape.add_member(:result, ShapeRef.new(
|
67
|
+
shape: context.operation.output.shape,
|
68
|
+
location_name: context.operation.name + 'Result'
|
69
|
+
))
|
70
|
+
shape[:struct_class] = WRAPPER_STRUCT
|
71
|
+
shape.add_member(:response_metadata, METADATA_REF)
|
72
|
+
ShapeRef.new(shape: shape)
|
59
73
|
end
|
60
74
|
|
61
|
-
def remove_wrapper(data, context
|
62
|
-
if context.operation.output
|
75
|
+
def remove_wrapper(data, context)
|
76
|
+
if context.operation.output
|
63
77
|
context[:request_id] = data.response_metadata.request_id
|
64
|
-
data
|
78
|
+
data.result || Structure.new(context.operation.output.shape.member_names)
|
65
79
|
else
|
66
80
|
data
|
67
81
|
end
|
@@ -4,100 +4,92 @@ module Aws
|
|
4
4
|
module Query
|
5
5
|
class ParamBuilder
|
6
6
|
|
7
|
-
|
7
|
+
include Seahorse::Model::Shapes
|
8
|
+
|
8
9
|
def initialize(param_list)
|
9
10
|
@params = param_list
|
10
11
|
end
|
11
12
|
|
12
|
-
# @return [ParamList]
|
13
13
|
attr_reader :params
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
# rules provided by `shape`.
|
18
|
-
# @param [Seahorse::Model::Shapes::Structure] shape
|
19
|
-
# @param [Hash] params
|
20
|
-
# @return [void]
|
21
|
-
def apply(shape, params)
|
22
|
-
structure(shape, params, '')
|
15
|
+
def apply(ref, params)
|
16
|
+
structure(ref, params, '')
|
23
17
|
end
|
24
18
|
|
25
19
|
private
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
member_shape = structure.member(name)
|
34
|
-
format(member_shape, value, prefix + query_name(member_shape))
|
35
|
-
end
|
21
|
+
def structure(ref, values, prefix)
|
22
|
+
shape = ref.shape
|
23
|
+
values.each_pair do |name, value|
|
24
|
+
next if value.nil?
|
25
|
+
member_ref = shape.member(name)
|
26
|
+
format(member_ref, value, prefix + query_name(member_ref))
|
36
27
|
end
|
37
28
|
end
|
38
29
|
|
39
|
-
|
40
|
-
|
41
|
-
# @param [String] prefix
|
42
|
-
def list(list, values, prefix)
|
30
|
+
def list(ref, values, prefix)
|
31
|
+
member_ref = ref.shape.member
|
43
32
|
if values.empty?
|
44
33
|
set(prefix, '')
|
45
34
|
return
|
46
35
|
end
|
47
|
-
if flat?(
|
48
|
-
if name = query_name(
|
36
|
+
if flat?(ref)
|
37
|
+
if name = query_name(member_ref)
|
49
38
|
parts = prefix.split('.')
|
50
39
|
parts.pop
|
51
40
|
parts.push(name)
|
52
41
|
prefix = parts.join('.')
|
53
42
|
end
|
54
43
|
else
|
55
|
-
prefix += '.member'
|
44
|
+
prefix += '.' + (member_ref.location_name || 'member')
|
56
45
|
end
|
57
46
|
values.each.with_index do |value, n|
|
58
|
-
format(
|
47
|
+
format(member_ref, value, "#{prefix}.#{n+1}")
|
59
48
|
end
|
60
49
|
end
|
61
50
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
value_name = "%s.%d.#{query_name(map.value, 'value')}"
|
51
|
+
def map(ref, values, prefix)
|
52
|
+
key_ref = ref.shape.key
|
53
|
+
value_ref = ref.shape.value
|
54
|
+
prefix += '.entry' unless flat?(ref)
|
55
|
+
key_name = "%s.%d.#{query_name(key_ref, 'key')}"
|
56
|
+
value_name = "%s.%d.#{query_name(value_ref, 'value')}"
|
69
57
|
values.each.with_index do |(key, value), n|
|
70
|
-
format(
|
71
|
-
format(
|
58
|
+
format(key_ref, key, key_name % [prefix, n + 1])
|
59
|
+
format(value_ref, value, value_name % [prefix, n + 1])
|
72
60
|
end
|
73
61
|
end
|
74
62
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
when
|
81
|
-
when
|
82
|
-
|
83
|
-
when 'blob' then set(prefix, Base64.strict_encode64(value.read))
|
84
|
-
when 'timestamp'
|
85
|
-
set(prefix, shape.format_time(value, 'iso8601').to_s)
|
86
|
-
else
|
87
|
-
set(prefix, value.to_s)
|
63
|
+
def format(ref, value, prefix)
|
64
|
+
case ref.shape
|
65
|
+
when StructureShape then structure(ref, value, prefix + '.')
|
66
|
+
when ListShape then list(ref, value, prefix)
|
67
|
+
when MapShape then map(ref, value, prefix)
|
68
|
+
when BlobShape then set(prefix, blob(value))
|
69
|
+
when TimestampShape then set(prefix, timestamp(value))
|
70
|
+
else set(prefix, value.to_s)
|
88
71
|
end
|
89
72
|
end
|
90
73
|
|
91
|
-
def query_name(
|
92
|
-
|
74
|
+
def query_name(ref, default = nil)
|
75
|
+
ref.location_name || default
|
93
76
|
end
|
94
77
|
|
95
78
|
def set(name, value)
|
96
79
|
params.set(name, value)
|
97
80
|
end
|
98
81
|
|
99
|
-
def flat?(
|
100
|
-
|
82
|
+
def flat?(ref)
|
83
|
+
ref['flattened']
|
84
|
+
end
|
85
|
+
|
86
|
+
def timestamp(value)
|
87
|
+
value.utc.iso8601
|
88
|
+
end
|
89
|
+
|
90
|
+
def blob(value)
|
91
|
+
value = value.read unless String === value
|
92
|
+
Base64.strict_encode64(value)
|
101
93
|
end
|
102
94
|
|
103
95
|
end
|
@@ -20,22 +20,10 @@ module Aws
|
|
20
20
|
refresh
|
21
21
|
end
|
22
22
|
|
23
|
-
# @return [
|
24
|
-
def
|
23
|
+
# @return [Credentials]
|
24
|
+
def credentials
|
25
25
|
refresh_if_near_expiration
|
26
|
-
@
|
27
|
-
end
|
28
|
-
|
29
|
-
# @return [String,nil]
|
30
|
-
def secret_access_key
|
31
|
-
refresh_if_near_expiration
|
32
|
-
@secret_access_key
|
33
|
-
end
|
34
|
-
|
35
|
-
# @return [String,nil]
|
36
|
-
def session_token
|
37
|
-
refresh_if_near_expiration
|
38
|
-
@session_token
|
26
|
+
@credentials
|
39
27
|
end
|
40
28
|
|
41
29
|
# @return [Time,nil]
|