aws-sdk-code-generator 0.1.0.pre → 0.2.4.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +5 -5
  2. data/lib/aws-sdk-code-generator/api.rb +150 -0
  3. data/lib/aws-sdk-code-generator/apply_docs.rb +15 -2
  4. data/lib/aws-sdk-code-generator/client_constructor.rb +39 -0
  5. data/lib/aws-sdk-code-generator/client_operation_documentation.rb +282 -0
  6. data/lib/aws-sdk-code-generator/client_operation_list.rb +148 -0
  7. data/lib/aws-sdk-code-generator/client_response_structure_example.rb +115 -0
  8. data/lib/aws-sdk-code-generator/code_builder.rb +146 -133
  9. data/lib/aws-sdk-code-generator/crosslink.rb +42 -0
  10. data/lib/aws-sdk-code-generator/docstring.rb +199 -0
  11. data/lib/aws-sdk-code-generator/error_list.rb +77 -0
  12. data/lib/aws-sdk-code-generator/errors.rb +2 -0
  13. data/lib/aws-sdk-code-generator/eventstream_example.rb +220 -0
  14. data/lib/aws-sdk-code-generator/gem_builder.rb +42 -25
  15. data/lib/aws-sdk-code-generator/hash_formatter.rb +5 -2
  16. data/lib/aws-sdk-code-generator/helper.rb +86 -119
  17. data/lib/aws-sdk-code-generator/plugin_list.rb +147 -0
  18. data/lib/aws-sdk-code-generator/resource_action.rb +69 -0
  19. data/lib/aws-sdk-code-generator/resource_action_code.rb +57 -0
  20. data/lib/aws-sdk-code-generator/resource_association.rb +37 -0
  21. data/lib/aws-sdk-code-generator/resource_attribute.rb +76 -0
  22. data/lib/aws-sdk-code-generator/resource_batch_action.rb +56 -0
  23. data/lib/aws-sdk-code-generator/resource_batch_action_code.rb +136 -0
  24. data/lib/aws-sdk-code-generator/resource_batch_action_documentation.rb +108 -0
  25. data/lib/aws-sdk-code-generator/resource_batch_builder.rb +212 -0
  26. data/lib/aws-sdk-code-generator/resource_builder.rb +48 -0
  27. data/lib/aws-sdk-code-generator/resource_client_request.rb +62 -0
  28. data/lib/aws-sdk-code-generator/resource_client_request_documentation.rb +81 -0
  29. data/lib/aws-sdk-code-generator/resource_client_request_params.rb +86 -0
  30. data/lib/aws-sdk-code-generator/resource_data_method.rb +60 -0
  31. data/lib/aws-sdk-code-generator/resource_has_association.rb +117 -0
  32. data/lib/aws-sdk-code-generator/resource_has_many_association.rb +52 -0
  33. data/lib/aws-sdk-code-generator/resource_has_many_association_code.rb +76 -0
  34. data/lib/aws-sdk-code-generator/resource_identifier.rb +44 -0
  35. data/lib/aws-sdk-code-generator/resource_identifiers_method.rb +29 -0
  36. data/lib/aws-sdk-code-generator/resource_load_method.rb +68 -0
  37. data/lib/aws-sdk-code-generator/resource_method.rb +22 -0
  38. data/lib/aws-sdk-code-generator/resource_skip_params.rb +36 -0
  39. data/lib/aws-sdk-code-generator/resource_value_source.rb +68 -0
  40. data/lib/aws-sdk-code-generator/resource_waiter.rb +80 -0
  41. data/lib/aws-sdk-code-generator/service.rb +30 -7
  42. data/lib/aws-sdk-code-generator/shared_example.rb +131 -0
  43. data/lib/aws-sdk-code-generator/syntax_example.rb +60 -0
  44. data/lib/aws-sdk-code-generator/syntax_example_hash.rb +174 -0
  45. data/lib/aws-sdk-code-generator/underscore.rb +10 -5
  46. data/lib/aws-sdk-code-generator/view.rb +33 -0
  47. data/lib/aws-sdk-code-generator/views/apig_endpoint_class.rb +25 -0
  48. data/lib/aws-sdk-code-generator/views/apig_readme.rb +32 -0
  49. data/lib/aws-sdk-code-generator/views/async_client_class.rb +68 -0
  50. data/lib/aws-sdk-code-generator/views/authorizer_class.rb +17 -0
  51. data/lib/aws-sdk-code-generator/views/client_api_module.rb +602 -0
  52. data/lib/aws-sdk-code-generator/views/client_class.rb +93 -0
  53. data/lib/aws-sdk-code-generator/views/docstring.rb +27 -0
  54. data/lib/aws-sdk-code-generator/views/errors_module.rb +32 -0
  55. data/lib/aws-sdk-code-generator/views/event_streams_module.rb +149 -0
  56. data/lib/aws-sdk-code-generator/views/features/env.rb +9 -0
  57. data/lib/aws-sdk-code-generator/views/features/smoke.rb +52 -0
  58. data/lib/aws-sdk-code-generator/views/features/smoke_step_definitions.rb +26 -0
  59. data/lib/aws-sdk-code-generator/views/features/step_definitions.rb +6 -2
  60. data/lib/aws-sdk-code-generator/views/gemspec.rb +39 -5
  61. data/lib/aws-sdk-code-generator/views/resource_class.rb +122 -0
  62. data/lib/aws-sdk-code-generator/views/root_resource_class.rb +58 -0
  63. data/lib/aws-sdk-code-generator/views/service_module.rb +38 -14
  64. data/lib/aws-sdk-code-generator/views/spec/spec_helper.rb +9 -0
  65. data/lib/aws-sdk-code-generator/views/types_module.rb +329 -0
  66. data/lib/aws-sdk-code-generator/views/version.rb +2 -0
  67. data/lib/aws-sdk-code-generator/views/waiters_module.rb +37 -0
  68. data/lib/aws-sdk-code-generator/views.rb +2 -0
  69. data/lib/aws-sdk-code-generator/waiter.rb +95 -0
  70. data/lib/aws-sdk-code-generator/yard_option_tag.rb +43 -0
  71. data/lib/aws-sdk-code-generator.rb +68 -75
  72. data/templates/apig_endpoint_class.mustache +16 -0
  73. data/templates/apig_readme.mustache +62 -0
  74. data/templates/async_client_class.mustache +125 -0
  75. data/templates/authorizer_class.mustache +37 -0
  76. data/templates/client_api_module.mustache +106 -0
  77. data/templates/client_class.mustache +295 -0
  78. data/templates/code.mustache +4 -0
  79. data/templates/documentation.mustache +4 -0
  80. data/templates/errors_module.mustache +70 -0
  81. data/templates/event_streams_module.mustache +76 -0
  82. data/templates/features/env.mustache +15 -0
  83. data/templates/features/smoke.mustache +22 -0
  84. data/templates/features/smoke_step_definitions.mustache +31 -0
  85. data/templates/features/step_definitions.mustache +13 -0
  86. data/templates/gemspec.mustache +31 -0
  87. data/templates/license.txt +202 -0
  88. data/templates/method.mustache +7 -0
  89. data/templates/resource_class.mustache +304 -0
  90. data/templates/root_resource_class.mustache +51 -0
  91. data/templates/service_module.mustache +58 -0
  92. data/templates/spec/spec_helper.mustache +15 -0
  93. data/templates/types_module.mustache +53 -0
  94. data/templates/version.mustache +1 -0
  95. data/templates/waiters_module.mustache +112 -0
  96. metadata +115 -70
  97. data/lib/aws-sdk-code-generator/dsl/access_control_statement.rb +0 -23
  98. data/lib/aws-sdk-code-generator/dsl/attribute_accessor.rb +0 -43
  99. data/lib/aws-sdk-code-generator/dsl/attribute_reader.rb +0 -11
  100. data/lib/aws-sdk-code-generator/dsl/attribute_writer.rb +0 -11
  101. data/lib/aws-sdk-code-generator/dsl/autoload_statement.rb +0 -15
  102. data/lib/aws-sdk-code-generator/dsl/block_param.rb +0 -11
  103. data/lib/aws-sdk-code-generator/dsl/class.rb +0 -27
  104. data/lib/aws-sdk-code-generator/dsl/code_literal.rb +0 -66
  105. data/lib/aws-sdk-code-generator/dsl/code_object.rb +0 -33
  106. data/lib/aws-sdk-code-generator/dsl/docstring.rb +0 -36
  107. data/lib/aws-sdk-code-generator/dsl/eigenclass.rb +0 -15
  108. data/lib/aws-sdk-code-generator/dsl/extend_statement.rb +0 -12
  109. data/lib/aws-sdk-code-generator/dsl/formatter.rb +0 -25
  110. data/lib/aws-sdk-code-generator/dsl/include_statement.rb +0 -17
  111. data/lib/aws-sdk-code-generator/dsl/main.rb +0 -105
  112. data/lib/aws-sdk-code-generator/dsl/method.rb +0 -108
  113. data/lib/aws-sdk-code-generator/dsl/module.rb +0 -167
  114. data/lib/aws-sdk-code-generator/dsl/option_tag.rb +0 -36
  115. data/lib/aws-sdk-code-generator/dsl/param.rb +0 -43
  116. data/lib/aws-sdk-code-generator/dsl/param_list.rb +0 -38
  117. data/lib/aws-sdk-code-generator/dsl/return_tag.rb +0 -19
  118. data/lib/aws-sdk-code-generator/dsl/tag_default.rb +0 -20
  119. data/lib/aws-sdk-code-generator/dsl/tag_docstring.rb +0 -27
  120. data/lib/aws-sdk-code-generator/dsl/tag_type.rb +0 -18
  121. data/lib/aws-sdk-code-generator/generators/client_api_module.rb +0 -334
  122. data/lib/aws-sdk-code-generator/generators/client_class.rb +0 -389
  123. data/lib/aws-sdk-code-generator/generators/client_operation_documentation.rb +0 -166
  124. data/lib/aws-sdk-code-generator/generators/errors_module.rb +0 -25
  125. data/lib/aws-sdk-code-generator/generators/resource/action.rb +0 -88
  126. data/lib/aws-sdk-code-generator/generators/resource/batch_builder.rb +0 -211
  127. data/lib/aws-sdk-code-generator/generators/resource/builder.rb +0 -50
  128. data/lib/aws-sdk-code-generator/generators/resource/client_getter.rb +0 -15
  129. data/lib/aws-sdk-code-generator/generators/resource/client_request.rb +0 -49
  130. data/lib/aws-sdk-code-generator/generators/resource/client_request_docs.rb +0 -97
  131. data/lib/aws-sdk-code-generator/generators/resource/client_request_params.rb +0 -88
  132. data/lib/aws-sdk-code-generator/generators/resource/collection_class.rb +0 -180
  133. data/lib/aws-sdk-code-generator/generators/resource/data_attribute_getter.rb +0 -24
  134. data/lib/aws-sdk-code-generator/generators/resource/data_loaded_method.rb +0 -18
  135. data/lib/aws-sdk-code-generator/generators/resource/data_method.rb +0 -49
  136. data/lib/aws-sdk-code-generator/generators/resource/exists_method.rb +0 -29
  137. data/lib/aws-sdk-code-generator/generators/resource/extract_identifier_method.rb +0 -32
  138. data/lib/aws-sdk-code-generator/generators/resource/has_association.rb +0 -101
  139. data/lib/aws-sdk-code-generator/generators/resource/has_many_association.rb +0 -108
  140. data/lib/aws-sdk-code-generator/generators/resource/identifier_getter.rb +0 -26
  141. data/lib/aws-sdk-code-generator/generators/resource/identifiers_method.rb +0 -28
  142. data/lib/aws-sdk-code-generator/generators/resource/initialize_method.rb +0 -67
  143. data/lib/aws-sdk-code-generator/generators/resource/load_method.rb +0 -65
  144. data/lib/aws-sdk-code-generator/generators/resource/value_source.rb +0 -68
  145. data/lib/aws-sdk-code-generator/generators/resource/waiter_method.rb +0 -61
  146. data/lib/aws-sdk-code-generator/generators/resource_class.rb +0 -325
  147. data/lib/aws-sdk-code-generator/generators/response_structure_example.rb +0 -83
  148. data/lib/aws-sdk-code-generator/generators/root_resource_class.rb +0 -42
  149. data/lib/aws-sdk-code-generator/generators/service_documentation.rb +0 -64
  150. data/lib/aws-sdk-code-generator/generators/shared_example.rb +0 -132
  151. data/lib/aws-sdk-code-generator/generators/structure_type_class.rb +0 -95
  152. data/lib/aws-sdk-code-generator/generators/syntax_example.rb +0 -169
  153. data/lib/aws-sdk-code-generator/generators/types_module.rb +0 -52
  154. data/lib/aws-sdk-code-generator/generators/waiter_class.rb +0 -62
  155. data/lib/aws-sdk-code-generator/generators/waiters_module.rb +0 -20
