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
@@ -1,91 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'aws-sdk-code-generator/api'
1
4
  require_relative 'aws-sdk-code-generator/apply_docs'
5
+ require_relative 'aws-sdk-code-generator/client_constructor'
6
+ require_relative 'aws-sdk-code-generator/client_operation_documentation'
7
+ require_relative 'aws-sdk-code-generator/client_operation_list'
8
+ require_relative 'aws-sdk-code-generator/error_list'
9
+ require_relative 'aws-sdk-code-generator/client_response_structure_example'
10
+ require_relative 'aws-sdk-code-generator/crosslink'
11
+ require_relative 'aws-sdk-code-generator/docstring'
12
+ require_relative 'aws-sdk-code-generator/hash_formatter'
2
13
  require_relative 'aws-sdk-code-generator/helper'
14
+ require_relative 'aws-sdk-code-generator/plugin_list'
15
+ require_relative 'aws-sdk-code-generator/resource_action'
16
+ require_relative 'aws-sdk-code-generator/resource_action_code'
17
+ require_relative 'aws-sdk-code-generator/resource_association'
18
+ require_relative 'aws-sdk-code-generator/resource_attribute'
19
+ require_relative 'aws-sdk-code-generator/resource_batch_action'
20
+ require_relative 'aws-sdk-code-generator/resource_batch_action_code'
21
+ require_relative 'aws-sdk-code-generator/resource_batch_action_documentation'
22
+ require_relative 'aws-sdk-code-generator/resource_batch_builder'
23
+ require_relative 'aws-sdk-code-generator/resource_builder'
24
+ require_relative 'aws-sdk-code-generator/resource_client_request'
25
+ require_relative 'aws-sdk-code-generator/resource_client_request_documentation'
26
+ require_relative 'aws-sdk-code-generator/resource_client_request_params'
27
+ require_relative 'aws-sdk-code-generator/resource_data_method'
28
+ require_relative 'aws-sdk-code-generator/resource_has_association'
29
+ require_relative 'aws-sdk-code-generator/resource_has_many_association'
30
+ require_relative 'aws-sdk-code-generator/resource_has_many_association_code'
31
+ require_relative 'aws-sdk-code-generator/resource_identifier'
32
+ require_relative 'aws-sdk-code-generator/resource_identifiers_method'
33
+ require_relative 'aws-sdk-code-generator/resource_load_method'
34
+ require_relative 'aws-sdk-code-generator/resource_method'
35
+ require_relative 'aws-sdk-code-generator/resource_skip_params'
36
+ require_relative 'aws-sdk-code-generator/resource_value_source'
37
+ require_relative 'aws-sdk-code-generator/resource_waiter'
3
38
  require_relative 'aws-sdk-code-generator/service'
39
+ require_relative 'aws-sdk-code-generator/shared_example'
40
+ require_relative 'aws-sdk-code-generator/eventstream_example'
41
+ require_relative 'aws-sdk-code-generator/syntax_example'
42
+ require_relative 'aws-sdk-code-generator/syntax_example_hash'
4
43
  require_relative 'aws-sdk-code-generator/underscore'
5
44
  require_relative 'aws-sdk-code-generator/view'
6
-
7
- require_relative 'aws-sdk-code-generator/code_builder'
8
- require_relative 'aws-sdk-code-generator/gem_builder'
9
-
10
- # views
45
+ require_relative 'aws-sdk-code-generator/views/client_api_module'
46
+ require_relative 'aws-sdk-code-generator/views/client_class'
47
+ require_relative 'aws-sdk-code-generator/views/async_client_class'
48
+ require_relative 'aws-sdk-code-generator/views/docstring'
49
+ require_relative 'aws-sdk-code-generator/views/errors_module'
11
50
  require_relative 'aws-sdk-code-generator/views/features/env'
12
51
  require_relative 'aws-sdk-code-generator/views/features/step_definitions'
52
+ require_relative 'aws-sdk-code-generator/views/features/smoke_step_definitions'
53
+ require_relative 'aws-sdk-code-generator/views/features/smoke'
13
54
  require_relative 'aws-sdk-code-generator/views/gemspec'
