aws-sdk-core 2.0.48 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/apis/autoscaling/2011-01-01/api-2.json +636 -33
  3. data/apis/cloudhsm/2014-05-30/api-2.json +3 -6
  4. data/apis/ec2/2014-10-01/api-2.json +10267 -0
  5. data/apis/ec2/2014-10-01/paginators-1.json +125 -0
  6. data/apis/ec2/2014-10-01/resources-1.json +2289 -0
  7. data/apis/ec2/2014-10-01/waiters-2.json +453 -0
  8. data/apis/ec2/2015-03-01/api-2.json +11245 -0
  9. data/apis/ec2/2015-03-01/paginators-1.json +125 -0
  10. data/apis/ec2/2015-03-01/resources-1.json +2479 -0
  11. data/apis/ec2/2015-03-01/waiters-2.json +458 -0
  12. data/apis/ec2/2015-04-15/api-2.json +182 -2
  13. data/apis/ecs/2014-11-13/api-2.json +316 -7
  14. data/apis/ecs/2014-11-13/paginators-1.json +40 -0
  15. data/apis/ecs/2014-11-13/waiters-2.json +93 -0
  16. data/apis/redshift/2012-12-01/waiters-2.json +19 -0
  17. data/apis/s3/2006-03-01/api-2.json +1 -2
  18. data/apis/sqs/2012-11-05/api-2.json +5 -6
  19. data/ca-bundle.crt +3554 -0
  20. data/lib/aws-sdk-core.rb +127 -44
  21. data/lib/aws-sdk-core/api/builder.rb +95 -0
  22. data/lib/aws-sdk-core/api/customizations.rb +152 -0
  23. data/lib/aws-sdk-core/api/docs/builder.rb +220 -0
  24. data/lib/aws-sdk-core/api/docs/client_type_documenter.rb +109 -0
  25. data/lib/aws-sdk-core/api/docs/docstring_provider.rb +66 -0
  26. data/lib/aws-sdk-core/api/docs/operation_documenter.rb +107 -0
  27. data/lib/aws-sdk-core/api/docs/param_formatter.rb +163 -0
  28. data/lib/aws-sdk-core/api/docs/request_syntax_example.rb +22 -0
  29. data/lib/aws-sdk-core/api/docs/response_structure_example.rb +91 -0
  30. data/lib/aws-sdk-core/api/docs/utils.rb +133 -0
  31. data/lib/aws-sdk-core/api/shape_map.rb +140 -0
  32. data/lib/aws-sdk-core/assume_role_credentials.rb +9 -6
  33. data/lib/aws-sdk-core/client.rb +9 -6
  34. data/lib/aws-sdk-core/client_stubs.rb +127 -133
  35. data/lib/aws-sdk-core/client_waiters.rb +1 -1
  36. data/lib/aws-sdk-core/credential_provider.rb +44 -0
  37. data/lib/aws-sdk-core/credential_provider_chain.rb +3 -2
  38. data/lib/aws-sdk-core/credentials.rb +5 -0
  39. data/lib/aws-sdk-core/deprecations.rb +69 -0
  40. data/lib/aws-sdk-core/dynamodb.rb +12 -0
  41. data/lib/aws-sdk-core/eager_loader.rb +31 -0
  42. data/lib/aws-sdk-core/ecs.rb +2 -0
  43. data/lib/aws-sdk-core/empty_structure.rb +1 -82
  44. data/lib/aws-sdk-core/endpoint_provider.rb +1 -1
  45. data/lib/aws-sdk-core/instance_profile_credentials.rb +9 -10
  46. data/lib/aws-sdk-core/json.rb +56 -0
  47. data/lib/aws-sdk-core/json/builder.rb +33 -34
  48. data/lib/aws-sdk-core/json/error_handler.rb +2 -2
  49. data/lib/aws-sdk-core/json/handler.rb +67 -0
  50. data/lib/aws-sdk-core/json/json_engine.rb +15 -0
  51. data/lib/aws-sdk-core/json/oj_engine.rb +15 -0
  52. data/lib/aws-sdk-core/json/parser.rb +30 -38
  53. data/lib/aws-sdk-core/pageable_response.rb +9 -12
  54. data/lib/aws-sdk-core/pager.rb +69 -0
  55. data/lib/aws-sdk-core/param_converter.rb +203 -0
  56. data/lib/aws-sdk-core/param_validator.rb +148 -0
  57. data/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb +21 -18
  58. data/lib/aws-sdk-core/plugins/glacier_account_id.rb +9 -1
  59. data/lib/aws-sdk-core/plugins/glacier_checksums.rb +2 -3
  60. data/lib/aws-sdk-core/plugins/param_converter.rb +27 -0
  61. data/lib/aws-sdk-core/plugins/param_validator.rb +28 -0
  62. data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +3 -7
  63. data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +1 -2
  64. data/lib/aws-sdk-core/plugins/protocols/rest_xml.rb +1 -1
  65. data/lib/aws-sdk-core/plugins/regional_endpoint.rb +1 -1
  66. data/lib/aws-sdk-core/plugins/request_signer.rb +5 -5
  67. data/lib/aws-sdk-core/plugins/response_paging.rb +20 -11
  68. data/lib/aws-sdk-core/plugins/s3_get_bucket_location_fix.rb +1 -1
  69. data/lib/aws-sdk-core/plugins/s3_request_signer.rb +1 -2
  70. data/lib/aws-sdk-core/plugins/stub_responses.rb +25 -27
  71. data/lib/aws-sdk-core/query/ec2_param_builder.rb +29 -34
  72. data/lib/aws-sdk-core/query/handler.rb +32 -18
  73. data/lib/aws-sdk-core/query/param_builder.rb +45 -53
  74. data/lib/aws-sdk-core/refreshing_credentials.rb +3 -15
  75. data/lib/aws-sdk-core/rest/handler.rb +22 -0
  76. data/lib/aws-sdk-core/rest/request/body.rb +58 -0
  77. data/lib/aws-sdk-core/rest/request/builder.rb +50 -0
  78. data/lib/aws-sdk-core/rest/request/endpoint.rb +70 -0
  79. data/lib/aws-sdk-core/rest/request/headers.rb +48 -0
  80. data/lib/aws-sdk-core/rest/response/body.rb +43 -0
  81. data/lib/aws-sdk-core/rest/response/headers.rb +60 -0
  82. data/lib/aws-sdk-core/rest/response/parser.rb +47 -0
  83. data/lib/aws-sdk-core/rest/response/status_code.rb +24 -0
  84. data/lib/aws-sdk-core/shared_credentials.rb +11 -6
  85. data/lib/aws-sdk-core/signers/base.rb +1 -1
  86. data/lib/aws-sdk-core/signers/s3.rb +2 -3
  87. data/lib/aws-sdk-core/signers/v2.rb +7 -4
  88. data/lib/aws-sdk-core/signers/v4.rb +11 -22
  89. data/lib/aws-sdk-core/structure.rb +26 -145
  90. data/lib/aws-sdk-core/stubbing/data_applicator.rb +46 -0
  91. data/lib/aws-sdk-core/stubbing/empty_stub.rb +53 -0
  92. data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +49 -0
  93. data/lib/aws-sdk-core/stubbing/protocols/json.rb +40 -0
  94. data/lib/aws-sdk-core/stubbing/protocols/query.rb +40 -0
  95. data/lib/aws-sdk-core/stubbing/protocols/rest.rb +67 -0
  96. data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +25 -0
  97. data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +38 -0
  98. data/lib/aws-sdk-core/stubbing/stub_data.rb +34 -0
  99. data/lib/aws-sdk-core/version.rb +1 -1
  100. data/lib/aws-sdk-core/xml/builder.rb +58 -52
  101. data/lib/aws-sdk-core/xml/default_map.rb +10 -0
  102. data/lib/aws-sdk-core/xml/doc_builder.rb +86 -0
  103. data/lib/aws-sdk-core/xml/error_handler.rb +7 -2
  104. data/lib/aws-sdk-core/xml/parser.rb +4 -4
  105. data/lib/aws-sdk-core/xml/parser/frame.rb +75 -70
  106. data/lib/aws-sdk-core/xml/parser/stack.rb +4 -4
  107. data/lib/seahorse.rb +0 -11
  108. data/lib/seahorse/client/base.rb +3 -12
  109. data/lib/seahorse/client/http/request.rb +9 -5
  110. data/lib/seahorse/client/plugins/endpoint.rb +5 -56
  111. data/lib/seahorse/client/plugins/restful_bindings.rb +38 -31
  112. data/lib/seahorse/client/request_context.rb +2 -2
  113. data/lib/seahorse/client/response.rb +6 -5
  114. data/lib/seahorse/model/api.rb +18 -61
  115. data/lib/seahorse/model/operation.rb +24 -54
  116. data/lib/seahorse/model/shapes.rb +120 -364
  117. data/lib/seahorse/util.rb +2 -6
  118. metadata +56 -109
  119. data/apis/autoscaling/2011-01-01/docs-2.json +0 -1246
  120. data/apis/cloudformation/2010-05-15/docs-2.json +0 -725
  121. data/apis/cloudfront/2014-11-06/docs-2.json +0 -1125
  122. data/apis/cloudhsm/2014-05-30/docs-2.json +0 -472
  123. data/apis/cloudsearch/2013-01-01/docs-2.json +0 -865
  124. data/apis/cloudsearchdomain/2013-01-01/docs-2.json +0 -311
  125. data/apis/cloudtrail/2013-11-01/docs-2.json +0 -328
  126. data/apis/codedeploy/2014-10-06/docs-2.json +0 -1261
  127. data/apis/cognito-identity/2014-06-30/docs-2.json +0 -506
  128. data/apis/cognito-sync/2014-06-30/docs-2.json +0 -582
  129. data/apis/config/2014-10-17/docs-2.json +0 -513
  130. data/apis/config/2014-11-12/docs-2.json +0 -514
  131. data/apis/datapipeline/2012-10-29/docs-2.json +0 -607
  132. data/apis/directconnect/2012-10-25/docs-2.json +0 -494
  133. data/apis/ds/2015-04-16/docs-2.json +0 -753
  134. data/apis/dynamodb/2011-12-05/api-2.json +0 -949
  135. data/apis/dynamodb/2011-12-05/docs-2.json +0 -606
  136. data/apis/dynamodb/2011-12-05/paginators-1.json +0 -26
  137. data/apis/dynamodb/2011-12-05/waiters-2.json +0 -35
  138. data/apis/dynamodb/2012-08-10/docs-2.json +0 -977
  139. data/apis/ec2/2015-04-15/docs-2.json +0 -5368
  140. data/apis/ecs/2014-11-13/docs-2.json +0 -791
  141. data/apis/elasticache/2015-02-02/docs-2.json +0 -1390
  142. data/apis/elasticbeanstalk/2010-12-01/docs-2.json +0 -1114
  143. data/apis/elasticfilesystem/2015-02-01/docs-2.json +0 -414
  144. data/apis/elasticloadbalancing/2012-06-01/docs-2.json +0 -1078
  145. data/apis/elasticmapreduce/2009-03-31/docs-2.json +0 -969
  146. data/apis/elastictranscoder/2012-09-25/docs-2.json +0 -1152
  147. data/apis/email/2010-12-01/docs-2.json +0 -441
  148. data/apis/glacier/2012-06-01/docs-2.json +0 -575
  149. data/apis/iam/2010-05-08/docs-2.json +0 -2138
  150. data/apis/importexport/2010-06-01/docs-2.json +0 -432
  151. data/apis/kinesis/2013-12-02/docs-2.json +0 -424
  152. data/apis/kms/2014-11-01/docs-2.json +0 -628
  153. data/apis/lambda/2014-11-11/docs-2.json +0 -303
  154. data/apis/lambda/2015-03-31/docs-2.json +0 -490
  155. data/apis/logs/2014-03-28/docs-2.json +0 -599
  156. data/apis/machinelearning/2014-12-12/docs-2.json +0 -1034
  157. data/apis/monitoring/2010-08-01/docs-2.json +0 -514
  158. data/apis/opsworks/2013-02-18/docs-2.json +0 -1592
  159. data/apis/rds/2014-10-31/docs-2.json +0 -2074
  160. data/apis/redshift/2012-12-01/docs-2.json +0 -1890
  161. data/apis/route53/2013-04-01/docs-2.json +0 -1159
  162. data/apis/route53domains/2014-05-15/docs-2.json +0 -620
  163. data/apis/s3/2006-03-01/docs-2.json +0 -2213
  164. data/apis/sdb/2009-04-15/docs-2.json +0 -339
  165. data/apis/sns/2010-03-31/docs-2.json +0 -564
  166. data/apis/sqs/2012-11-05/docs-2.json +0 -503
  167. data/apis/ssm/2014-11-06/docs-2.json +0 -440
  168. data/apis/storagegateway/2013-06-30/docs-2.json +0 -1331
  169. data/apis/sts/2011-06-15/docs-2.json +0 -351
  170. data/apis/support/2013-04-15/docs-2.json +0 -680
  171. data/apis/swf/2012-01-25/docs-2.json +0 -1569
  172. data/apis/workspaces/2015-04-08/docs-2.json +0 -457
  173. data/lib/aws-sdk-core/api/customizer.rb +0 -75
  174. data/lib/aws-sdk-core/api/docstrings.rb +0 -38
  175. data/lib/aws-sdk-core/api/documenter.rb +0 -241
  176. data/lib/aws-sdk-core/api/operation_documenter.rb +0 -173
  177. data/lib/aws-sdk-core/api/operation_example.rb +0 -133
  178. data/lib/aws-sdk-core/api/service_customizations.rb +0 -140
  179. data/lib/aws-sdk-core/client_paging.rb +0 -31
  180. data/lib/aws-sdk-core/json/rest_handler.rb +0 -20
  181. data/lib/aws-sdk-core/json/rpc_body_handler.rb +0 -38
  182. data/lib/aws-sdk-core/json/rpc_headers_handler.rb +0 -34
  183. data/lib/aws-sdk-core/json/simple_body_handler.rb +0 -34
  184. data/lib/aws-sdk-core/paging/null_pager.rb +0 -20
  185. data/lib/aws-sdk-core/paging/null_provider.rb +0 -13
  186. data/lib/aws-sdk-core/paging/pager.rb +0 -70
  187. data/lib/aws-sdk-core/paging/provider.rb +0 -22
  188. data/lib/aws-sdk-core/rest_body_handler.rb +0 -111
  189. data/lib/aws-sdk-core/signers/handler.rb +0 -18
  190. data/lib/aws-sdk-core/xml/rest_handler.rb +0 -20
  191. data/lib/seahorse/client/param_converter.rb +0 -207
  192. data/lib/seahorse/client/param_validator.rb +0 -139
  193. data/lib/seahorse/client/plugins/json_simple.rb +0 -33
  194. data/lib/seahorse/client/plugins/param_conversion.rb +0 -29
  195. data/lib/seahorse/client/plugins/param_validation.rb +0 -30
  196. data/lib/seahorse/client/xml/builder.rb +0 -91
  197. data/lib/seahorse/model/shape_map.rb +0 -47
