aws-sdk-code-generator 0.1.0.pre → 0.2.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/aws-sdk-code-generator.rb +68 -75
- data/lib/aws-sdk-code-generator/api.rb +130 -0
- data/lib/aws-sdk-code-generator/apply_docs.rb +15 -2
- data/lib/aws-sdk-code-generator/client_constructor.rb +39 -0
- data/lib/aws-sdk-code-generator/client_operation_documentation.rb +268 -0
- data/lib/aws-sdk-code-generator/client_operation_list.rb +148 -0
- data/lib/aws-sdk-code-generator/client_response_structure_example.rb +108 -0
- data/lib/aws-sdk-code-generator/code_builder.rb +146 -133
- data/lib/aws-sdk-code-generator/crosslink.rb +42 -0
- data/lib/aws-sdk-code-generator/docstring.rb +199 -0
- data/lib/aws-sdk-code-generator/error_list.rb +77 -0
- data/lib/aws-sdk-code-generator/errors.rb +2 -0
- data/lib/aws-sdk-code-generator/eventstream_example.rb +220 -0
- data/lib/aws-sdk-code-generator/gem_builder.rb +19 -25
- data/lib/aws-sdk-code-generator/hash_formatter.rb +5 -2
- data/lib/aws-sdk-code-generator/helper.rb +77 -61
- data/lib/aws-sdk-code-generator/plugin_list.rb +146 -0
- data/lib/aws-sdk-code-generator/resource_action.rb +69 -0
- data/lib/aws-sdk-code-generator/resource_action_code.rb +57 -0
- data/lib/aws-sdk-code-generator/resource_association.rb +37 -0
- data/lib/aws-sdk-code-generator/resource_attribute.rb +76 -0
- data/lib/aws-sdk-code-generator/resource_batch_action.rb +56 -0
- data/lib/aws-sdk-code-generator/resource_batch_action_code.rb +136 -0
- data/lib/aws-sdk-code-generator/resource_batch_action_documentation.rb +108 -0
- data/lib/aws-sdk-code-generator/resource_batch_builder.rb +212 -0
- data/lib/aws-sdk-code-generator/resource_builder.rb +48 -0
- data/lib/aws-sdk-code-generator/resource_client_request.rb +62 -0
- data/lib/aws-sdk-code-generator/resource_client_request_documentation.rb +81 -0
- data/lib/aws-sdk-code-generator/resource_client_request_params.rb +86 -0
- data/lib/aws-sdk-code-generator/resource_data_method.rb +60 -0
- data/lib/aws-sdk-code-generator/resource_has_association.rb +117 -0
- data/lib/aws-sdk-code-generator/resource_has_many_association.rb +52 -0
- data/lib/aws-sdk-code-generator/resource_has_many_association_code.rb +76 -0
- data/lib/aws-sdk-code-generator/resource_identifier.rb +44 -0
- data/lib/aws-sdk-code-generator/resource_identifiers_method.rb +29 -0
- data/lib/aws-sdk-code-generator/resource_load_method.rb +68 -0
- data/lib/aws-sdk-code-generator/resource_method.rb +22 -0
- data/lib/aws-sdk-code-generator/resource_skip_params.rb +36 -0
- data/lib/aws-sdk-code-generator/resource_value_source.rb +68 -0
- data/lib/aws-sdk-code-generator/resource_waiter.rb +80 -0
- data/lib/aws-sdk-code-generator/service.rb +30 -7
- data/lib/aws-sdk-code-generator/shared_example.rb +131 -0
- data/lib/aws-sdk-code-generator/syntax_example.rb +60 -0
- data/lib/aws-sdk-code-generator/syntax_example_hash.rb +174 -0
- data/lib/aws-sdk-code-generator/underscore.rb +10 -5
- data/lib/aws-sdk-code-generator/view.rb +33 -0
- data/lib/aws-sdk-code-generator/views.rb +2 -0
- data/lib/aws-sdk-code-generator/views/apig_endpoint_class.rb +25 -0
- data/lib/aws-sdk-code-generator/views/apig_readme.rb +32 -0
- data/lib/aws-sdk-code-generator/views/async_client_class.rb +68 -0
- data/lib/aws-sdk-code-generator/views/authorizer_class.rb +17 -0
- data/lib/aws-sdk-code-generator/views/client_api_module.rb +583 -0
- data/lib/aws-sdk-code-generator/views/client_class.rb +93 -0
- data/lib/aws-sdk-code-generator/views/docstring.rb +27 -0
- data/lib/aws-sdk-code-generator/views/errors_module.rb +32 -0
- data/lib/aws-sdk-code-generator/views/event_streams_module.rb +149 -0
- data/lib/aws-sdk-code-generator/views/features/env.rb +9 -0
- data/lib/aws-sdk-code-generator/views/features/smoke.rb +51 -0
- data/lib/aws-sdk-code-generator/views/features/smoke_step_definitions.rb +26 -0
- data/lib/aws-sdk-code-generator/views/features/step_definitions.rb +2 -0
- data/lib/aws-sdk-code-generator/views/gemspec.rb +39 -5
- data/lib/aws-sdk-code-generator/views/resource_class.rb +122 -0
- data/lib/aws-sdk-code-generator/views/root_resource_class.rb +58 -0
- data/lib/aws-sdk-code-generator/views/service_module.rb +30 -14
- data/lib/aws-sdk-code-generator/views/spec/spec_helper.rb +9 -0
- data/lib/aws-sdk-code-generator/views/types_module.rb +294 -0
- data/lib/aws-sdk-code-generator/views/version.rb +2 -0
- data/lib/aws-sdk-code-generator/views/waiters_module.rb +37 -0
- data/lib/aws-sdk-code-generator/waiter.rb +95 -0
- data/lib/aws-sdk-code-generator/yard_option_tag.rb +43 -0
- metadata +61 -68
- data/lib/aws-sdk-code-generator/dsl/access_control_statement.rb +0 -23
- data/lib/aws-sdk-code-generator/dsl/attribute_accessor.rb +0 -43
- data/lib/aws-sdk-code-generator/dsl/attribute_reader.rb +0 -11
- data/lib/aws-sdk-code-generator/dsl/attribute_writer.rb +0 -11
- data/lib/aws-sdk-code-generator/dsl/autoload_statement.rb +0 -15
- data/lib/aws-sdk-code-generator/dsl/block_param.rb +0 -11
- data/lib/aws-sdk-code-generator/dsl/class.rb +0 -27
- data/lib/aws-sdk-code-generator/dsl/code_literal.rb +0 -66
- data/lib/aws-sdk-code-generator/dsl/code_object.rb +0 -33
- data/lib/aws-sdk-code-generator/dsl/docstring.rb +0 -36
- data/lib/aws-sdk-code-generator/dsl/eigenclass.rb +0 -15
- data/lib/aws-sdk-code-generator/dsl/extend_statement.rb +0 -12
- data/lib/aws-sdk-code-generator/dsl/formatter.rb +0 -25
- data/lib/aws-sdk-code-generator/dsl/include_statement.rb +0 -17
- data/lib/aws-sdk-code-generator/dsl/main.rb +0 -105
- data/lib/aws-sdk-code-generator/dsl/method.rb +0 -108
- data/lib/aws-sdk-code-generator/dsl/module.rb +0 -167
- data/lib/aws-sdk-code-generator/dsl/option_tag.rb +0 -36
- data/lib/aws-sdk-code-generator/dsl/param.rb +0 -43
- data/lib/aws-sdk-code-generator/dsl/param_list.rb +0 -38
- data/lib/aws-sdk-code-generator/dsl/return_tag.rb +0 -19
- data/lib/aws-sdk-code-generator/dsl/tag_default.rb +0 -20
- data/lib/aws-sdk-code-generator/dsl/tag_docstring.rb +0 -27
- data/lib/aws-sdk-code-generator/dsl/tag_type.rb +0 -18
- data/lib/aws-sdk-code-generator/generators/client_api_module.rb +0 -334
- data/lib/aws-sdk-code-generator/generators/client_class.rb +0 -389
- data/lib/aws-sdk-code-generator/generators/client_operation_documentation.rb +0 -166
- data/lib/aws-sdk-code-generator/generators/errors_module.rb +0 -25
- data/lib/aws-sdk-code-generator/generators/resource/action.rb +0 -88
- data/lib/aws-sdk-code-generator/generators/resource/batch_builder.rb +0 -211
- data/lib/aws-sdk-code-generator/generators/resource/builder.rb +0 -50
- data/lib/aws-sdk-code-generator/generators/resource/client_getter.rb +0 -15
- data/lib/aws-sdk-code-generator/generators/resource/client_request.rb +0 -49
- data/lib/aws-sdk-code-generator/generators/resource/client_request_docs.rb +0 -97
- data/lib/aws-sdk-code-generator/generators/resource/client_request_params.rb +0 -88
- data/lib/aws-sdk-code-generator/generators/resource/collection_class.rb +0 -180
- data/lib/aws-sdk-code-generator/generators/resource/data_attribute_getter.rb +0 -24
- data/lib/aws-sdk-code-generator/generators/resource/data_loaded_method.rb +0 -18
- data/lib/aws-sdk-code-generator/generators/resource/data_method.rb +0 -49
- data/lib/aws-sdk-code-generator/generators/resource/exists_method.rb +0 -29
- data/lib/aws-sdk-code-generator/generators/resource/extract_identifier_method.rb +0 -32
- data/lib/aws-sdk-code-generator/generators/resource/has_association.rb +0 -101
- data/lib/aws-sdk-code-generator/generators/resource/has_many_association.rb +0 -108
- data/lib/aws-sdk-code-generator/generators/resource/identifier_getter.rb +0 -26
- data/lib/aws-sdk-code-generator/generators/resource/identifiers_method.rb +0 -28
- data/lib/aws-sdk-code-generator/generators/resource/initialize_method.rb +0 -67
- data/lib/aws-sdk-code-generator/generators/resource/load_method.rb +0 -65
- data/lib/aws-sdk-code-generator/generators/resource/value_source.rb +0 -68
- data/lib/aws-sdk-code-generator/generators/resource/waiter_method.rb +0 -61
- data/lib/aws-sdk-code-generator/generators/resource_class.rb +0 -325
- data/lib/aws-sdk-code-generator/generators/response_structure_example.rb +0 -83
- data/lib/aws-sdk-code-generator/generators/root_resource_class.rb +0 -42
- data/lib/aws-sdk-code-generator/generators/service_documentation.rb +0 -64
- data/lib/aws-sdk-code-generator/generators/shared_example.rb +0 -132
- data/lib/aws-sdk-code-generator/generators/structure_type_class.rb +0 -95
- data/lib/aws-sdk-code-generator/generators/syntax_example.rb +0 -169
- data/lib/aws-sdk-code-generator/generators/types_module.rb +0 -52
- data/lib/aws-sdk-code-generator/generators/waiter_class.rb +0 -62
- data/lib/aws-sdk-code-generator/generators/waiters_module.rb +0 -20
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
module Views
|
5
|
+
class ClientClass < View
|
6
|
+
|
7
|
+
# @option options [required, String] :service_identifier
|
8
|
+
# @option options [required, String] :service_name
|
9
|
+
# @option options [required, String] :module_name
|
10
|
+
# @option options [required, String] :gem_name
|
11
|
+
# @option options [required, String] :gem_version
|
12
|
+
# @option options [required, String] :aws_sdk_core_lib_path
|
13
|
+
# @option options [required, String] :protocol
|
14
|
+
# @option options [required, String] :signature_version
|
15
|
+
# @option options [required, Boolean] :endpoint_discovery_required
|
16
|
+
# @option options [required, Hash] :add_plugins
|
17
|
+
# @option options [required, Array] :remove_plugins
|
18
|
+
# @option options [required, Hash] :api
|
19
|
+
# @option options [Hash] :waiters
|
20
|
+
# @option options [Hash] :client_examples
|
21
|
+
def initialize(options)
|
22
|
+
@service_identifier = options.fetch(:service_identifier)
|
23
|
+
@service_name = options.fetch(:service_name)
|
24
|
+
@module_name = options.fetch(:module_name)
|
25
|
+
@gem_name = options.fetch(:gem_name)
|
26
|
+
@gem_version = options.fetch(:gem_version)
|
27
|
+
@plugins = PluginList.new(options)
|
28
|
+
@client_constructor = ClientConstructor.new(options.merge(plugins: @plugins))
|
29
|
+
@operations = ClientOperationList.new(options).to_a
|
30
|
+
@waiters = Waiter.build_list(options[:waiters])
|
31
|
+
@custom = options.fetch(:custom)
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [String]
|
35
|
+
attr_reader :service_identifier
|
36
|
+
|
37
|
+
# @return [String]
|
38
|
+
attr_reader :service_name
|
39
|
+
|
40
|
+
# @return [String]
|
41
|
+
attr_reader :module_name
|
42
|
+
|
43
|
+
# @return [String]
|
44
|
+
attr_reader :gem_name
|
45
|
+
|
46
|
+
# @return [String]
|
47
|
+
attr_reader :gem_version
|
48
|
+
|
49
|
+
# @return [ClientConstructor]
|
50
|
+
attr_reader :client_constructor
|
51
|
+
|
52
|
+
# @return [Array<Operation>]
|
53
|
+
attr_reader :operations
|
54
|
+
|
55
|
+
# @return [String|nil]
|
56
|
+
def generated_src_warning
|
57
|
+
return if @custom
|
58
|
+
GENERATED_SRC_WARNING
|
59
|
+
end
|
60
|
+
|
61
|
+
# @return [Array<String>]
|
62
|
+
def plugin_requires
|
63
|
+
@plugins.map(&:require_path)
|
64
|
+
end
|
65
|
+
|
66
|
+
# @return [Array<String>]
|
67
|
+
def plugin_class_names
|
68
|
+
@plugins.map(&:class_name)
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return [Array<Waiter>]
|
72
|
+
def waiters
|
73
|
+
@waiters
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Boolean]
|
77
|
+
def waiters?
|
78
|
+
@waiters.size > 0
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [String<Markdown>]
|
82
|
+
def waiters_markdown_table
|
83
|
+
Waiter.markdown_table(@waiters)
|
84
|
+
end
|
85
|
+
|
86
|
+
# @return [Boolean]
|
87
|
+
def authorizer?
|
88
|
+
@custom
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'set'
|
4
|
+
|
5
|
+
module AwsSdkCodeGenerator
|
6
|
+
module Views
|
7
|
+
class BlockComment < View
|
8
|
+
|
9
|
+
# @param [String, nil] text
|
10
|
+
def initialize(text)
|
11
|
+
@text = text
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Array<String>]
|
15
|
+
def lines
|
16
|
+
@text.to_s.lines.map do |line|
|
17
|
+
if line == "\n"
|
18
|
+
"#"
|
19
|
+
else
|
20
|
+
"# #{line}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
module Views
|
5
|
+
class ErrorsModule < View
|
6
|
+
|
7
|
+
# @option options [required, Service] :service
|
8
|
+
def initialize(options)
|
9
|
+
@service = options.fetch(:service)
|
10
|
+
@service_name = @service.name
|
11
|
+
@errors = ErrorList.new(api: @service.api, module_name: module_name).to_a
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Array<Error>]
|
15
|
+
attr_reader :errors
|
16
|
+
|
17
|
+
# @return [String]
|
18
|
+
attr_reader :service_name
|
19
|
+
|
20
|
+
# @return [String|nil]
|
21
|
+
def generated_src_warning
|
22
|
+
return if @service.protocol == 'api-gateway'
|
23
|
+
GENERATED_SRC_WARNING
|
24
|
+
end
|
25
|
+
|
26
|
+
def module_name
|
27
|
+
@service.module_name
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
module Views
|
5
|
+
class EventStreamsModule < View
|
6
|
+
|
7
|
+
include Helper
|
8
|
+
|
9
|
+
def initialize(options)
|
10
|
+
@service = options.fetch(:service)
|
11
|
+
input, output = extract_eventstreams
|
12
|
+
@input_eventstreams = input
|
13
|
+
@output_eventstreams = output
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Array<EventStreamClass>]
|
17
|
+
attr_reader :input_eventstreams
|
18
|
+
|
19
|
+
# @return [Array<EventStreamClass>]
|
20
|
+
attr_reader :output_eventstreams
|
21
|
+
|
22
|
+
# @return [String|nil]
|
23
|
+
def generated_src_warning
|
24
|
+
return if @service.protocol == 'api-gateway'
|
25
|
+
GENERATED_SRC_WARNING
|
26
|
+
end
|
27
|
+
|
28
|
+
def module_name
|
29
|
+
@service.module_name
|
30
|
+
end
|
31
|
+
|
32
|
+
def extract_eventstreams
|
33
|
+
es = []
|
34
|
+
@service.api['operations'].each do |_, ref|
|
35
|
+
pair = []
|
36
|
+
if input = ref['input']
|
37
|
+
input_shape = @service.api['shapes'][input['shape']]
|
38
|
+
input_shape['members'].each do |_, m_ref|
|
39
|
+
if @service.api['shapes'][m_ref['shape']]['eventstream']
|
40
|
+
shape = @service.api['shapes'][m_ref['shape']]
|
41
|
+
pair << {
|
42
|
+
class_name: m_ref['shape'],
|
43
|
+
event_entries: eventstream_members_w_doc(shape),
|
44
|
+
types: eventstream_members(shape)
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
# have a placeholder for input
|
50
|
+
pair << nil if pair.empty?
|
51
|
+
if output = ref['output']
|
52
|
+
output_shape = @service.api['shapes'][output['shape']]
|
53
|
+
output_shape['members'].each do |_, m_ref|
|
54
|
+
if @service.api['shapes'][m_ref['shape']]['eventstream']
|
55
|
+
shape = @service.api['shapes'][m_ref['shape']]
|
56
|
+
pair << {
|
57
|
+
class_name: m_ref['shape'],
|
58
|
+
types: eventstream_members(shape)
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
es << pair unless pair.compact.empty?
|
64
|
+
end
|
65
|
+
# rename eventstream when needed
|
66
|
+
input_es = []
|
67
|
+
output_es = []
|
68
|
+
es.each do |pair|
|
69
|
+
input, output = pair
|
70
|
+
# bidirectional and sharing same eventstream shape
|
71
|
+
if input && output && input[:class_name] == output[:class_name]
|
72
|
+
input[:class_name] = "Input" + input[:class_name]
|
73
|
+
output[:class_name] = "Output" + output[:class_name]
|
74
|
+
end
|
75
|
+
input_es << EventStreamClass.new(input) if input
|
76
|
+
output_es << EventStreamClass.new(output) if output
|
77
|
+
end
|
78
|
+
[input_es, output_es]
|
79
|
+
end
|
80
|
+
|
81
|
+
def eventstream_members(shape)
|
82
|
+
raise 'no event members for an eventstream' if shape['members'].nil?
|
83
|
+
shape['members'].keys.map {|m| underscore(m)}
|
84
|
+
end
|
85
|
+
|
86
|
+
def eventstream_members_w_doc(shape)
|
87
|
+
raise 'no event members for an eventstream' if shape['members'].nil?
|
88
|
+
shape['members'].inject([]) do |m, (n, ref)|
|
89
|
+
event_shape = @service.api['shapes'][ref['shape']]
|
90
|
+
option_tags = event_shape['members'].map do |member_name, member_ref|
|
91
|
+
next if member_ref['documented'] === false
|
92
|
+
docstring = Api.docstring(member_ref, @service.api)
|
93
|
+
YardOptionTag.new(
|
94
|
+
name: Underscore.underscore(member_name),
|
95
|
+
ruby_type: Api.ruby_input_type(member_ref, @service.api),
|
96
|
+
required: shape.fetch('required', []).include?(member_name),
|
97
|
+
docstring: Docstring.html_to_markdown(docstring),
|
98
|
+
option_hash_name: 'params',
|
99
|
+
).to_s
|
100
|
+
end
|
101
|
+
param_hash_str = Docstring.join_docstrings([option_tags], block_comment: false)
|
102
|
+
m << EventEntry.new(
|
103
|
+
name: underscore(n),
|
104
|
+
param_hash: Docstring.indent(param_hash_str, ' ')
|
105
|
+
)
|
106
|
+
m
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
class EventEntry
|
113
|
+
|
114
|
+
def initialize(options)
|
115
|
+
@name = options.fetch(:name)
|
116
|
+
@param_hash = options.fetch(:param_hash)
|
117
|
+
end
|
118
|
+
|
119
|
+
# @return [String]
|
120
|
+
attr_reader :name
|
121
|
+
|
122
|
+
# @return [String]
|
123
|
+
attr_reader :param_hash
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
class EventStreamClass
|
128
|
+
|
129
|
+
def initialize(options)
|
130
|
+
@class_name = options.fetch(:class_name)
|
131
|
+
@types = options.fetch(:types)
|
132
|
+
@event_entries = options[:event_entries] || []
|
133
|
+
end
|
134
|
+
|
135
|
+
# @return [String]
|
136
|
+
attr_accessor :class_name
|
137
|
+
|
138
|
+
# @return [Array<String>]
|
139
|
+
attr_accessor :types
|
140
|
+
|
141
|
+
# @return [Array<EventEntry>]
|
142
|
+
attr_reader :event_entries
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module AwsSdkCodeGenerator
|
2
4
|
module Views
|
3
5
|
module Features
|
@@ -12,12 +14,19 @@ module AwsSdkCodeGenerator
|
|
12
14
|
@gem_dependencies = service.gem_dependencies.map do |gem_name, _|
|
13
15
|
{ dependency: gem_name }
|
14
16
|
end
|
17
|
+
@custom = service.protocol == 'api-gateway'
|
15
18
|
end
|
16
19
|
|
17
20
|
attr_reader :gem_name
|
18
21
|
attr_reader :module_name
|
19
22
|
attr_reader :gem_dependencies
|
20
23
|
|
24
|
+
# @return [String|nil]
|
25
|
+
def generated_src_warning
|
26
|
+
return if @custom
|
27
|
+
GENERATED_SRC_WARNING
|
28
|
+
end
|
29
|
+
|
21
30
|
end
|
22
31
|
end
|
23
32
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
module Views
|
5
|
+
module Features
|
6
|
+
class Smoke < View
|
7
|
+
|
8
|
+
# @param [Hash] options
|
9
|
+
# @option options [required, Service] :service
|
10
|
+
def initialize(options)
|
11
|
+
service = options.fetch(:service)
|
12
|
+
@custom = service.protocol == 'api-gateway'
|
13
|
+
@service = service.name
|
14
|
+
|
15
|
+
# This will only be called if this is defined
|
16
|
+
smoke_json = service.smoke_tests
|
17
|
+
@client_region = smoke_json["defaultRegion"]
|
18
|
+
@smoke_tests = smoke_json["testCases"].map do |test|
|
19
|
+
h = {
|
20
|
+
operation: underscore(test["operationName"]),
|
21
|
+
smoke_test_tags: "@#{service.identifier} @smoke",
|
22
|
+
}
|
23
|
+
if test["errorExpectedFromService"]
|
24
|
+
h[:error_expectation] = "I expect an error was raised"
|
25
|
+
h[:scenario_string] = "Call Aws::#{service.module_name}::Client##{h[:operation]} and expect it to fail"
|
26
|
+
else
|
27
|
+
h[:error_expectation] = "I expect an error was not raised"
|
28
|
+
h[:scenario_string] = "Call #{service.module_name}::Client##{h[:operation]} and expect it to succeed"
|
29
|
+
end
|
30
|
+
h[:param_hash] = test["input"].inject({}) do |acc, kv|
|
31
|
+
raw_key, value = kv
|
32
|
+
key = underscore(raw_key)
|
33
|
+
acc[key] = value
|
34
|
+
acc
|
35
|
+
end.to_json
|
36
|
+
h
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
attr_reader :service, :client_region, :smoke_tests
|
41
|
+
|
42
|
+
# @return [String|nil]
|
43
|
+
def generated_src_warning
|
44
|
+
return if @custom
|
45
|
+
GENERATED_SRC_WARNING
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
module Views
|
5
|
+
module Features
|
6
|
+
class SmokeStepDefinitions < View
|
7
|
+
|
8
|
+
# @param [Hash] options
|
9
|
+
# @option options [required, Service] :service
|
10
|
+
def initialize(options)
|
11
|
+
service = options.fetch(:service)
|
12
|
+
@module_name = service.module_name
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :module_name
|
16
|
+
|
17
|
+
# @return [String|nil]
|
18
|
+
def generated_src_warning
|
19
|
+
return if @custom
|
20
|
+
GENERATED_SRC_WARNING
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module AwsSdkCodeGenerator
|
2
4
|
module Views
|
3
5
|
class Gemspec < View
|
@@ -5,6 +7,13 @@ module AwsSdkCodeGenerator
|
|
5
7
|
# @option options [required, Service] :service
|
6
8
|
def initialize(options)
|
7
9
|
@service = options.fetch(:service)
|
10
|
+
@custom = @service.protocol == 'api-gateway'
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [String|nil]
|
14
|
+
def generated_src_warning
|
15
|
+
return if @service.protocol == 'api-gateway'
|
16
|
+
GENERATED_SRC_WARNING
|
8
17
|
end
|
9
18
|
|
10
19
|
# @return [String]
|
@@ -12,21 +21,46 @@ module AwsSdkCodeGenerator
|
|
12
21
|
@service.gem_name
|
13
22
|
end
|
14
23
|
|
24
|
+
def author
|
25
|
+
@custom ? 'Author Name' : 'Amazon Web Services'
|
26
|
+
end
|
27
|
+
|
28
|
+
def homepage
|
29
|
+
@custom ? 'http://gem-homepage.com' : 'https://github.com/aws/aws-sdk-ruby'
|
30
|
+
end
|
31
|
+
|
32
|
+
def email
|
33
|
+
@custom ? 'yourname@email.com' : 'trevrowe@amazon.com'
|
34
|
+
end
|
35
|
+
|
15
36
|
# @return [String]
|
16
37
|
def summary
|
17
|
-
"AWS SDK for Ruby - #{@service.short_name}"
|
38
|
+
@custom ? @service.short_name : "AWS SDK for Ruby - #{@service.short_name}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def metadata
|
42
|
+
@custom ? false : true
|
18
43
|
end
|
19
44
|
|
20
45
|
# @return [String]
|
21
46
|
def description
|
22
|
-
if @
|
23
|
-
|
47
|
+
if @custom
|
48
|
+
desc = "Gem Description"
|
49
|
+
else
|
50
|
+
if @service.short_name != @service.full_name
|
51
|
+
abbreviation = " (#{@service.short_name})"
|
52
|
+
end
|
53
|
+
desc = "Official AWS Ruby gem for #{@service.full_name}#{abbreviation}. "
|
54
|
+
desc += 'This gem is part of the AWS SDK for Ruby.'
|
24
55
|
end
|
25
|
-
desc = "Official AWS Ruby gem for #{@service.full_name}#{abbreviation}. "
|
26
|
-
desc += 'This gem is part of the AWS SDK for Ruby.'
|
27
56
|
desc
|
28
57
|
end
|
29
58
|
|
59
|
+
# @return [String]
|
60
|
+
def code_uri
|
61
|
+
"https://github.com/aws/aws-sdk-ruby/tree/master/gems/#{gem_name}"
|
62
|
+
end
|
63
|
+
|
30
64
|
# @return [Array<Dependency>]
|
31
65
|
def dependencies
|
32
66
|
@service.gem_dependencies.map do |gem, version|
|