55
+ require_relative 'aws-sdk-code-generator/views/resource_class'
56
+ require_relative 'aws-sdk-code-generator/views/root_resource_class'
14
57
  require_relative 'aws-sdk-code-generator/views/service_module'
15
58
  require_relative 'aws-sdk-code-generator/views/spec/spec_helper'
59
+ require_relative 'aws-sdk-code-generator/views/types_module'
60
+ require_relative 'aws-sdk-code-generator/views/event_streams_module'
61
+ require_relative 'aws-sdk-code-generator/views/authorizer_class'
62
+ require_relative 'aws-sdk-code-generator/views/apig_endpoint_class'
63
+ require_relative 'aws-sdk-code-generator/views/apig_readme'
16
64
  require_relative 'aws-sdk-code-generator/views/version'
65
+ require_relative 'aws-sdk-code-generator/views/waiters_module'
66
+ require_relative 'aws-sdk-code-generator/waiter'
67
+ require_relative 'aws-sdk-code-generator/yard_option_tag'
17
68
 
18
- module AwsSdkCodeGenerator
19
-
20
- autoload :Errors, 'aws-sdk-code-generator/errors'
21
- autoload :HashFormatter, 'aws-sdk-code-generator/hash_formatter'
22
- autoload :Helper, 'aws-sdk-code-generator/helper'
23
-
24
- module Dsl
25
- autoload :AccessControlStatement, 'aws-sdk-code-generator/dsl/access_control_statement'
26
- autoload :AutoloadStatement, 'aws-sdk-code-generator/dsl/autoload_statement'
27
- autoload :AttributeAccessor, 'aws-sdk-code-generator/dsl/attribute_accessor'
28
- autoload :AttributeReader, 'aws-sdk-code-generator/dsl/attribute_reader'
29
- autoload :AttributeWriter, 'aws-sdk-code-generator/dsl/attribute_writer'
30
- autoload :BlockParam, 'aws-sdk-code-generator/dsl/block_param'
31
- autoload :Class, 'aws-sdk-code-generator/dsl/class'
32
- autoload :CodeLiteral, 'aws-sdk-code-generator/dsl/code_literal'
33
- autoload :CodeObject, 'aws-sdk-code-generator/dsl/code_object'
34
- autoload :Docstring, 'aws-sdk-code-generator/dsl/docstring'
35
- autoload :Eigenclass, 'aws-sdk-code-generator/dsl/eigenclass'
36
- autoload :ExtendStatement, 'aws-sdk-code-generator/dsl/extend_statement'
37
- autoload :IncludeStatement, 'aws-sdk-code-generator/dsl/include_statement'
38
- autoload :Main, 'aws-sdk-code-generator/dsl/main'
39
- autoload :Method, 'aws-sdk-code-generator/dsl/method'
40
- autoload :Module, 'aws-sdk-code-generator/dsl/module'
41
- autoload :OptionTag, 'aws-sdk-code-generator/dsl/option_tag'
42
- autoload :Param, 'aws-sdk-code-generator/dsl/param'
43
- autoload :ParamList, 'aws-sdk-code-generator/dsl/param_list'
44
- autoload :ReturnTag, 'aws-sdk-code-generator/dsl/return_tag'
45
- autoload :TagDocstring, 'aws-sdk-code-generator/dsl/tag_docstring'
46
- autoload :TagDefault, 'aws-sdk-code-generator/dsl/tag_default'
47
- autoload :TagType, 'aws-sdk-code-generator/dsl/tag_type'
48
- end
69
+ # Public interfaces
70
+ require_relative 'aws-sdk-code-generator/code_builder'
71
+ require_relative 'aws-sdk-code-generator/gem_builder'
49
72
 
