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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aws-sdk-code-generator/client_constructor.rb +2 -1
  3. data/lib/aws-sdk-code-generator/code_builder.rb +52 -0
  4. data/lib/aws-sdk-code-generator/eventstream_example.rb +34 -34
  5. data/lib/aws-sdk-code-generator/gem_builder.rb +3 -5
  6. data/lib/aws-sdk-code-generator/plugin_list.rb +2 -1
  7. data/lib/aws-sdk-code-generator/rbs/error_list.rb +38 -0
  8. data/lib/aws-sdk-code-generator/rbs/keyword_argument_builder.rb +159 -0
  9. data/lib/aws-sdk-code-generator/rbs/method_signature.rb +11 -0
  10. data/lib/aws-sdk-code-generator/rbs/resource_action.rb +39 -0
  11. data/lib/aws-sdk-code-generator/rbs/resource_association.rb +50 -0
  12. data/lib/aws-sdk-code-generator/rbs/resource_batch_action.rb +59 -0
  13. data/lib/aws-sdk-code-generator/rbs/resource_client_request.rb +40 -0
  14. data/lib/aws-sdk-code-generator/rbs/waiter.rb +53 -0
  15. data/lib/aws-sdk-code-generator/rbs.rb +40 -0
  16. data/lib/aws-sdk-code-generator/resource_batch_action_code.rb +3 -1
  17. data/lib/aws-sdk-code-generator/resource_client_request.rb +3 -1
  18. data/lib/aws-sdk-code-generator/resource_waiter.rb +6 -5
  19. data/lib/aws-sdk-code-generator/service.rb +21 -0
  20. data/lib/aws-sdk-code-generator/views/async_client_class.rb +5 -1
  21. data/lib/aws-sdk-code-generator/views/client_api_module.rb +29 -4
  22. data/lib/aws-sdk-code-generator/views/client_class.rb +5 -1
  23. data/lib/aws-sdk-code-generator/views/endpoint_provider_class.rb +221 -2
  24. data/lib/aws-sdk-code-generator/views/event_streams_module.rb +7 -1
  25. data/lib/aws-sdk-code-generator/views/features/smoke.rb +99 -23
  26. data/lib/aws-sdk-code-generator/views/features/step_definitions.rb +1 -4
  27. data/lib/aws-sdk-code-generator/views/gemspec.rb +13 -3
  28. data/lib/aws-sdk-code-generator/views/rbs/client_class.rb +172 -0
  29. data/lib/aws-sdk-code-generator/views/rbs/errors_module.rb +28 -0
  30. data/lib/aws-sdk-code-generator/views/rbs/resource_class.rb +95 -0
  31. data/lib/aws-sdk-code-generator/views/rbs/root_resource_class.rb +30 -0
  32. data/lib/aws-sdk-code-generator/views/rbs/types_module.rb +257 -0
  33. data/lib/aws-sdk-code-generator/views/rbs/waiters_module.rb +22 -0
  34. data/lib/aws-sdk-code-generator/views/spec/endpoint_provider_spec_class.rb +5 -1
  35. data/lib/aws-sdk-code-generator/views/types_module.rb +8 -9
  36. data/lib/aws-sdk-code-generator.rb +17 -1
  37. data/templates/client_api_module.mustache +7 -0
  38. data/templates/client_class.mustache +0 -45
  39. data/templates/endpoint_provider_class.mustache +1 -19
  40. data/templates/endpoints_module.mustache +1 -0
  41. data/templates/endpoints_plugin.mustache +4 -2
  42. data/templates/features/smoke.mustache +11 -15
  43. data/templates/features/step_definitions.mustache +0 -5
  44. data/templates/gemspec.mustache +5 -2
  45. data/templates/rbs/client_class.mustache +39 -0
  46. data/templates/rbs/errors_module.mustache +17 -0
  47. data/templates/rbs/resource_class.mustache +71 -0
  48. data/templates/rbs/root_resource_class.mustache +26 -0
  49. data/templates/rbs/types_module.mustache +37 -0
  50. data/templates/rbs/waiters_module.mustache +17 -0
  51. data/templates/resource_class.mustache +3 -1
  52. data/templates/spec/endpoint_provider_spec_class.mustache +10 -0
  53. metadata +24 -5
  54. data/lib/aws-sdk-code-generator/views/features/smoke_step_definitions.rb +0 -26
  55. data/templates/features/smoke_step_definitions.mustache +0 -31
