aws-sdk-resources 2.11.443 → 3.69.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/bin/aws-v3.rb +201 -0
  3. data/lib/aws-sdk-resources.rb +223 -87
  4. metadata +3070 -70
  5. data/lib/aws-sdk-resources/batch.rb +0 -143
  6. data/lib/aws-sdk-resources/builder.rb +0 -85
  7. data/lib/aws-sdk-resources/builder_sources.rb +0 -105
  8. data/lib/aws-sdk-resources/collection.rb +0 -107
  9. data/lib/aws-sdk-resources/definition.rb +0 -331
  10. data/lib/aws-sdk-resources/documenter.rb +0 -70
  11. data/lib/aws-sdk-resources/documenter/base_operation_documenter.rb +0 -279
  12. data/lib/aws-sdk-resources/documenter/data_operation_documenter.rb +0 -25
  13. data/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb +0 -69
  14. data/lib/aws-sdk-resources/documenter/has_operation_documenter.rb +0 -66
  15. data/lib/aws-sdk-resources/documenter/operation_documenter.rb +0 -20
  16. data/lib/aws-sdk-resources/documenter/resource_operation_documenter.rb +0 -53
  17. data/lib/aws-sdk-resources/documenter/waiter_operation_documenter.rb +0 -77
  18. data/lib/aws-sdk-resources/errors.rb +0 -15
  19. data/lib/aws-sdk-resources/operation_methods.rb +0 -83
  20. data/lib/aws-sdk-resources/operations.rb +0 -280
  21. data/lib/aws-sdk-resources/options.rb +0 -17
  22. data/lib/aws-sdk-resources/request.rb +0 -39
  23. data/lib/aws-sdk-resources/request_params.rb +0 -140
  24. data/lib/aws-sdk-resources/resource.rb +0 -243
  25. data/lib/aws-sdk-resources/services/ec2.rb +0 -21
  26. data/lib/aws-sdk-resources/services/ec2/instance.rb +0 -29
  27. data/lib/aws-sdk-resources/services/iam.rb +0 -19
  28. data/lib/aws-sdk-resources/services/s3.rb +0 -20
  29. data/lib/aws-sdk-resources/services/s3/bucket.rb +0 -131
  30. data/lib/aws-sdk-resources/services/s3/encryption.rb +0 -21
  31. data/lib/aws-sdk-resources/services/s3/encryption/client.rb +0 -369
  32. data/lib/aws-sdk-resources/services/s3/encryption/decrypt_handler.rb +0 -174
  33. data/lib/aws-sdk-resources/services/s3/encryption/default_cipher_provider.rb +0 -63
  34. data/lib/aws-sdk-resources/services/s3/encryption/default_key_provider.rb +0 -38
  35. data/lib/aws-sdk-resources/services/s3/encryption/encrypt_handler.rb +0 -50
  36. data/lib/aws-sdk-resources/services/s3/encryption/errors.rb +0 -13
  37. data/lib/aws-sdk-resources/services/s3/encryption/io_auth_decrypter.rb +0 -56
  38. data/lib/aws-sdk-resources/services/s3/encryption/io_decrypter.rb +0 -29
  39. data/lib/aws-sdk-resources/services/s3/encryption/io_encrypter.rb +0 -69
  40. data/lib/aws-sdk-resources/services/s3/encryption/key_provider.rb +0 -29
  41. data/lib/aws-sdk-resources/services/s3/encryption/kms_cipher_provider.rb +0 -71
  42. data/lib/aws-sdk-resources/services/s3/encryption/materials.rb +0 -58
  43. data/lib/aws-sdk-resources/services/s3/encryption/utils.rb +0 -79
  44. data/lib/aws-sdk-resources/services/s3/file_downloader.rb +0 -169
  45. data/lib/aws-sdk-resources/services/s3/file_part.rb +0 -75
  46. data/lib/aws-sdk-resources/services/s3/file_uploader.rb +0 -58
  47. data/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb +0 -187
  48. data/lib/aws-sdk-resources/services/s3/multipart_upload.rb +0 -42
  49. data/lib/aws-sdk-resources/services/s3/multipart_upload_error.rb +0 -16
  50. data/lib/aws-sdk-resources/services/s3/object.rb +0 -290
  51. data/lib/aws-sdk-resources/services/s3/object_copier.rb +0 -99
  52. data/lib/aws-sdk-resources/services/s3/object_multipart_copier.rb +0 -180
  53. data/lib/aws-sdk-resources/services/s3/object_summary.rb +0 -73
  54. data/lib/aws-sdk-resources/services/s3/presigned_post.rb +0 -651
  55. data/lib/aws-sdk-resources/services/sns.rb +0 -7
  56. data/lib/aws-sdk-resources/services/sns/message_verifier.rb +0 -171
  57. data/lib/aws-sdk-resources/services/sqs.rb +0 -7
  58. data/lib/aws-sdk-resources/services/sqs/queue_poller.rb +0 -521
  59. data/lib/aws-sdk-resources/source.rb +0 -39