50
- module Generators
51
- autoload :ClientApiModule, 'aws-sdk-code-generator/generators/client_api_module'
52
- autoload :ClientClass, 'aws-sdk-code-generator/generators/client_class'
53
- autoload :ClientOperationDocumentation, 'aws-sdk-code-generator/generators/client_operation_documentation'
54
- autoload :ErrorsModule, 'aws-sdk-code-generator/generators/errors_module'
55
- autoload :TypesModule, 'aws-sdk-code-generator/generators/types_module'
56
- autoload :RootResourceClass, 'aws-sdk-code-generator/generators/root_resource_class'
57
- autoload :ResourceClass, 'aws-sdk-code-generator/generators/resource_class'
58
- autoload :ResponseStructureExample, 'aws-sdk-code-generator/generators/response_structure_example'
59
- autoload :ServiceDocumentation, 'aws-sdk-code-generator/generators/service_documentation'
60
- autoload :SharedExample, 'aws-sdk-code-generator/generators/shared_example'
61
- autoload :StructureTypeClass, 'aws-sdk-code-generator/generators/structure_type_class'
62
- autoload :SyntaxExample, 'aws-sdk-code-generator/generators/syntax_example'
63
- autoload :WaiterClass, 'aws-sdk-code-generator/generators/waiter_class'
64
- autoload :WaitersModule, 'aws-sdk-code-generator/generators/waiters_module'
73
+ module AwsSdkCodeGenerator
65
74
 
66
- module Resource
67
- autoload :Action, 'aws-sdk-code-generator/generators/resource/action'
68
- autoload :BatchBuilder, 'aws-sdk-code-generator/generators/resource/batch_builder'
69
- autoload :Builder, 'aws-sdk-code-generator/generators/resource/builder'
70
- autoload :ClientGetter, 'aws-sdk-code-generator/generators/resource/client_getter'
71
- autoload :ClientRequest, 'aws-sdk-code-generator/generators/resource/client_request'
72
- autoload :ClientRequestParams, 'aws-sdk-code-generator/generators/resource/client_request_params'
73
- autoload :ClientRequestDocs, 'aws-sdk-code-generator/generators/resource/client_request_docs'
74
- autoload :CollectionClass, 'aws-sdk-code-generator/generators/resource/collection_class'
75
- autoload :DataMethod, 'aws-sdk-code-generator/generators/resource/data_method'
76
- autoload :DataAttributeGetter, 'aws-sdk-code-generator/generators/resource/data_attribute_getter'
77
- autoload :DataLoadedMethod, 'aws-sdk-code-generator/generators/resource/data_loaded_method'
78
- autoload :ExistsMethod, 'aws-sdk-code-generator/generators/resource/exists_method'
79
- autoload :ExtractIdentifierMethod, 'aws-sdk-code-generator/generators/resource/extract_identifier_method'
80
- autoload :HasAssociation, 'aws-sdk-code-generator/generators/resource/has_association'
81
- autoload :HasManyAssociation, 'aws-sdk-code-generator/generators/resource/has_many_association'
82
- autoload :InitializeMethod, 'aws-sdk-code-generator/generators/resource/initialize_method'
83
- autoload :IdentifiersMethod, 'aws-sdk-code-generator/generators/resource/identifiers_method'
84
- autoload :IdentifierGetter, 'aws-sdk-code-generator/generators/resource/identifier_getter'
85
- autoload :LoadMethod, 'aws-sdk-code-generator/generators/resource/load_method'
86
- autoload :ValueSource, 'aws-sdk-code-generator/generators/resource/value_source'
87
- autoload :WaiterMethod, 'aws-sdk-code-generator/generators/resource/waiter_method'
88
- end
89
- end
75
+ GENERATED_SRC_WARNING = <<-WARNING_TXT
76
+ # WARNING ABOUT GENERATED CODE
77
+ #
78
+ # This file is generated. See the contributing guide for more information:
79
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
80
+ #
81
+ # WARNING ABOUT GENERATED CODE
82
+ WARNING_TXT
90
83
 