@@ -0,0 +1,71 @@
1
+ {{generated_src_warning}}
2
+ module Aws
3
+ module {{service_name}}
4
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html
5
+ class {{class_name}}
6
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#initialize-instance_method
7
+ {{{initialize_signature}}}
8
+ {{#identifiers}}
9
+
10
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#{{name}}-instance_method
11
+ def {{name}}: () -> {{type}}
12
+ {{#alias}}
13
+ alias {{alias}} {{name}}
14
+ {{/alias}}
15
+ {{/identifiers}}
16
+ {{#data_attributes}}
17
+
18
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#{{method_name}}-instance_method
19
+ {{{signature}}}
20
+ {{/data_attributes}}
21
+
22
+ def client: () -> Client
23
+
24
+ {{#load?}}
25
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#load-instance_method
26
+ def load: () -> self
27
+ alias reload load
28
+ {{/load?}}
29
+
30
+ {{#load_or_shape?}}
31
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#data-instance_method
32
+ def data: () -> Types::{{shape}}
33
+ {{/load_or_shape?}}
34
+ {{^load_or_shape?}}
35
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#data-instance_method
36
+ def data: () -> EmptyStructure
37
+ {{/load_or_shape?}}
38
+
39
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#data_loaded?-instance_method
40
+ def data_loaded?: () -> bool
41
+
42
+ {{#exists_waiters}}
43
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#exists?-instance_method
44
+ def exists?: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) -> bool
45
+ | (?Hash[Symbol, untyped]) -> bool
46
+ {{/exists_waiters}}
47
+ {{#waiters}}
48
+
49
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#{{method_name}}-instance_method
50
+ {{{signature}}}
51
+ {{/waiters}}
52
+ {{#actions}}
53
+
54
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#{{method_name}}-instance_method
55
+ {{{signature}}}
56
+ {{/actions}}
57
+ {{#associations}}
58
+
59
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/{{class_name}}.html#{{method_name}}-instance_method
60
+ {{{signature}}}
61
+ {{/associations}}
62
+
63
+ class Collection < ::Aws::Resources::Collection[{{class_name}}]
64
+ {{#batch_actions}}
65
+
66
+ {{{signature}}}
67
+ {{/batch_actions}}
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,26 @@
1
+ {{generated_src_warning}}
2
+ module Aws
3
+ module {{service_name}}
4
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/Resource.html
5
+ class Resource
6
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/Resource.html#initialize-instance_method
7
+ def initialize: (
8
+ ?client: Client,{{{client_option}}}) -> void
9
+ | (?Hash[Symbol, untyped]) -> void
10
+
11
+ def client: () -> Client
12
+
13
+ {{#actions}}
14
+
15
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/Resource.html#{{method_name}}-instance_method
16
+ {{{signature}}}
17
+ {{/actions}}
18
+
19
+ {{#associations}}
20
+
21
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/{{service_name}}/Resource.html#{{method_name}}-instance_method
22
+ {{{signature}}}
23
+ {{/associations}}
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,37 @@
1
+ {{#generated_src_warning}}
2
+ {{generated_src_warning}}
3
+ {{/generated_src_warning}}
4
+ module {{module_name}}
5
+ module Types
6
+ {{#structures}}
7
+
8
+ {{> documentation}}
9
+ {{#empty?}}
10
+ class {{class_name}} < Aws::EmptyStructure
11
+ end
12
+ {{/empty?}}
13
+ {{^empty?}}
14
+ class {{class_name}}
15
+ {{#members}}
16
+ attr_accessor {{member_name}}: {{{returns}}}
17
+ {{/members}}
18
+ SENSITIVE: {{sensitive_params}}
19
+ {{#union?}}
20
+
21
+ {{#members}}
22
+ class {{member_class_name}} < {{class_name}}
23
+ end
24
+ {{/members}}
25
+ {{/union?}}
26
+ end
27
+ {{/empty?}}
28
+ {{/structures}}
29
+ {{#eventstreams}}
30
+
31
+ {{> documentation}}
32
+ class {{class_name}} < Enumerator[untyped, untyped]
33
+ def event_types: () -> {{#empty?}}[]{{/empty?}}{{^empty?}}[{{#types}}:{{member_name}}{{^last}}, {{/last}}{{/types}}]{{/empty?}}
34
+ end
35
+ {{/eventstreams}}
36
+ end
37
+ end
@@ -0,0 +1,17 @@
1
+ {{generated_src_warning}}
2
+ module Aws
3
+ module {{service_name}}
4
+ module Waiters
5
+ {{#waiters}}
6
+
7
+ class {{class_name}}
8
+ def initialize: (?client: Client, ?max_attempts: Integer, ?delay: Integer, ?before_attempt: Proc, ?before_wait: Proc) -> void
9
+ | (?Hash[Symbol, untyped]) -> void
10
+
11
+ def wait: {{{waiter_overload_keyword_argument}}}
12
+ | {{{waiter_overload_positional_argument}}}
13
+ end
14
+ {{/waiters}}
15
+ end
16
+ end
17
+ end
@@ -213,7 +213,9 @@ module {{module_name}}
213
213
  :retry
214
214
  end
215
215
  end
216
- Aws::Waiters::Waiter.new(options).wait({})
216
+ Aws::Plugins::UserAgent.feature('resource') do
217
+ Aws::Waiters::Waiter.new(options).wait({})
218
+ end
217
219
  end
218
220
  {{/wait_until}}
219
221
  {{#actions?}}
@@ -50,6 +50,16 @@ module {{module_name}}
50
50
  {{/expect_error?}}
51
51
  {{^expect_error?}}
52
52
  {{#expect_auth?}}
53
+ {{#s3_express_auth?}}
54
+ client.stub_responses(:create_session, credentials: {
55
+ access_key_id: 's3-akid',
56
+ secret_access_key: 's3-secret',
57
+ session_token: 's3-session',
58
+ expiration: Time.now + 60 * 5
59
+ })
60
+ expect_auth({"name"=>"sigv4", "signingName"=>"s3express"})
61
+ Aws::S3.express_credentials_cache.clear
62
+ {{/s3_express_auth?}}
53
63
  expect_auth({{{expected_auth}}})
54
64
  {{/expect_auth?}}
55
65
  resp = client.{{operation_name}}(
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.3.0.pre
4
+ version: 0.5.0.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: 2022-12-20 00:00:00.000000000 Z
11
+ date: 2024-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -63,6 +63,15 @@ files:
63
63
  - lib/aws-sdk-code-generator/hash_formatter.rb
64
64
  - lib/aws-sdk-code-generator/helper.rb
65
65
  - lib/aws-sdk-code-generator/plugin_list.rb
66
+ - lib/aws-sdk-code-generator/rbs.rb
67
+ - lib/aws-sdk-code-generator/rbs/error_list.rb
68
+ - lib/aws-sdk-code-generator/rbs/keyword_argument_builder.rb
69
+ - lib/aws-sdk-code-generator/rbs/method_signature.rb
70
+ - lib/aws-sdk-code-generator/rbs/resource_action.rb
71
+ - lib/aws-sdk-code-generator/rbs/resource_association.rb
72
+ - lib/aws-sdk-code-generator/rbs/resource_batch_action.rb
73
+ - lib/aws-sdk-code-generator/rbs/resource_client_request.rb
74
+ - lib/aws-sdk-code-generator/rbs/waiter.rb
66
75
  - lib/aws-sdk-code-generator/resource_action.rb
67
76
  - lib/aws-sdk-code-generator/resource_action_code.rb
68
77
  - lib/aws-sdk-code-generator/resource_association.rb
@@ -108,9 +117,14 @@ files:
108
117
  - lib/aws-sdk-code-generator/views/event_streams_module.rb
109
118
  - lib/aws-sdk-code-generator/views/features/env.rb
110
119
  - lib/aws-sdk-code-generator/views/features/smoke.rb
111
- - lib/aws-sdk-code-generator/views/features/smoke_step_definitions.rb
112
120
  - lib/aws-sdk-code-generator/views/features/step_definitions.rb
113
121
  - lib/aws-sdk-code-generator/views/gemspec.rb
122
+ - lib/aws-sdk-code-generator/views/rbs/client_class.rb
123
+ - lib/aws-sdk-code-generator/views/rbs/errors_module.rb
124
+ - lib/aws-sdk-code-generator/views/rbs/resource_class.rb
125
+ - lib/aws-sdk-code-generator/views/rbs/root_resource_class.rb
126
+ - lib/aws-sdk-code-generator/views/rbs/types_module.rb
127
+ - lib/aws-sdk-code-generator/views/rbs/waiters_module.rb
114
128
  - lib/aws-sdk-code-generator/views/resource_class.rb
115
129
  - lib/aws-sdk-code-generator/views/root_resource_class.rb
116
130
  - lib/aws-sdk-code-generator/views/service_module.rb
@@ -137,11 +151,16 @@ files:
137
151
  - templates/event_streams_module.mustache
138
152
  - templates/features/env.mustache
139
153
  - templates/features/smoke.mustache
140
- - templates/features/smoke_step_definitions.mustache
141
154
  - templates/features/step_definitions.mustache
142
155
  - templates/gemspec.mustache
143
156
  - templates/license.txt
144
157
  - templates/method.mustache
158
+ - templates/rbs/client_class.mustache
159
+ - templates/rbs/errors_module.mustache
160
+ - templates/rbs/resource_class.mustache
161
+ - templates/rbs/root_resource_class.mustache
162
+ - templates/rbs/types_module.mustache
163
+ - templates/rbs/waiters_module.mustache
145
164
  - templates/resource_class.mustache
146
165
  - templates/root_resource_class.mustache
147
166
  - templates/service_module.mustache
@@ -169,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
188
  - !ruby/object:Gem::Version
170
189
  version: 1.3.1
171
190
  requirements: []
172
- rubygems_version: 3.2.22
191
+ rubygems_version: 3.4.1
173
192
  signing_key:
174
193
  specification_version: 4
175
194
  summary: AWS SDK for Ruby - Code Generator
@@ -1,26 +0,0 @@
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,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- {{#generated_src_warning}}
4
- {{generated_src_warning}}
5
- {{/generated_src_warning}}
6
- # Shared Smoke Test Definitions
7
- Given(/I create a client in region '(.*?)'/) do |region|
8
- @regional_client = {{module_name}}::Client.new(region: region)
9
- end
10
-
11
- Given(/I create a client with endpoint '(.*?)'/) do |endpoint|
12
- @regional_client = {{module_name}}::Client.new(endpoint: endpoint)
13
- end
14
-
15
- When(/I call the operation '(.*?)' with params:/) do |operation, params|
16
- opts = JSON.parse(params, symbolize_names: true)
17
- begin
18
- @regional_client.send(operation.to_sym, opts)
19
- @operation_raised_error = false
20
- rescue StandardError
21
- @operation_raised_error = true
22
- end
23
- end
24
-
25
- Then(/I expect an error was raised/) do
26
- expect(@operation_raised_error).to be_truthy
27
- end
28
-
29
- Then(/I expect an error was not raised/) do
30
- expect(@operation_raised_error).not_to be_truthy
31
- end