aws-sdk-code-generator 0.1.0.pre → 0.2.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/aws-sdk-code-generator.rb +68 -75
- data/lib/aws-sdk-code-generator/api.rb +130 -0
- data/lib/aws-sdk-code-generator/apply_docs.rb +15 -2
- data/lib/aws-sdk-code-generator/client_constructor.rb +39 -0
- data/lib/aws-sdk-code-generator/client_operation_documentation.rb +268 -0
- data/lib/aws-sdk-code-generator/client_operation_list.rb +148 -0
- data/lib/aws-sdk-code-generator/client_response_structure_example.rb +108 -0
- data/lib/aws-sdk-code-generator/code_builder.rb +146 -133
- data/lib/aws-sdk-code-generator/crosslink.rb +42 -0
- data/lib/aws-sdk-code-generator/docstring.rb +199 -0
- data/lib/aws-sdk-code-generator/error_list.rb +77 -0
- data/lib/aws-sdk-code-generator/errors.rb +2 -0
- data/lib/aws-sdk-code-generator/eventstream_example.rb +220 -0
- data/lib/aws-sdk-code-generator/gem_builder.rb +19 -25
- data/lib/aws-sdk-code-generator/hash_formatter.rb +5 -2
- data/lib/aws-sdk-code-generator/helper.rb +77 -61
- data/lib/aws-sdk-code-generator/plugin_list.rb +146 -0
- data/lib/aws-sdk-code-generator/resource_action.rb +69 -0
- data/lib/aws-sdk-code-generator/resource_action_code.rb +57 -0
- data/lib/aws-sdk-code-generator/resource_association.rb +37 -0
- data/lib/aws-sdk-code-generator/resource_attribute.rb +76 -0
- data/lib/aws-sdk-code-generator/resource_batch_action.rb +56 -0
- data/lib/aws-sdk-code-generator/resource_batch_action_code.rb +136 -0
- data/lib/aws-sdk-code-generator/resource_batch_action_documentation.rb +108 -0
- data/lib/aws-sdk-code-generator/resource_batch_builder.rb +212 -0
- data/lib/aws-sdk-code-generator/resource_builder.rb +48 -0
- data/lib/aws-sdk-code-generator/resource_client_request.rb +62 -0
- data/lib/aws-sdk-code-generator/resource_client_request_documentation.rb +81 -0
- data/lib/aws-sdk-code-generator/resource_client_request_params.rb +86 -0
- data/lib/aws-sdk-code-generator/resource_data_method.rb +60 -0
- data/lib/aws-sdk-code-generator/resource_has_association.rb +117 -0
- data/lib/aws-sdk-code-generator/resource_has_many_association.rb +52 -0
- data/lib/aws-sdk-code-generator/resource_has_many_association_code.rb +76 -0
- data/lib/aws-sdk-code-generator/resource_identifier.rb +44 -0
- data/lib/aws-sdk-code-generator/resource_identifiers_method.rb +29 -0
- data/lib/aws-sdk-code-generator/resource_load_method.rb +68 -0
- data/lib/aws-sdk-code-generator/resource_method.rb +22 -0
- data/lib/aws-sdk-code-generator/resource_skip_params.rb +36 -0
- data/lib/aws-sdk-code-generator/resource_value_source.rb +68 -0
- data/lib/aws-sdk-code-generator/resource_waiter.rb +80 -0
- data/lib/aws-sdk-code-generator/service.rb +30 -7
- data/lib/aws-sdk-code-generator/shared_example.rb +131 -0
- data/lib/aws-sdk-code-generator/syntax_example.rb +60 -0
- data/lib/aws-sdk-code-generator/syntax_example_hash.rb +174 -0
- data/lib/aws-sdk-code-generator/underscore.rb +10 -5
- data/lib/aws-sdk-code-generator/view.rb +33 -0
- data/lib/aws-sdk-code-generator/views.rb +2 -0
- data/lib/aws-sdk-code-generator/views/apig_endpoint_class.rb +25 -0
- data/lib/aws-sdk-code-generator/views/apig_readme.rb +32 -0
- data/lib/aws-sdk-code-generator/views/async_client_class.rb +68 -0
- data/lib/aws-sdk-code-generator/views/authorizer_class.rb +17 -0
- data/lib/aws-sdk-code-generator/views/client_api_module.rb +583 -0
- data/lib/aws-sdk-code-generator/views/client_class.rb +93 -0
- data/lib/aws-sdk-code-generator/views/docstring.rb +27 -0
- data/lib/aws-sdk-code-generator/views/errors_module.rb +32 -0
- data/lib/aws-sdk-code-generator/views/event_streams_module.rb +149 -0
- data/lib/aws-sdk-code-generator/views/features/env.rb +9 -0
- data/lib/aws-sdk-code-generator/views/features/smoke.rb +51 -0
- data/lib/aws-sdk-code-generator/views/features/smoke_step_definitions.rb +26 -0
- data/lib/aws-sdk-code-generator/views/features/step_definitions.rb +2 -0
- data/lib/aws-sdk-code-generator/views/gemspec.rb +39 -5
- data/lib/aws-sdk-code-generator/views/resource_class.rb +122 -0
- data/lib/aws-sdk-code-generator/views/root_resource_class.rb +58 -0
- data/lib/aws-sdk-code-generator/views/service_module.rb +30 -14
- data/lib/aws-sdk-code-generator/views/spec/spec_helper.rb +9 -0
- data/lib/aws-sdk-code-generator/views/types_module.rb +294 -0
- data/lib/aws-sdk-code-generator/views/version.rb +2 -0
- data/lib/aws-sdk-code-generator/views/waiters_module.rb +37 -0
- data/lib/aws-sdk-code-generator/waiter.rb +95 -0
- data/lib/aws-sdk-code-generator/yard_option_tag.rb +43 -0
- metadata +61 -68
- data/lib/aws-sdk-code-generator/dsl/access_control_statement.rb +0 -23
- data/lib/aws-sdk-code-generator/dsl/attribute_accessor.rb +0 -43
- data/lib/aws-sdk-code-generator/dsl/attribute_reader.rb +0 -11
- data/lib/aws-sdk-code-generator/dsl/attribute_writer.rb +0 -11
- data/lib/aws-sdk-code-generator/dsl/autoload_statement.rb +0 -15
- data/lib/aws-sdk-code-generator/dsl/block_param.rb +0 -11
- data/lib/aws-sdk-code-generator/dsl/class.rb +0 -27
- data/lib/aws-sdk-code-generator/dsl/code_literal.rb +0 -66
- data/lib/aws-sdk-code-generator/dsl/code_object.rb +0 -33
- data/lib/aws-sdk-code-generator/dsl/docstring.rb +0 -36
- data/lib/aws-sdk-code-generator/dsl/eigenclass.rb +0 -15
- data/lib/aws-sdk-code-generator/dsl/extend_statement.rb +0 -12
- data/lib/aws-sdk-code-generator/dsl/formatter.rb +0 -25
- data/lib/aws-sdk-code-generator/dsl/include_statement.rb +0 -17
- data/lib/aws-sdk-code-generator/dsl/main.rb +0 -105
- data/lib/aws-sdk-code-generator/dsl/method.rb +0 -108
- data/lib/aws-sdk-code-generator/dsl/module.rb +0 -167
- data/lib/aws-sdk-code-generator/dsl/option_tag.rb +0 -36
- data/lib/aws-sdk-code-generator/dsl/param.rb +0 -43
- data/lib/aws-sdk-code-generator/dsl/param_list.rb +0 -38
- data/lib/aws-sdk-code-generator/dsl/return_tag.rb +0 -19
- data/lib/aws-sdk-code-generator/dsl/tag_default.rb +0 -20
- data/lib/aws-sdk-code-generator/dsl/tag_docstring.rb +0 -27
- data/lib/aws-sdk-code-generator/dsl/tag_type.rb +0 -18
- data/lib/aws-sdk-code-generator/generators/client_api_module.rb +0 -334
- data/lib/aws-sdk-code-generator/generators/client_class.rb +0 -389
- data/lib/aws-sdk-code-generator/generators/client_operation_documentation.rb +0 -166
- data/lib/aws-sdk-code-generator/generators/errors_module.rb +0 -25
- data/lib/aws-sdk-code-generator/generators/resource/action.rb +0 -88
- data/lib/aws-sdk-code-generator/generators/resource/batch_builder.rb +0 -211
- data/lib/aws-sdk-code-generator/generators/resource/builder.rb +0 -50
- data/lib/aws-sdk-code-generator/generators/resource/client_getter.rb +0 -15
- data/lib/aws-sdk-code-generator/generators/resource/client_request.rb +0 -49
- data/lib/aws-sdk-code-generator/generators/resource/client_request_docs.rb +0 -97
- data/lib/aws-sdk-code-generator/generators/resource/client_request_params.rb +0 -88
- data/lib/aws-sdk-code-generator/generators/resource/collection_class.rb +0 -180
- data/lib/aws-sdk-code-generator/generators/resource/data_attribute_getter.rb +0 -24
- data/lib/aws-sdk-code-generator/generators/resource/data_loaded_method.rb +0 -18
- data/lib/aws-sdk-code-generator/generators/resource/data_method.rb +0 -49
- data/lib/aws-sdk-code-generator/generators/resource/exists_method.rb +0 -29
- data/lib/aws-sdk-code-generator/generators/resource/extract_identifier_method.rb +0 -32
- data/lib/aws-sdk-code-generator/generators/resource/has_association.rb +0 -101
- data/lib/aws-sdk-code-generator/generators/resource/has_many_association.rb +0 -108
- data/lib/aws-sdk-code-generator/generators/resource/identifier_getter.rb +0 -26
- data/lib/aws-sdk-code-generator/generators/resource/identifiers_method.rb +0 -28
- data/lib/aws-sdk-code-generator/generators/resource/initialize_method.rb +0 -67
- data/lib/aws-sdk-code-generator/generators/resource/load_method.rb +0 -65
- data/lib/aws-sdk-code-generator/generators/resource/value_source.rb +0 -68
- data/lib/aws-sdk-code-generator/generators/resource/waiter_method.rb +0 -61
- data/lib/aws-sdk-code-generator/generators/resource_class.rb +0 -325
- data/lib/aws-sdk-code-generator/generators/response_structure_example.rb +0 -83
- data/lib/aws-sdk-code-generator/generators/root_resource_class.rb +0 -42
- data/lib/aws-sdk-code-generator/generators/service_documentation.rb +0 -64
- data/lib/aws-sdk-code-generator/generators/shared_example.rb +0 -132
- data/lib/aws-sdk-code-generator/generators/structure_type_class.rb +0 -95
- data/lib/aws-sdk-code-generator/generators/syntax_example.rb +0 -169
- data/lib/aws-sdk-code-generator/generators/types_module.rb +0 -52
- data/lib/aws-sdk-code-generator/generators/waiter_class.rb +0 -62
- data/lib/aws-sdk-code-generator/generators/waiters_module.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4894f20ce7d85b716b2c70eb94ab224ae37262f9b325fec17fe45529cd0cf2fa
|
4
|
+
data.tar.gz: 5c0547128fce67627df4e291d97b6fd9a05eb7cd8e09431ba3ca5594dc5c5192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7857e3fd7e22f68d17cd4c9cff65e9d80f9e8e0bd526b2c4395bbf2d9f2f215f83694a56179844b46d7f9e302f2fb4eb90dbb810b182e4f001428ba0e3ba9fa5
|
7
|
+
data.tar.gz: 7c41c3cac485f1a10305f987db7861051d32fcd9f34eac72f32ec1ec0da9e157c5c00ddb302772d5ff8affc9eb8b51b1213492751084758a31fd6b40a9aa8714
|
@@ -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/
|
8
|
-
require_relative 'aws-sdk-code-generator/
|
9
|
-
|
10
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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/master/CONTRIBUTING.md
|
80
|
+
#
|
81
|
+
# WARNING ABOUT GENERATED CODE
|
82
|
+
WARNING_TXT
|
90
83
|
|
91
84
|
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
module Api
|
5
|
+
class << self
|
6
|
+
|
7
|
+
# @param [Hash, String] shape_or_shape_ref
|
8
|
+
# @param [Hash, String] api
|
9
|
+
# @return [String, nil]
|
10
|
+
def docstring(shape_or_shape_ref, api)
|
11
|
+
ref, shape = resolve(shape_or_shape_ref, api)
|
12
|
+
# APIG models, downcase shape name in origin or "__" prefix in origin
|
13
|
+
# code-gen shape name might have been changed (upcased_first/lstrip_prefix/both),
|
14
|
+
# when shape cannot be located with current shape name, try to resolve shape with
|
15
|
+
# (downcase_fist/apig_prefix/both) original names
|
16
|
+
if shape.nil?
|
17
|
+
ref, shape = resolve(AwsSdkCodeGenerator::Helper.downcase_first(shape_or_shape_ref), api)
|
18
|
+
if shape.nil?
|
19
|
+
ref, shape = resolve(AwsSdkCodeGenerator::Helper.apig_prefix(shape_or_shape_ref), api)
|
20
|
+
if shape.nil?
|
21
|
+
ref, shape = resolve(AwsSdkCodeGenerator::Helper.apig_prefix(downcase_first(shape_or_shape_ref)), api)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
ref['documentation'] || shape['documentation']
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param [Hash, String] shape_or_shape_ref
|
29
|
+
# @param [Hash, String] api
|
30
|
+
# @return [Hash<ShapeRef>, Hash<Shape>]
|
31
|
+
def resolve(shape_or_shape_ref, api)
|
32
|
+
if String === shape_or_shape_ref
|
33
|
+
[{}, api['shapes'][shape_or_shape_ref]]
|
34
|
+
elsif shape_or_shape_ref['type']
|
35
|
+
[{}, shape_or_shape_ref]
|
36
|
+
else
|
37
|
+
[shape_or_shape_ref, api['shapes'][shape_or_shape_ref['shape']]]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# @param [String, Hash] shape_name_or_ref
|
42
|
+
# @return [Hash]
|
43
|
+
def shape(shape_name_or_ref, api)
|
44
|
+
case shape_name_or_ref
|
45
|
+
when Hash then api.fetch('shapes').fetch(shape_name_or_ref.fetch('shape'))
|
46
|
+
when String then api.fetch('shapes').fetch(shape_name_or_ref)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def ruby_input_type(shape_ref, api, options = {})
|
51
|
+
nested = options.fetch(:nested, false)
|
52
|
+
_, shape = resolve(shape_ref, api)
|
53
|
+
case shape['type']
|
54
|
+
when 'byte' then 'Integer<byte>'
|
55
|
+
when 'blob' then 'String, IO'
|
56
|
+
when 'boolean' then 'Boolean'
|
57
|
+
when 'character' then 'String<character>'
|
58
|
+
when 'double' then 'Float'
|
59
|
+
when 'float' then 'Float'
|
60
|
+
when 'integer' then 'Integer'
|
61
|
+
when 'list'
|
62
|
+
if nested
|
63
|
+
"Array"
|
64
|
+
else
|
65
|
+
"Array<#{ruby_input_type(shape['member'], api, nested: true)}>"
|
66
|
+
end
|
67
|
+
when 'long' then 'Integer'
|
68
|
+
when 'map'
|
69
|
+
if nested
|
70
|
+
"Hash"
|
71
|
+
else
|
72
|
+
"Hash<String,#{ruby_input_type(shape['value'], api, nested: true)}>"
|
73
|
+
end
|
74
|
+
when 'string' then 'String'
|
75
|
+
when 'structure' then "Types::#{shape_ref['shape']}"
|
76
|
+
when 'timestamp' then 'Time,DateTime,Date,Integer,String'
|
77
|
+
else
|
78
|
+
raise "unhandled type #{shape.type}.inspect"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def ruby_type(shape_ref, api)
|
83
|
+
_, shape = resolve(shape_ref, api)
|
84
|
+
case shape['type']
|
85
|
+
when 'blob' then streaming?(shape_ref, api) ? 'IO' : 'String'
|
86
|
+
when 'boolean' then 'Boolean'
|
87
|
+
when 'byte' then 'Integer<byte>'
|
88
|
+
when 'character' then 'String<character>'
|
89
|
+
when 'double' then 'Float'
|
90
|
+
when 'float' then 'Float'
|
91
|
+
when 'integer' then 'Integer'
|
92
|
+
when 'list' then "Array<#{ruby_type(shape['member'], api)}>"
|
93
|
+
when 'long' then 'Integer'
|
94
|
+
when 'map' then "Hash<String,#{ruby_type(shape['value'], api)}>"
|
95
|
+
when 'string' then streaming?(shape_ref, api) ? 'IO' : 'String'
|
96
|
+
when 'structure' then "Types::#{shape_ref['shape']}"
|
97
|
+
when 'timestamp' then 'Time'
|
98
|
+
else
|
99
|
+
raise "unhandled type #{shape['type'].inspect}"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# @return [Boolean]
|
104
|
+
def streaming?(shape_or_shape_ref, api)
|
105
|
+
ref, shape = resolve(shape_or_shape_ref, api)
|
106
|
+
ref['streaming'] || shape['streaming'] ||
|
107
|
+
ref['eventstream'] || shape['eventstream']
|
108
|
+
end
|
109
|
+
|
110
|
+
# @return [Boolean]
|
111
|
+
def eventstream?(shape_or_shape_ref, api)
|
112
|
+
ref, shape = resolve(shape_or_shape_ref, api)
|
113
|
+
ref['eventstream'] || shape['eventstream']
|
114
|
+
end
|
115
|
+
|
116
|
+
def plural?(resource)
|
117
|
+
plural = false
|
118
|
+
(resource['identifiers'] || []).each do |i|
|
119
|
+
if i['path'] && i['path'].include?('[]')
|
120
|
+
plural = true
|
121
|
+
break
|
122
|
+
end
|
123
|
+
end
|
124
|
+
plural = true if resource['data'] && resource['data'].include?('[]')
|
125
|
+
plural
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module AwsSdkCodeGenerator
|
2
4
|
class ApplyDocs
|
3
5
|
|
@@ -17,17 +19,28 @@ module AwsSdkCodeGenerator
|
|
17
19
|
def apply_docs(docs)
|
18
20
|
@api['documentation'] = docs['service']
|
19
21
|
docs['operations'].each do |name, docstring|
|
22
|
+
next unless @api['operations'][name]
|
20
23
|
@api['operations'][name]['documentation'] = docstring
|
21
24
|
end
|
22
25
|
docs['shapes'].each do |shape_name, shape_docs|
|
26
|
+
next unless @api['shapes'][shape_name]
|
23
27
|
@api['shapes'][shape_name]['documentation'] = shape_docs['base']
|
24
28
|
shape_docs['refs'].each do |ref, ref_docs|
|
25
29
|
ref_shape, ref_member = ref.split('$')
|
30
|
+
next unless @api['shapes'][ref_shape]
|
26
31
|
case @api['shapes'][ref_shape]['type']
|
27
32
|
when 'structure'
|
28
|
-
@api['shapes'][ref_shape]
|
33
|
+
shape = @api['shapes'][ref_shape]
|
34
|
+
if shape && shape['members']
|
35
|
+
member = shape['members'][ref_member]
|
36
|
+
member['documentation'] = ref_docs if member
|
37
|
+
end
|
29
38
|
when 'list', 'map'
|
30
|
-
@api['shapes'][ref_shape]
|
39
|
+
shape = @api['shapes'][ref_shape]
|
40
|
+
if shape
|
41
|
+
member = shape[ref_member]
|
42
|
+
member['documentation'] = ref_docs if member
|
43
|
+
end
|
31
44
|
end
|
32
45
|
end
|
33
46
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
class ClientConstructor
|
5
|
+
|
6
|
+
# @option options [required, PluginList] :plugins
|
7
|
+
def initialize(options)
|
8
|
+
plugin_options = documented_plugin_options(options.fetch(:plugins))
|
9
|
+
documentation = {}
|
10
|
+
plugin_options.each do |option|
|
11
|
+
documentation[option.name] = YardOptionTag.new(
|
12
|
+
name: option.name,
|
13
|
+
required: option.required,
|
14
|
+
ruby_type: option.doc_type,
|
15
|
+
default_value: option.doc_default(options),
|
16
|
+
docstring: option.docstring,
|
17
|
+
indent: " "
|
18
|
+
).to_s
|
19
|
+
end
|
20
|
+
@documentation = Docstring.join_docstrings(documentation.values, block_comment: false)
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String]
|
24
|
+
attr_reader :documentation
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def documented_plugin_options(plugins)
|
29
|
+
i = 0
|
30
|
+
plugins.map(&:options).flatten.select(&:documented?).sort_by do |opt|
|
31
|
+
# Stable sort, first required options, then sort by name, then if
|
32
|
+
# two plugins of the same name, use an incrementer.
|
33
|
+
# options.fetch(:plugins) will be ordered.
|
34
|
+
[opt.required ? 'a' : 'b', opt.name, i += 1] #, opt.override ? 'b' : 'a']
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,268 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AwsSdkCodeGenerator
|
4
|
+
class ClientOperationDocumentation
|
5
|
+
|
6
|
+
# @option options [required, String] :method_name
|
7
|
+
# @option options [required, Hash] :operation
|
8
|
+
# @option options [required, Hash] :api
|
9
|
+
# @option options [Array<Hash>] :examples
|
10
|
+
def initialize(options)
|
11
|
+
@name = options.fetch(:name)
|
12
|
+
@method_name = options.fetch(:method_name)
|
13
|
+
@operation = options.fetch(:operation)
|
14
|
+
@api = options.fetch(:api)
|
15
|
+
@client_examples = options.fetch(:client_examples, [])
|
16
|
+
@examples = options.fetch(:examples)
|
17
|
+
@module_name = options.fetch(:module_name)
|
18
|
+
@async_client = options[:async_client] || false
|
19
|
+
@pager = options[:pager]
|
20
|
+
@waiters = options[:waiters]
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String]
|
24
|
+
attr_reader :method_name
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
attr_reader :module_name
|
28
|
+
|
29
|
+
# @return [Hash]
|
30
|
+
attr_reader :operation
|
31
|
+
|
32
|
+
# @return [Hash]
|
33
|
+
attr_reader :api
|
34
|
+
|
35
|
+
# @return [Array<Hash>]
|
36
|
+
attr_reader :examples
|
37
|
+
|
38
|
+
# @return [Array<Hash>]
|
39
|
+
attr_reader :client_examples
|
40
|
+
|
41
|
+
# @return [Hash]
|
42
|
+
attr_reader :pager
|
43
|
+
|
44
|
+
# @return [String]
|
45
|
+
def to_str
|
46
|
+
Docstring.join_docstrings([
|
47
|
+
docstring(operation),
|
48
|
+
response_target_tag(operation, api),
|
49
|
+
option_tags(operation, api),
|
50
|
+
return_tag(operation, api),
|
51
|
+
pagination(pager, operation, api),
|
52
|
+
generated_examples(operation, api),
|
53
|
+
eventstream_examples(module_name, method_name, operation, api),
|
54
|
+
shared_examples(examples, operation, api),
|
55
|
+
given_examples(client_examples),
|
56
|
+
@async_client ? async_request_syntax_example(method_name, operation, api)
|
57
|
+
: request_syntax_example(method_name, operation, api),
|
58
|
+
response_structure_example(operation, api),
|
59
|
+
waiters_tag(@waiters),
|
60
|
+
see_also_tag(operation, api),
|
61
|
+
], block_comment: false)
|
62
|
+
end
|
63
|
+
alias to_s to_str
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def docstring(operation)
|
68
|
+
Docstring.block_comment(
|
69
|
+
Docstring.html_to_markdown(operation['documentation'])
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
def response_target_tag(operation, api)
|
74
|
+
if output = Api.shape(operation['output'], api)
|
75
|
+
if output['payload'] && output['members'][output['payload']]['streaming']
|
76
|
+
YardOptionTag.new(
|
77
|
+
name: 'response_target',
|
78
|
+
ruby_type: 'String, IO',
|
79
|
+
option_hash_name: 'params',
|
80
|
+
required: false,
|
81
|
+
docstring: 'Where to write response data, file path, or IO object.'
|
82
|
+
).to_s
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def option_tags(operation, api)
|
88
|
+
if operation['input']
|
89
|
+
shape = Api.shape(operation['input'], api)
|
90
|
+
return if shape['members'].nil?
|
91
|
+
shape['members'].map do |member_name, member_ref|
|
92
|
+
next if member_ref['documented'] === false
|
93
|
+
# input eventstream is not provided by params
|
94
|
+
member_shape = Api.shape(member_ref['shape'], api)
|
95
|
+
next if member_shape['eventstream'] === true
|
96
|
+
docstring = Api.docstring(member_ref, api)
|
97
|
+
if member_ref['idempotencyToken']
|
98
|
+
docstring = docstring.to_s + "<p><b>A suitable default value is auto-generated.** You should normally not need to pass this option.</b></p>"
|
99
|
+
end
|
100
|
+
if member_ref['jsonvalue']
|
101
|
+
docstring = docstring.to_s + "<p><b>SDK automatically handles json encoding and base64 encoding for you when the required value (Hash, Array, etc.) is provided according to the description.</b></p>"
|
102
|
+
end
|
103
|
+
YardOptionTag.new(
|
104
|
+
name: Underscore.underscore(member_name),
|
105
|
+
ruby_type: Api.ruby_input_type(member_ref, api),
|
106
|
+
required: shape.fetch('required', []).include?(member_name),
|
107
|
+
docstring: Docstring.html_to_markdown(docstring),
|
108
|
+
option_hash_name: 'params',
|
109
|
+
).to_s
|
110
|
+
end
|
111
|
+
else
|
112
|
+
[]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def return_tag(operation, api)
|
117
|
+
output = Api.shape(operation['output'], api)
|
118
|
+
if output && output['members'] && output['members'].size > 0
|
119
|
+
shape_name = operation.fetch('output').fetch('shape')
|
120
|
+
type = "Types::#{shape_name}"
|
121
|
+
_, shape = Api.resolve(shape_name, api)
|
122
|
+
# add rest body streaming if qualified
|
123
|
+
unless shape['payload'].nil?
|
124
|
+
_, member_shape = Api.resolve(shape['payload'], api)
|
125
|
+
unless member_shape.nil?
|
126
|
+
member_shape['streaming'] = member_shape['type'] == 'blob' ||
|
127
|
+
member_shape['type'] == 'string'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
methods = shape['members'].map do |member_name, member_ref|
|
131
|
+
member_type = Docstring.escape_html(Api.ruby_type(member_ref, api))
|
132
|
+
method_name = Underscore.underscore(member_name)
|
133
|
+
"# * {#{type}##{method_name} ##{method_name}} => #{member_type}"
|
134
|
+
end
|
135
|
+
"# @return [#{type}] Returns a {Seahorse::Client::Response response} object which responds to the following methods:\n#\n" + methods.join("\n")
|
136
|
+
else
|
137
|
+
"# @return [Struct] Returns an empty {Seahorse::Client::Response response}."
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def pagination(pager, operation, api)
|
142
|
+
return unless pager
|
143
|
+
|
144
|
+
input = Array(pager['input_token'])
|
145
|
+
output = Array(pager['output_token'])
|
146
|
+
tokens = {}
|
147
|
+
input.each.with_index do |key, n|
|
148
|
+
tokens[Underscore.underscore_jmespath(output[n])] = Underscore.underscore_jmespath(key)
|
149
|
+
end
|
150
|
+
|
151
|
+
return if tokens.empty?
|
152
|
+
|
153
|
+
"# The returned {Seahorse::Client::Response response}" \
|
154
|
+
" is a pageable response and is Enumerable. For details on usage see" \
|
155
|
+
" {Aws::PageableResponse PageableResponse}."
|
156
|
+
end
|
157
|
+
|
158
|
+
def shared_examples(examples, operation, api)
|
159
|
+
return if examples.nil? || examples['examples'].nil? || examples['examples'][@name].nil?
|
160
|
+
begin # skip broken/nil examples
|
161
|
+
example_block = []
|
162
|
+
examples['examples'][@name].each do |example|
|
163
|
+
comments = example['comments']
|
164
|
+
input = SharedExample.new(
|
165
|
+
example['input'],
|
166
|
+
method_name,
|
167
|
+
operation,
|
168
|
+
api,
|
169
|
+
(comments.nil? ? '' : comments['input'])).to_str_input
|
170
|
+
parts = []
|
171
|
+
parts << "#\n"
|
172
|
+
parts << "# @example Example: #{example['title']}\n#\n"
|
173
|
+
if example['description'] && example['description'].length > 0
|
174
|
+
parts << "#{Helper.wrap_string(example['description'], 120, "# # ")}\n#\n"
|
175
|
+
end
|
176
|
+
parts += input.lines.map { |line| "# " + line }
|
177
|
+
if example['output']
|
178
|
+
output = SharedExample.new(
|
179
|
+
example['output'],
|
180
|
+
method_name,
|
181
|
+
operation,
|
182
|
+
api,
|
183
|
+
(comments.nil? ? '' : comments['output'])).to_str_output
|
184
|
+
parts << "\n#\n# resp.to_h outputs the following:\n"
|
185
|
+
parts += output.lines.map { |line| "# " + line }
|
186
|
+
end
|
187
|
+
example_block << parts.join
|
188
|
+
end
|
189
|
+
example_block.join("\n")
|
190
|
+
rescue
|
191
|
+
puts "Invalid example for operation: #{@name}"
|
192
|
+
nil
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def generated_examples(operation, api)
|
197
|
+
nil
|
198
|
+
end
|
199
|
+
|
200
|
+
def eventstream_examples(module_name, method_name, operation, api)
|
201
|
+
return unless !!Helper.eventstream_output?(operation, api)
|
202
|
+
EventStreamExample.new(
|
203
|
+
api: api,
|
204
|
+
operation: operation,
|
205
|
+
method_name: method_name,
|
206
|
+
module_name: module_name,
|
207
|
+
receiver: 'client',
|
208
|
+
resp_var: 'resp'
|
209
|
+
).format
|
210
|
+
end
|
211
|
+
|
212
|
+
def given_examples(client_examples)
|
213
|
+
client_examples.map do |example|
|
214
|
+
name = example[:name]
|
215
|
+
code = example[:code]
|
216
|
+
"# @example #{name}\n" + Docstring.block_comment(code, gap: ' ')
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def request_syntax_example(method_name, operation, api)
|
221
|
+
SyntaxExample.new(
|
222
|
+
api: api,
|
223
|
+
shape: Api.shape(operation['input'], api),
|
224
|
+
method_name: method_name,
|
225
|
+
receiver: 'client',
|
226
|
+
resp_var: 'resp',
|
227
|
+
).format
|
228
|
+
end
|
229
|
+
|
230
|
+
def async_request_syntax_example(method_name, operation, api)
|
231
|
+
SyntaxExample.new(
|
232
|
+
api: api,
|
233
|
+
shape: Api.shape(operation['input'], api),
|
234
|
+
method_name: method_name,
|
235
|
+
receiver: 'async_client',
|
236
|
+
resp_var: 'async_resp',
|
237
|
+
async: true
|
238
|
+
).format
|
239
|
+
end
|
240
|
+
|
241
|
+
def response_structure_example(operation, api)
|
242
|
+
output = Api.shape(operation['output'], api) if operation['output']
|
243
|
+
if output && output['members'] && output['members'].size > 0
|
244
|
+
Docstring.block_comment(ClientResponseStructureExample.new(
|
245
|
+
shape_ref: operation['output'],
|
246
|
+
api: api
|
247
|
+
).to_s)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def waiters_tag(waiters)
|
252
|
+
return unless waiters && waiters.size > 0
|
253
|
+
|
254
|
+
waiters_doc = waiters.map do |w|
|
255
|
+
"# * #{w.name}"
|
256
|
+
end
|
257
|
+
"#\n# The following waiters are defined for this operation (see {Client#wait_until} for detailed usage):\n#\n" + waiters_doc.join("\n")
|
258
|
+
end
|
259
|
+
|
260
|
+
def see_also_tag(operation, api)
|
261
|
+
uid = api['metadata']['uid']
|
262
|
+
if api['metadata']['protocol'] != 'api-gateway' && Crosslink.taggable?(uid)
|
263
|
+
"# " + Crosslink.tag_string(uid, operation['name'])
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
end
|