91
84
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module {{module_name}}
4
+ module Plugins
5
+
6
+ class APIGEndpoint < Seahorse::Client::Plugin
7
+
8
+ def after_initialize(client)
9
+ if client.config.endpoint.nil?
10
+ client.config.endpoint = '{{default_endpoint}}'
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,62 @@
1
+ # {{service_name}}
2
+
3
+ This is the Version {{gem_major_version}} of the {{gem_name}} gem.
4
+
5
+ ## WARNING
6
+
7
+ Please read through this `README.md` and `{{gem_name}}.gemspec` then tailor it with your gem needs before serving it for any official usage or gem publishing. If you have any questions, issue or feature requests for this generated gem, feel free to open an issue or PR againt [`AWS SDK for Ruby`](https://github.com/aws/aws-sdk-ruby)
8
+
9
+ ## API Client
10
+
11
+ Initialize a service client and list all operations available.
12
+
13
+ ```ruby
14
+ require '{{gem_name}}'
15
+
16
+ client = {{module_name}}::Client.new
17
+
18
+ puts client.operation_names
19
+ ```
20
+
21
+ For each operation usage example, see `lib/client.rb` documentation block per operation
22
+
23
+ ## Authorizer
24
+
25
+ For operations used custom authorizer, you can provide your own authorizer token logic at `lib/plugins/authorizer.rb` under method `generate_token`. For more information, please see [here](http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html).
26
+
27
+ ## AWS Credentials
28
+
29
+ For those API requets that are authenticated with AWS Credentials (e.g. IAM roles), you would need to configure `:credentials` and `:region` that helps sigining request with [AWS Signature V4](http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). You can also provide those information via your environment:
30
+
31
+ The SDK searches the following locations for credentials:
32
+
33
+ * `ENV['AWS_ACCESS_KEY_ID']` and `ENV['AWS_SECRET_ACCESS_KEY']`
34
+ * Unless `ENV['AWS_SDK_CONFIG_OPT_OUT']` is set, the shared configuration files (`~/.aws/credentials` and `~/.aws/config`) will be checked for a `role_arn` and `source_profile`, which if present will be used to attempt to assume a role.
35
+ * The shared credentials ini file at `~/.aws/credentials` ([more information](http://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs))
36
+ * Unless `ENV['AWS_SDK_CONFIG_OPT_OUT']` is set, the shared configuration ini file at `~/.aws/config` will also be parsed for credentials.
37
+ * From an instance profile when running on EC2, or from the ECS credential provider when running in an ECS container with that feature enabled.
38
+
39
+ The SDK searches the following locations for a region:
40
+
41
+ * `ENV['AWS_REGION']`
42
+ * Unless `ENV['AWS_SDK_CONFIG_OPT_OUT']` is set, the shared configuration files (`~/.aws/credentials` and `~/.aws/config`) will also be checked for a region selection.
43
+
44
+ Valid region and credentials options are:
45
+
46
+ * `:region` - A string like `us-west-2`.
47
+ * `:credentials` - An instance of one of the following classes:
48
+ * [`Aws::Credentials`](http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Credentials.html)
49
+ * [`Aws::SharedCredentials`](http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SharedCredentials.html)
50
+ * [`Aws::InstanceProfileCredentials`](http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/InstanceProfileCredentials.html)
51
+ * [`Aws::AssumeRoleCredentials`](http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/AssumeRoleCredentials.html)
52
+
53
+ ## API Key
54
+
55
+ Simply provide an `:api_key` value when calling an API along with other params, this value will be picked up in the `x-api-key` header value.
56
+
57
+ ## License
58
+
59
+ DEFAULT: This library is distributed under the
60
+ [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
61
+
62
+ Feel free to change your license specification here and at `{{gem_name}}.gemspec`
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+
3
+ {{#generated_src_warning}}
4
+ {{generated_src_warning}}
5
+ {{/generated_src_warning}}
6
+ begin
7
+ require 'http/2'
8
+ rescue LoadError; end
9
+ {{#plugin_requires}}
10
+ require '{{.}}'
11
+ {{/plugin_requires}}
12
+
13
+ Aws::Plugins::GlobalConfiguration.add_identifier(:{{service_identifier}})
14
+
15
+ module {{module_name}}
16
+ class AsyncClient < Seahorse::Client::AsyncBase
17
+
18
+ include Aws::AsyncClientStubs
19
+
20
+ @identifier = :{{service_identifier}}
21
+
22
+ set_api(ClientApi::API)
23
+
24
+ {{#plugin_class_names}}
25
+ add_plugin({{{.}}})
26
+ {{/plugin_class_names}}
27
+
28
+ {{#client_constructor}}
29
+ {{>documentation}}
30
+ {{/client_constructor}}
31
+ def initialize(*args)
32
+ unless Kernel.const_defined?("HTTP2")
33
+ raise "Must include http/2 gem to use AsyncClient instances."
34
+ end
35
+ super
36
+ end
37
+
38
+ # @!group API Operations
39
+ {{#operations}}
40
+
41
+ {{#documentation}}
42
+ {{>documentation}}
43
+ {{/documentation}}
44
+ # @overload {{name}}(params = {})
45
+ # @param [Hash] params ({})
46
+ def {{name}}(params = {}, options = {}{{{block_option}}})
47
+ params = params.dup
48
+ {{#eventstream_input}}
49
+ input_event_stream_handler = _event_stream_handler(
50
+ :input,
51
+ params.delete(:input_event_stream_handler),
52
+ EventStreams::{{input_eventstream_member}}
53
+ )
54
+ {{/eventstream_input}}
55
+ {{#eventstream_output}}
56
+ output_event_stream_handler = _event_stream_handler(
57
+ :output,
58
+ params.delete(:output_event_stream_handler) || params.delete(:event_stream_handler),
59
+ EventStreams::{{output_eventstream_member}}
60
+ )
61
+ {{/eventstream_output}}
62
+
63
+ yield({{#eventstream_output}}output_event_stream_handler{{/eventstream_output}}) if block_given?
64
+
65
+ req = build_request(:{{name}}, params)
66
+
67
+ {{#eventstream_input}}
68
+ req.context[:input_event_stream_handler] = input_event_stream_handler
69
+ req.handlers.add(Aws::Binary::EncodeHandler, priority: 95)
70
+ {{/eventstream_input}}
71
+ {{#eventstream_output}}
72
+ req.context[:output_event_stream_handler] = output_event_stream_handler
73
+ req.handlers.add(Aws::Binary::DecodeHandler, priority: 95)
74
+ {{/eventstream_output}}
75
+
76
+ req.send_request(options{{{block_option}}})
77
+ end
78
+ {{/operations}}
79
+
80
+ # @!endgroup
81
+
82
+ # @param params ({})
83
+ # @api private
84
+ def build_request(operation_name, params = {})
85
+ handlers = @handlers.for(operation_name)
86
+ context = Seahorse::Client::RequestContext.new(
87
+ operation_name: operation_name,
88
+ operation: config.api.operation(operation_name),
89
+ client: self,
90
+ params: params,
91
+ http_response: Seahorse::Client::Http::AsyncResponse.new,
92
+ config: config)
93
+ context[:gem_name] = '{{gem_name}}'
94
+ context[:gem_version] = '{{gem_version}}'
95
+ Seahorse::Client::Request.new(handlers, context)
96
+ end
97
+
98
+ private
99
+
100
+ def _event_stream_handler(type, handler, event_stream_class)
101
+ case handler
102
+ when event_stream_class then handler
103
+ when Proc then event_stream_class.new.tap(&handler)
104
+ when nil then event_stream_class.new
105
+ else
106
+ msg = "expected #{type}_event_stream_handler to be a block or "\
107
+ "instance of {{module_name}}::#{event_stream_class}"\
108
+ ", got `#{handler.inspect}` instead"
109
+ raise ArgumentError, msg
110
+ end
111
+ end
112
+
113
+ class << self
114
+
115
+ # @api private
116
+ attr_reader :identifier
117
+
118
+ # @api private
119
+ def errors_module
120
+ Errors
121
+ end
122
+
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module {{module_name}}
4
+ module Plugins
5
+
6
+ # APIG Custom Authorizer, generated token will be used by API Gateway
7
+ # to interact with AWS Lambda for authentication
8
+ #
9
+ # More information see: http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html
10
+ class Authorizer < Seahorse::Client::Plugin
11
+
12
+ def add_handlers(handlers, config)
13
+ handlers.add(CustomAuthHandler, step: :initialize)
14
+ end
15
+
16
+ # @api private
17
+ class CustomAuthHandler < Seahorse::Client::Handler
18
+
19
+ def call(context)
20
+ if context.operation['authtype'] == 'custom'
21
+ context.config.authorizer_token = generate_token(context)
22
+ end
23
+ @handler.call(context)
24
+ end
25
+
26
+ private
27
+
28
+ # TODO
29
+ # Provide your own token generation logic here
30
+ def generate_token(context)
31
+ nil
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ {{#generated_src_warning}}
4
+ {{generated_src_warning}}
5
+ {{/generated_src_warning}}
6
+ module {{module_name}}
7
+ # @api private
8
+ module ClientApi
9
+
10
+ include Seahorse::Model
11
+
12
+ {{#shapes}}
13
+ {{name}} = {{class_name}}.new({{{constructor_args}}})
14
+ {{/shapes}}
15
+
16
+ {{#shape_definitions}}
17
+ {{#lines}}
18
+ {{{.}}}{{/lines}}
19
+
20
+ {{/shape_definitions}}
21
+
22
+ # @api private
23
+ API = Seahorse::Model::Api.new.tap do |api|
24
+
25
+ api.version = "{{api_version}}"
26
+
27
+ api.metadata = {
28
+ {{#metadata}}
29
+ {{{key}}} => {{{value}}},
30
+ {{/metadata}}
31
+ }
32
+ {{#endpoint_operation}}
33
+ api.endpoint_operation = :{{endpoint_operation}}
34
+ {{/endpoint_operation}}
35
+ {{#require_endpoint_discovery}}
36
+ api.require_endpoint_discovery = true
37
+ {{/require_endpoint_discovery}}
38
+ {{#operations}}
39
+
40
+ api.add_operation(:{{method_name}}, Seahorse::Model::Operation.new.tap do |o|
41
+ o.name = "{{name}}"
42
+ o.http_method = "{{http_method}}"
43
+ o.http_request_uri = "{{{http_request_uri}}}"
44
+ {{#http_checksum_required}}
45
+ o.http_checksum_required = true
46
+ {{/http_checksum_required}}
47
+ {{#deprecated}}
48
+ o.deprecated = true
49
+ {{/deprecated}}
50
+ {{#endpoint_operation}}
51
+ o.endpoint_operation = true
52
+ {{/endpoint_operation}}
53
+ {{#endpoint_discovery_available}}
54
+ o.endpoint_discovery = {
55
+ {{#endpoint_discovery}}
56
+ {{{key}}} => {{{value}}},
57
+ {{/endpoint_discovery}}
58
+ }
59
+ {{/endpoint_discovery_available}}
60
+ {{#authorizer}}
61
+ o.authorizer = "{{authorizer}}"
62
+ {{/authorizer}}
63
+ {{#authtype}}
64
+ o['authtype'] = "{{.}}"
65
+ {{/authtype}}
66
+ {{#endpoint_trait}}
67
+ o.endpoint_pattern = {
68
+ {{#endpoint_pattern}}
69
+ {{{key}}} => {{{value}}},
70
+ {{/endpoint_pattern}}
71
+ }
72
+ {{/endpoint_trait}}
73
+ {{#require_apikey}}
74
+ o.require_apikey = {{require_apikey}}
75
+ {{/require_apikey}}
76
+ {{#shape_references}}
77
+ {{#lines}}
78
+ {{{.}}}{{/lines}}
79
+ {{/shape_references}}
80
+ {{#error_shape_names}}
81
+ o.errors << Shapes::ShapeRef.new(shape: {{.}})
82
+ {{/error_shape_names}}
83
+ {{#pager}}
84
+ {{#lines}}
85
+ {{{.}}}{{/lines}}
86
+ {{/pager}}
87
+ {{#async}}
88
+ o.async = true
89
+ {{/async}}
90
+ end)
91
+ {{/operations}}
92
+ {{#apig_authorizer}}
93
+
94
+ api.add_authorizer(:{{authorizer_name}}, Seahorse::Model::Authorizer.new.tap do |a|
95
+ a.name = "{{name}}"{{#type}}
96
+ a.type = "{{type}}"{{/type}}{{#location}}
97
+ a.placement = {
98
+ :location => "{{location}}",
99
+ :name => "{{location_name}}"
100
+ }{{/location}}
101
+ end)
102
+ {{/apig_authorizer}}
103
+ end
104
+
105
+ end
106
+ end