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
@@ -15,7 +15,12 @@ module Aws
|
|
15
15
|
|
16
16
|
def error(context)
|
17
17
|
body = context.http_response.body_contents
|
18
|
-
|
18
|
+
if body.empty?
|
19
|
+
code = http_status_error_code(context)
|
20
|
+
message = ''
|
21
|
+
else
|
22
|
+
code, message = extract_error(body, context)
|
23
|
+
end
|
19
24
|
svc = context.client.class.name.split('::')[1]
|
20
25
|
errors_module = Aws.const_get(svc).const_get(:Errors)
|
21
26
|
errors_module.error_class(code).new(context, message)
|
@@ -50,7 +55,7 @@ module Aws
|
|
50
55
|
end
|
51
56
|
|
52
57
|
def remove_prefix(error_code, context)
|
53
|
-
if prefix = context.config.api.metadata
|
58
|
+
if prefix = context.config.api.metadata['errorPrefix']
|
54
59
|
error_code.sub(/^#{prefix}/, '')
|
55
60
|
else
|
56
61
|
error_code
|
@@ -13,9 +13,9 @@ module Aws
|
|
13
13
|
autoload :OxEngine, 'aws-sdk-core/xml/parser/engines/ox'
|
14
14
|
autoload :RexmlEngine, 'aws-sdk-core/xml/parser/engines/rexml'
|
15
15
|
|
16
|
-
# @param [Seahorse::Model::
|
17
|
-
def initialize(
|
18
|
-
@
|
16
|
+
# @param [Seahorse::Model::ShapeRef] rules
|
17
|
+
def initialize(rules, options = {})
|
18
|
+
@rules = rules
|
19
19
|
@engine = options[:engine] || self.class.engine
|
20
20
|
end
|
21
21
|
|
@@ -24,7 +24,7 @@ module Aws
|
|
24
24
|
# @return [Structure]
|
25
25
|
def parse(xml, target = nil)
|
26
26
|
xml = '<xml/>' if xml.nil? or xml.empty?
|
27
|
-
stack = Stack.new(@
|
27
|
+
stack = Stack.new(@rules, target)
|
28
28
|
@engine.new(stack).parse(xml.to_s)
|
29
29
|
stack.result
|
30
30
|
end
|
@@ -6,16 +6,45 @@ module Aws
|
|
6
6
|
class Parser
|
7
7
|
class Frame
|
8
8
|
|
9
|
-
|
9
|
+
include Seahorse::Model::Shapes
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
def new(parent, ref, result = nil)
|
14
|
+
if self == Frame
|
15
|
+
frame = frame_class(ref && ref.shape).allocate
|
16
|
+
frame.send(:initialize, parent, ref, result)
|
17
|
+
frame
|
18
|
+
else
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def frame_class(shape)
|
26
|
+
klass = FRAME_CLASSES[shape.class]
|
27
|
+
if ListFrame == klass && shape[:flattened]
|
28
|
+
FlatListFrame
|
29
|
+
elsif MapFrame == klass && shape[:flattened]
|
30
|
+
MapEntryFrame
|
31
|
+
else
|
32
|
+
klass
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize(parent, ref, result = nil)
|
10
39
|
@parent = parent
|
11
|
-
@
|
40
|
+
@ref = ref
|
12
41
|
@result = result
|
13
42
|
@text = []
|
14
43
|
end
|
15
44
|
|
16
45
|
attr_reader :parent
|
17
46
|
|
18
|
-
attr_reader :
|
47
|
+
attr_reader :ref
|
19
48
|
|
20
49
|
attr_reader :result
|
21
50
|
|
@@ -29,70 +58,26 @@ module Aws
|
|
29
58
|
|
30
59
|
def consume_child_frame(child); end
|
31
60
|
|
32
|
-
private
|
33
|
-
|
34
|
-
class << self
|
35
|
-
|
36
|
-
def new(parent, shape, result = nil)
|
37
|
-
if self == Frame
|
38
|
-
frame = frame_class(shape).allocate
|
39
|
-
frame.send(:initialize, parent, shape, result)
|
40
|
-
frame
|
41
|
-
else
|
42
|
-
super
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
def frame_class(shape)
|
49
|
-
@classes ||= {
|
50
|
-
'blob' => BlobFrame,
|
51
|
-
'boolean' => BooleanFrame,
|
52
|
-
'byte' => BlobFrame,
|
53
|
-
'character' => StringFrame,
|
54
|
-
'double' => FloatFrame,
|
55
|
-
'float' => FloatFrame,
|
56
|
-
'integer' => IntegerFrame,
|
57
|
-
'list' => ListFrame,
|
58
|
-
'list:flat' => FlatListFrame,
|
59
|
-
'long' => IntegerFrame,
|
60
|
-
'map' => MapFrame,
|
61
|
-
'map:flat' => MapEntryFrame,
|
62
|
-
'string' => StringFrame,
|
63
|
-
'structure' => StructureFrame,
|
64
|
-
'timestamp' => TimestampFrame,
|
65
|
-
}
|
66
|
-
if shape
|
67
|
-
type = shape.type
|
68
|
-
type += ':flat' if shape.definition['flattened']
|
69
|
-
@classes[type]
|
70
|
-
else
|
71
|
-
NullFrame
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
61
|
end
|
77
62
|
|
78
63
|
class StructureFrame < Frame
|
79
64
|
|
80
|
-
def initialize(parent,
|
65
|
+
def initialize(parent, ref, result = nil)
|
81
66
|
super
|
82
|
-
@result ||=
|
67
|
+
@result ||= ref[:struct_class].new
|
83
68
|
@members = {}
|
84
|
-
shape.members.each do |member_name,
|
85
|
-
apply_default_value(member_name,
|
86
|
-
@members[xml_name(
|
69
|
+
ref.shape.members.each do |member_name, member_ref|
|
70
|
+
apply_default_value(member_name, member_ref)
|
71
|
+
@members[xml_name(member_ref)] = {
|
87
72
|
name: member_name,
|
88
|
-
|
73
|
+
ref: member_ref,
|
89
74
|
}
|
90
75
|
end
|
91
76
|
end
|
92
77
|
|
93
78
|
def child_frame(xml_name)
|
94
79
|
if @member = @members[xml_name]
|
95
|
-
Frame.new(self, @member[:
|
80
|
+
Frame.new(self, @member[:ref])
|
96
81
|
else
|
97
82
|
NullFrame.new(self)
|
98
83
|
end
|
@@ -112,21 +97,25 @@ module Aws
|
|
112
97
|
|
113
98
|
private
|
114
99
|
|
115
|
-
def apply_default_value(name,
|
116
|
-
case shape
|
117
|
-
when
|
118
|
-
when
|
100
|
+
def apply_default_value(name, ref)
|
101
|
+
case ref.shape
|
102
|
+
when ListShape then @result[name] = DefaultList.new
|
103
|
+
when MapShape then @result[name] = DefaultMap.new
|
119
104
|
end
|
120
105
|
end
|
121
106
|
|
122
|
-
def xml_name(
|
123
|
-
if
|
124
|
-
|
107
|
+
def xml_name(ref)
|
108
|
+
if flattened_list?(ref.shape)
|
109
|
+
ref.shape.member.location_name || ref.location_name
|
125
110
|
else
|
126
|
-
|
111
|
+
ref.location_name
|
127
112
|
end
|
128
113
|
end
|
129
114
|
|
115
|
+
def flattened_list?(shape)
|
116
|
+
ListShape === shape && shape['flattened']
|
117
|
+
end
|
118
|
+
|
130
119
|
end
|
131
120
|
|
132
121
|
class ListFrame < Frame
|
@@ -134,12 +123,12 @@ module Aws
|
|
134
123
|
def initialize(*args)
|
135
124
|
super
|
136
125
|
@result = []
|
137
|
-
@member_xml_name = @shape.member.location_name || 'member'
|
126
|
+
@member_xml_name = @ref.shape.member.location_name || 'member'
|
138
127
|
end
|
139
128
|
|
140
129
|
def child_frame(xml_name)
|
141
130
|
if xml_name == @member_xml_name
|
142
|
-
Frame.new(self, @shape.member)
|
131
|
+
Frame.new(self, @ref.shape.member)
|
143
132
|
else
|
144
133
|
raise NotImplementedError
|
145
134
|
end
|
@@ -155,7 +144,7 @@ module Aws
|
|
155
144
|
|
156
145
|
def initialize(*args)
|
157
146
|
super
|
158
|
-
@member = Frame.new(self, @shape.member)
|
147
|
+
@member = Frame.new(self, @ref.shape.member)
|
159
148
|
end
|
160
149
|
|
161
150
|
def result
|
@@ -185,7 +174,7 @@ module Aws
|
|
185
174
|
|
186
175
|
def child_frame(xml_name)
|
187
176
|
if xml_name == 'entry'
|
188
|
-
MapEntryFrame.new(self, @
|
177
|
+
MapEntryFrame.new(self, @ref)
|
189
178
|
else
|
190
179
|
raise NotImplementedError
|
191
180
|
end
|
@@ -201,10 +190,10 @@ module Aws
|
|
201
190
|
|
202
191
|
def initialize(*args)
|
203
192
|
super
|
204
|
-
@key_name = @shape.key.location_name || 'key'
|
205
|
-
@key = Frame.new(self, @shape.key)
|
206
|
-
@value_name = @shape.value.location_name || 'value'
|
207
|
-
@value = Frame.new(self, @shape.value)
|
193
|
+
@key_name = @ref.shape.key.location_name || 'key'
|
194
|
+
@key = Frame.new(self, @ref.shape.key)
|
195
|
+
@value_name = @ref.shape.value.location_name || 'value'
|
196
|
+
@value = Frame.new(self, @ref.shape.value)
|
208
197
|
end
|
209
198
|
|
210
199
|
# @return [StringFrame]
|
@@ -278,6 +267,22 @@ module Aws
|
|
278
267
|
end
|
279
268
|
end
|
280
269
|
end
|
270
|
+
|
271
|
+
include Seahorse::Model::Shapes
|
272
|
+
|
273
|
+
FRAME_CLASSES = {
|
274
|
+
NilClass => NullFrame,
|
275
|
+
BlobShape => BlobFrame,
|
276
|
+
BooleanShape => BooleanFrame,
|
277
|
+
FloatShape => FloatFrame,
|
278
|
+
IntegerShape => IntegerFrame,
|
279
|
+
ListShape => ListFrame,
|
280
|
+
MapShape => MapFrame,
|
281
|
+
StringShape => StringFrame,
|
282
|
+
StructureShape => StructureFrame,
|
283
|
+
TimestampShape => TimestampFrame,
|
284
|
+
}
|
285
|
+
|
281
286
|
end
|
282
287
|
end
|
283
288
|
end
|
@@ -3,8 +3,8 @@ module Aws
|
|
3
3
|
class Parser
|
4
4
|
class Stack
|
5
5
|
|
6
|
-
def initialize(
|
7
|
-
@
|
6
|
+
def initialize(ref, result = nil)
|
7
|
+
@ref = ref
|
8
8
|
@frame = self
|
9
9
|
@result = result
|
10
10
|
end
|
@@ -19,7 +19,7 @@ module Aws
|
|
19
19
|
|
20
20
|
def attr(name, value)
|
21
21
|
if name.to_s == 'encoding' && value.to_s == 'base64'
|
22
|
-
@frame = BlobFrame.new(@frame.parent, @frame.
|
22
|
+
@frame = BlobFrame.new(@frame.parent, @frame.ref)
|
23
23
|
else
|
24
24
|
start_element(name)
|
25
25
|
text(value)
|
@@ -45,7 +45,7 @@ module Aws
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def child_frame(name)
|
48
|
-
Frame.new(self, @
|
48
|
+
Frame.new(self, @ref, @result)
|
49
49
|
end
|
50
50
|
|
51
51
|
def consume_child_frame(frame)
|
data/lib/seahorse.rb
CHANGED
@@ -13,8 +13,6 @@ module Seahorse
|
|
13
13
|
autoload :HandlerListEntry, 'seahorse/client/handler_list_entry'
|
14
14
|
autoload :ManagedFile, 'seahorse/client/managed_file'
|
15
15
|
autoload :NetworkingError, 'seahorse/client/networking_error'
|
16
|
-
autoload :ParamConverter, 'seahorse/client/param_converter'
|
17
|
-
autoload :ParamValidator, 'seahorse/client/param_validator'
|
18
16
|
autoload :Plugin, 'seahorse/client/plugin'
|
19
17
|
autoload :PluginList, 'seahorse/client/plugin_list'
|
20
18
|
autoload :Request, 'seahorse/client/request'
|
@@ -42,27 +40,18 @@ module Seahorse
|
|
42
40
|
module Plugins
|
43
41
|
autoload :ContentLength, 'seahorse/client/plugins/content_length'
|
44
42
|
autoload :Endpoint, 'seahorse/client/plugins/endpoint'
|
45
|
-
autoload :JsonSimple, 'seahorse/client/plugins/json_simple'
|
46
43
|
autoload :Logging, 'seahorse/client/plugins/logging'
|
47
44
|
autoload :NetHttp, 'seahorse/client/plugins/net_http'
|
48
|
-
autoload :ParamConversion, 'seahorse/client/plugins/param_conversion'
|
49
|
-
autoload :ParamValidation, 'seahorse/client/plugins/param_validation'
|
50
45
|
autoload :RaiseResponseErrors, 'seahorse/client/plugins/raise_response_errors'
|
51
46
|
autoload :ResponseTarget, 'seahorse/client/plugins/response_target'
|
52
47
|
autoload :RestfulBindings, 'seahorse/client/plugins/restful_bindings'
|
53
48
|
end
|
54
49
|
|
55
|
-
# @api private
|
56
|
-
module Xml
|
57
|
-
autoload :Builder, 'seahorse/client/xml/builder'
|
58
|
-
end
|
59
|
-
|
60
50
|
end
|
61
51
|
|
62
52
|
module Model
|
63
53
|
autoload :Api, 'seahorse/model/api'
|
64
54
|
autoload :Operation, 'seahorse/model/operation'
|
65
|
-
autoload :ShapeMap, 'seahorse/model/shape_map'
|
66
55
|
autoload :Shapes, 'seahorse/model/shapes'
|
67
56
|
end
|
68
57
|
|
data/lib/seahorse/client/base.rb
CHANGED
@@ -10,8 +10,6 @@ module Seahorse
|
|
10
10
|
@plugins = PluginList.new([
|
11
11
|
Plugins::Endpoint,
|
12
12
|
Plugins::NetHttp,
|
13
|
-
Plugins::ParamConversion,
|
14
|
-
Plugins::ParamValidation,
|
15
13
|
Plugins::RaiseResponseErrors,
|
16
14
|
Plugins::ResponseTarget,
|
17
15
|
])
|
@@ -90,7 +88,7 @@ module Seahorse
|
|
90
88
|
# @return [RequestContext]
|
91
89
|
def context_for(operation_name, params)
|
92
90
|
RequestContext.new(
|
93
|
-
operation_name: operation_name
|
91
|
+
operation_name: operation_name,
|
94
92
|
operation: operation(operation_name),
|
95
93
|
client: self,
|
96
94
|
params: params,
|
@@ -177,17 +175,10 @@ module Seahorse
|
|
177
175
|
@api ||= Model::Api.new
|
178
176
|
end
|
179
177
|
|
180
|
-
# @param [Model::Api
|
178
|
+
# @param [Model::Api] api
|
181
179
|
# @return [Model::Api]
|
182
180
|
def set_api(api)
|
183
|
-
@api =
|
184
|
-
case api
|
185
|
-
when nil then Model::Api.new({})
|
186
|
-
when Model::Api then api
|
187
|
-
when Hash then Model::Api.new(api)
|
188
|
-
when String, Pathname then Model::Api.new(Util.load_json(api))
|
189
|
-
else raise ArgumentError, "invalid api definition #{api}"
|
190
|
-
end
|
181
|
+
@api = api
|
191
182
|
define_operation_methods
|
192
183
|
@api
|
193
184
|
end
|
@@ -17,17 +17,16 @@ module Seahorse
|
|
17
17
|
self.body = options[:body]
|
18
18
|
end
|
19
19
|
|
20
|
-
# @return [URI::HTTP, URI::HTTPS, nil]
|
21
|
-
attr_accessor :endpoint
|
22
|
-
|
23
20
|
# @return [String] The HTTP request method, e.g. `GET`, `PUT`, etc.
|
24
21
|
attr_accessor :http_method
|
25
22
|
|
26
23
|
# @return [Headers] The hash of request headers.
|
27
24
|
attr_accessor :headers
|
28
25
|
|
29
|
-
# @return [
|
30
|
-
|
26
|
+
# @return [URI::HTTP, URI::HTTPS, nil]
|
27
|
+
def endpoint
|
28
|
+
@endpoint
|
29
|
+
end
|
31
30
|
|
32
31
|
# @param [String, URI::HTTP, URI::HTTPS, nil] endpoint
|
33
32
|
def endpoint=(endpoint)
|
@@ -41,6 +40,11 @@ module Seahorse
|
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
43
|
+
# @return [IO]
|
44
|
+
def body
|
45
|
+
@body
|
46
|
+
end
|
47
|
+
|
44
48
|
# @return [String]
|
45
49
|
def body_contents
|
46
50
|
body.rewind
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Seahorse
|
2
2
|
module Client
|
3
3
|
module Plugins
|
4
|
-
|
5
4
|
# @seahorse.client.option [String] :endpoint
|
6
5
|
# The HTTP or HTTPS endpoint to send requests to.
|
7
6
|
# For example:
|
@@ -14,6 +13,10 @@ module Seahorse
|
|
14
13
|
|
15
14
|
option(:endpoint)
|
16
15
|
|
16
|
+
def add_handlers(handlers, config)
|
17
|
+
handlers.add(Handler, priority: 90)
|
18
|
+
end
|
19
|
+
|
17
20
|
def after_initialize(client)
|
18
21
|
endpoint = URI.parse(client.config.endpoint.to_s)
|
19
22
|
if URI::HTTPS === endpoint or URI::HTTP === endpoint
|
@@ -27,65 +30,11 @@ module Seahorse
|
|
27
30
|
class Handler < Client::Handler
|
28
31
|
|
29
32
|
def call(context)
|
30
|
-
context.http_request.endpoint =
|
33
|
+
context.http_request.endpoint = URI.parse(context.config.endpoint.to_s)
|
31
34
|
@handler.call(context)
|
32
35
|
end
|
33
36
|
|
34
|
-
private
|
35
|
-
|
36
|
-
def build_endpoint(context)
|
37
|
-
uri = URI.parse(context.config.endpoint.to_s)
|
38
|
-
apply_path_params(uri, context)
|
39
|
-
apply_querystring_params(uri, context)
|
40
|
-
uri
|
41
|
-
end
|
42
|
-
|
43
|
-
def apply_path_params(uri, context)
|
44
|
-
path = uri.path.sub(/\/$/, '')
|
45
|
-
path += context.operation.http_request_uri.split('?')[0]
|
46
|
-
input = context.operation.input
|
47
|
-
uri.path = path.gsub(/{\w+\+?}/) do |placeholder|
|
48
|
-
if placeholder.include?('+')
|
49
|
-
placeholder = placeholder[1..-3]
|
50
|
-
greedy = true
|
51
|
-
else
|
52
|
-
placeholder = placeholder[1..-2]
|
53
|
-
end
|
54
|
-
name, shape = input.member_by_location_name(placeholder)
|
55
|
-
param = context.params[name]
|
56
|
-
if greedy
|
57
|
-
param = param.gsub(/[^\/]+/) { |v| escape(v) }
|
58
|
-
else
|
59
|
-
escape(param)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def apply_querystring_params(uri, context)
|
65
|
-
parts = []
|
66
|
-
parts << context.operation.http_request_uri.split('?')[1]
|
67
|
-
parts.compact!
|
68
|
-
if input = context.operation.input
|
69
|
-
params = context.params
|
70
|
-
input.members.each do |member_name, member|
|
71
|
-
if member.location == 'querystring' && !params[member_name].nil?
|
72
|
-
param_name = member.location_name
|
73
|
-
param_value = params[member_name]
|
74
|
-
parts << "#{param_name}=#{escape(param_value.to_s)}"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
uri.query = parts.empty? ? nil : parts.join('&')
|
79
|
-
end
|
80
|
-
|
81
|
-
def escape(string)
|
82
|
-
Util.uri_escape(string)
|
83
|
-
end
|
84
|
-
|
85
37
|
end
|
86
|
-
|
87
|
-
handle(Handler, priority: 90)
|
88
|
-
|
89
38
|
end
|
90
39
|
end
|
91
40
|
end
|