aws-sdk-code-generator 0.3.0.pre → 0.5.0.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/client_constructor.rb +2 -1
- data/lib/aws-sdk-code-generator/code_builder.rb +52 -0
- data/lib/aws-sdk-code-generator/eventstream_example.rb +34 -34
- data/lib/aws-sdk-code-generator/gem_builder.rb +3 -5
- data/lib/aws-sdk-code-generator/plugin_list.rb +2 -1
- data/lib/aws-sdk-code-generator/rbs/error_list.rb +38 -0
- data/lib/aws-sdk-code-generator/rbs/keyword_argument_builder.rb +159 -0
- data/lib/aws-sdk-code-generator/rbs/method_signature.rb +11 -0
- data/lib/aws-sdk-code-generator/rbs/resource_action.rb +39 -0
- data/lib/aws-sdk-code-generator/rbs/resource_association.rb +50 -0
- data/lib/aws-sdk-code-generator/rbs/resource_batch_action.rb +59 -0
- data/lib/aws-sdk-code-generator/rbs/resource_client_request.rb +40 -0
- data/lib/aws-sdk-code-generator/rbs/waiter.rb +53 -0
- data/lib/aws-sdk-code-generator/rbs.rb +40 -0
- data/lib/aws-sdk-code-generator/resource_batch_action_code.rb +3 -1
- data/lib/aws-sdk-code-generator/resource_client_request.rb +3 -1
- data/lib/aws-sdk-code-generator/resource_waiter.rb +6 -5
- data/lib/aws-sdk-code-generator/service.rb +21 -0
- data/lib/aws-sdk-code-generator/views/async_client_class.rb +5 -1
- data/lib/aws-sdk-code-generator/views/client_api_module.rb +29 -4
- data/lib/aws-sdk-code-generator/views/client_class.rb +5 -1
- data/lib/aws-sdk-code-generator/views/endpoint_provider_class.rb +221 -2
- data/lib/aws-sdk-code-generator/views/event_streams_module.rb +7 -1
- data/lib/aws-sdk-code-generator/views/features/smoke.rb +99 -23
- data/lib/aws-sdk-code-generator/views/features/step_definitions.rb +1 -4
- data/lib/aws-sdk-code-generator/views/gemspec.rb +13 -3
- data/lib/aws-sdk-code-generator/views/rbs/client_class.rb +172 -0
- data/lib/aws-sdk-code-generator/views/rbs/errors_module.rb +28 -0
- data/lib/aws-sdk-code-generator/views/rbs/resource_class.rb +95 -0
- data/lib/aws-sdk-code-generator/views/rbs/root_resource_class.rb +30 -0
- data/lib/aws-sdk-code-generator/views/rbs/types_module.rb +257 -0
- data/lib/aws-sdk-code-generator/views/rbs/waiters_module.rb +22 -0
- data/lib/aws-sdk-code-generator/views/spec/endpoint_provider_spec_class.rb +5 -1
- data/lib/aws-sdk-code-generator/views/types_module.rb +8 -9
- data/lib/aws-sdk-code-generator.rb +17 -1
- data/templates/client_api_module.mustache +7 -0
- data/templates/client_class.mustache +0 -45
- data/templates/endpoint_provider_class.mustache +1 -19
- data/templates/endpoints_module.mustache +1 -0
- data/templates/endpoints_plugin.mustache +4 -2
- data/templates/features/smoke.mustache +11 -15
- data/templates/features/step_definitions.mustache +0 -5
- data/templates/gemspec.mustache +5 -2
- data/templates/rbs/client_class.mustache +39 -0
- data/templates/rbs/errors_module.mustache +17 -0
- data/templates/rbs/resource_class.mustache +71 -0
- data/templates/rbs/root_resource_class.mustache +26 -0
- data/templates/rbs/types_module.mustache +37 -0
- data/templates/rbs/waiters_module.mustache +17 -0
- data/templates/resource_class.mustache +3 -1
- data/templates/spec/endpoint_provider_spec_class.mustache +10 -0
- metadata +24 -5
- data/lib/aws-sdk-code-generator/views/features/smoke_step_definitions.rb +0 -26
- data/templates/features/smoke_step_definitions.mustache +0 -31
@@ -0,0 +1,257 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
module Views
|
5
|
+
module RBS
|
6
|
+
class TypesModule < View
|
7
|
+
|
8
|
+
include Helper
|
9
|
+
|
10
|
+
# @option options [required, Service] :service
|
11
|
+
def initialize(options)
|
12
|
+
@service = options.fetch(:service)
|
13
|
+
@api = @service.api
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [String|nil]
|
17
|
+
def generated_src_warning
|
18
|
+
return if @service.protocol == 'api-gateway'
|
19
|
+
GENERATED_SRC_WARNING
|
20
|
+
end
|
21
|
+
|
22
|
+
def module_name
|
23
|
+
@service.module_name
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Array<StructClass>]
|
27
|
+
def structures
|
28
|
+
@service.api['shapes'].each do |_, shape|
|
29
|
+
if shape['eventstream']
|
30
|
+
# add internal exception_event ctrait to all exceptions
|
31
|
+
# exceptions will not have the event trait.
|
32
|
+
shape['members'].each do |name, ref|
|
33
|
+
if !!@service.api['shapes'][ref['shape']]['exception']
|
34
|
+
@service.api['shapes'][ref['shape']]['exception_event'] = true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
@service.api['shapes'].inject([]) do |list, (shape_name, shape)|
|
40
|
+
# APIG model can have input/output shape with downcase and '__'
|
41
|
+
if @service.protocol == 'api-gateway'
|
42
|
+
shape_name = lstrip_prefix(upcase_first(shape_name))
|
43
|
+
end
|
44
|
+
# eventstream shape will be inheriting from enumerator
|
45
|
+
if shape['eventstream']
|
46
|
+
list
|
47
|
+
elsif shape['type'] == 'structure' && !shape['document']
|
48
|
+
struct_members = struct_members(shape)
|
49
|
+
sensitive_params = struct_members.select(&:sensitive).map do |m|
|
50
|
+
m.member_name.to_sym
|
51
|
+
end
|
52
|
+
list << StructClass.new(
|
53
|
+
class_name: shape_name,
|
54
|
+
members: struct_members,
|
55
|
+
sensitive_params: sensitive_params,
|
56
|
+
documentation: struct_class_docs(shape_name, shape),
|
57
|
+
union: shape['union']
|
58
|
+
)
|
59
|
+
else
|
60
|
+
list
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# return [Array<EventStreamClass>]
|
66
|
+
def eventstreams
|
67
|
+
@service.api['shapes'].inject([]) do |list, (shape_name, shape)|
|
68
|
+
if shape['eventstream']
|
69
|
+
list << EventStreamClass.new(
|
70
|
+
class_name: shape_name,
|
71
|
+
types: struct_members(shape),
|
72
|
+
documentation: eventstream_class_docs(shape_name, shape)
|
73
|
+
)
|
74
|
+
else
|
75
|
+
list
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def struct_members(shape)
|
83
|
+
return if shape['members'].nil?
|
84
|
+
members = shape['members'].map do |member_name, member_ref|
|
85
|
+
sensitive = !!(member_ref['sensitive'] ||
|
86
|
+
@api['shapes'][member_ref['shape']]['sensitive'])
|
87
|
+
StructMember.new(
|
88
|
+
member_name: underscore(member_name),
|
89
|
+
sensitive: sensitive,
|
90
|
+
returns: AwsSdkCodeGenerator::RBS.to_type(member_ref, @api)
|
91
|
+
)
|
92
|
+
end
|
93
|
+
if shape['event'] || shape['exception_event']
|
94
|
+
members << StructMember.new(
|
95
|
+
member_name: 'event_type',
|
96
|
+
returns: 'untyped'
|
97
|
+
)
|
98
|
+
end
|
99
|
+
members
|
100
|
+
end
|
101
|
+
|
102
|
+
def struct_class_docs(shape_name, shape)
|
103
|
+
nil
|
104
|
+
end
|
105
|
+
|
106
|
+
def eventstream_class_docs(shape_name, shape)
|
107
|
+
nil
|
108
|
+
end
|
109
|
+
|
110
|
+
def eventstream_docs(shape_name)
|
111
|
+
nil
|
112
|
+
end
|
113
|
+
|
114
|
+
def output_example_docs(shape_name, shape)
|
115
|
+
nil
|
116
|
+
end
|
117
|
+
|
118
|
+
def input_example_docs(shape_name, shape)
|
119
|
+
nil
|
120
|
+
end
|
121
|
+
|
122
|
+
def attribute_macros_docs(shape_name)
|
123
|
+
nil
|
124
|
+
end
|
125
|
+
|
126
|
+
def idempotency_token?(member_ref)
|
127
|
+
member_ref['idempotencyToken'] || shape(member_ref)['idempotencyToken']
|
128
|
+
end
|
129
|
+
|
130
|
+
def idempotency_token_msg
|
131
|
+
"<p><b>A suitable default value is auto-generated.</b> You should normally not need to pass this option.</p>"
|
132
|
+
end
|
133
|
+
|
134
|
+
def visit_shapes(shape_ref, shapes)
|
135
|
+
return if shapes.include?(shape_ref['shape']) # recursion
|
136
|
+
shapes << shape_ref['shape']
|
137
|
+
s = shape(shape_ref)
|
138
|
+
raise "cannot locate shape #{shape_ref['shape']}" if s.nil?
|
139
|
+
case s['type']
|
140
|
+
when 'structure'
|
141
|
+
return if s['members'].nil?
|
142
|
+
s['members'].each_pair do |_, member_ref|
|
143
|
+
visit_shapes(member_ref, shapes)
|
144
|
+
end
|
145
|
+
when 'list'
|
146
|
+
visit_shapes(s['member'], shapes)
|
147
|
+
when 'map'
|
148
|
+
visit_shapes(s['key'], shapes)
|
149
|
+
visit_shapes(s['value'], shapes)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def shape(shape_ref)
|
154
|
+
Api.resolve(shape_ref, @api)[1]
|
155
|
+
end
|
156
|
+
|
157
|
+
class EventStreamClass
|
158
|
+
|
159
|
+
def initialize(options)
|
160
|
+
@class_name = options.fetch(:class_name)
|
161
|
+
@types = options.fetch(:types)
|
162
|
+
@documentation = options.fetch(:documentation)
|
163
|
+
if @types.nil? || @types.empty?
|
164
|
+
@empty = true
|
165
|
+
else
|
166
|
+
@empty = false
|
167
|
+
@types.last.last = true
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# @return [String]
|
172
|
+
attr_accessor :class_name
|
173
|
+
|
174
|
+
# @return [Array<StructMember>]
|
175
|
+
attr_accessor :types
|
176
|
+
|
177
|
+
# @return [String, nil]
|
178
|
+
attr_accessor :documentation
|
179
|
+
|
180
|
+
# @return [Boolean]
|
181
|
+
def empty?
|
182
|
+
@empty
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
class StructClass
|
188
|
+
|
189
|
+
def initialize(options)
|
190
|
+
@class_name = options.fetch(:class_name)
|
191
|
+
@members = options.fetch(:members)
|
192
|
+
@documentation = options.fetch(:documentation)
|
193
|
+
@sensitive_params = options.fetch(:sensitive_params)
|
194
|
+
@union = options.fetch(:union)
|
195
|
+
@members << StructMember.new(
|
196
|
+
member_name: :unknown,
|
197
|
+
returns: 'untyped' # FIXME
|
198
|
+
) if @union
|
199
|
+
if @members.nil? || @members.empty?
|
200
|
+
@empty = true
|
201
|
+
else
|
202
|
+
@empty = false
|
203
|
+
@members.last.last = true
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# @return [String]
|
208
|
+
attr_accessor :class_name
|
209
|
+
|
210
|
+
# @return [Array<StructMember>]
|
211
|
+
attr_accessor :members
|
212
|
+
|
213
|
+
# @return [String, nil]
|
214
|
+
attr_accessor :documentation
|
215
|
+
|
216
|
+
# @return [Array<Symbol>]
|
217
|
+
attr_accessor :sensitive_params
|
218
|
+
|
219
|
+
# @return [Boolean]
|
220
|
+
def union?
|
221
|
+
@union
|
222
|
+
end
|
223
|
+
|
224
|
+
# @return [Boolean]
|
225
|
+
def empty?
|
226
|
+
@empty
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
class StructMember
|
231
|
+
def initialize(member_name:, sensitive: false, returns:)
|
232
|
+
@member_name = member_name
|
233
|
+
@member_class_name = AwsSdkCodeGenerator::Helper::pascal_case(@member_name)
|
234
|
+
@sensitive = sensitive
|
235
|
+
@returns = returns
|
236
|
+
@last = false
|
237
|
+
end
|
238
|
+
|
239
|
+
# @return [String]
|
240
|
+
attr_accessor :member_name
|
241
|
+
|
242
|
+
# @return [Boolean]
|
243
|
+
attr_accessor :sensitive
|
244
|
+
|
245
|
+
# @return [String]
|
246
|
+
attr_accessor :member_class_name
|
247
|
+
|
248
|
+
# @return [String]
|
249
|
+
attr_accessor :returns
|
250
|
+
|
251
|
+
# @return [Boolean]
|
252
|
+
attr_accessor :last
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
module Views
|
5
|
+
module RBS
|
6
|
+
class WaitersModule < View
|
7
|
+
attr_reader :service_name
|
8
|
+
attr_reader :waiters
|
9
|
+
|
10
|
+
def initialize(service_name:, api:, waiters:)
|
11
|
+
@service_name = service_name
|
12
|
+
@waiters = AwsSdkCodeGenerator::RBS::Waiter.build_list(api: api, waiters: waiters)
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [String|nil]
|
16
|
+
def generated_src_warning
|
17
|
+
GENERATED_SRC_WARNING
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -90,6 +90,10 @@ module AwsSdkCodeGenerator
|
|
90
90
|
!@expect['endpoint']['properties']['authSchemes'].empty?
|
91
91
|
end
|
92
92
|
|
93
|
+
def s3_express_auth?
|
94
|
+
expect_auth? && expected_auth['name'] == 'sigv4-s3express'
|
95
|
+
end
|
96
|
+
|
93
97
|
def expected_headers
|
94
98
|
@expect['endpoint']['headers'].map { |k,v| Param.new(k, v.join(",")) }
|
95
99
|
end
|
@@ -137,7 +141,7 @@ module AwsSdkCodeGenerator
|
|
137
141
|
case value
|
138
142
|
when Hash
|
139
143
|
value.each_with_object({}) do |(k, v), o|
|
140
|
-
o[Underscore.underscore(k)] = transform_operation_values(v)
|
144
|
+
o[Underscore.underscore(k).to_sym] = transform_operation_values(v)
|
141
145
|
end
|
142
146
|
when Array
|
143
147
|
value.map { |v| transform_operation_values(v) }
|
@@ -28,14 +28,13 @@ module AwsSdkCodeGenerator
|
|
28
28
|
|
29
29
|
# @return [Array<StructClass>]
|
30
30
|
def structures
|
31
|
-
|
32
|
-
if
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
31
|
+
@service.api['shapes'].each do |_, shape|
|
32
|
+
if shape['eventstream']
|
33
|
+
# add internal exception_event ctrait to all exceptions
|
34
|
+
# exceptions will not have the event trait.
|
35
|
+
shape['members'].each do |name, ref|
|
36
|
+
if !!@service.api['shapes'][ref['shape']]['exception']
|
37
|
+
@service.api['shapes'][ref['shape']]['exception_event'] = true
|
39
38
|
end
|
40
39
|
end
|
41
40
|
end
|
@@ -93,7 +92,7 @@ module AwsSdkCodeGenerator
|
|
93
92
|
sensitive: sensitive
|
94
93
|
)
|
95
94
|
end
|
96
|
-
if shape['event']
|
95
|
+
if shape['event'] || shape['exception_event']
|
97
96
|
members << StructMember.new(member_name: 'event_type')
|
98
97
|
end
|
99
98
|
members
|
@@ -50,7 +50,6 @@ require_relative 'aws-sdk-code-generator/views/docstring'
|
|
50
50
|
require_relative 'aws-sdk-code-generator/views/errors_module'
|
51
51
|
require_relative 'aws-sdk-code-generator/views/features/env'
|
52
52
|
require_relative 'aws-sdk-code-generator/views/features/step_definitions'
|
53
|
-
require_relative 'aws-sdk-code-generator/views/features/smoke_step_definitions'
|
54
53
|
require_relative 'aws-sdk-code-generator/views/features/smoke'
|
55
54
|
require_relative 'aws-sdk-code-generator/views/gemspec'
|
56
55
|
require_relative 'aws-sdk-code-generator/views/resource_class'
|
@@ -76,6 +75,23 @@ require_relative 'aws-sdk-code-generator/yard_option_tag'
|
|
76
75
|
require_relative 'aws-sdk-code-generator/code_builder'
|
77
76
|
require_relative 'aws-sdk-code-generator/gem_builder'
|
78
77
|
|
78
|
+
# RBS
|
79
|
+
require_relative 'aws-sdk-code-generator/rbs'
|
80
|
+
require_relative 'aws-sdk-code-generator/rbs/error_list'
|
81
|
+
require_relative 'aws-sdk-code-generator/rbs/method_signature'
|
82
|
+
require_relative 'aws-sdk-code-generator/rbs/keyword_argument_builder'
|
83
|
+
require_relative 'aws-sdk-code-generator/rbs/resource_action'
|
84
|
+
require_relative 'aws-sdk-code-generator/rbs/resource_association'
|
85
|
+
require_relative 'aws-sdk-code-generator/rbs/resource_batch_action'
|
86
|
+
require_relative 'aws-sdk-code-generator/rbs/resource_client_request'
|
87
|
+
require_relative 'aws-sdk-code-generator/rbs/waiter'
|
88
|
+
require_relative 'aws-sdk-code-generator/views/rbs/client_class'
|
89
|
+
require_relative 'aws-sdk-code-generator/views/rbs/errors_module'
|
90
|
+
require_relative 'aws-sdk-code-generator/views/rbs/resource_class'
|
91
|
+
require_relative 'aws-sdk-code-generator/views/rbs/root_resource_class'
|
92
|
+
require_relative 'aws-sdk-code-generator/views/rbs/types_module'
|
93
|
+
require_relative 'aws-sdk-code-generator/views/rbs/waiters_module'
|
94
|
+
|
79
95
|
module AwsSdkCodeGenerator
|
80
96
|
|
81
97
|
GENERATED_SRC_WARNING = <<-WARNING_TXT
|
@@ -51,6 +51,13 @@ module {{module_name}}
|
|
51
51
|
{{/http_checksum}}
|
52
52
|
}
|
53
53
|
{{/http_checksum}}
|
54
|
+
{{#request_compression}}
|
55
|
+
o.request_compression = {
|
56
|
+
{{#request_compression}}
|
57
|
+
{{{key}}} => {{{value}}},
|
58
|
+
{{/request_compression}}
|
59
|
+
}
|
60
|
+
{{/request_compression}}
|
54
61
|
{{#deprecated}}
|
55
62
|
o.deprecated = true
|
56
63
|
{{/deprecated}}
|
@@ -38,51 +38,6 @@ module {{module_name}}
|
|
38
38
|
# @overload initialize(options)
|
39
39
|
# @param [Hash] options
|
40
40
|
{{>documentation}}
|
41
|
-
# @option options [URI::HTTP,String] :http_proxy A proxy to send
|
42
|
-
# requests through. Formatted like 'http://proxy.com:123'.
|
43
|
-
#
|
44
|
-
# @option options [Float] :http_open_timeout (15) The number of
|
45
|
-
# seconds to wait when opening a HTTP session before raising a
|
46
|
-
# `Timeout::Error`.
|
47
|
-
#
|
48
|
-
# @option options [Float] :http_read_timeout (60) The default
|
49
|
-
# number of seconds to wait for response data. This value can
|
50
|
-
# safely be set per-request on the session.
|
51
|
-
#
|
52
|
-
# @option options [Float] :http_idle_timeout (5) The number of
|
53
|
-
# seconds a connection is allowed to sit idle before it is
|
54
|
-
# considered stale. Stale connections are closed and removed
|
55
|
-
# from the pool before making a request.
|
56
|
-
#
|
57
|
-
# @option options [Float] :http_continue_timeout (1) The number of
|
58
|
-
# seconds to wait for a 100-continue response before sending the
|
59
|
-
# request body. This option has no effect unless the request has
|
60
|
-
# "Expect" header set to "100-continue". Defaults to `nil` which
|
61
|
-
# disables this behaviour. This value can safely be set per
|
62
|
-
# request on the session.
|
63
|
-
#
|
64
|
-
# @option options [Float] :ssl_timeout (nil) Sets the SSL timeout
|
65
|
-
# in seconds.
|
66
|
-
#
|
67
|
-
# @option options [Boolean] :http_wire_trace (false) When `true`,
|
68
|
-
# HTTP debug output will be sent to the `:logger`.
|
69
|
-
#
|
70
|
-
# @option options [Boolean] :ssl_verify_peer (true) When `true`,
|
71
|
-
# SSL peer certificates are verified when establishing a
|
72
|
-
# connection.
|
73
|
-
#
|
74
|
-
# @option options [String] :ssl_ca_bundle Full path to the SSL
|
75
|
-
# certificate authority bundle file that should be used when
|
76
|
-
# verifying peer certificates. If you do not pass
|
77
|
-
# `:ssl_ca_bundle` or `:ssl_ca_directory` the the system default
|
78
|
-
# will be used if available.
|
79
|
-
#
|
80
|
-
# @option options [String] :ssl_ca_directory Full path of the
|
81
|
-
# directory that contains the unbundled SSL certificate
|
82
|
-
# authority files for verifying peer certificates. If you do
|
83
|
-
# not pass `:ssl_ca_bundle` or `:ssl_ca_directory` the the
|
84
|
-
# system default will be used if available.
|
85
|
-
#
|
86
41
|
{{/client_constructor}}
|
87
42
|
def initialize(*args)
|
88
43
|
super
|
@@ -5,26 +5,8 @@
|
|
5
5
|
{{/generated_src_warning}}
|
6
6
|
module {{module_name}}
|
7
7
|
class EndpointProvider
|
8
|
-
def initialize(rule_set = nil)
|
9
|
-
@@rule_set ||= begin
|
10
|
-
endpoint_rules = Aws::Json.load(Base64.decode64(RULES))
|
11
|
-
Aws::Endpoints::RuleSet.new(
|
12
|
-
version: endpoint_rules['version'],
|
13
|
-
service_id: endpoint_rules['serviceId'],
|
14
|
-
parameters: endpoint_rules['parameters'],
|
15
|
-
rules: endpoint_rules['rules']
|
16
|
-
)
|
17
|
-
end
|
18
|
-
@provider = Aws::Endpoints::RulesProvider.new(rule_set || @@rule_set)
|
19
|
-
end
|
20
|
-
|
21
8
|
def resolve_endpoint(parameters)
|
22
|
-
|
9
|
+
{{{ endpoint_rules_code }}}
|
23
10
|
end
|
24
|
-
|
25
|
-
# @api private
|
26
|
-
RULES = <<-JSON
|
27
|
-
{{endpoint_rules_encoded}}
|
28
|
-
JSON
|
29
11
|
end
|
30
12
|
end
|
@@ -10,6 +10,7 @@ module {{module_name}}
|
|
10
10
|
option(
|
11
11
|
:endpoint_provider,
|
12
12
|
doc_type: '{{module_name}}::EndpointProvider',
|
13
|
+
rbs_type: 'untyped',
|
13
14
|
docstring: 'The endpoint provider used to resolve endpoints. Any '\
|
14
15
|
'object that responds to `#resolve_endpoint(parameters)` '\
|
15
16
|
'where `parameters` is a Struct similar to '\
|
@@ -29,16 +30,17 @@ module {{module_name}}
|
|
29
30
|
# @api private
|
30
31
|
class Handler < Seahorse::Client::Handler
|
31
32
|
def call(context)
|
32
|
-
# If endpoint was discovered, do not resolve or apply the endpoint.
|
33
33
|
unless context[:discovered_endpoint]
|
34
34
|
params = parameters_for_operation(context)
|
35
35
|
endpoint = context.config.endpoint_provider.resolve_endpoint(params)
|
36
36
|
|
37
37
|
context.http_request.endpoint = endpoint.url
|
38
38
|
apply_endpoint_headers(context, endpoint.headers)
|
39
|
+
|
40
|
+
context[:endpoint_params] = params
|
41
|
+
context[:endpoint_properties] = endpoint.properties
|
39
42
|
end
|
40
43
|
|
41
|
-
context[:endpoint_params] = params
|
42
44
|
context[:auth_scheme] =
|
43
45
|
Aws::Endpoints.resolve_auth_scheme(context, endpoint)
|
44
46
|
|
@@ -1,22 +1,18 @@
|
|
1
1
|
{{#generated_src_warning}}
|
2
2
|
{{generated_src_warning}}
|
3
3
|
{{/generated_src_warning}}
|
4
|
-
Feature: Smoke tests for {{
|
5
|
-
|
6
|
-
Background:
|
7
|
-
{{#client_endpoint}}
|
8
|
-
Given I create a client with endpoint '{{client_endpoint}}'
|
9
|
-
{{/client_endpoint}}
|
10
|
-
{{^client_endpoint}}
|
11
|
-
Given I create a client in region '{{client_region}}'
|
12
|
-
{{/client_endpoint}}
|
4
|
+
Feature: Smoke tests for {{service_name}}
|
13
5
|
{{#smoke_tests}}
|
14
6
|
|
15
|
-
{{
|
16
|
-
Scenario: {{
|
17
|
-
|
18
|
-
|
7
|
+
{{tags}}
|
8
|
+
Scenario: {{id}}
|
9
|
+
Given I create a '{{service_module}}' client with config:
|
10
|
+
"""
|
11
|
+
{{&config_hash}}
|
12
|
+
"""
|
13
|
+
When I call the operation '{{operation_name}}' with params:
|
14
|
+
"""
|
19
15
|
{{¶m_hash}}
|
20
|
-
|
21
|
-
|
16
|
+
"""
|
17
|
+
Then {{&expectation}}
|
22
18
|
{{/smoke_tests}}
|
@@ -1,10 +1,5 @@
|
|
1
1
|
Before("@{{var_name}}") do
|
2
|
-
{{#client_endpoint}}
|
3
|
-
@service = {{module_name}}::Resource.new(endpoint: '{{client_endpoint}}')
|
4
|
-
{{/client_endpoint}}
|
5
|
-
{{^client_endpoint}}
|
6
2
|
@service = {{module_name}}::Resource.new
|
7
|
-
{{/client_endpoint}}
|
8
3
|
@client = @service.client
|
9
4
|
end
|
10
5
|
|
data/templates/gemspec.mustache
CHANGED
@@ -24,8 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
{{/metadata}}
|
26
26
|
{{#dependencies}}
|
27
|
-
spec.add_dependency(
|
27
|
+
spec.add_dependency({{{gem_version}}})
|
28
28
|
{{/dependencies}}
|
29
29
|
|
30
|
-
spec.required_ruby_version = '>= 2.
|
30
|
+
spec.required_ruby_version = '>= 2.5'
|
31
|
+
{{#deprecated?}}
|
32
|
+
spec.post_install_message = '*** {{gem_name}} is deprecated ***'
|
33
|
+
{{/deprecated?}}
|
31
34
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
{{generated_src_warning}}
|
2
|
+
module Aws
|
3
|
+
module {{service_name}}
|
4
|
+
class Client < ::Seahorse::Client::Base
|
5
|
+
include ::Aws::ClientStubs
|
6
|
+
|
7
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/Client.html#initialize-instance_method
|
8
|
+
def self.new: ({{{client_option}}}) -> instance
|
9
|
+
| (?Hash[Symbol, untyped]) -> instance
|
10
|
+
|
11
|
+
{{#operations}}
|
12
|
+
|
13
|
+
{{^empty_structure}}
|
14
|
+
interface {{interface}}
|
15
|
+
include ::Seahorse::Client::_ResponseSuccess[{{data}}]
|
16
|
+
{{#returns_members}}
|
17
|
+
def {{method_name}}: () -> {{{returns}}}
|
18
|
+
{{/returns_members}}
|
19
|
+
end
|
20
|
+
{{/empty_structure}}
|
21
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/Client.html#{{method_name}}-instance_method
|
22
|
+
{{{signature}}}
|
23
|
+
{{/operations}}
|
24
|
+
{{#waiters?}}
|
25
|
+
|
26
|
+
{{#waiters_first}}
|
27
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/Client.html#wait_until-instance_method
|
28
|
+
def wait_until: {{{client_overload_keyword_argument}}}
|
29
|
+
| {{{client_overload_positional_argument}}}
|
30
|
+
{{/waiters_first}}
|
31
|
+
{{#waiters_others}}
|
32
|
+
| {{{client_overload_keyword_argument}}}
|
33
|
+
| {{{client_overload_positional_argument}}}
|
34
|
+
{{/waiters_others}}
|
35
|
+
{{/waiters?}}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{{generated_src_warning}}
|
2
|
+
module Aws
|
3
|
+
module {{service_name}}
|
4
|
+
module Errors
|
5
|
+
class ServiceError < ::Aws::Errors::ServiceError
|
6
|
+
end
|
7
|
+
|
8
|
+
{{#errors}}
|
9
|
+
class {{name}} < ::Aws::Errors::ServiceError
|
10
|
+
{{#members}}
|
11
|
+
{{{signature}}}
|
12
|
+
{{/members}}
|
13
|
+
end
|
14
|
+
{{/errors}}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|