aws-sdk-resources 2.0.18.pre → 2.0.19.pre
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/lib/aws-sdk-resources/builder_sources.rb +25 -66
- data/lib/aws-sdk-resources/definition.rb +87 -123
- data/lib/aws-sdk-resources/documenter.rb +1 -1
- data/lib/aws-sdk-resources/documenter/{belongs_to_operation_documenter.rb → has_operation_documenter.rb} +1 -1
- data/lib/aws-sdk-resources/documenter/waiter_operation_documenter.rb +3 -3
- data/lib/aws-sdk-resources/operation_methods.rb +2 -2
- data/lib/aws-sdk-resources/operations.rb +1 -1
- data/lib/aws-sdk-resources/options.rb +0 -6
- data/lib/aws-sdk-resources/request.rb +1 -1
- data/lib/aws-sdk-resources/request_params.rb +30 -117
- data/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb +4 -2
- data/lib/aws-sdk-resources/services/s3/object.rb +2 -2
- data/lib/aws-sdk-resources/validator.rb +2 -6
- data/lib/aws-sdk-resources/validator/operation_validator.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5343b4a72639e9a6d1d439dff2489d670ed307ce
|
4
|
+
data.tar.gz: 281a1fc5f17f129f329b080b55cc77e47b259aee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21c4ebe7c7715ef34a2c2d6dec31e3c8a8a4cc64afa3168d9e21147fcf9020156988426d56f625b45d37bc3f39fb06ab61ccc7378301ff3a0df24a6585d347c2
|
7
|
+
data.tar.gz: 20bc14e715abf9320f02115e4c63e4dbb6339dc5921b6f3c1a98d67d51c26846284a5b78b3290eeba12a0b7ff7ce248f94fb89f4e68cd2dc5c83d7f4c808ea0f
|
@@ -2,30 +2,14 @@ module Aws
|
|
2
2
|
module Resources
|
3
3
|
module BuilderSources
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
#
|
11
|
-
# @see {Argument}
|
12
|
-
# @see {Identifier}
|
13
|
-
# @see {DataMember}
|
14
|
-
# @see {RequestParameter}
|
15
|
-
# @see {ResponsePath}
|
16
|
-
#
|
17
|
-
class Base
|
18
|
-
|
19
|
-
include Options
|
20
|
-
|
21
|
-
# @param [String] source
|
22
|
-
# @param [Symbol] target
|
23
|
-
def initialize(source, target)
|
24
|
-
@source = source
|
25
|
-
@target = target.to_sym
|
5
|
+
module Source
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
@source = options[:source]
|
9
|
+
@target = options[:target].to_sym
|
26
10
|
end
|
27
11
|
|
28
|
-
# @return [String]
|
12
|
+
# @return [String, nil]
|
29
13
|
attr_reader :source
|
30
14
|
|
31
15
|
# @return [Symbol]
|
@@ -33,22 +17,14 @@ module Aws
|
|
33
17
|
|
34
18
|
# @return [Boolean]
|
35
19
|
def plural?
|
36
|
-
source.include?('[')
|
37
|
-
end
|
38
|
-
|
39
|
-
# @param [Hash] options
|
40
|
-
# @return [String, Array<String>]
|
41
|
-
def extract(options)
|
42
|
-
raise NotImplementedError, 'must be defined in subclasses'
|
20
|
+
!!(@source && @source.include?('['))
|
43
21
|
end
|
44
22
|
|
45
23
|
end
|
46
24
|
|
47
|
-
class Argument
|
25
|
+
class Argument
|
48
26
|
|
49
|
-
|
50
|
-
super(target.to_s, target)
|
51
|
-
end
|
27
|
+
include Source
|
52
28
|
|
53
29
|
# @option [required, String] :argument
|
54
30
|
def extract(options)
|
@@ -59,34 +35,26 @@ module Aws
|
|
59
35
|
|
60
36
|
# Extracts an identifier from a parent resource identifier. Used
|
61
37
|
# when building a {Resource} from the context of another resource.
|
62
|
-
class Identifier
|
38
|
+
class Identifier
|
39
|
+
|
40
|
+
include Source
|
63
41
|
|
64
42
|
# @option [required, Resource] :resource
|
65
43
|
def extract(options)
|
66
|
-
resource(
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
def resource(options)
|
72
|
-
option(:resource, options)
|
44
|
+
options[:resource].send(@source)
|
73
45
|
end
|
74
46
|
|
75
47
|
end
|
76
48
|
|
77
49
|
# Extracts an identifier from the data of a parent resource. Used
|
78
50
|
# when building a {Resource} from the context of another resource.
|
79
|
-
class DataMember
|
51
|
+
class DataMember
|
52
|
+
|
53
|
+
include Source
|
80
54
|
|
81
55
|
# @option [required, Resource] :resource
|
82
56
|
def extract(options)
|
83
|
-
JMESPath.search(source, resource
|
84
|
-
end
|
85
|
-
|
86
|
-
private
|
87
|
-
|
88
|
-
def resource(options)
|
89
|
-
option(:resource, options)
|
57
|
+
JMESPath.search(@source, options[:resource].data)
|
90
58
|
end
|
91
59
|
|
92
60
|
end
|
@@ -94,35 +62,26 @@ module Aws
|
|
94
62
|
# Extracts an identifier from the request parameters used to generate
|
95
63
|
# a response. Used when building a {Resource} object from the response
|
96
64
|
# of an operation.
|
97
|
-
class RequestParameter
|
65
|
+
class RequestParameter
|
66
|
+
|
67
|
+
include Source
|
98
68
|
|
99
69
|
# @option [required, Seahorse::Client::Response] :response
|
100
70
|
def extract(options)
|
101
|
-
|
102
|
-
JMESPath.search(source, params)
|
103
|
-
end
|
104
|
-
|
105
|
-
private
|
106
|
-
|
107
|
-
def response(options)
|
108
|
-
option(:response, options)
|
71
|
+
JMESPath.search(@source, options[:response].context.params)
|
109
72
|
end
|
110
73
|
|
111
74
|
end
|
112
75
|
|
113
76
|
# Extracts an identifier from the data of a response. Used when
|
114
77
|
# building a {Resource} object from the response of an operation.
|
115
|
-
class ResponsePath
|
78
|
+
class ResponsePath
|
79
|
+
|
80
|
+
include Source
|
116
81
|
|
117
82
|
# @option [required, Seahorse::Client::Response] :response
|
118
83
|
def extract(options)
|
119
|
-
JMESPath.search(source, response
|
120
|
-
end
|
121
|
-
|
122
|
-
private
|
123
|
-
|
124
|
-
def response(options)
|
125
|
-
option(:response, options)
|
84
|
+
JMESPath.search(@source, options[:response].data)
|
126
85
|
end
|
127
86
|
|
128
87
|
end
|
@@ -23,12 +23,10 @@ module Aws
|
|
23
23
|
define_actions(namespace, resource, definition['actions'] || {})
|
24
24
|
define_batch_actions(namespace, resource, definition['batchActions'] || {})
|
25
25
|
define_waiters(namespace, resource, definition['waiters'] || {})
|
26
|
+
define_has(namespace, resource, definition['has'] || {})
|
26
27
|
define_has_many(namespace, resource, definition['hasMany'] || {})
|
27
|
-
define_belongs_to(namespace, resource, definition['belongsTo'] || {})
|
28
28
|
define_data_attributes(namespace, resource, definition)
|
29
|
-
define_subresources(namespace, resource, definition['subResources'] || {})
|
30
29
|
end
|
31
|
-
define_top_level_references(namespace)
|
32
30
|
end
|
33
31
|
|
34
32
|
private
|
@@ -51,52 +49,6 @@ module Aws
|
|
51
49
|
end
|
52
50
|
end
|
53
51
|
|
54
|
-
def define_subresources(namespace, parent, definition)
|
55
|
-
parent_name = parent.resource_name
|
56
|
-
identifiers = definition['identifiers'] || {}
|
57
|
-
(definition['resources'] || []).each do |child_name|
|
58
|
-
|
59
|
-
method_name = underscore(child_name.sub(/^#{parent_name}/, ''))
|
60
|
-
operation = subresource(namespace, child_name, identifiers)
|
61
|
-
parent.add_operation(method_name, operation)
|
62
|
-
|
63
|
-
method_name = underscore(parent_name)
|
64
|
-
operation = subresource(namespace, parent_name, identifiers.invert)
|
65
|
-
namespace.const_get(child_name).add_operation(method_name, operation)
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def subresource(namespace, type, identifiers)
|
71
|
-
Operations::BelongsToOperation.new(builder: define_builder(namespace, {
|
72
|
-
'type' => type,
|
73
|
-
'identifiers' => identifiers.map { |source, target|
|
74
|
-
{
|
75
|
-
'target' => target,
|
76
|
-
'sourceType' => 'identifier',
|
77
|
-
'source' => source,
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}))
|
81
|
-
end
|
82
|
-
|
83
|
-
def define_top_level_references(namespace)
|
84
|
-
top_level = Set.new(resource_definitions.keys)
|
85
|
-
each_resource_class(namespace) do |resource, definition|
|
86
|
-
unless resource.identifiers.count <= 1
|
87
|
-
top_level.delete(resource.resource_name)
|
88
|
-
end
|
89
|
-
((definition['subResources'] || {})['resources'] || {}).each do |child|
|
90
|
-
top_level.delete(child)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
top_level.each do |resource_name|
|
94
|
-
method_name = underscore(resource_name)
|
95
|
-
operation = subresource(namespace, resource_name, {})
|
96
|
-
namespace::Resource.add_operation(method_name, operation)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
52
|
def define_batch_actions(namespace, resource, batch_actions)
|
101
53
|
batch_actions.each do |name, definition|
|
102
54
|
method_name = underscore(name)
|
@@ -149,22 +101,27 @@ module Aws
|
|
149
101
|
end
|
150
102
|
|
151
103
|
def build_operation(namespace, resource, definition)
|
152
|
-
|
153
|
-
|
104
|
+
if definition['resource']
|
105
|
+
build_resource_action(namespace, resource, definition)
|
106
|
+
else
|
107
|
+
build_basic_action(namespace, resource, definition)
|
108
|
+
end
|
154
109
|
end
|
155
110
|
|
156
|
-
def
|
111
|
+
def build_basic_action(namespace, resource, definition)
|
157
112
|
Operations::Operation.new(
|
158
113
|
request: define_request(definition['request']),
|
159
114
|
source: source(definition)
|
160
115
|
)
|
161
116
|
end
|
162
117
|
|
163
|
-
def
|
118
|
+
def build_resource_action(namespace, resource, definition)
|
164
119
|
builder = define_builder(namespace, definition['resource'])
|
165
120
|
if path = definition['resource']['path']
|
166
|
-
|
167
|
-
|
121
|
+
builder.sources << BuilderSources::ResponsePath.new({
|
122
|
+
source: underscore(path),
|
123
|
+
target: :data,
|
124
|
+
})
|
168
125
|
end
|
169
126
|
Operations::ResourceOperation.new(
|
170
127
|
request: define_request(definition['request']),
|
@@ -173,11 +130,13 @@ module Aws
|
|
173
130
|
)
|
174
131
|
end
|
175
132
|
|
176
|
-
def
|
133
|
+
def has_many(namespace, resource, definition)
|
177
134
|
builder = define_builder(namespace, definition['resource'])
|
178
135
|
if path = definition['resource']['path']
|
179
|
-
|
180
|
-
|
136
|
+
builder.sources << BuilderSources::ResponsePath.new({
|
137
|
+
source: underscore(path),
|
138
|
+
target: :data,
|
139
|
+
})
|
181
140
|
end
|
182
141
|
Operations::HasManyOperation.new(
|
183
142
|
request: define_request(definition['request']),
|
@@ -209,98 +168,107 @@ module Aws
|
|
209
168
|
|
210
169
|
def request_params(params)
|
211
170
|
params.map do |definition|
|
212
|
-
|
213
|
-
case definition['sourceType']
|
214
|
-
when 'identifier' then RequestParams::Identifier
|
215
|
-
when 'dataMember' then RequestParams::DataMember
|
216
|
-
when 'string' then RequestParams::String
|
217
|
-
when 'integer' then RequestParams::Integer
|
218
|
-
when 'boolean' then RequestParams::Boolean
|
219
|
-
else
|
220
|
-
msg = "unhandled param source type `#{definition['sourceType']}'"
|
221
|
-
raise ArgumentError, msg
|
222
|
-
end
|
223
|
-
source = definition['source']
|
224
|
-
param_class.new(
|
225
|
-
param_class.literal? ? source : underscore(source),
|
226
|
-
underscore(definition['target'])
|
227
|
-
)
|
171
|
+
send("#{definition['source']}_request_param", definition)
|
228
172
|
end
|
229
173
|
end
|
230
174
|
|
175
|
+
def identifier_request_param(definition)
|
176
|
+
RequestParams::Identifier.new({
|
177
|
+
target: underscore(definition['target']),
|
178
|
+
name: underscore(definition['name']).to_sym,
|
179
|
+
})
|
180
|
+
end
|
181
|
+
|
182
|
+
def data_request_param(definition)
|
183
|
+
RequestParams::DataMember.new({
|
184
|
+
target: underscore(definition['target']),
|
185
|
+
value: underscore(definition['path']),
|
186
|
+
})
|
187
|
+
end
|
188
|
+
|
189
|
+
def string_request_param(definition)
|
190
|
+
RequestParams::Literal.new({
|
191
|
+
target: underscore(definition['target']),
|
192
|
+
value: definition['value'],
|
193
|
+
})
|
194
|
+
end
|
195
|
+
alias integer_request_param string_request_param
|
196
|
+
alias float_request_param string_request_param
|
197
|
+
alias boolean_request_param string_request_param
|
198
|
+
alias null_request_param string_request_param
|
199
|
+
|
231
200
|
def define_has_many(namespace, resource, has_many)
|
232
201
|
has_many.each do |name, definition|
|
233
|
-
operation =
|
202
|
+
operation = has_many(namespace, resource, definition)
|
234
203
|
resource.add_operation(underscore(name), operation)
|
235
204
|
end
|
236
205
|
end
|
237
206
|
|
238
|
-
def
|
239
|
-
|
240
|
-
|
207
|
+
def define_has(namespace, resource, has)
|
208
|
+
has.each do |name, definition|
|
209
|
+
has_operation(namespace, resource, name, definition)
|
241
210
|
end
|
242
211
|
end
|
243
212
|
|
244
|
-
def
|
213
|
+
def has_operation(namespace, resource, name, definition)
|
245
214
|
builder = define_builder(namespace, definition['resource'])
|
246
215
|
if path = definition['resource']['path']
|
247
|
-
|
248
|
-
|
216
|
+
builder.sources << BuilderSources::DataMember.new({
|
217
|
+
source: underscore(path),
|
218
|
+
target: :data,
|
219
|
+
})
|
249
220
|
end
|
250
|
-
operation = Operations::
|
221
|
+
operation = Operations::HasOperation.new(
|
251
222
|
builder: builder,
|
252
223
|
source: source(definition))
|
253
224
|
resource.add_operation(underscore(name), operation)
|
254
225
|
end
|
255
226
|
|
256
227
|
def define_builder(namespace, definition)
|
257
|
-
|
228
|
+
Builder.new(
|
258
229
|
resource_class: namespace.const_get(definition['type']),
|
259
230
|
sources: builder_sources(definition['identifiers'] || [])
|
260
231
|
)
|
261
|
-
delta = builder.resource_class.identifiers - builder.sources.map(&:target)
|
262
|
-
if delta.size == 0
|
263
|
-
# all identifiers provided
|
264
|
-
elsif delta.size == 1
|
265
|
-
# all but one provided, adding an Argument source
|
266
|
-
target = delta.first
|
267
|
-
builder.sources << BuilderSources::Argument.new(target)
|
268
|
-
else
|
269
|
-
msg = "too many unsourced identifiers: #{definition.inspect}"
|
270
|
-
raise Errors::DefinitionError, msg
|
271
|
-
end
|
272
|
-
builder
|
273
232
|
end
|
274
233
|
|
275
234
|
def builder_sources(sources)
|
276
235
|
sources.map do |definition|
|
277
|
-
|
278
|
-
case definition['sourceType']
|
279
|
-
when 'identifier' then BuilderSources::Identifier
|
280
|
-
when 'dataMember' then BuilderSources::DataMember
|
281
|
-
when 'requestParameter' then BuilderSources::RequestParameter
|
282
|
-
when 'responsePath' then BuilderSources::ResponsePath
|
283
|
-
else
|
284
|
-
msg = "unhandled identifier source type `#{definition['sourceType']}'"
|
285
|
-
raise ArgumentError, msg
|
286
|
-
end
|
287
|
-
source_class.new(
|
288
|
-
underscore(definition['source']),
|
289
|
-
underscore(definition['target'])
|
290
|
-
)
|
236
|
+
send("#{definition['source']}_builder_source", definition)
|
291
237
|
end
|
292
238
|
end
|
293
239
|
|
294
|
-
def
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
240
|
+
def input_builder_source(definition)
|
241
|
+
BuilderSources::Argument.new({
|
242
|
+
target: underscore(definition['target']),
|
243
|
+
})
|
244
|
+
end
|
245
|
+
|
246
|
+
def identifier_builder_source(definition)
|
247
|
+
BuilderSources::Identifier.new({
|
248
|
+
source: underscore(definition['name']),
|
249
|
+
target: underscore(definition['target']),
|
250
|
+
})
|
251
|
+
end
|
252
|
+
|
253
|
+
def data_builder_source(definition)
|
254
|
+
BuilderSources::DataMember.new({
|
255
|
+
source: underscore(definition['path']),
|
256
|
+
target: underscore(definition['target']),
|
257
|
+
})
|
258
|
+
end
|
259
|
+
|
260
|
+
def requestParameter_builder_source(definition)
|
261
|
+
BuilderSources::RequestParameter.new({
|
262
|
+
source: underscore(definition['path']),
|
263
|
+
target: underscore(definition['target']),
|
264
|
+
})
|
265
|
+
end
|
266
|
+
|
267
|
+
def response_builder_source(definition)
|
268
|
+
BuilderSources::ResponsePath.new({
|
269
|
+
source: underscore(definition['path']),
|
270
|
+
target: underscore(definition['target']),
|
271
|
+
})
|
304
272
|
end
|
305
273
|
|
306
274
|
def svc_definition
|
@@ -322,10 +290,6 @@ module Aws
|
|
322
290
|
end
|
323
291
|
end
|
324
292
|
|
325
|
-
def pluralize(str)
|
326
|
-
underscore(str) + 's'
|
327
|
-
end
|
328
|
-
|
329
293
|
def source(definition)
|
330
294
|
if ENV['SOURCE']
|
331
295
|
Source.new(definition, @source_path)
|
@@ -5,7 +5,7 @@ module Aws
|
|
5
5
|
class Documenter
|
6
6
|
|
7
7
|
autoload :BaseOperationDocumenter, 'aws-sdk-resources/documenter/base_operation_documenter'
|
8
|
-
autoload :
|
8
|
+
autoload :HasOperationDocumenter, 'aws-sdk-resources/documenter/has_operation_documenter'
|
9
9
|
autoload :HasManyOperationDocumenter, 'aws-sdk-resources/documenter/has_many_operation_documenter'
|
10
10
|
autoload :OperationDocumenter, 'aws-sdk-resources/documenter/operation_documenter'
|
11
11
|
autoload :ResourceOperationDocumenter, 'aws-sdk-resources/documenter/resource_operation_documenter'
|
@@ -8,12 +8,12 @@ module Aws
|
|
8
8
|
Waits until this #{resource_class_name} is #{state}. This method
|
9
9
|
waits by polling {Client##{api_request_name}} until successful. An error is
|
10
10
|
raised after a configurable number of failed checks.
|
11
|
-
|
11
|
+
|
12
12
|
This waiter uses the following defaults:
|
13
13
|
|
14
14
|
| Configuration | Default |
|
15
15
|
|-----------------|------------------------|
|
16
|
-
| `#
|
16
|
+
| `#delay` | #{waiter.delay} |
|
17
17
|
| `#max_attempts` | #{waiter.max_attempts} |
|
18
18
|
|
19
19
|
You can modify defaults and register callbacks by passing a block argument.
|
@@ -52,7 +52,7 @@ You can modify defaults and register callbacks by passing a block argument.
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def api_request_name
|
55
|
-
waiter.
|
55
|
+
waiter.poller.operation_name
|
56
56
|
end
|
57
57
|
|
58
58
|
def option_tags
|
@@ -28,7 +28,7 @@ module Aws
|
|
28
28
|
|
29
29
|
# @return [Array<Symbol>]
|
30
30
|
def operation_names
|
31
|
-
@operations.keys
|
31
|
+
@operations.keys.sort
|
32
32
|
end
|
33
33
|
|
34
34
|
# @param [Symbol] name
|
@@ -54,7 +54,7 @@ module Aws
|
|
54
54
|
|
55
55
|
# @return [Array<Symbol>]
|
56
56
|
def batch_operation_names
|
57
|
-
@batch_operations.keys
|
57
|
+
@batch_operations.keys.sort
|
58
58
|
end
|
59
59
|
|
60
60
|
# @api private
|
@@ -4,12 +4,6 @@ module Aws
|
|
4
4
|
|
5
5
|
private
|
6
6
|
|
7
|
-
def expect_hash(key, options)
|
8
|
-
if options.key?(key) && !(Hash === options[key])
|
9
|
-
raise ArgumentError, "expected #{key.inspect} to be a Hash"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
7
|
def option(key, options)
|
14
8
|
if options[key].nil?
|
15
9
|
raise Errors::DefinitionError, "missing required option #{key.inspect}"
|
@@ -3,9 +3,9 @@ module Aws
|
|
3
3
|
module RequestParams
|
4
4
|
|
5
5
|
# @api private
|
6
|
-
class
|
6
|
+
class ParamHash
|
7
7
|
|
8
|
-
# @param [Array<RequestParams::
|
8
|
+
# @param [Array<RequestParams::Param>] params
|
9
9
|
def initialize(params)
|
10
10
|
@params = params
|
11
11
|
end
|
@@ -21,7 +21,7 @@ module Aws
|
|
21
21
|
|
22
22
|
def user_params(options)
|
23
23
|
args = options[:args] || []
|
24
|
-
args.last.is_a?(Hash) ? args.last : {}
|
24
|
+
args.last.is_a?(Hash) ? args.last : {}
|
25
25
|
end
|
26
26
|
|
27
27
|
def computed_params(options)
|
@@ -44,16 +44,11 @@ module Aws
|
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
# @see {RequestParams::Identifier}
|
49
|
-
# @see {RequestParams::DataMember}
|
50
|
-
# @see {RequestParams::String}
|
51
|
-
# @see {RequestParams::Integer}
|
52
|
-
class Base
|
47
|
+
module Param
|
53
48
|
|
54
49
|
# @param [String] target
|
55
|
-
def initialize(
|
56
|
-
@target = target.to_s
|
50
|
+
def initialize(options)
|
51
|
+
@target = options[:target].to_s
|
57
52
|
@steps = []
|
58
53
|
@target.scan(/\w+|\[\]|\[\*\]|\[[0-9]+\]/) do |step|
|
59
54
|
case step
|
@@ -70,14 +65,11 @@ module Aws
|
|
70
65
|
# @return [String] target
|
71
66
|
attr_reader :target
|
72
67
|
|
73
|
-
|
74
|
-
# @param [Object] value
|
75
|
-
# @return [Hash] Returns the modified params hash.
|
76
|
-
def apply(params, value, n = nil)
|
68
|
+
def apply(params, options = {})
|
77
69
|
if @final == -1
|
78
|
-
build_context(params, n) << value
|
70
|
+
build_context(params, options[:n]) << value(options)
|
79
71
|
else
|
80
|
-
build_context(params, n)[@final] = value
|
72
|
+
build_context(params, options[:n])[@final] = value(options)
|
81
73
|
end
|
82
74
|
params
|
83
75
|
end
|
@@ -100,126 +92,47 @@ module Aws
|
|
100
92
|
|
101
93
|
end
|
102
94
|
|
103
|
-
class Identifier
|
95
|
+
class Identifier
|
104
96
|
|
105
|
-
|
106
|
-
# @param (see Base#initialize)
|
107
|
-
def initialize(identifier_name, target)
|
108
|
-
@identifier_name = identifier_name.to_sym
|
109
|
-
super(target)
|
110
|
-
end
|
111
|
-
|
112
|
-
# @param [Symbol] identifier_name
|
113
|
-
attr_reader :identifier_name
|
114
|
-
|
115
|
-
# @param [Hash] params_hash
|
116
|
-
# @option [requried, Resource] :resource
|
117
|
-
def apply(params_hash, options)
|
118
|
-
value = options[:resource].identifiers[identifier_name]
|
119
|
-
super(params_hash, value, options[:n])
|
120
|
-
end
|
121
|
-
|
122
|
-
# @api private
|
123
|
-
def self.literal?
|
124
|
-
false
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
class DataMember < Base
|
130
|
-
|
131
|
-
# @param [String] member_name
|
132
|
-
# @param (see Base#initialize)
|
133
|
-
def initialize(member_name, target)
|
134
|
-
@member_name = member_name
|
135
|
-
super(target)
|
136
|
-
end
|
137
|
-
|
138
|
-
# @return [String]
|
139
|
-
attr_reader :member_name
|
140
|
-
|
141
|
-
# @param [Hash] params_hash
|
142
|
-
# @option [requried, Resource] :resource
|
143
|
-
def apply(params_hash, options)
|
144
|
-
value = options[:resource].data[member_name.to_sym]
|
145
|
-
super(params_hash, value, options[:n])
|
146
|
-
end
|
97
|
+
include Param
|
147
98
|
|
148
|
-
|
149
|
-
|
150
|
-
|
99
|
+
def initialize(options)
|
100
|
+
@identifier_name = options[:name]
|
101
|
+
super
|
151
102
|
end
|
152
103
|
|
153
|
-
|
154
|
-
|
155
|
-
class String < Base
|
156
|
-
|
157
|
-
# @param [String] value
|
158
|
-
# @param (see Base#initialize)
|
159
|
-
def initialize(value, target)
|
160
|
-
@value = value
|
161
|
-
super(target)
|
162
|
-
end
|
163
|
-
|
164
|
-
# @return [String]
|
165
|
-
attr_reader :value
|
166
|
-
|
167
|
-
# @param [Hash] params_hash
|
168
|
-
def apply(params_hash, options = {})
|
169
|
-
super(params_hash, value, options[:n])
|
170
|
-
end
|
171
|
-
|
172
|
-
# @api private
|
173
|
-
def self.literal?
|
174
|
-
true
|
104
|
+
def value(options)
|
105
|
+
options[:resource].send(@identifier_name)
|
175
106
|
end
|
176
107
|
|
177
108
|
end
|
178
109
|
|
179
|
-
class
|
180
|
-
|
181
|
-
# @param [String] value
|
182
|
-
# @param (see Base#initialize)
|
183
|
-
def initialize(value, target)
|
184
|
-
@value = value.to_i
|
185
|
-
super(target)
|
186
|
-
end
|
110
|
+
class DataMember
|
187
111
|
|
188
|
-
|
189
|
-
attr_reader :value
|
112
|
+
include Param
|
190
113
|
|
191
|
-
|
192
|
-
|
193
|
-
super
|
114
|
+
def initialize(options)
|
115
|
+
@path = options[:data_path]
|
116
|
+
super
|
194
117
|
end
|
195
118
|
|
196
|
-
|
197
|
-
|
198
|
-
true
|
119
|
+
def value(options)
|
120
|
+
JMESPath.search(@path, options[:resource].data)
|
199
121
|
end
|
200
122
|
|
201
123
|
end
|
202
124
|
|
203
|
-
class
|
204
|
-
|
205
|
-
# @param [String<'true'>,String<'false'>] value
|
206
|
-
# @param (see Base#initialize)
|
207
|
-
def initialize(value, target)
|
208
|
-
@value = (value == 'true')
|
209
|
-
super(target)
|
210
|
-
end
|
125
|
+
class Literal
|
211
126
|
|
212
|
-
|
213
|
-
attr_reader :value
|
127
|
+
include Param
|
214
128
|
|
215
|
-
|
216
|
-
|
217
|
-
super
|
129
|
+
def initialize(options)
|
130
|
+
@value = options[:value]
|
131
|
+
super
|
218
132
|
end
|
219
133
|
|
220
|
-
|
221
|
-
|
222
|
-
true
|
134
|
+
def value(*args)
|
135
|
+
@value
|
223
136
|
end
|
224
137
|
|
225
138
|
end
|
@@ -83,7 +83,9 @@ module Aws
|
|
83
83
|
part_number = 1
|
84
84
|
parts = []
|
85
85
|
while offset < size
|
86
|
-
parts <<
|
86
|
+
parts << {
|
87
|
+
bucket: options[:bucket],
|
88
|
+
key: options[:key],
|
87
89
|
upload_id: upload_id,
|
88
90
|
part_number: part_number,
|
89
91
|
body: FilePart.new(
|
@@ -91,7 +93,7 @@ module Aws
|
|
91
93
|
offset: offset,
|
92
94
|
size: part_size(size, default_part_size, offset)
|
93
95
|
)
|
94
|
-
|
96
|
+
}
|
95
97
|
part_number += 1
|
96
98
|
offset += default_part_size
|
97
99
|
end
|
@@ -26,8 +26,8 @@ module Aws
|
|
26
26
|
#
|
27
27
|
# | HTTP Method | Client Method |
|
28
28
|
# |---------------|------------------------|
|
29
|
-
# | `:get` | {Client#
|
30
|
-
# | `:put` | {Client#
|
29
|
+
# | `:get` | {Client#get_object} |
|
30
|
+
# | `:put` | {Client#put_object} |
|
31
31
|
# | `:head` | {Client#head_object} |
|
32
32
|
# | `:delete` | {Client#delete_object} |
|
33
33
|
#
|
@@ -180,7 +180,7 @@ module Aws
|
|
180
180
|
match('#/resources/(\w+)/load') do |context|
|
181
181
|
v = OperationValidator.new(context)
|
182
182
|
v.validate_request do
|
183
|
-
v.validate_param_source_type_not_used('
|
183
|
+
v.validate_param_source_type_not_used('data')
|
184
184
|
#v.validate_path(origin: :response, target: :self)
|
185
185
|
end
|
186
186
|
v.validate_path_set
|
@@ -214,7 +214,7 @@ module Aws
|
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
217
|
-
match('#/resources/(\w+)/
|
217
|
+
match('#/resources/(\w+)/has/\w+') do |context, matches|
|
218
218
|
v = OperationValidator.new(context)
|
219
219
|
v.validate_request_not_set
|
220
220
|
v.validate_resource do
|
@@ -234,10 +234,6 @@ module Aws
|
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
237
|
-
match('#/resources/(\w+)/subResources') do |context|
|
238
|
-
# TODO : validate subResources
|
239
|
-
end
|
240
|
-
|
241
237
|
end
|
242
238
|
end
|
243
239
|
end
|
@@ -145,7 +145,7 @@ module Aws
|
|
145
145
|
# "dataMember" source types.
|
146
146
|
def validate_param_source_type_not_used(source_type)
|
147
147
|
(@operation['request']['params'] || []).each.with_index do |param, n|
|
148
|
-
if param['
|
148
|
+
if param['source'] == source_type
|
149
149
|
error("'#{path}/request/params/#{n}/sourceType' is set to '#{source_type}' which is not valid in this context.")
|
150
150
|
end
|
151
151
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.19.pre
|
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: 2015-01-
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.
|
19
|
+
version: 2.0.19
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.
|
26
|
+
version: 2.0.19
|
27
27
|
description: Provides resource-oriented abstractions for AWS.
|
28
28
|
email:
|
29
29
|
executables: []
|
@@ -38,9 +38,9 @@ files:
|
|
38
38
|
- lib/aws-sdk-resources/definition.rb
|
39
39
|
- lib/aws-sdk-resources/documenter.rb
|
40
40
|
- lib/aws-sdk-resources/documenter/base_operation_documenter.rb
|
41
|
-
- lib/aws-sdk-resources/documenter/belongs_to_operation_documenter.rb
|
42
41
|
- lib/aws-sdk-resources/documenter/data_operation_documenter.rb
|
43
42
|
- lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb
|
43
|
+
- lib/aws-sdk-resources/documenter/has_operation_documenter.rb
|
44
44
|
- lib/aws-sdk-resources/documenter/operation_documenter.rb
|
45
45
|
- lib/aws-sdk-resources/documenter/resource_operation_documenter.rb
|
46
46
|
- lib/aws-sdk-resources/documenter/waiter_operation_documenter.rb
|