@@ -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.
@@ -0,0 +1,7 @@
1
+ {{> documentation}}
2
+ def {{method_name}}{{#arguments}}({{{.}}}){{/arguments}}
3
+ {{> code}}
4
+ end
5
+ {{#alias}}
6
+ alias {{alias}} {{method_name}}
7
+ {{/alias}}
@@ -0,0 +1,304 @@
1
+ # frozen_string_literal: true
2
+
3
+ {{#generated_src_warning}}
4
+ {{generated_src_warning}}
5
+ {{/generated_src_warning}}
6
+ module {{module_name}}
7
+
8
+ class {{class_name}}
9
+
10
+ extend Aws::Deprecations
11
+
12
+ # @overload def initialize({{#identifiers}}{{name}}, {{/identifiers}}options = {})
13
+ {{#identifiers}}
14
+ # @param [{{type}}] {{name}}
15
+ {{/identifiers}}
16
+ # @option options [Client] :client
17
+ {{#identifiers?}}
18
+ # @overload def initialize(options = {})
19
+ {{#identifiers}}
20
+ # @option options [required, {{type}}] :{{name}}
21
+ {{/identifiers}}
22
+ # @option options [Client] :client
23
+ {{/identifiers?}}
24
+ def initialize(*args)
25
+ options = Hash === args.last ? args.pop.dup : {}
26
+ {{#identifiers}}
27
+ @{{name}} = extract_{{name}}(args, options)
28
+ {{/identifiers}}
29
+ {{#shape}}
30
+ @data = options.delete(:data)
31
+ {{/shape}}
32
+ {{^shape}}
33
+ @data = Aws::EmptyStructure.new
34
+ {{/shape}}
35
+ @client = options.delete(:client) || Client.new(options)
36
+ @waiter_block_warned = false
37
+ end
38
+
39
+ # @!group Read-Only Attributes
40
+ {{#identifiers}}
41
+
42
+ # @return [{{type}}]
43
+ def {{name}}
44
+ @{{name}}
45
+ end
46
+ {{#alias}}
47
+ alias :{{alias}} :{{name}}
48
+ {{/alias}}
49
+ {{/identifiers}}
50
+ {{#data_attributes}}
51
+
52
+ {{> documentation}}
53
+ def {{name}}
54
+ data[:{{name}}]
55
+ end
56
+ {{/data_attributes}}
57
+
58
+ # @!endgroup
59
+
60
+ # @return [Client]
61
+ def client
62
+ @client
63
+ end
64
+
65
+ {{#load_method}}
66
+ {{> method}}
67
+ {{/load_method}}
68
+ alias :reload :load
69
+
70
+ {{#data_method}}
71
+ {{> method}}
72
+ {{/data_method}}
73
+
74
+ # @return [Boolean]
75
+ # Returns `true` if this resource is loaded. Accessing attributes or
76
+ # {#data} on an unloaded resource will trigger a call to {#load}.
77
+ def data_loaded?
78
+ !!@data
79
+ end
80
+ {{#exists_waiter}}
81
+
82
+ # @param [Hash] options ({})
83
+ # @return [Boolean]
84
+ # Returns `true` if the {{class_name}} exists.
85
+ def exists?(options = {})
86
+ begin
87
+ wait_until_exists(options.merge(max_attempts: 1))
88
+ true
89
+ rescue Aws::Waiters::Errors::UnexpectedError => e
90
+ raise e.error
91
+ rescue Aws::Waiters::Errors::WaiterFailed
92
+ false
93
+ end
94
+ end
95
+ {{/exists_waiter}}
96
+ {{#waiters}}
97
+
98
+ # @param [Hash] options ({})
99
+ # @option options [Integer] :max_attempts ({{max_attempts}})
100
+ # @option options [Float] :delay ({{delay}})
101
+ # @option options [Proc] :before_attempt
102
+ # @option options [Proc] :before_wait
103
+ # @return [{{class_name}}]
104
+ def wait_until_{{name}}(options = {}, &block)
105
+ options, params = separate_params_and_options(options)
106
+ waiter = Waiters::{{waiter_class_name}}.new(options)
107
+ yield_waiter_and_warn(waiter, &block) if block_given?
108
+ {{#wait_call}}
109
+ {{#lines}}
110
+ {{{.}}}{{/lines}}
111
+ {{/wait_call}}
112
+ {{class_name}}.new({
113
+ {{#constructor_args}}
114
+ {{#lines}}
115
+ {{{.}}}{{/lines}}
116
+ {{/constructor_args}}
117
+ })
118
+ end
119
+ {{/waiters}}
120
+ {{#wait_until}}
121
+
122
+ # @deprecated Use [{{module_name}}::Client] #wait_until instead
123
+ #
124
+ # Waiter polls an API operation until a resource enters a desired
125
+ # state.
126
+ #
127
+ # @note The waiting operation is performed on a copy. The original resource
128
+ # remains unchanged.
129
+ #
130
+ # ## Basic Usage
131
+ #
132
+ # Waiter will polls until it is successful, it fails by
133
+ # entering a terminal state, or until a maximum number of attempts
134
+ # are made.
135
+ #
136
+ # # polls in a loop until condition is true
137
+ # resource.wait_until(options) {|resource| condition}
138
+ #
139
+ # ## Example
140
+ #
141
+ # instance.wait_until(max_attempts:10, delay:5) do |instance|
142
+ # instance.state.name == 'running'
143
+ # end
144
+ #
145
+ # ## Configuration
146
+ #
147
+ # You can configure the maximum number of polling attempts, and the
148
+ # delay (in seconds) between each polling attempt. The waiting condition is
149
+ # set by passing a block to {#wait_until}:
150
+ #
151
+ # # poll for ~25 seconds
152
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
153
+ #
154
+ # ## Callbacks
155
+ #
156
+ # You can be notified before each polling attempt and before each
157
+ # delay. If you throw `:success` or `:failure` from these callbacks,
158
+ # it will terminate the waiter.
159
+ #
160
+ # started_at = Time.now
161
+ # # poll for 1 hour, instead of a number of attempts
162
+ # proc = Proc.new do |attempts, response|
163
+ # throw :failure if Time.now - started_at > 3600
164
+ # end
165
+ #
166
+ # # disable max attempts
167
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
168
+ #
169
+ # ## Handling Errors
170
+ #
171
+ # When a waiter is successful, it returns the Resource. When a waiter
172
+ # fails, it raises an error.
173
+ #
174
+ # begin
175
+ # resource.wait_until(...)
176
+ # rescue Aws::Waiters::Errors::WaiterFailed
177
+ # # resource did not enter the desired state in time
178
+ # end
179
+ #
180
+ # @yieldparam [Resource] resource to be used in the waiting condition.
181
+ #
182
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
183
+ # terminates because the waiter has entered a state that it will not
184
+ # transition out of, preventing success.
185
+ #
186
+ # yet successful.
187
+ #
188
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
189
+ # encountered while polling for a resource that is not expected.
190
+ #
191
+ # @raise [NotImplementedError] Raised when the resource does not
192
+ #
193
+ # @option options [Integer] :max_attempts (10) Maximum number of
194
+ # attempts
195
+ # @option options [Integer] :delay (10) Delay between each
196
+ # attempt in seconds
197
+ # @option options [Proc] :before_attempt (nil) Callback
198
+ # invoked before each attempt
199
+ # @option options [Proc] :before_wait (nil) Callback
200
+ # invoked before each wait
201
+ # @return [Resource] if the waiter was successful
202
+ def wait_until(options = {}, &block)
203
+ self_copy = self.dup
204
+ attempts = 0
205
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
206
+ options[:delay] ||= 10
207
+ options[:poller] = Proc.new do
208
+ attempts += 1
209
+ if block.call(self_copy)
210
+ [:success, self_copy]
211
+ else
212
+ self_copy.reload unless attempts == options[:max_attempts]
213
+ :retry
214
+ end
215
+ end
216
+ Aws::Waiters::Waiter.new(options).wait({})
217
+ end
218
+ {{/wait_until}}
219
+ {{#actions?}}
220
+
221
+ # @!group Actions
222
+ {{#actions}}
223
+
224
+ {{> method}}
225
+ {{/actions}}
226
+ {{/actions?}}
227
+ {{#associations?}}
228
+
229
+ # @!group Associations
230
+ {{#associations}}
231
+
232
+ {{> method}}
233
+ {{/associations}}
234
+ {{/associations?}}
235
+
236
+ {{#identifiers_method}}
237
+ {{> method}}
238
+ {{/identifiers_method}}
239
+ deprecated(:identifiers)
240
+ {{#identifiers?}}
241
+
242
+ private
243
+ {{#identifiers}}
244
+
245
+ def extract_{{name}}(args, options)
246
+ value = args[{{offset}}] || options.delete(:{{name}})
247
+ case value
248
+ when {{type}} then value
249
+ when nil then raise ArgumentError, "missing required option :{{name}}"
250
+ else
251
+ msg = "expected :{{name}} to be a {{type}}, got #{value.class}"
252
+ raise ArgumentError, msg
253
+ end
254
+ end
255
+ {{/identifiers}}
256
+ {{/identifiers?}}
257
+ {{#waiters?}}
258
+
259
+ def yield_waiter_and_warn(waiter, &block)
260
+ if !@waiter_block_warned
261
+ msg = "pass options to configure the waiter; "\
262
+ "yielding the waiter is deprecated"
263
+ warn(msg)
264
+ @waiter_block_warned = true
265
+ end
266
+ yield(waiter.waiter)
267
+ end
268
+
269
+ def separate_params_and_options(options)
270
+ opts = Set.new(
271
+ [:client, :max_attempts, :delay, :before_attempt, :before_wait]
272
+ )
273
+ waiter_opts = {}
274
+ waiter_params = {}
275
+ options.each_pair do |key, value|
276
+ if opts.include?(key)
277
+ waiter_opts[key] = value
278
+ else
279
+ waiter_params[key] = value
280
+ end
281
+ end
282
+ waiter_opts[:client] ||= @client
283
+ [waiter_opts, waiter_params]
284
+ end
285
+ {{/waiters?}}
286
+
287
+ {{^batch_actions?}}
288
+ class Collection < Aws::Resources::Collection; end
289
+ {{/batch_actions?}}
290
+ {{#batch_actions?}}
291
+ class Collection < Aws::Resources::Collection
292
+
293
+ # @!group Batch Actions
294
+ {{#batch_actions}}
295
+
296
+ {{> method}}
297
+ {{/batch_actions}}
298
+
299
+ # @!endgroup
300
+
301
+ end
302
+ {{/batch_actions?}}
303
+ end
304
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ {{#generated_src_warning}}
4
+ {{generated_src_warning}}
5
+ {{/generated_src_warning}}
6
+ module {{module_name}}
7
+
8
+ {{#documentation?}}
9
+ # This class provides a resource oriented interface for {{service_name}}.
10
+ # To create a resource object:
11
+ #
12
+ # resource = {{module_name}}::Resource.new(region: 'us-west-2')
13
+ #
14
+ # You can supply a client object with custom configuration that will be used for all resource operations.
15
+ # If you do not pass `:client`, a default client will be constructed.
16
+ #
17
+ # client = {{module_name}}::Client.new(region: 'us-west-2')
18
+ # resource = {{module_name}}::Resource.new(client: client)
19
+ #
20
+ {{/documentation?}}
21
+ class Resource
22
+
23
+ # @param options ({})
24
+ # @option options [Client] :client
25
+ def initialize(options = {})
26
+ @client = options[:client] || Client.new(options)
27
+ end
28
+
29
+ # @return [Client]
30
+ def client
31
+ @client
32
+ end
33
+ {{#actions?}}
34
+
35
+ # @!group Actions
36
+ {{#actions}}
37
+
38
+ {{> method}}
39
+ {{/actions}}
40
+ {{/actions?}}
41
+ {{#associations?}}
42
+
43
+ # @!group Associations
44
+ {{#associations}}
45
+
46
+ {{> method}}
47
+ {{/associations}}
48
+ {{/associations?}}
49
+
50
+ end
51
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ {{#generated_src_warning}}
4
+ {{generated_src_warning}}
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?}}
15
+ {{#requires}}
16
+ require '{{.}}'
17
+ {{/requires}}
18
+ {{/require_core_guard?}}
19
+
20
+ {{#relative_requires}}
21
+ require_relative '{{.}}'
22
+ {{/relative_requires}}
23
+
24
+ # This module provides support for {{full_name}}. This module is available in the
25
+ # `{{gem_name}}` gem.
26
+ #
27
+ # # Client
28
+ #
29
+ # The {Client} class provides one method for each API operation. Operation
30
+ # methods each accept a hash of request parameters and return a response
31
+ # structure.
32
+ {{#example_operation_name}}
33
+ #
34
+ # {{example_var_name}} = {{module_name}}::Client.new
35
+ # resp = {{example_var_name}}.{{example_operation_name}}(params)
36
+ {{/example_operation_name}}
37
+ #
38
+ # See {Client} for more information.
39
+ #
40
+ # # Errors
41
+ #
42
+ # Errors returned from {{full_name}} are defined in the
43
+ # {Errors} module and all extend {Errors::ServiceError}.
44
+ #
45
+ # begin
46
+ # # do stuff
47
+ # rescue {{module_name}}::Errors::ServiceError
48
+ # # rescues all {{full_name}} API errors
49
+ # end
50
+ #
51
+ # See {Errors} for more information.
52
+ #
53
+ # @!group service
54
+ module {{module_name}}
55
+
56
+ GEM_VERSION = '{{gem_version}}'
57
+
58
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ {{#generated_src_warning}}
4
+ {{generated_src_warning}}
5
+ {{/generated_src_warning}}
6
+ require_relative '../../aws-sdk-core/spec/shared_spec_helper'
7
+
8
+ $:.unshift(File.expand_path('../../lib', __FILE__))
9
+ {{#gem_dependencies}}
10
+ $:.unshift(File.expand_path('../../../{{dependency}}/lib', __FILE__))
11
+ {{/gem_dependencies}}
12
+
13
+ require 'rspec'
14
+ require 'webmock/rspec'
15
+ require '{{gem_name}}'
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ {{#generated_src_warning}}
4
+ {{generated_src_warning}}
5
+ {{/generated_src_warning}}
6
+ module {{module_name}}
7
+ module Types
8
+ {{#structures}}
9
+
10
+ {{> documentation}}
11
+ {{#empty?}}
12
+ class {{class_name}} < Aws::EmptyStructure; end
13
+ {{/empty?}}
14
+ {{^empty?}}
15
+ class {{class_name}} < Struct.new(
16
+ {{#members}}
17
+ :{{member_name}}{{^last}},{{/last}}{{#last}}){{/last}}
18
+ {{/members}}
19
+ SENSITIVE = {{sensitive_params}}
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?}}
28
+ end
29
+ {{/empty?}}
30
+ {{/structures}}
31
+ {{#eventstreams}}
32
+
33
+ {{> documentation}}
34
+ class {{class_name}} < Enumerator
35
+
36
+ def event_types
37
+ {{#empty?}}
38
+ []
39
+ {{/empty?}}
40
+ {{^empty?}}
41
+ [
42
+ {{#types}}
43
+ :{{member_name}}{{^last}},{{/last}}
44
+ {{/types}}
45
+ ]
46
+ {{/empty?}}
47
+ end
48
+
49
+ end
50
+ {{/eventstreams}}
51
+
52
+ end
53
+ end
@@ -0,0 +1 @@
1
+ {{version}}