aws-sdk-s3vectors 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::S3Vectors
11
+ # Endpoint parameters used to influence endpoints per request.
12
+ #
13
+ # @!attribute use_fips
14
+ # When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
15
+ #
16
+ # @return [Boolean]
17
+ #
18
+ # @!attribute endpoint
19
+ # Override the endpoint used to send this request
20
+ #
21
+ # @return [String]
22
+ #
23
+ # @!attribute region
24
+ # The AWS region used to dispatch the request.
25
+ #
26
+ # @return [String]
27
+ #
28
+ EndpointParameters = Struct.new(
29
+ :use_fips,
30
+ :endpoint,
31
+ :region,
32
+ ) do
33
+ include Aws::Structure
34
+
35
+ # @api private
36
+ class << self
37
+ PARAM_MAP = {
38
+ 'UseFIPS' => :use_fips,
39
+ 'Endpoint' => :endpoint,
40
+ 'Region' => :region,
41
+ }.freeze
42
+ end
43
+
44
+ def initialize(options = {})
45
+ self[:use_fips] = options[:use_fips]
46
+ self[:use_fips] = false if self[:use_fips].nil?
47
+ self[:endpoint] = options[:endpoint]
48
+ self[:region] = options[:region]
49
+ end
50
+
51
+ def self.create(config, options={})
52
+ new({
53
+ use_fips: config.use_fips_endpoint,
54
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
55
+ region: config.region,
56
+ }.merge(options))
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::S3Vectors
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ if Aws::Endpoints::Matchers.set?(parameters.endpoint)
14
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
15
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
16
+ end
17
+ return Aws::Endpoints::Endpoint.new(url: parameters.endpoint, headers: {}, properties: {})
18
+ end
19
+ if Aws::Endpoints::Matchers.set?(parameters.region)
20
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(parameters.region))
21
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
22
+ return Aws::Endpoints::Endpoint.new(url: "https://s3vectors-fips.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
23
+ end
24
+ return Aws::Endpoints::Endpoint.new(url: "https://s3vectors.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
25
+ end
26
+ end
27
+ raise ArgumentError, "Invalid Configuration: Missing Region"
28
+ raise ArgumentError, 'No endpoint could be resolved'
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ module Aws::S3Vectors
12
+ # @api private
13
+ module Endpoints
14
+
15
+
16
+ def self.parameters_for_operation(context)
17
+ Aws::S3Vectors::EndpointParameters.create(context.config)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,251 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::S3Vectors
11
+
12
+ # When S3Vectors returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::S3Vectors::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all S3Vectors errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::S3Vectors::Errors::ServiceError
20
+ # # rescues all S3Vectors API errors
21
+ # end
22
+ #
23
+ #
24
+ # ## Request Context
25
+ # ServiceError objects have a {Aws::Errors::ServiceError#context #context} method that returns
26
+ # information about the request that generated the error.
27
+ # See {Seahorse::Client::RequestContext} for more information.
28
+ #
29
+ # ## Error Classes
30
+ # * {AccessDeniedException}
31
+ # * {ConflictException}
32
+ # * {InternalServerException}
33
+ # * {KmsDisabledException}
34
+ # * {KmsInvalidKeyUsageException}
35
+ # * {KmsInvalidStateException}
36
+ # * {KmsNotFoundException}
37
+ # * {NotFoundException}
38
+ # * {ServiceQuotaExceededException}
39
+ # * {ServiceUnavailableException}
40
+ # * {TooManyRequestsException}
41
+ # * {ValidationException}
42
+ #
43
+ # Additionally, error classes are dynamically generated for service errors based on the error code
44
+ # if they are not defined above.
45
+ module Errors
46
+
47
+ extend Aws::Errors::DynamicErrors
48
+
49
+ class AccessDeniedException < ServiceError
50
+
51
+ # @param [Seahorse::Client::RequestContext] context
52
+ # @param [String] message
53
+ # @param [Aws::S3Vectors::Types::AccessDeniedException] data
54
+ def initialize(context, message, data = Aws::EmptyStructure.new)
55
+ super(context, message, data)
56
+ end
57
+
58
+ # @return [String]
59
+ def message
60
+ @message || @data[:message]
61
+ end
62
+ end
63
+
64
+ class ConflictException < ServiceError
65
+
66
+ # @param [Seahorse::Client::RequestContext] context
67
+ # @param [String] message
68
+ # @param [Aws::S3Vectors::Types::ConflictException] data
69
+ def initialize(context, message, data = Aws::EmptyStructure.new)
70
+ super(context, message, data)
71
+ end
72
+
73
+ # @return [String]
74
+ def message
75
+ @message || @data[:message]
76
+ end
77
+ end
78
+
79
+ class InternalServerException < ServiceError
80
+
81
+ # @param [Seahorse::Client::RequestContext] context
82
+ # @param [String] message
83
+ # @param [Aws::S3Vectors::Types::InternalServerException] data
84
+ def initialize(context, message, data = Aws::EmptyStructure.new)
85
+ super(context, message, data)
86
+ end
87
+
88
+ # @return [String]
89
+ def message
90
+ @message || @data[:message]
91
+ end
92
+
93
+ def retryable?
94
+ true
95
+ end
96
+ end
97
+
98
+ class KmsDisabledException < ServiceError
99
+
100
+ # @param [Seahorse::Client::RequestContext] context
101
+ # @param [String] message
102
+ # @param [Aws::S3Vectors::Types::KmsDisabledException] data
103
+ def initialize(context, message, data = Aws::EmptyStructure.new)
104
+ super(context, message, data)
105
+ end
106
+
107
+ # @return [String]
108
+ def message
109
+ @message || @data[:message]
110
+ end
111
+ end
112
+
113
+ class KmsInvalidKeyUsageException < ServiceError
114
+
115
+ # @param [Seahorse::Client::RequestContext] context
116
+ # @param [String] message
117
+ # @param [Aws::S3Vectors::Types::KmsInvalidKeyUsageException] data
118
+ def initialize(context, message, data = Aws::EmptyStructure.new)
119
+ super(context, message, data)
120
+ end
121
+
122
+ # @return [String]
123
+ def message
124
+ @message || @data[:message]
125
+ end
126
+ end
127
+
128
+ class KmsInvalidStateException < ServiceError
129
+
130
+ # @param [Seahorse::Client::RequestContext] context
131
+ # @param [String] message
132
+ # @param [Aws::S3Vectors::Types::KmsInvalidStateException] data
133
+ def initialize(context, message, data = Aws::EmptyStructure.new)
134
+ super(context, message, data)
135
+ end
136
+
137
+ # @return [String]
138
+ def message
139
+ @message || @data[:message]
140
+ end
141
+ end
142
+
143
+ class KmsNotFoundException < ServiceError
144
+
145
+ # @param [Seahorse::Client::RequestContext] context
146
+ # @param [String] message
147
+ # @param [Aws::S3Vectors::Types::KmsNotFoundException] data
148
+ def initialize(context, message, data = Aws::EmptyStructure.new)
149
+ super(context, message, data)
150
+ end
151
+
152
+ # @return [String]
153
+ def message
154
+ @message || @data[:message]
155
+ end
156
+ end
157
+
158
+ class NotFoundException < ServiceError
159
+
160
+ # @param [Seahorse::Client::RequestContext] context
161
+ # @param [String] message
162
+ # @param [Aws::S3Vectors::Types::NotFoundException] data
163
+ def initialize(context, message, data = Aws::EmptyStructure.new)
164
+ super(context, message, data)
165
+ end
166
+
167
+ # @return [String]
168
+ def message
169
+ @message || @data[:message]
170
+ end
171
+ end
172
+
173
+ class ServiceQuotaExceededException < ServiceError
174
+
175
+ # @param [Seahorse::Client::RequestContext] context
176
+ # @param [String] message
177
+ # @param [Aws::S3Vectors::Types::ServiceQuotaExceededException] data
178
+ def initialize(context, message, data = Aws::EmptyStructure.new)
179
+ super(context, message, data)
180
+ end
181
+
182
+ # @return [String]
183
+ def message
184
+ @message || @data[:message]
185
+ end
186
+ end
187
+
188
+ class ServiceUnavailableException < ServiceError
189
+
190
+ # @param [Seahorse::Client::RequestContext] context
191
+ # @param [String] message
192
+ # @param [Aws::S3Vectors::Types::ServiceUnavailableException] data
193
+ def initialize(context, message, data = Aws::EmptyStructure.new)
194
+ super(context, message, data)
195
+ end
196
+
197
+ # @return [String]
198
+ def message
199
+ @message || @data[:message]
200
+ end
201
+
202
+ def retryable?
203
+ true
204
+ end
205
+ end
206
+
207
+ class TooManyRequestsException < ServiceError
208
+
209
+ # @param [Seahorse::Client::RequestContext] context
210
+ # @param [String] message
211
+ # @param [Aws::S3Vectors::Types::TooManyRequestsException] data
212
+ def initialize(context, message, data = Aws::EmptyStructure.new)
213
+ super(context, message, data)
214
+ end
215
+
216
+ # @return [String]
217
+ def message
218
+ @message || @data[:message]
219
+ end
220
+
221
+ def retryable?
222
+ true
223
+ end
224
+
225
+ def throttling?
226
+ true
227
+ end
228
+ end
229
+
230
+ class ValidationException < ServiceError
231
+
232
+ # @param [Seahorse::Client::RequestContext] context
233
+ # @param [String] message
234
+ # @param [Aws::S3Vectors::Types::ValidationException] data
235
+ def initialize(context, message, data = Aws::EmptyStructure.new)
236
+ super(context, message, data)
237
+ end
238
+
239
+ # @return [String]
240
+ def message
241
+ @message || @data[:message]
242
+ end
243
+
244
+ # @return [String]
245
+ def field_list
246
+ @data[:field_list]
247
+ end
248
+ end
249
+
250
+ end
251
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ module Aws::S3Vectors
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::S3Vectors::EndpointProvider',
17
+ rbs_type: 'untyped',
18
+ docstring: <<~DOCS) do |_cfg|
19
+ The endpoint provider used to resolve endpoints. Any object that responds to
20
+ `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to
21
+ `Aws::S3Vectors::EndpointParameters`.
22
+ DOCS
23
+ Aws::S3Vectors::EndpointProvider.new
24
+ end
25
+
26
+ # @api private
27
+ class Handler < Seahorse::Client::Handler
28
+ def call(context)
29
+ unless context[:discovered_endpoint]
30
+ params = Aws::S3Vectors::Endpoints.parameters_for_operation(context)
31
+ endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
+
33
+ context.http_request.endpoint = endpoint.url
34
+ apply_endpoint_headers(context, endpoint.headers)
35
+
36
+ context[:endpoint_params] = params
37
+ context[:endpoint_properties] = endpoint.properties
38
+ end
39
+
40
+ context[:auth_scheme] =
41
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
42
+
43
+ with_metrics(context) { @handler.call(context) }
44
+ end
45
+
46
+ private
47
+
48
+ def with_metrics(context, &block)
49
+ metrics = []
50
+ metrics << 'ENDPOINT_OVERRIDE' unless context.config.regional_endpoint
51
+ if context[:auth_scheme] && context[:auth_scheme]['name'] == 'sigv4a'
52
+ metrics << 'SIGV4A_SIGNING'
53
+ end
54
+ if context.config.credentials&.credentials&.account_id
55
+ metrics << 'RESOLVED_ACCOUNT_ID'
56
+ end
57
+ Aws::Plugins::UserAgent.metric(*metrics, &block)
58
+ end
59
+
60
+ def apply_endpoint_headers(context, headers)
61
+ headers.each do |key, values|
62
+ value = values
63
+ .compact
64
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
65
+ .join(',')
66
+
67
+ context.http_request.headers[key] = value
68
+ end
69
+ end
70
+ end
71
+
72
+ def add_handlers(handlers, _config)
73
+ handlers.add(Handler, step: :build, priority: 75)
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::S3Vectors
11
+
12
+ class Resource
13
+
14
+ # @param options ({})
15
+ # @option options [Client] :client
16
+ def initialize(options = {})
17
+ @client = options[:client] || Client.new(options)
18
+ end
19
+
20
+ # @return [Client]
21
+ def client
22
+ @client
23
+ end
24
+
25
+ end
26
+ end