@@ -1,75 +0,0 @@
1
- module Aws
2
- module Api
3
- class Customizer
4
-
5
- # @api private
6
- def initialize(client_class)
7
- @client_class = client_class
8
- @api = client_class.api
9
- end
10
-
11
- # @return [Class<Seahorse::Client::Base>]
12
- attr_reader :client_class
13
-
14
- # @return [Seahorse::Model::Api]
15
- attr_reader :api
16
-
17
- # @api private
18
- def apply(&customizations)
19
- instance_eval(&customizations)
20
- end
21
-
22
- # @param [String, Class<Seahorse::Client::Plugin>] plugin
23
- def add_plugin(plugin)
24
- @client_class.add_plugin(plugin)
25
- end
26
-
27
- # @param [String, Class<Seahorse::Client::Plugin>] plugin
28
- def remove_plugin(plugin)
29
- @client_class.remove_plugin(plugin)
30
- end
31
-
32
- def metadata(key, value)
33
- @client_class.api.definition['metadata'][key] = value
34
- end
35
-
36
- def add_shape(shape_name, definition)
37
- @client_class.api.definition['shapes'][shape_name] = definition
38
- end
39
-
40
- def reshape(shape_name, modifications)
41
- shape = @client_class.api.definition['shapes'][shape_name]
42
- shape = deep_merge(shape, modifications)
43
- @client_class.api.definition['shapes'][shape_name] = shape
44
- end
45
-
46
- def reshape_members(member_regex, modifications)
47
- if member_regex.is_a?(String)
48
- member_regex = /^#{member_regex}$/
49
- end
50
- @client_class.api.definition['shapes'].each_value do |shape|
51
- if shape['members']
52
- shape['members'].each do |member_name, member_ref|
53
- if member_name.match(member_regex)
54
- shape['members'][member_name] = deep_merge(member_ref, modifications)
55
- end
56
- end
57
- end
58
- end
59
- end
60
-
61
- def each_operation(&block)
62
- @client_class.api.definition['operations'].each(&block)
63
- end
64
-
65
- private
66
-
67
- def deep_merge(first_hash, other_hash)
68
- first_hash.merge(other_hash) do |key, old, new|
69
- Hash === old && Hash === new ? deep_merge(old, new) : new
70
- end
71
- end
72
-
73
- end
74
- end
75
- end
@@ -1,38 +0,0 @@
1
- module Aws
2
- module Api
3
- # @api private
4
- # This module loads the API documentation for the given API.
5
- module Docstrings
6
-
7
- def self.apply(client_class, path)
8
- api = client_class.api.definition
9
- docs = File.open(path, 'r', encoding: 'UTF-8') { |f| f.read }
10
- docs = MultiJson.load(docs)
11
-
12
- api['documentation'] = docs['service']
13
-
14
- docs['operations'].each do |operation, doc|
15
- api['operations'][operation]['documentation'] = doc
16
- end
17
-
18
- docs['shapes'].each do |shape_name, shape|
19
- api['shapes'][shape_name]['documentation'] = shape['base']
20
- shape['refs'].each do |ref,doc|
21
- if doc.nil?
22
- doc = shape['base']
23
- end
24
- target_shape_name, member = ref.split('$')
25
- target_shape = api['shapes'][target_shape_name]
26
- case target_shape['type']
27
- when 'structure' then target_shape['members'][member]['documentation'] = doc
28
- when 'list' then target_shape[member]['documentation'] = doc
29
- when 'map' then target_shape[member]['documentation'] = doc
30
- else raise 'not handled'
31
- end
32
- end
33
- end
34
- client_class.set_api(Seahorse::Model::Api.new(api))
35
- end
36
- end
37
- end
38
- end
@@ -1,241 +0,0 @@
1
- require 'erb'
2
-
3
- module Aws
4
- module Api
5
- class Documenter
6
-
7
- def initialize(svc_module, docs_path)
8
- @svc_module = svc_module
9
- @svc_name = svc_module.name.split('::').last
10
- @client_class = svc_module.const_get(:Client)
11
- Aws::Api::Docstrings.apply(@client_class, docs_path)
12
- @api = @client_class.api
13
- @full_name = @api.metadata('serviceFullName')
14
- @error_names = @api.operations.map {|_,o| o.errors.map(&:name) }
15
- @error_names = @error_names.flatten.uniq.sort
16
- @namespace = YARD::Registry['Aws']
17
- end
18
-
19
- def apply
20
- document_service
21
- document_client
22
- document_errors
23
- end
24
-
25
- private
26
-
27
- def document_service
28
- yard_mod = YARD::CodeObjects::ModuleObject.new(@namespace, @svc_name)
29
- yard_mod.docstring = service_docstring
30
- yard_mod.docstring.add_tag(YARD::Tags::Tag.new(:service, @svc_name))
31
- @namespace = yard_mod
32
- end
33
-
34
- def service_docstring
35
- path = "doc-src/services/#{@svc_name}/service.md"
36
- path = 'doc-src/services/default/service.md' unless File.exists?(path)
37
- template = read(path)
38
- svc_name = @svc_name
39
- api = @api
40
- full_name = @full_name
41
- ERB.new(template).result(binding)
42
- end
43
-
44
- def document_errors
45
- yard_mod = YARD::CodeObjects::ModuleObject.new(@namespace, 'Errors')
46
- yard_mod.docstring = errors_docstring
47
-
48
- base_error = YARD::CodeObjects::ClassObject.new(yard_mod, 'ServiceError')
49
- base_error.docstring = "Base class for all Aws::#{@svc_name} errors."
50
- base_error.superclass = YARD::Registry['Aws::Errors::ServiceError']
51
-
52
- @error_names.each do |error_name|
53
- error_klass = YARD::CodeObjects::ClassObject.new(yard_mod, error_name)
54
- error_klass.superclass = base_error
55
- end
56
- end
57
-
58
- def errors_docstring
59
- path = "doc-src/services/#{@svc_name}/errors.md"
60
- path = 'doc-src/services/default/errors.md' unless File.exists?(path)
61
- template = read(path)
62
- svc_name = @svc_name
63
- api = @api
64
- full_name = @full_name
65
- known_errors = @error_names
66
- ERB.new(template).result(binding)
67
- end
68
-
69
- def document_client
70
- yard_class = YARD::CodeObjects::ClassObject.new(@namespace, 'Client')
71
- yard_class.superclass = YARD::Registry['Seahorse::Client::Base']
72
- yard_class.docstring = client_docstring
73
- document_client_constructor(yard_class)
74
- document_client_operations(yard_class)
75
- document_client_waiters(yard_class)
76
- end
77
-
78
- def client_docstring
79
- path = "doc-src/services/#{@svc_name}/client.md"
80
- path = 'doc-src/services/default/client.md' unless File.exists?(path)
81
- render(path)
82
- end
83
-
84
- def render(path)
85
- svc_name = @svc_name
86
- api = @api
87
- full_name = @full_name
88
- ERB.new(File.read(path)).result(binding)
89
- end
90
-
91
- def document_client_constructor(namespace)
92
- constructor = YARD::CodeObjects::MethodObject.new(namespace, :initialize)
93
- constructor.group = 'Constructor'
94
- constructor.scope = :instance
95
- constructor.parameters << ['options', '{}']
96
- constructor.docstring = client_constructor_docstring
97
- end
98
-
99
- def client_constructor_docstring
100
- <<-DOCS.strip
101
- Constructs an API client.
102
- #{client_constructor_options}
103
- @return [#{@client_class.name}] Returns an API client.
104
- DOCS
105
- end
106
-
107
- def client_constructor_options
108
- options = {}
109
- @client_class.plugins.each do |plugin|
110
- if p = YARD::Registry[plugin.name]
111
- p.tags.each do |tag|
112
- if tag.tag_name == 'seahorse_client_option'
113
- option_name = tag.text.match(/.+(:\w+)/)[1]
114
- option_text = "@option options " + tag.text.split("\n").join("\n ")
115
- options[option_name] = option_text +
116
- " See {#{plugin.name}} for more details."
117
- end
118
- end
119
- end
120
- end
121
- options.sort_by { |k,v| k }.map(&:last).join("\n")
122
- end
123
-
124
- def document_client_operations(namespace)
125
- @api.operations.each do |method_name, operation|
126
- document_client_operation(namespace, method_name, operation)
127
- end
128
- end
129
-
130
- def document_client_operation(namespace, method_name, operation)
131
- m = YARD::CodeObjects::MethodObject.new(namespace, method_name)
132
- m.group = 'Service Operations'
133
- m.scope = :instance
134
- m.parameters << ['params', '{}']
135
- m.docstring = operation_docstring(method_name, operation)
136
- end
137
-
138
- def operation_docstring(method_name, operation)
139
-
140
- documentor = OperationDocumenter.new(
141
- svc_var_name: @svc_name.downcase,
142
- method_name: method_name,
143
- operation: operation)
144
-
145
- tabs = Tabulator.new.tap do |t|
146
- t.tab(method_name, 'Formatting Example') do
147
- "<pre><code>#{documentor.example}</code></pre>"
148
- end
149
- t.tab(method_name, 'Request Parameters') do
150
- documentor.input
151
- end
152
- t.tab(method_name, 'Response Structure') do
153
- documentor.output
154
- end
155
- end
156
-
157
- errors = (operation.errors || []).map { |shape| shape.name }
158
- errors = errors.map { |e| "@raise [Errors::#{e}]" }.join("\n")
159
-
160
- docstring = <<-DOCSTRING.strip
161
- <p>Calls the #{operation.name} operation.<p>
162
- #{documentor.api_ref(operation)}
163
- #{tabs}
164
- @param [Hash] params ({})
165
- @return [PageableResponse]
166
- #{errors}
167
- DOCSTRING
168
- end
169
-
170
- def document_client_waiters(yard_class)
171
- m = YARD::CodeObjects::MethodObject.new(yard_class, :wait_until)
172
- m.scope = :instance
173
- m.parameters << ['waiter_name', nil]
174
- m.parameters << ['params', '{}']
175
- m.docstring = YARD::Registry['Aws::ClientWaiters#wait_until'].docstring
176
-
177
- waiters = @client_class.waiters.waiter_names.sort.inject('') do |w,name|
178
- waiter = @client_class.waiters.waiter(name)
179
- operation = waiter.poller.operation_name
180
- w << "<tr><td><tt>:#{name}</tt></td><td>{##{operation}}</td><td>#{waiter.delay}</td><td>#{waiter.max_attempts}</td></tr>"
181
- end
182
- docstring = <<-DOCSTRING
183
- Returns the list of supported waiters. The following table lists the supported
184
- waiters and the client method they call:
185
- <table>
186
- <thead>
187
- <tr><th>Waiter Name</th><th>Client Method</th><th>Delay</th><th>Max Attempts</th></tr>
188
- </thead>
189
- <tbody>
190
- #{waiters}
191
- </tbody>
192
- </table>
193
- @return [Array<Symbol>] the list of supported waiters.
194
- DOCSTRING
195
- m = YARD::CodeObjects::MethodObject.new(yard_class, :waiter_names)
196
- m.scope = :instance
197
- m.docstring = docstring
198
- end
199
-
200
- class Tabulator
201
-
202
- def initialize
203
- @tabs = []
204
- @tab_contents = []
205
- end
206
-
207
- def tab(method_name, tab_name, &block)
208
- tab_class = tab_name.downcase.gsub(/[^a-z]+/i, '-')
209
- tab_id = "#{method_name.to_s.gsub(/_/, '-')}-#{tab_class}"
210
- class_names = ['tab-contents', tab_class]
211
- @tabs << [tab_id, tab_name]
212
- @tab_contents << "<div class=\"#{class_names.join(' ')}\" id=\"#{tab_id}\">"
213
- @tab_contents << yield
214
- @tab_contents << '</div>'
215
- end
216
-
217
- def to_html
218
- lines = []
219
- lines << '<div class="tab-box">'
220
- lines << '<ul class="tabs">'
221
- @tabs.each do |tab_id, tab_name|
222
- lines << "<li data-tab-id=\"#{tab_id}\">#{tab_name}</li>"
223
- end
224
- lines << '</ul>'
225
- lines.concat(@tab_contents)
226
- lines << '</div>'
227
- lines.join
228
- end
229
- alias inspect to_html
230
- alias to_str to_html
231
- alias to_s to_html
232
-
233
- end
234
-
235
- def read(path)
236
- File.open(path, 'r', encoding: 'UTF-8') { |f| f.read }
237
- end
238
-
239
- end
240
- end
241
- end
@@ -1,173 +0,0 @@
1
- module Aws
2
- module Api
3
- class OperationDocumenter
4
-
5
- def initialize(options)
6
- @operation = options[:operation]
7
- @example = OperationExample.new(options)
8
- end
9
-
10
- def input
11
- params(nil) do
12
- if @operation.input
13
- lines = []
14
- if @operation.output
15
- lines << '<div class="param"><div class="entry"><span class="key">:response_target</span> => String, Pathname, File</div>Optional path to a file or file object where the HTTP response body should be written.</div>'
16
- end
17
- lines + structure(@operation.input, [])
18
- else
19
- []
20
- end
21
- end.join
22
- end
23
-
24
- def output
25
- params(nil) do
26
- if @operation.output
27
- structure(@operation.output, [])
28
- else
29
- []
30
- end
31
- end.join
32
- end
33
-
34
- def example
35
- @example
36
- end
37
-
38
- def clean(docs)
39
- docs = docs.gsub(/<!--.*?-->/m, '')
40
- docs = docs.gsub(/<examples?>.+?<\/examples?>/m, '')
41
- docs = docs.gsub(/<\/?note>/m, '')
42
- docs = docs.gsub(/\{(\S+)\}/, '`{\1}`')
43
- docs = docs.gsub(/\s+/, ' ').strip
44
- docs
45
- end
46
-
47
- def api_ref(shape)
48
- docs = shape.nil? ? '' : shape.documentation
49
- if docs && !docs.empty?
50
- "<div class=\"api-ref\">#{clean(docs)}</div>"
51
- end
52
- end
53
-
54
- private
55
-
56
- def params(shape, &block)
57
- if shape && shape.name == 'AttributeValue'
58
- ['<p>An attribute value may be one of:<ul><li>`Hash`</li><li>`Array`</li><li>`String`</li><li>`Numeric`</li><li>`true` | `false`</li><li>`nil`</li><li>`IO`</li><li>`Set<String,Numeric,IO>`</li></ul></p>']
59
- else
60
- ['<div class="params">', api_ref(shape)] + yield + ['</div>']
61
- end
62
- end
63
-
64
- def param(shape, key_name, value_type, required, visited, &block)
65
- lines = []
66
- lines << '<div class="param">'
67
- lines << entry(shape, key_name, value_type, required, visited)
68
-
69
- if visited.include?(shape)
70
- lines << "AttributeValue, recursive"
71
- else
72
- visited = visited + [shape]
73
- yield(lines) if block_given?
74
- lines += nested_params(shape, visited)
75
- end
76
-
77
- lines << '</div>'
78
- lines
79
- end
80
-
81
- def nested_params(shape, visited)
82
- if leaf?(shape)
83
- nested(shape, visited)
84
- else
85
- params(shape) { nested(shape, visited) }
86
- end
87
- end
88
-
89
- def nested(shape, visited)
90
- case shape
91
- when Seahorse::Model::Shapes::Structure then structure(shape, visited)
92
- when Seahorse::Model::Shapes::Map then map(shape, visited)
93
- when Seahorse::Model::Shapes::List then list(shape, visited)
94
- else [api_ref(shape)]
95
- end
96
- end
97
-
98
- def structure(shape, visited)
99
- shape.members.inject([]) do |lines, (member_name, member_shape)|
100
- lines += param(member_shape, member_name, shape_type(member_shape), shape.required.include?(member_name), visited)
101
- end
102
- end
103
-
104
- def map(shape, visited)
105
- param(shape.value, key_name(shape), value_type(shape), false, visited)
106
- end
107
-
108
- def list(shape, visited)
109
- case shape.member
110
- when Seahorse::Model::Shapes::Structure then structure(shape.member, visited)
111
- when Seahorse::Model::Shapes::Map then map(shape.member, visited)
112
- when Seahorse::Model::Shapes::List then raise NotImplementedError
113
- else [api_ref(shape)]
114
- end
115
- end
116
-
117
- def entry(shape, key_name, value_type, required, visited)
118
- classes = ['key']
119
- classes << 'required' if required
120
- line = '<div class="entry">'
121
- line << "<span class=\"#{classes.join(' ')}\">#{key_name.inspect}</span>"
122
- line << " => #{value_type}"
123
- line << '</div>'
124
- line
125
- end
126
-
127
- def shape_type(shape)
128
- case shape
129
- when Seahorse::Model::Shapes::Structure then 'Hash'
130
- when Seahorse::Model::Shapes::Map then 'Hash'
131
- when Seahorse::Model::Shapes::List then "Array&lt;#{value_type(shape)}&gt;"
132
- when Seahorse::Model::Shapes::String then 'String'
133
- when Seahorse::Model::Shapes::Timestamp then 'Time'
134
- when Seahorse::Model::Shapes::Integer then 'Integer'
135
- when Seahorse::Model::Shapes::Float then 'Number'
136
- when Seahorse::Model::Shapes::Boolean then 'Boolean'
137
- when Seahorse::Model::Shapes::Blob then 'String,IO'
138
- else raise "unhandled type #{shape.type}"
139
- end
140
- end
141
-
142
- def key_type(shape)
143
- shape_type(shape.key)
144
- end
145
-
146
- def value_type(shape)
147
- case shape
148
- when Seahorse::Model::Shapes::List then shape_type(shape.member)
149
- when Seahorse::Model::Shapes::Map then shape_type(shape.value)
150
- else raise 'stop'
151
- end
152
- end
153
-
154
- def key_name(shape)
155
- shape.key.metadata('shape')
156
- end
157
-
158
- def value_name(shape)
159
- shape.members.metadata('shape')
160
- end
161
-
162
- def leaf?(shape)
163
- case shape
164
- when Seahorse::Model::Shapes::Structure then false
165
- when Seahorse::Model::Shapes::Map then false
166
- when Seahorse::Model::Shapes::List then leaf?(shape.member)
167
- else true
168
- end
169
- end
170
-
171
- end
172
- end
173
- end