aws-sdk-code-generator 0.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/aws-sdk-code-generator.rb +91 -0
- data/lib/aws-sdk-code-generator/apply_docs.rb +37 -0
- data/lib/aws-sdk-code-generator/code_builder.rb +201 -0
- data/lib/aws-sdk-code-generator/dsl/access_control_statement.rb +23 -0
- data/lib/aws-sdk-code-generator/dsl/attribute_accessor.rb +43 -0
- data/lib/aws-sdk-code-generator/dsl/attribute_reader.rb +11 -0
- data/lib/aws-sdk-code-generator/dsl/attribute_writer.rb +11 -0
- data/lib/aws-sdk-code-generator/dsl/autoload_statement.rb +15 -0
- data/lib/aws-sdk-code-generator/dsl/block_param.rb +11 -0
- data/lib/aws-sdk-code-generator/dsl/class.rb +27 -0
- data/lib/aws-sdk-code-generator/dsl/code_literal.rb +66 -0
- data/lib/aws-sdk-code-generator/dsl/code_object.rb +33 -0
- data/lib/aws-sdk-code-generator/dsl/docstring.rb +36 -0
- data/lib/aws-sdk-code-generator/dsl/eigenclass.rb +15 -0
- data/lib/aws-sdk-code-generator/dsl/extend_statement.rb +12 -0
- data/lib/aws-sdk-code-generator/dsl/formatter.rb +25 -0
- data/lib/aws-sdk-code-generator/dsl/include_statement.rb +17 -0
- data/lib/aws-sdk-code-generator/dsl/main.rb +105 -0
- data/lib/aws-sdk-code-generator/dsl/method.rb +108 -0
- data/lib/aws-sdk-code-generator/dsl/module.rb +167 -0
- data/lib/aws-sdk-code-generator/dsl/option_tag.rb +36 -0
- data/lib/aws-sdk-code-generator/dsl/param.rb +43 -0
- data/lib/aws-sdk-code-generator/dsl/param_list.rb +38 -0
- data/lib/aws-sdk-code-generator/dsl/return_tag.rb +19 -0
- data/lib/aws-sdk-code-generator/dsl/tag_default.rb +20 -0
- data/lib/aws-sdk-code-generator/dsl/tag_docstring.rb +27 -0
- data/lib/aws-sdk-code-generator/dsl/tag_type.rb +18 -0
- data/lib/aws-sdk-code-generator/errors.rb +30 -0
- data/lib/aws-sdk-code-generator/gem_builder.rb +71 -0
- data/lib/aws-sdk-code-generator/generators/client_api_module.rb +334 -0
- data/lib/aws-sdk-code-generator/generators/client_class.rb +389 -0
- data/lib/aws-sdk-code-generator/generators/client_operation_documentation.rb +166 -0
- data/lib/aws-sdk-code-generator/generators/errors_module.rb +25 -0
- data/lib/aws-sdk-code-generator/generators/resource/action.rb +88 -0
- data/lib/aws-sdk-code-generator/generators/resource/batch_builder.rb +211 -0
- data/lib/aws-sdk-code-generator/generators/resource/builder.rb +50 -0
- data/lib/aws-sdk-code-generator/generators/resource/client_getter.rb +15 -0
- data/lib/aws-sdk-code-generator/generators/resource/client_request.rb +49 -0
- data/lib/aws-sdk-code-generator/generators/resource/client_request_docs.rb +97 -0
- data/lib/aws-sdk-code-generator/generators/resource/client_request_params.rb +88 -0
- data/lib/aws-sdk-code-generator/generators/resource/collection_class.rb +180 -0
- data/lib/aws-sdk-code-generator/generators/resource/data_attribute_getter.rb +24 -0
- data/lib/aws-sdk-code-generator/generators/resource/data_loaded_method.rb +18 -0
- data/lib/aws-sdk-code-generator/generators/resource/data_method.rb +49 -0
- data/lib/aws-sdk-code-generator/generators/resource/exists_method.rb +29 -0
- data/lib/aws-sdk-code-generator/generators/resource/extract_identifier_method.rb +32 -0
- data/lib/aws-sdk-code-generator/generators/resource/has_association.rb +101 -0
- data/lib/aws-sdk-code-generator/generators/resource/has_many_association.rb +108 -0
- data/lib/aws-sdk-code-generator/generators/resource/identifier_getter.rb +26 -0
- data/lib/aws-sdk-code-generator/generators/resource/identifiers_method.rb +28 -0
- data/lib/aws-sdk-code-generator/generators/resource/initialize_method.rb +67 -0
- data/lib/aws-sdk-code-generator/generators/resource/load_method.rb +65 -0
- data/lib/aws-sdk-code-generator/generators/resource/value_source.rb +68 -0
- data/lib/aws-sdk-code-generator/generators/resource/waiter_method.rb +61 -0
- data/lib/aws-sdk-code-generator/generators/resource_class.rb +325 -0
- data/lib/aws-sdk-code-generator/generators/response_structure_example.rb +83 -0
- data/lib/aws-sdk-code-generator/generators/root_resource_class.rb +42 -0
- data/lib/aws-sdk-code-generator/generators/service_documentation.rb +64 -0
- data/lib/aws-sdk-code-generator/generators/shared_example.rb +132 -0
- data/lib/aws-sdk-code-generator/generators/structure_type_class.rb +95 -0
- data/lib/aws-sdk-code-generator/generators/syntax_example.rb +169 -0
- data/lib/aws-sdk-code-generator/generators/types_module.rb +52 -0
- data/lib/aws-sdk-code-generator/generators/waiter_class.rb +62 -0
- data/lib/aws-sdk-code-generator/generators/waiters_module.rb +20 -0
- data/lib/aws-sdk-code-generator/hash_formatter.rb +122 -0
- data/lib/aws-sdk-code-generator/helper.rb +215 -0
- data/lib/aws-sdk-code-generator/service.rb +126 -0
- data/lib/aws-sdk-code-generator/underscore.rb +45 -0
- data/lib/aws-sdk-code-generator/view.rb +23 -0
- data/lib/aws-sdk-code-generator/views.rb +3 -0
- data/lib/aws-sdk-code-generator/views/features/env.rb +24 -0
- data/lib/aws-sdk-code-generator/views/features/step_definitions.rb +20 -0
- data/lib/aws-sdk-code-generator/views/gemspec.rb +41 -0
- data/lib/aws-sdk-code-generator/views/service_module.rb +85 -0
- data/lib/aws-sdk-code-generator/views/spec/spec_helper.rb +24 -0
- data/lib/aws-sdk-code-generator/views/version.rb +16 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cd7b6eb0cfae166558e734fdb8e7c9236f7f14d6
|
4
|
+
data.tar.gz: 8cad3f3e2213a13d558259216831b08e1e4d5323
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c970544cd6c87e3794260f4dda931f717c9e7ef9dfb43693b35c0d22f0a3b1ec850b3ff281b7e9e825591905a2a45b19168337521c8039c2e648db3e66b1d525
|
7
|
+
data.tar.gz: 6a927656fc80f7df13cc27c03f1675a81fb3f000bcec4b6fb3ba6d672ad1e37a74296ccaff8b37137e3ce4912780bf1a1818f4b7c03e13ca3b8781f9a7375ade
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require_relative 'aws-sdk-code-generator/apply_docs'
|
2
|
+
require_relative 'aws-sdk-code-generator/helper'
|
3
|
+
require_relative 'aws-sdk-code-generator/service'
|
4
|
+
require_relative 'aws-sdk-code-generator/underscore'
|
5
|
+
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
|
11
|
+
require_relative 'aws-sdk-code-generator/views/features/env'
|
12
|
+
require_relative 'aws-sdk-code-generator/views/features/step_definitions'
|
13
|
+
require_relative 'aws-sdk-code-generator/views/gemspec'
|
14
|
+
require_relative 'aws-sdk-code-generator/views/service_module'
|
15
|
+
require_relative 'aws-sdk-code-generator/views/spec/spec_helper'
|
16
|
+
require_relative 'aws-sdk-code-generator/views/version'
|
17
|
+
|
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
|
49
|
+
|
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'
|
65
|
+
|
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
|
90
|
+
|
91
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module AwsSdkCodeGenerator
|
2
|
+
class ApplyDocs
|
3
|
+
|
4
|
+
def initialize(api)
|
5
|
+
@api = api
|
6
|
+
end
|
7
|
+
|
8
|
+
# @param [Hash, nil] docs
|
9
|
+
def apply(docs)
|
10
|
+
if docs
|
11
|
+
apply_docs(docs)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def apply_docs(docs)
|
18
|
+
@api['documentation'] = docs['service']
|
19
|
+
docs['operations'].each do |name, docstring|
|
20
|
+
@api['operations'][name]['documentation'] = docstring
|
21
|
+
end
|
22
|
+
docs['shapes'].each do |shape_name, shape_docs|
|
23
|
+
@api['shapes'][shape_name]['documentation'] = shape_docs['base']
|
24
|
+
shape_docs['refs'].each do |ref, ref_docs|
|
25
|
+
ref_shape, ref_member = ref.split('$')
|
26
|
+
case @api['shapes'][ref_shape]['type']
|
27
|
+
when 'structure'
|
28
|
+
@api['shapes'][ref_shape]['members'][ref_member]['documentation'] = ref_docs
|
29
|
+
when 'list', 'map'
|
30
|
+
@api['shapes'][ref_shape][ref_member]['documentation'] = ref_docs
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
module AwsSdkCodeGenerator
|
2
|
+
class CodeBuilder
|
3
|
+
|
4
|
+
# @api private
|
5
|
+
GENERATED_SRC_WARNING = <<-WARNING
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
#
|
8
|
+
# This file is generated. See the contributing for info on making contributions:
|
9
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
10
|
+
#
|
11
|
+
# WARNING ABOUT GENERATED CODE
|
12
|
+
|
13
|
+
WARNING
|
14
|
+
|
15
|
+
include Helper
|
16
|
+
|
17
|
+
# @option options [required, Service] :service
|
18
|
+
def initialize(options)
|
19
|
+
@service = options.fetch(:service)
|
20
|
+
# TODO : remove these
|
21
|
+
@add_plugins = @service.add_plugins
|
22
|
+
@remove_plugins = @service.remove_plugins
|
23
|
+
@gem_dependencies = @service.gem_dependencies
|
24
|
+
@module_names = @service.module_name.split('::')
|
25
|
+
@api = @service.api
|
26
|
+
@paginators = @service.paginators
|
27
|
+
@waiters = @service.waiters
|
28
|
+
@resources = @service.resources
|
29
|
+
@examples = @service.examples
|
30
|
+
end
|
31
|
+
|
32
|
+
def source
|
33
|
+
svc_mod = new_svc_module
|
34
|
+
@gem_dependencies.each { |gem_name, _| svc_mod.require(gem_name) }
|
35
|
+
svc_mod.docstring(service_docstring)
|
36
|
+
each_module do |mod, _|
|
37
|
+
svc_mod.add(mod)
|
38
|
+
end
|
39
|
+
@callback.call(svc_mod) if @callback
|
40
|
+
svc_mod.root.to_s
|
41
|
+
end
|
42
|
+
|
43
|
+
# @option options [String] :prefix
|
44
|
+
# @return [Enumerable<String<path>, String<code>>]
|
45
|
+
def source_files(options = {})
|
46
|
+
prefix = options.fetch(:prefix, nil)
|
47
|
+
prefix ||= @module_names.map { |n| underscore(n) }.join('/')
|
48
|
+
# prefix should always be the gemname. The service-module (the first
|
49
|
+
# item yielded below) should be moved from here into the gem builder
|
50
|
+
# The source code builder should simply yield the empty module
|
51
|
+
Enumerator.new do |y|
|
52
|
+
y.yield("#{prefix}.rb", Views::ServiceModule.new(service: @service, prefix: prefix).render)
|
53
|
+
y.yield("#{prefix}/customizations.rb", '')
|
54
|
+
each_module do |mod, type, code|
|
55
|
+
case type
|
56
|
+
when :unwrapped
|
57
|
+
filename = File.join(prefix, underscore(mod.name) + '.rb')
|
58
|
+
y.yield(filename, GENERATED_SRC_WARNING + wrap(mod))
|
59
|
+
when :wrapped # dsl module
|
60
|
+
filename = File.join(prefix, underscore(mod.name) + '.rb')
|
61
|
+
y.yield(filename, GENERATED_SRC_WARNING + mod.root.to_s)
|
62
|
+
else
|
63
|
+
raise "expected :wrapped or :unwrapped"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def each_module(&block)
|
72
|
+
yield(types_module, :unwrapped)
|
73
|
+
yield(client_api_module, :unwrapped)
|
74
|
+
yield(client_class, :wrapped)
|
75
|
+
yield(errors_module, :unwrapped)
|
76
|
+
yield(waiters_module, :wrapped) if @waiters
|
77
|
+
yield(root_resource_class, :unwrapped)
|
78
|
+
if @resources
|
79
|
+
@resources['resources'].keys.sort.each do |name|
|
80
|
+
yield(resource_class(name, @resources['resources'][name]), :unwrapped)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def new_svc_module
|
86
|
+
@module_names.inject(Dsl::Main.new) do |mod, module_name|
|
87
|
+
mod.module(module_name)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def wrap(mod)
|
92
|
+
svc_mod = new_svc_module
|
93
|
+
svc_mod.add(mod)
|
94
|
+
svc_mod.root.to_s
|
95
|
+
end
|
96
|
+
|
97
|
+
def service_module(autoload_prefix)
|
98
|
+
autoloads = Generators::ServiceAutoloads.new(
|
99
|
+
prefix: autoload_prefix,
|
100
|
+
resources: @resources,
|
101
|
+
waiters: !!@waiters
|
102
|
+
)
|
103
|
+
svc_mod = new_svc_module
|
104
|
+
@gem_dependencies.each { |gem_name, _| svc_mod.require(gem_name) }
|
105
|
+
svc_mod.docstring(service_docstring)
|
106
|
+
svc_mod.code("GEM_VERSION = '#{@service.gem_version}'")
|
107
|
+
autoloads.apply(svc_mod)
|
108
|
+
@callback.call(svc_mod) if @callback
|
109
|
+
svc_mod.root.to_s
|
110
|
+
end
|
111
|
+
|
112
|
+
def types_module
|
113
|
+
Generators::TypesModule.new(api: @api)
|
114
|
+
end
|
115
|
+
|
116
|
+
def client_api_module
|
117
|
+
Generators::ClientApiModule.new(api: @api, paginators:@paginators)
|
118
|
+
end
|
119
|
+
|
120
|
+
def client_class(svc_mod = new_svc_module)
|
121
|
+
klass = Generators::ClientClass.new(
|
122
|
+
parent: svc_mod,
|
123
|
+
identifier: @module_names.last.downcase,
|
124
|
+
api: @api,
|
125
|
+
waiters: @waiters,
|
126
|
+
examples: @examples,
|
127
|
+
add_plugins: @add_plugins,
|
128
|
+
remove_plugins: @remove_plugins,
|
129
|
+
gem_name: @service.gem_name,
|
130
|
+
gem_version: @service.gem_version,
|
131
|
+
)
|
132
|
+
svc_mod.add(klass)
|
133
|
+
klass
|
134
|
+
end
|
135
|
+
|
136
|
+
def errors_module
|
137
|
+
Generators::ErrorsModule.new(api: @api)
|
138
|
+
end
|
139
|
+
|
140
|
+
def waiters_module(svc_mod = new_svc_module)
|
141
|
+
klass = Generators::WaitersModule.new(
|
142
|
+
parent: svc_mod,
|
143
|
+
waiters: @waiters
|
144
|
+
)
|
145
|
+
svc_mod.add(klass)
|
146
|
+
klass
|
147
|
+
end
|
148
|
+
|
149
|
+
def root_resource_class
|
150
|
+
Generators::RootResourceClass.new({
|
151
|
+
api: @api,
|
152
|
+
resources: @resources,
|
153
|
+
paginators: @paginators,
|
154
|
+
var_name: underscore(@module_names.last),
|
155
|
+
})
|
156
|
+
end
|
157
|
+
|
158
|
+
def resource_class(resource_name, resource_definition)
|
159
|
+
Generators::ResourceClass.new(
|
160
|
+
api: @api,
|
161
|
+
name: resource_name,
|
162
|
+
resource: resource_definition,
|
163
|
+
paginators: @paginators,
|
164
|
+
waiters: @waiters,
|
165
|
+
)
|
166
|
+
end
|
167
|
+
|
168
|
+
def service_docstring
|
169
|
+
metadata = @api['metadata'] || {}
|
170
|
+
Generators::ServiceDocumentation.new(
|
171
|
+
product_name: metadata['serviceFullName'] || @module_names.last,
|
172
|
+
namespace: @module_names.join('::'),
|
173
|
+
api: @api
|
174
|
+
).docstring
|
175
|
+
end
|
176
|
+
|
177
|
+
# @api private
|
178
|
+
# This method can be removed if move to used the combined API and
|
179
|
+
# docs JSON document.
|
180
|
+
def apply_docs(api, docs)
|
181
|
+
api['documentation'] = docs['service']
|
182
|
+
docs['operations'].each do |name, docstring|
|
183
|
+
api['operations'][name]['documentation'] = docstring
|
184
|
+
end
|
185
|
+
docs['shapes'].each do |shape_name, shape_docs|
|
186
|
+
api['shapes'][shape_name]['documentation'] = shape_docs['base']
|
187
|
+
shape_docs['refs'].each do |ref, ref_docs|
|
188
|
+
ref_shape, ref_member = ref.split('$')
|
189
|
+
case api['shapes'][ref_shape]['type']
|
190
|
+
when 'structure'
|
191
|
+
api['shapes'][ref_shape]['members'][ref_member]['documentation'] = ref_docs
|
192
|
+
when 'list', 'map'
|
193
|
+
api['shapes'][ref_shape][ref_member]['documentation'] = ref_docs
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module AwsSdkCodeGenerator
|
2
|
+
module Dsl
|
3
|
+
class AccessControlStatement
|
4
|
+
|
5
|
+
include Dsl::CodeObject
|
6
|
+
|
7
|
+
def initialize(access)
|
8
|
+
if [:public, :protected, :private].include?(access)
|
9
|
+
@access = access
|
10
|
+
else
|
11
|
+
raise ArgumentError, "expected :public, :protected, or :private"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :access
|
16
|
+
|
17
|
+
def lines
|
18
|
+
[access.to_s]
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module AwsSdkCodeGenerator
|
2
|
+
module Dsl
|
3
|
+
class AttributeAccessor
|
4
|
+
|
5
|
+
include Dsl::CodeObject
|
6
|
+
|
7
|
+
# @option options [Boolean] :api_private (false)
|
8
|
+
def initialize(name, options = {}, &block)
|
9
|
+
@name = name
|
10
|
+
@tags = []
|
11
|
+
yield(self) if block
|
12
|
+
api_private! if options.fetch(:api_private, false)
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :name
|
16
|
+
|
17
|
+
def returns(type, options = {})
|
18
|
+
@tags << ReturnTag.new(options.merge(type:type))
|
19
|
+
end
|
20
|
+
|
21
|
+
def api_private!
|
22
|
+
@tags << "# @api private"
|
23
|
+
end
|
24
|
+
|
25
|
+
def documented?
|
26
|
+
!@tags.empty?
|
27
|
+
end
|
28
|
+
|
29
|
+
def lines
|
30
|
+
lines = []
|
31
|
+
@tags.each do |tag|
|
32
|
+
lines.concat(tag.lines.to_a)
|
33
|
+
end
|
34
|
+
lines + ["#{macro} :#{@name}"]
|
35
|
+
end
|
36
|
+
|
37
|
+
def macro
|
38
|
+
"attr_accessor"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|