aws-sdk-code-generator 0.2.2.pre → 0.2.4.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-code-generator/api.rb +12 -2
- data/lib/aws-sdk-code-generator/client_operation_documentation.rb +17 -3
- data/lib/aws-sdk-code-generator/client_response_structure_example.rb +8 -1
- data/lib/aws-sdk-code-generator/code_builder.rb +1 -1
- data/lib/aws-sdk-code-generator/gem_builder.rb +23 -0
- data/lib/aws-sdk-code-generator/helper.rb +10 -1
- data/lib/aws-sdk-code-generator/plugin_list.rb +1 -0
- data/lib/aws-sdk-code-generator/views/client_api_module.rb +23 -4
- data/lib/aws-sdk-code-generator/views/gemspec.rb +2 -2
- data/lib/aws-sdk-code-generator/views/service_module.rb +8 -0
- data/lib/aws-sdk-code-generator/views/types_module.rb +52 -17
- data/lib/aws-sdk-code-generator.rb +1 -1
- data/templates/async_client_class.mustache +3 -5
- data/templates/gemspec.mustache +2 -1
- data/templates/license.txt +202 -0
- data/templates/service_module.mustache +11 -1
- data/templates/types_module.mustache +7 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cd62265104fa228849cca4ee26d749025e7ba94a0ff446885abc045a17a91cf
|
4
|
+
data.tar.gz: 537442139442f772fecb3e829a9a584a07bf6795757c01b90032f78c5b4fde99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dd69754c3ad489c192c4db3986fc79376dbd34316f5d6d79694e5807824d36de9333762d49727a4e92525bbea4b0190803474641282499e116afd7955d6a162
|
7
|
+
data.tar.gz: a44c6a9fd0a8778bbe4d00c73dcc07584b1beac9c278671f006c349c7e7f0a36d6e8fa18084ebd61984769496abde3faf9037b85d09e40ce7c86d9f823030923
|
@@ -77,7 +77,12 @@ module AwsSdkCodeGenerator
|
|
77
77
|
"Hash<String,#{ruby_input_type(shape['value'], api, operation, nested: true)}>"
|
78
78
|
end
|
79
79
|
when 'string' then 'String'
|
80
|
-
when 'structure'
|
80
|
+
when 'structure'
|
81
|
+
if shape['document']
|
82
|
+
'Hash,Array,String,Numeric,Boolean'
|
83
|
+
else
|
84
|
+
"Types::#{shape_ref['shape']}"
|
85
|
+
end
|
81
86
|
when 'timestamp' then 'Time,DateTime,Date,Integer,String'
|
82
87
|
else
|
83
88
|
raise "unhandled type #{shape.type}.inspect"
|
@@ -98,7 +103,12 @@ module AwsSdkCodeGenerator
|
|
98
103
|
when 'long' then 'Integer'
|
99
104
|
when 'map' then "Hash<String,#{ruby_type(shape['value'], api)}>"
|
100
105
|
when 'string' then streaming?(shape_ref, api) ? 'IO' : 'String'
|
101
|
-
when 'structure'
|
106
|
+
when 'structure'
|
107
|
+
if shape['document']
|
108
|
+
'Hash,Array,String,Numeric,Boolean'
|
109
|
+
else
|
110
|
+
"Types::#{shape_ref['shape']}"
|
111
|
+
end
|
102
112
|
when 'timestamp' then 'Time'
|
103
113
|
else
|
104
114
|
raise "unhandled type #{shape['type'].inspect}"
|
@@ -3,6 +3,10 @@
|
|
3
3
|
module AwsSdkCodeGenerator
|
4
4
|
class ClientOperationDocumentation
|
5
5
|
|
6
|
+
# get all of the enumerable methods that may conflict with members
|
7
|
+
# count has special handling in UnsafeEnumerableMethods
|
8
|
+
ENUMERABLE_METHODS = Class.new.new.extend(Enumerable).methods - [:count]
|
9
|
+
|
6
10
|
# @option options [required, String] :method_name
|
7
11
|
# @option options [required, Hash] :operation
|
8
12
|
# @option options [required, Hash] :api
|
@@ -57,7 +61,7 @@ module AwsSdkCodeGenerator
|
|
57
61
|
: request_syntax_example(method_name, operation, api),
|
58
62
|
response_structure_example(operation, api),
|
59
63
|
waiters_tag(@waiters),
|
60
|
-
see_also_tag(
|
64
|
+
see_also_tag(@name, api),
|
61
65
|
], block_comment: false)
|
62
66
|
end
|
63
67
|
alias to_s to_str
|
@@ -100,6 +104,12 @@ module AwsSdkCodeGenerator
|
|
100
104
|
if member_ref['jsonvalue']
|
101
105
|
docstring = docstring.to_s + "<p><b>SDK automatically handles json encoding and base64 encoding for you when the required value (Hash, Array, etc.) is provided according to the description.</b></p>"
|
102
106
|
end
|
107
|
+
if member_shape['document']
|
108
|
+
docstring = docstring.to_s + "<p>Document type used to carry open content (Hash,Array,String,Numeric,Boolean). A document type value is serialized using the same format as its surroundings and requires no additional encoding or escaping.</p>"
|
109
|
+
end
|
110
|
+
if member_ref['union']
|
111
|
+
docstring = docstring.to_s + "<p>This is a union type and you must set exactly one of the members.</p>"
|
112
|
+
end
|
103
113
|
YardOptionTag.new(
|
104
114
|
name: Underscore.underscore(member_name),
|
105
115
|
ruby_type: Api.ruby_input_type(member_ref, api, operation),
|
@@ -130,7 +140,11 @@ module AwsSdkCodeGenerator
|
|
130
140
|
methods = shape['members'].map do |member_name, member_ref|
|
131
141
|
member_type = Docstring.escape_html(Api.ruby_type(member_ref, api))
|
132
142
|
method_name = Underscore.underscore(member_name)
|
133
|
-
|
143
|
+
if ENUMERABLE_METHODS.include?(method_name.to_sym)
|
144
|
+
"# * {#{type}##{method_name} #data.#{method_name}} => #{member_type} (This method conflicts with a method on Response, call it through the data member)"
|
145
|
+
else
|
146
|
+
"# * {#{type}##{method_name} ##{method_name}} => #{member_type}"
|
147
|
+
end
|
134
148
|
end
|
135
149
|
"# @return [#{type}] Returns a {Seahorse::Client::Response response} object which responds to the following methods:\n#\n" + methods.join("\n")
|
136
150
|
else
|
@@ -260,7 +274,7 @@ module AwsSdkCodeGenerator
|
|
260
274
|
def see_also_tag(operation, api)
|
261
275
|
uid = api['metadata']['uid']
|
262
276
|
if api['metadata']['protocol'] != 'api-gateway' && Crosslink.taggable?(uid)
|
263
|
-
"# " + Crosslink.tag_string(uid, operation
|
277
|
+
"# " + Crosslink.tag_string(uid, operation)
|
264
278
|
end
|
265
279
|
end
|
266
280
|
|
@@ -5,6 +5,8 @@ require 'set'
|
|
5
5
|
module AwsSdkCodeGenerator
|
6
6
|
class ClientResponseStructureExample
|
7
7
|
|
8
|
+
ENUMERABLE_METHODS = Class.new.new.extend(Enumerable).methods - [:count]
|
9
|
+
|
8
10
|
# @option options [required, Hash] :shape_ref
|
9
11
|
# @option options [required, Hash] :api
|
10
12
|
def initialize(options = {})
|
@@ -40,7 +42,12 @@ module AwsSdkCodeGenerator
|
|
40
42
|
return event_ctx
|
41
43
|
elsif shape['members']
|
42
44
|
shape['members'].each_pair do |member_name, member_ref|
|
43
|
-
|
45
|
+
method_name = underscore(member_name)
|
46
|
+
if context == 'resp' && ENUMERABLE_METHODS.include?(method_name.to_sym)
|
47
|
+
lines += entry(member_ref, "#{context}.data.#{method_name}", visited)
|
48
|
+
else
|
49
|
+
lines += entry(member_ref, "#{context}.#{method_name}", visited)
|
50
|
+
end
|
44
51
|
end
|
45
52
|
end
|
46
53
|
lines
|
@@ -59,7 +59,7 @@ module AwsSdkCodeGenerator
|
|
59
59
|
y.yield("#{prefix}/plugins/apig_endpoint.rb", apig_endpoint_class)
|
60
60
|
end
|
61
61
|
y.yield("#{prefix}.rb", service_module(prefix))
|
62
|
-
unless
|
62
|
+
unless %w[aws-sdk-sts aws-sdk-sso].include? prefix
|
63
63
|
y.yield("#{prefix}/customizations.rb", '')
|
64
64
|
end
|
65
65
|
y.yield("#{prefix}/types.rb", types_module)
|
@@ -8,11 +8,16 @@ module AwsSdkCodeGenerator
|
|
8
8
|
def initialize(options)
|
9
9
|
@options = options
|
10
10
|
@service = options.fetch(:service)
|
11
|
+
validate_model!
|
11
12
|
end
|
12
13
|
|
13
14
|
# @return [Hash]
|
14
15
|
attr_reader :options
|
15
16
|
|
17
|
+
def validate_model!
|
18
|
+
validate_document_support!
|
19
|
+
end
|
20
|
+
|
16
21
|
def each(&block)
|
17
22
|
Enumerator.new do |y|
|
18
23
|
y.yield("#{@service.gem_name}.gemspec", gemspec_file)
|
@@ -24,6 +29,7 @@ module AwsSdkCodeGenerator
|
|
24
29
|
y.yield('features/smoke_step_definitions.rb', smoke_step_definitions_file)
|
25
30
|
end
|
26
31
|
y.yield('VERSION', version_file)
|
32
|
+
y.yield('LICENSE.txt', license_file)
|
27
33
|
code = CodeBuilder.new(@options)
|
28
34
|
code.source_files.each do |path, code|
|
29
35
|
y.yield("lib/#{path}", code)
|
@@ -61,5 +67,22 @@ module AwsSdkCodeGenerator
|
|
61
67
|
Views::Version.new(options).render
|
62
68
|
end
|
63
69
|
|
70
|
+
def license_file
|
71
|
+
File.read(File.expand_path('../../../templates/license.txt',__FILE__ ))
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
# document types are only supported for rest-json and json
|
77
|
+
def validate_document_support!
|
78
|
+
return if ['rest-json', 'json'].include?(@service.protocol)
|
79
|
+
|
80
|
+
# Check all shapes and raise if any are Document types
|
81
|
+
@service.api.fetch('shapes', {}).each do |name, shape|
|
82
|
+
if shape['type'] == 'structure' && shape['document']
|
83
|
+
raise "Shape #{name} is a document type. Document types are only supported in json protocols."
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
64
87
|
end
|
65
88
|
end
|
@@ -31,6 +31,15 @@ module AwsSdkCodeGenerator
|
|
31
31
|
end.join('.')
|
32
32
|
end
|
33
33
|
|
34
|
+
# convert a snake case to pascal case
|
35
|
+
def pascal_case(str)
|
36
|
+
str
|
37
|
+
.to_s
|
38
|
+
.split('_')
|
39
|
+
.collect(&:capitalize)
|
40
|
+
.join
|
41
|
+
end
|
42
|
+
|
34
43
|
def structures
|
35
44
|
Enumerator.new do |y|
|
36
45
|
(@api['shapes'] || {}).each do |shape_name, shape|
|
@@ -167,7 +176,7 @@ module AwsSdkCodeGenerator
|
|
167
176
|
end
|
168
177
|
|
169
178
|
module_function :deep_copy, :operation_streaming?, :downcase_first, :wrap_string, :apig_prefix,
|
170
|
-
:eventstream_output?, :eventstream_input?, :operation_eventstreaming
|
179
|
+
:eventstream_output?, :eventstream_input?, :operation_eventstreaming?, :pascal_case
|
171
180
|
|
172
181
|
end
|
173
182
|
end
|
@@ -64,6 +64,7 @@ module AwsSdkCodeGenerator
|
|
64
64
|
|
65
65
|
def default_async_plugins
|
66
66
|
plugins = default_plugins.dup
|
67
|
+
plugins.delete('Seahorse::Client::Plugins::ContentLength')
|
67
68
|
plugins.delete('Aws::Plugins::ResponsePaging')
|
68
69
|
plugins.delete('Aws::Plugins::EndpointDiscovery')
|
69
70
|
plugins.delete('Aws::Plugins::EndpointPattern')
|
@@ -30,7 +30,9 @@ module AwsSdkCodeGenerator
|
|
30
30
|
'timestampFormat' => true, # glacier api customization
|
31
31
|
'xmlNamespace' => true,
|
32
32
|
'streaming' => true, # transfer-encoding
|
33
|
-
'requiresLength' => true, #
|
33
|
+
'requiresLength' => true, # transfer-encoding
|
34
|
+
'union' => false,
|
35
|
+
'document' => true,
|
34
36
|
# event stream modeling
|
35
37
|
'event' => false,
|
36
38
|
'eventstream' => false,
|
@@ -60,7 +62,7 @@ module AwsSdkCodeGenerator
|
|
60
62
|
'max' => false,
|
61
63
|
'wrapper' => false,
|
62
64
|
'xmlOrder' => false,
|
63
|
-
'retryable' => false
|
65
|
+
'retryable' => false,
|
64
66
|
}
|
65
67
|
|
66
68
|
METADATA_KEYS = {
|
@@ -127,13 +129,22 @@ module AwsSdkCodeGenerator
|
|
127
129
|
shape_name = lstrip_prefix(upcase_first(shape_name))
|
128
130
|
end
|
129
131
|
lines = []
|
130
|
-
if non_error_struct?(shape)
|
132
|
+
if non_error_struct?(shape) && !document_struct?(shape)
|
131
133
|
required = Set.new(shape['required'] || [])
|
132
134
|
unless shape['members'].nil?
|
133
135
|
shape['members'].each do |member_name, member_ref|
|
134
136
|
lines << "#{shape_name}.add_member(:#{underscore(member_name)}, #{shape_ref(member_ref, member_name, required)})"
|
135
137
|
end
|
136
138
|
end
|
139
|
+
if shape['union']
|
140
|
+
lines << "#{shape_name}.add_member(:unknown, Shapes::ShapeRef.new(shape: nil, location_name: 'unknown'))"
|
141
|
+
shape['members'].each do |member_name, member_ref|
|
142
|
+
member_name_underscore = underscore(member_name)
|
143
|
+
member_class_name = pascal_case(member_name_underscore)
|
144
|
+
lines << "#{shape_name}.add_member_subclass(:#{member_name_underscore}, Types::#{shape_name}::#{member_class_name})"
|
145
|
+
end
|
146
|
+
lines << "#{shape_name}.add_member_subclass(:unknown, Types::#{shape_name}::Unknown)"
|
147
|
+
end
|
137
148
|
lines << "#{shape_name}.struct_class = Types::#{shape_name}"
|
138
149
|
if payload = shape['payload']
|
139
150
|
lines << "#{shape_name}[:payload] = :#{underscore(payload)}"
|
@@ -258,7 +269,11 @@ module AwsSdkCodeGenerator
|
|
258
269
|
if @service.protocol == 'api-gateway' && type == 'timestamp'
|
259
270
|
shape['timestampFormat'] = 'iso8601'
|
260
271
|
end
|
261
|
-
if
|
272
|
+
if document_struct?(shape)
|
273
|
+
["Shapes::DocumentShape", shape]
|
274
|
+
elsif shape['union']
|
275
|
+
["Shapes::UnionShape", shape]
|
276
|
+
elsif SHAPE_CLASSES.key?(type)
|
262
277
|
["Shapes::#{SHAPE_CLASSES[type]}", shape]
|
263
278
|
else
|
264
279
|
raise ArgumentError, "unsupported shape type `#{type}'"
|
@@ -315,6 +330,10 @@ module AwsSdkCodeGenerator
|
|
315
330
|
(shape['error'] || shape['exception'])
|
316
331
|
end
|
317
332
|
|
333
|
+
def document_struct?(shape)
|
334
|
+
shape['type'] == 'structure' && shape['document']
|
335
|
+
end
|
336
|
+
|
318
337
|
def structure_shape_enum
|
319
338
|
Enumerator.new do |y|
|
320
339
|
shape_enum.each do |shape_name, shape|
|
@@ -30,7 +30,7 @@ module AwsSdkCodeGenerator
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def email
|
33
|
-
@custom ? 'yourname@email.com' : '
|
33
|
+
@custom ? 'yourname@email.com' : 'aws-dr-rubygems@amazon.com'
|
34
34
|
end
|
35
35
|
|
36
36
|
# @return [String]
|
@@ -58,7 +58,7 @@ module AwsSdkCodeGenerator
|
|
58
58
|
|
59
59
|
# @return [String]
|
60
60
|
def code_uri
|
61
|
-
"https://github.com/aws/aws-sdk-ruby/tree/
|
61
|
+
"https://github.com/aws/aws-sdk-ruby/tree/version-3/gems/#{gem_name}"
|
62
62
|
end
|
63
63
|
|
64
64
|
# @return [Array<Dependency>]
|
@@ -51,6 +51,14 @@ module AwsSdkCodeGenerator
|
|
51
51
|
@service.gem_dependencies.keys
|
52
52
|
end
|
53
53
|
|
54
|
+
# @return [Boolean] - Return true if a check is needed before
|
55
|
+
# requiring core to prevent circular dependencies.
|
56
|
+
# This is required to support backwards compatibility for SSO which was
|
57
|
+
# moved from the aws-sdk-sso gem into aws-sdk-core.
|
58
|
+
def require_core_guard?
|
59
|
+
name == 'SSO' || name == 'STS'
|
60
|
+
end
|
61
|
+
|
54
62
|
# @return [Array<String>]
|
55
63
|
def relative_requires
|
56
64
|
paths = Set.new
|
@@ -13,6 +13,7 @@ module AwsSdkCodeGenerator
|
|
13
13
|
@service = options.fetch(:service)
|
14
14
|
@api = @service.api
|
15
15
|
@input_shapes = compute_input_shapes(@service.api)
|
16
|
+
@output_shapes = compute_output_shapes(@service.api)
|
16
17
|
end
|
17
18
|
|
18
19
|
# @return [String|nil]
|
@@ -47,7 +48,7 @@ module AwsSdkCodeGenerator
|
|
47
48
|
# eventstream shape will be inheriting from enumerator
|
48
49
|
if shape['eventstream']
|
49
50
|
list
|
50
|
-
elsif shape['type'] == 'structure'
|
51
|
+
elsif shape['type'] == 'structure' && !shape['document']
|
51
52
|
struct_members = struct_members(shape)
|
52
53
|
sensitive_params = struct_members.select(&:sensitive).map do |m|
|
53
54
|
m.member_name.to_sym
|
@@ -56,7 +57,8 @@ module AwsSdkCodeGenerator
|
|
56
57
|
class_name: shape_name,
|
57
58
|
members: struct_members,
|
58
59
|
sensitive_params: sensitive_params,
|
59
|
-
documentation: struct_class_docs(shape_name)
|
60
|
+
documentation: struct_class_docs(shape_name, shape),
|
61
|
+
union: shape['union']
|
60
62
|
)
|
61
63
|
else
|
62
64
|
list
|
@@ -71,7 +73,7 @@ module AwsSdkCodeGenerator
|
|
71
73
|
list << EventStreamClass.new(
|
72
74
|
class_name: shape_name,
|
73
75
|
types: struct_members(shape),
|
74
|
-
documentation: eventstream_class_docs(shape_name)
|
76
|
+
documentation: eventstream_class_docs(shape_name, shape)
|
75
77
|
)
|
76
78
|
else
|
77
79
|
list
|
@@ -97,19 +99,20 @@ module AwsSdkCodeGenerator
|
|
97
99
|
members
|
98
100
|
end
|
99
101
|
|
100
|
-
def struct_class_docs(shape_name)
|
102
|
+
def struct_class_docs(shape_name, shape)
|
101
103
|
join_docstrings([
|
102
104
|
html_to_markdown(Api.docstring(shape_name, @api)),
|
103
|
-
input_example_docs(shape_name),
|
105
|
+
input_example_docs(shape_name, shape),
|
106
|
+
output_example_docs(shape_name, shape),
|
104
107
|
attribute_macros_docs(shape_name),
|
105
108
|
see_also_tag(shape_name),
|
106
109
|
])
|
107
110
|
end
|
108
111
|
|
109
|
-
def eventstream_class_docs(shape_name)
|
112
|
+
def eventstream_class_docs(shape_name, shape)
|
110
113
|
join_docstrings([
|
111
114
|
html_to_markdown(Api.docstring(shape_name, @api)),
|
112
|
-
input_example_docs(shape_name),
|
115
|
+
input_example_docs(shape_name, shape),
|
113
116
|
eventstream_docs(shape_name),
|
114
117
|
see_also_tag(shape_name),
|
115
118
|
])
|
@@ -120,11 +123,24 @@ module AwsSdkCodeGenerator
|
|
120
123
|
" #event_types #=> Array, returns all modeled event types in the stream"
|
121
124
|
end
|
122
125
|
|
123
|
-
def
|
126
|
+
def output_example_docs(shape_name, shape)
|
127
|
+
if @output_shapes.include?(shape_name)
|
128
|
+
if shape['union']
|
129
|
+
"@note #{shape_name} is a union - when returned from an API call"\
|
130
|
+
' exactly one value will be set and the returned type will'\
|
131
|
+
" be a subclass of #{shape_name} corresponding to the set member."
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def input_example_docs(shape_name, shape)
|
124
137
|
if @input_shapes.include?(shape_name)
|
125
138
|
return if shape(shape_name)['members'].nil?
|
126
139
|
if shape(shape_name)['members'].empty?
|
127
|
-
|
140
|
+
'@api private'
|
141
|
+
elsif shape['union']
|
142
|
+
"@note #{shape_name} is a union - when making an API calls you"\
|
143
|
+
' must set exactly one of the members.'
|
128
144
|
else
|
129
145
|
note = "@note When making an API call, you may pass #{shape_name}\n"
|
130
146
|
note += " data as a hash:\n\n"
|
@@ -172,11 +188,19 @@ module AwsSdkCodeGenerator
|
|
172
188
|
def compute_input_shapes(api)
|
173
189
|
inputs = Set.new
|
174
190
|
(api['operations'] || {}).each do |_, operation|
|
175
|
-
|
191
|
+
visit_shapes(operation['input'], inputs) if operation['input']
|
176
192
|
end
|
177
193
|
inputs
|
178
194
|
end
|
179
195
|
|
196
|
+
def compute_output_shapes(api)
|
197
|
+
outputs = Set.new
|
198
|
+
(api['operations'] || {}).each do |_, operation|
|
199
|
+
visit_shapes(operation['output'], outputs) if operation['output']
|
200
|
+
end
|
201
|
+
outputs
|
202
|
+
end
|
203
|
+
|
180
204
|
def idempotency_token?(member_ref)
|
181
205
|
member_ref['idempotencyToken'] || shape(member_ref)['idempotencyToken']
|
182
206
|
end
|
@@ -185,22 +209,22 @@ module AwsSdkCodeGenerator
|
|
185
209
|
"<p><b>A suitable default value is auto-generated.</b> You should normally not need to pass this option.</p>"
|
186
210
|
end
|
187
211
|
|
188
|
-
def
|
189
|
-
return if
|
190
|
-
|
212
|
+
def visit_shapes(shape_ref, shapes)
|
213
|
+
return if shapes.include?(shape_ref['shape']) # recursion
|
214
|
+
shapes << shape_ref['shape']
|
191
215
|
s = shape(shape_ref)
|
192
216
|
raise "cannot locate shape #{shape_ref['shape']}" if s.nil?
|
193
217
|
case s['type']
|
194
218
|
when 'structure'
|
195
219
|
return if s['members'].nil?
|
196
220
|
s['members'].each_pair do |_, member_ref|
|
197
|
-
|
221
|
+
visit_shapes(member_ref, shapes)
|
198
222
|
end
|
199
223
|
when 'list'
|
200
|
-
|
224
|
+
visit_shapes(s['member'], shapes)
|
201
225
|
when 'map'
|
202
|
-
|
203
|
-
|
226
|
+
visit_shapes(s['key'], shapes)
|
227
|
+
visit_shapes(s['value'], shapes)
|
204
228
|
end
|
205
229
|
end
|
206
230
|
|
@@ -245,6 +269,8 @@ module AwsSdkCodeGenerator
|
|
245
269
|
@members = options.fetch(:members)
|
246
270
|
@documentation = options.fetch(:documentation)
|
247
271
|
@sensitive_params = options.fetch(:sensitive_params)
|
272
|
+
@union = options.fetch(:union)
|
273
|
+
@members << StructMember.new(member_name: :unknown, member_class_name: 'Unknown') if @union
|
248
274
|
if @members.nil? || @members.empty?
|
249
275
|
@empty = true
|
250
276
|
else
|
@@ -265,6 +291,11 @@ module AwsSdkCodeGenerator
|
|
265
291
|
# @return [Array<Symbol>]
|
266
292
|
attr_accessor :sensitive_params
|
267
293
|
|
294
|
+
# @return [Boolean]
|
295
|
+
def union?
|
296
|
+
@union
|
297
|
+
end
|
298
|
+
|
268
299
|
# @return [Boolean]
|
269
300
|
def empty?
|
270
301
|
@empty
|
@@ -275,6 +306,7 @@ module AwsSdkCodeGenerator
|
|
275
306
|
|
276
307
|
def initialize(options)
|
277
308
|
@member_name = options.fetch(:member_name)
|
309
|
+
@member_class_name = AwsSdkCodeGenerator::Helper::pascal_case(@member_name)
|
278
310
|
@sensitive = options.fetch(:sensitive, false)
|
279
311
|
@last = false
|
280
312
|
end
|
@@ -285,6 +317,9 @@ module AwsSdkCodeGenerator
|
|
285
317
|
# @return [Boolean]
|
286
318
|
attr_accessor :sensitive
|
287
319
|
|
320
|
+
# @return [String]
|
321
|
+
attr_accessor :member_class_name
|
322
|
+
|
288
323
|
# @return [Boolean]
|
289
324
|
attr_accessor :last
|
290
325
|
|
@@ -76,7 +76,7 @@ module AwsSdkCodeGenerator
|
|
76
76
|
# WARNING ABOUT GENERATED CODE
|
77
77
|
#
|
78
78
|
# This file is generated. See the contributing guide for more information:
|
79
|
-
# https://github.com/aws/aws-sdk-ruby/blob/
|
79
|
+
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
|
80
80
|
#
|
81
81
|
# WARNING ABOUT GENERATED CODE
|
82
82
|
WARNING_TXT
|
@@ -3,11 +3,9 @@
|
|
3
3
|
{{#generated_src_warning}}
|
4
4
|
{{generated_src_warning}}
|
5
5
|
{{/generated_src_warning}}
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
rescue LoadError; end
|
10
|
-
end
|
6
|
+
begin
|
7
|
+
require 'http/2'
|
8
|
+
rescue LoadError; end
|
11
9
|
{{#plugin_requires}}
|
12
10
|
require '{{.}}'
|
13
11
|
{{/plugin_requires}}
|
data/templates/gemspec.mustache
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = 'Apache-2.0'
|
15
15
|
spec.email = ['{{email}}']
|
16
16
|
spec.require_paths = ['lib']
|
17
|
-
spec.files = Dir['lib/**/*.rb']
|
17
|
+
spec.files = Dir['LICENSE.txt', 'CHANGELOG.md', 'VERSION', 'lib/**/*.rb']
|
18
18
|
|
19
19
|
{{#metadata}}
|
20
20
|
spec.metadata = {
|
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency('{{gem}}', '{{&version}}')
|
28
28
|
{{/dependencies}}
|
29
29
|
|
30
|
+
spec.required_ruby_version = '>= 2.3'
|
30
31
|
end
|
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
@@ -3,9 +3,19 @@
|
|
3
3
|
{{#generated_src_warning}}
|
4
4
|
{{generated_src_warning}}
|
5
5
|
{{/generated_src_warning}}
|
6
|
+
|
7
|
+
{{#require_core_guard?}}
|
8
|
+
unless Module.const_defined?(:Aws)
|
9
|
+
{{#requires}}
|
10
|
+
require '{{.}}'
|
11
|
+
{{/requires}}
|
12
|
+
end
|
13
|
+
{{/require_core_guard?}}
|
14
|
+
{{^require_core_guard?}}
|
6
15
|
{{#requires}}
|
7
16
|
require '{{.}}'
|
8
17
|
{{/requires}}
|
18
|
+
{{/require_core_guard?}}
|
9
19
|
|
10
20
|
{{#relative_requires}}
|
11
21
|
require_relative '{{.}}'
|
@@ -40,7 +50,7 @@ require_relative '{{.}}'
|
|
40
50
|
#
|
41
51
|
# See {Errors} for more information.
|
42
52
|
#
|
43
|
-
#
|
53
|
+
# @!group service
|
44
54
|
module {{module_name}}
|
45
55
|
|
46
56
|
GEM_VERSION = '{{gem_version}}'
|
@@ -18,6 +18,13 @@ module {{module_name}}
|
|
18
18
|
{{/members}}
|
19
19
|
SENSITIVE = {{sensitive_params}}
|
20
20
|
include Aws::Structure
|
21
|
+
{{#union?}}
|
22
|
+
include Aws::Structure::Union
|
23
|
+
|
24
|
+
{{#members}}
|
25
|
+
class {{member_class_name}} < {{class_name}}; end
|
26
|
+
{{/members}}
|
27
|
+
{{/union?}}
|
21
28
|
end
|
22
29
|
{{/empty?}}
|
23
30
|
{{/structures}}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-code-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4.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:
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version: '0'
|
41
41
|
description: Generates the service code for the AWS SDK for Ruby
|
42
42
|
email:
|
43
|
-
-
|
43
|
+
- aws-dr-rubygems@amazon.com
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- templates/features/smoke_step_definitions.mustache
|
131
131
|
- templates/features/step_definitions.mustache
|
132
132
|
- templates/gemspec.mustache
|
133
|
+
- templates/license.txt
|
133
134
|
- templates/method.mustache
|
134
135
|
- templates/resource_class.mustache
|
135
136
|
- templates/root_resource_class.mustache
|
@@ -157,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
158
|
- !ruby/object:Gem::Version
|
158
159
|
version: 1.3.1
|
159
160
|
requirements: []
|
160
|
-
rubygems_version: 3.
|
161
|
+
rubygems_version: 3.2.7
|
161
162
|
signing_key:
|
162
163
|
specification_version: 4
|
163
164
|
summary: AWS SDK for Ruby - Code Generator
|