@@ -1,70 +0,0 @@
1
- require 'json'
2
-
3
- module Aws
4
- module Resources
5
- class Documenter
6
-
7
- autoload :BaseOperationDocumenter, 'aws-sdk-resources/documenter/base_operation_documenter'
8
- autoload :HasOperationDocumenter, 'aws-sdk-resources/documenter/has_operation_documenter'
9
- autoload :HasManyOperationDocumenter, 'aws-sdk-resources/documenter/has_many_operation_documenter'
10
- autoload :OperationDocumenter, 'aws-sdk-resources/documenter/operation_documenter'
11
- autoload :ResourceOperationDocumenter, 'aws-sdk-resources/documenter/resource_operation_documenter'
12
- autoload :WaiterOperationDocumenter, 'aws-sdk-resources/documenter/waiter_operation_documenter'
13
-
14
- class << self
15
-
16
- include Seahorse::Model::Shapes
17
-
18
- def apply_customizations
19
- document_s3_object_upload_file_additional_options
20
- document_s3_object_copy_from_options
21
- end
22
-
23
- private
24
-
25
- def document_s3_object_upload_file_additional_options
26
- input = Aws::S3::Client.api.operation(:create_multipart_upload).input
27
- opts = input.shape.member_names - [:bucket, :key]
28
- tags = opts.map do |opt|
29
- ref = input.shape.member(opt)
30
- type = case ref.shape
31
- when StructureShape then 'Structure'
32
- when ListShape then 'Array'
33
- when MapShape then 'Hash'
34
- when StringShape then 'String'
35
- when IntegerShape then 'Integer'
36
- when FloatShape then 'Float'
37
- when BooleanShape then 'Boolean'
38
- when TimestampShape then 'Time'
39
- when BlobShape then 'IO'
40
- else
41
- raise "unhandled shape class `#{ref.shape.class.name}'"
42
- end
43
- docs = ref.documentation || ref.shape.documentation
44
- "@option options [#{type}] :#{opt} #{docs}"
45
- end
46
- tags = YARD::DocstringParser.new.parse(tags).to_docstring.tags
47
- m = YARD::Registry['Aws::S3::Object#upload_file']
48
- tags.each { |tag| m.add_tag(tag) }
49
- end
50
-
51
- def document_s3_object_copy_from_options
52
- copy_from = YARD::Registry['Aws::S3::Object#copy_from']
53
- copy_to = YARD::Registry['Aws::S3::Object#copy_to']
54
- existing_tags = copy_from.tags
55
- existing_tags.each do |tag|
56
- if tag.tag_name == 'option' && tag.pair.name != ":copy_source"
57
- copy_from.add_tag(tag)
58
- copy_to.add_tag(tag)
59
- end
60
- end
61
- end
62
-
63
- def tag(string)
64
- YARD::DocstringParser.new.parse(string).to_docstring.tags.first
65
- end
66
-
67
- end
68
- end
69
- end
70
- end
@@ -1,279 +0,0 @@
1
- require 'set'
2
-
3
- module Aws
4
- module Resources
5
- class Documenter
6
- class BaseOperationDocumenter
7
-
8
- include Api::Docs::Utils
9
- include Seahorse::Model::Shapes
10
-
11
- def initialize(yard_class, resource_class, operation_name, operation)
12
- @yard_class = yard_class
13
- @resource_class = resource_class
14
- @resource_class_name = @resource_class.name.split('::').last
15
- @operation_name = operation_name.to_s
16
- @operation = operation
17
- @source = @operation.source
18
- if @operation.respond_to?(:request)
19
- @api_request_name = @operation.request.method_name
20
- @api_request = @resource_class.client_class.api.operation(@api_request_name)
21
- @api_request_params = @operation.request.params
22
- @request_operation_name = @operation.request.method_name.to_s
23
- @called_operation = "Client##{@api_request_name}"
24
- @yard_client_operation = YARD::Registry["#{@resource_class.client_class.name}##{api_request_name}"]
25
-
26
- end
27
- if @operation.respond_to?(:builder)
28
- @builder = @operation.builder
29
- @target_resource_class = @builder.resource_class
30
- @target_resource_class_name = @target_resource_class.name.split('::').last
31
- end
32
- end
33
-
34
- # @return [YARD::CodeObject::ClassObject]
35
- attr_reader :yard_class
36
-
37
- # @return [Class<Resource>] Returns the resource class this
38
- # operation belongs to.
39
- attr_reader :resource_class
40
-
41
- # @return [String] The name of this resource operation.
42
- attr_reader :operation_name
43
-
44
- # @return [String] Returns the name of the resource class being
45
- # documented without the namespace prefix. Example:
46
- #
47
- # * Aws::S3::Resource => 'Resource'
48
- # * Aws::S3::Bucket => 'Bucket'
49
- #
50
- attr_reader :resource_class_name
51
-
52
- # @return [Class<Resource>,nil] Returns the class of the resource
53
- # returned by invoking this operation. Returns `nil` if this operation
54
- # does not return any resource objects.
55
- attr_reader :target_resource_class
56
-
57
- # @return [String,nil] Returns the name of the resource class
58
- # returned by this operation. This is the base name of
59
- # the class without a namespace prefix. Returns `nil` if this
60
- # operation does not return any resource objects.
61
- attr_reader :target_resource_class_name
62
-
63
- # @return [String,nil] Returns the name of the API operation called
64
- # on the client. Returns `nil` if this operation does not make
65
- # any API requests.
66
- attr_reader :api_request_name
67
-
68
- # @return [Seahorse::Model::Operation,nil] Returns the model of the
69
- # API operation called. Returns `nil` if this operation does not make
70
- # any API requests.
71
- attr_reader :api_request
72
-
73
- # @return [Array<Resources::RequestParams::Base>, nil] Returns the
74
- # parameters this operation binds to the made request. Returns `nil`
75
- # if this operation does not make a request.
76
- attr_reader :api_request_params
77
-
78
- # @return [String,nil] Returns the `Client#operation_name` reference.
79
- # This is useful for generating `@see` tags and `{links}`.
80
- attr_reader :called_operation
81
-
82
- # @return [Builder,nil] Returns the resource builder for
83
- # this operation. Returns `nil` if this operation does not build
84
- # and return resource objects.
85
- attr_reader :builder
86
-
87
- # @return [Source]
88
- attr_reader :source
89
-
90
- # Constructs and returns a new YARD method object for this operation.
91
- # @return [YARD::CodeObject::MethodObject]
92
- def method_object
93
- if m = YARD::Registry[@resource_class.name + "##{operation_name}"]
94
- else
95
- m = YARD::CodeObjects::MethodObject.new(yard_class, operation_name)
96
- m.docstring = docstring
97
- m.parameters = parameters
98
- end
99
- m.scope = :instance
100
- if source
101
- m.source_type = :json
102
- m.source = source.format
103
- filename = source.file
104
- filename = filename.match('(aws-sdk-core/apis/.+)')[1]
105
- m.add_file(filename, nil, true)
106
- end
107
- tags.each do |tag|
108
- m.add_tag(tag)
109
- end
110
- m
111
- end
112
-
113
- private
114
-
115
- def parameters
116
- if option_tags.empty?
117
- []
118
- else
119
- [['options', '{}']]
120
- end
121
- end
122
-
123
- def docstring
124
- ''
125
- end
126
-
127
- def tags
128
- (option_tags + example_tags + [return_tag] + see_also_tags).compact
129
- end
130
-
131
- # This method should be overridden in sub-classes to add YARD tags
132
- # to the method code object.
133
- # @return [Array<YARD::Tag>]
134
- def example_tags
135
- if api_request && api_request.input
136
- [request_syntax_example_tag]
137
- else
138
- []
139
- end
140
- end
141
-
142
- def request_syntax_example_tag
143
- input = operation_input_ref(api_request, without: fixed_param_names)
144
- params = Api::Docs::ParamFormatter.new(input).format
145
- example = "#{variable_name}.#{operation_name}(#{params})"
146
- example = "@example Request syntax example with placeholder values" +
147
- "\n\n " + example.lines.join(' ')
148
- tag(example)
149
- end
150
-
151
- def option_tags
152
- if api_request && api_request.input
153
- skip = fixed_param_names
154
- tags = []
155
- @yard_client_operation.tags.each do |tag|
156
- if YARD::Tags::OptionTag === tag
157
- next if skip.include?(tag.pair.name[1..-1]) # remove `:` prefix
158
- tags << tag
159
- end
160
- end
161
- tags
162
- else
163
- []
164
- end
165
- end
166
-
167
- # Returns a set of root input params that are provided by default
168
- # by this operation. These params should not be documented in syntax
169
- # examples or in option tags.
170
- def fixed_param_names
171
- if api_request_params
172
- Set.new(api_request_params.map { |p| p.target.split(/\b/).first })
173
- else
174
- Set.new
175
- end
176
- end
177
-
178
- # If this operation makes an API request, then a `@see` tag is
179
- # returned that references the client API operation.
180
- # @return [Array<YARD::Tag>]
181
- def see_also_tags
182
- tags = []
183
- tags += related_resource_operation_tags if target_resource_class
184
- tags += called_operation_tag if called_operation
185
- tags
186
- end
187
-
188
- def called_operation_tag
189
- tag = "@see #{called_operation}"
190
- YARD::DocstringParser.new.parse(tag).to_docstring.tags
191
- end
192
-
193
- def related_resource_operation_tags
194
- tags = []
195
- resource_class.operations.each do |name,op|
196
- if
197
- name.to_s != self.operation_name &&
198
- op.respond_to?(:builder) &&
199
- op.builder.resource_class == target_resource_class
200
- then
201
- tags << "@see ##{name}"
202
- end
203
- end
204
- YARD::DocstringParser.new.parse(tags.sort.join("\n")).to_docstring.tags
205
- end
206
-
207
- # Returns a suitable variable name for the resource class being
208
- # documented:
209
- #
210
- # Aws::S3::Resource => 's3'
211
- # Aws::S3::Bucket => 'bucket'
212
- #
213
- def variable_name
214
- parts = resource_class.name.split('::')
215
- (parts.last == 'Resource' ? parts[-2] : parts[-1]).downcase
216
- end
217
-
218
- def path_type
219
- case path_shape
220
- when StructureShape then 'Structure'
221
- when ListShape then 'Array'
222
- when MapShape then 'Hash'
223
- when StringShape then 'String'
224
- when IntegerShape then 'Integer'
225
- when FloatShape then 'Float'
226
- when BooleanShape then 'Boolean'
227
- when TimestampShape then 'Time'
228
- when BlobShape then 'IO'
229
- else
230
- raise "unhandled shape class `#{path_shape.class.name}'"
231
- end
232
- end
233
-
234
- def path_shape
235
- resolve_shape(response_shape, @operation.path)
236
- end
237
-
238
- # Returns the output shape for the called operation.
239
- def response_shape
240
- api = resource_class.client_class.api
241
- output = api.operation(@operation.request.method_name).output
242
- output ? output.shape : nil
243
- end
244
-
245
- def resolve_shape(shape, path)
246
- if path != '@'
247
- shape = path.scan(/\w+|\[.*?\]/).inject(shape) do |shape, part|
248
- if part[0] == '['
249
- shape.member.shape
250
- else
251
- shape.member(part).shape
252
- end
253
- end
254
- end
255
- end
256
-
257
- def param_type(ref)
258
- case ref.shape
259
- when BlobShape then 'IO'
260
- when BooleanShape then 'Boolean'
261
- when FloatShape then 'Float'
262
- when IntegerShape then 'Integer'
263
- when ListShape then 'Array'
264
- when MapShape then 'Hash'
265
- when StringShape then 'String'
266
- when StructureShape then 'Hash'
267
- when TimestampShape then 'Time'
268
- else raise 'unhandled type'
269
- end
270
- end
271
-
272
- def docs(ref)
273
- ref.documentation || ref.shape.documentation
274
- end
275
-
276
- end
277
- end
278
- end
279
- end
@@ -1,25 +0,0 @@
1
- module Aws
2
- module Resources
3
- class Documenter
4
- class DataOperationDocumenter < BaseOperationDocumenter
5
-
6
- def return_type
7
- if plural?
8
- "Array<#{path_type}>"
9
- else
10
- path_type
11
- end
12
- end
13
-
14
- def return_tag
15
- tag("@return [#{return_type}]")
16
- end
17
-
18
- def plural?
19
- !!@operation.path.match(/\[/)
20
- end
21
-
22
- end
23
- end
24
- end
25
- end
@@ -1,69 +0,0 @@
1
- module Aws
2
- module Resources
3
- class Documenter
4
- class HasManyOperationDocumenter < BaseOperationDocumenter
5
-
6
- def docstring
7
- super + ' ' + <<-DOCSTRING.lstrip
8
- Returns a {Resources::Collection Collection} of {#{target_resource_class_name}}
9
- resources. No API requests are made until you call an enumerable method on the
10
- collection. {#{called_operation}} will be called multiple times until every
11
- {#{target_resource_class_name}} has been yielded.
12
- DOCSTRING
13
- end
14
-
15
- def return_tag
16
- tag("@return [Collection<#{target_resource_class_name}>]")
17
- end
18
-
19
- def example_tags
20
- tags = super
21
- tags << enumerate_example_tag
22
- tags << enumerate_with_limit_example_tag
23
- tags << batch_examples_tag if target_resource_batches?
24
- tags
25
- end
26
-
27
- def enumerate_example_tag
28
- tag(<<-EXAMPLE.strip)
29
- @example Enumerating {#{target_resource_class_name}} resources.
30
- #{variable_name}.#{@operation_name}.each do |#{target_resource_class_name.downcase}|
31
- # yields each #{target_resource_class_name.downcase}
32
- end
33
- EXAMPLE
34
- end
35
-
36
- def enumerate_with_limit_example_tag
37
- tag(<<-EXAMPLE.strip)
38
- @example Enumerating {#{target_resource_class_name}} resources with a limit.
39
- #{variable_name}.#{@operation_name}.limit(10).each do |#{target_resource_class_name.downcase}|
40
- # yields at most 10 #{@operation_name}
41
- end
42
- EXAMPLE
43
- end
44
-
45
- def batch_examples_tag
46
- example = []
47
- example << "@example Batch operations callable on the returned collection"
48
- target_resource_batch_operations.each do |name, operation|
49
- if operation.respond_to?(:request)
50
- example << ""
51
- example << " # calls Client##{operation.request.method_name} on each batch"
52
- example << " #{variable_name}.#{@operation_name}.#{name}"
53
- end
54
- end
55
- tag(example.join("\n"))
56
- end
57
-
58
- def target_resource_batches?
59
- target_resource_batch_operations.count > 0
60
- end
61
-
62
- def target_resource_batch_operations
63
- target_resource_class.batch_operations
64
- end
65
-
66
- end
67
- end
68
- end
69
- end
@@ -1,66 +0,0 @@
1
- module Aws
2
- module Resources
3
- class Documenter
4
- class HasOperationDocumenter < BaseOperationDocumenter
5
-
6
- def return_tag
7
- if plural?
8
- type = "Array<#{target_resource_class_name}>"
9
- else
10
- type = target_resource_class_name
11
- end
12
- type += ',nil' if can_return_nil?
13
- tag("@return [#{type}]")
14
- end
15
-
16
- def parameters
17
- if argument?
18
- arguments.map { |arg| [argument_name(arg), nil] }
19
- else
20
- []
21
- end
22
- end
23
-
24
- def tags
25
- tags = super
26
- if argument?
27
- arguments.each do |arg|
28
- tag = "@param [String] #{argument_name(arg)} "
29
- tag << "The {#{target_resource_class_name}##{argument_name(arg)}} "
30
- tag << "identifier."
31
- tags += YARD::DocstringParser.new.parse(tag).to_docstring.tags
32
- end
33
- end
34
- tags
35
- end
36
-
37
- def plural?
38
- @operation.builder.plural?
39
- end
40
-
41
- def argument?
42
- @operation.arity > 0
43
- end
44
-
45
- def can_return_nil?
46
- data_member
47
- end
48
-
49
- def data_member
50
- builder.sources.find { |s| BuilderSources::DataMember === s }
51
- end
52
-
53
- def arguments
54
- builder.sources.select do |source|
55
- BuilderSources::Argument === source
56
- end
57
- end
58
-
59
- def argument_name(argument)
60
- argument.target.to_s
61
- end
62
-
63
- end
64
- end
65
- end
66
- end