google-cloud-vector_search-v1 0.a → 0.1.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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/vector_search/v1/bindings_override.rb +75 -0
  6. data/lib/google/cloud/vector_search/v1/data_object_search_service/client.rb +851 -0
  7. data/lib/google/cloud/vector_search/v1/data_object_search_service/credentials.rb +47 -0
  8. data/lib/google/cloud/vector_search/v1/data_object_search_service/paths.rb +73 -0
  9. data/lib/google/cloud/vector_search/v1/data_object_search_service/rest/client.rb +788 -0
  10. data/lib/google/cloud/vector_search/v1/data_object_search_service/rest/service_stub.rb +329 -0
  11. data/lib/google/cloud/vector_search/v1/data_object_search_service/rest.rb +53 -0
  12. data/lib/google/cloud/vector_search/v1/data_object_search_service.rb +55 -0
  13. data/lib/google/cloud/vector_search/v1/data_object_service/client.rb +1115 -0
  14. data/lib/google/cloud/vector_search/v1/data_object_service/credentials.rb +47 -0
  15. data/lib/google/cloud/vector_search/v1/data_object_service/paths.rb +73 -0
  16. data/lib/google/cloud/vector_search/v1/data_object_service/rest/client.rb +1031 -0
  17. data/lib/google/cloud/vector_search/v1/data_object_service/rest/service_stub.rb +513 -0
  18. data/lib/google/cloud/vector_search/v1/data_object_service/rest.rb +53 -0
  19. data/lib/google/cloud/vector_search/v1/data_object_service.rb +55 -0
  20. data/lib/google/cloud/vector_search/v1/rest.rb +40 -0
  21. data/lib/google/cloud/vector_search/v1/vector_search_service/client.rb +1831 -0
  22. data/lib/google/cloud/vector_search/v1/vector_search_service/credentials.rb +47 -0
  23. data/lib/google/cloud/vector_search/v1/vector_search_service/operations.rb +843 -0
  24. data/lib/google/cloud/vector_search/v1/vector_search_service/paths.rb +111 -0
  25. data/lib/google/cloud/vector_search/v1/vector_search_service/rest/client.rb +1712 -0
  26. data/lib/google/cloud/vector_search/v1/vector_search_service/rest/operations.rb +927 -0
  27. data/lib/google/cloud/vector_search/v1/vector_search_service/rest/service_stub.rb +819 -0
  28. data/lib/google/cloud/vector_search/v1/vector_search_service/rest.rb +58 -0
  29. data/lib/google/cloud/vector_search/v1/vector_search_service.rb +60 -0
  30. data/lib/google/cloud/vector_search/v1/version.rb +7 -2
  31. data/lib/google/cloud/vector_search/v1.rb +47 -0
  32. data/lib/google/cloud/vectorsearch/v1/common_pb.rb +21 -0
  33. data/lib/google/cloud/vectorsearch/v1/data_object_pb.rb +29 -0
  34. data/lib/google/cloud/vectorsearch/v1/data_object_search_service_pb.rb +50 -0
  35. data/lib/google/cloud/vectorsearch/v1/data_object_search_service_services_pb.rb +51 -0
  36. data/lib/google/cloud/vectorsearch/v1/data_object_service_pb.rb +37 -0
  37. data/lib/google/cloud/vectorsearch/v1/data_object_service_services_pb.rb +57 -0
  38. data/lib/google/cloud/vectorsearch/v1/embedding_config_pb.rb +24 -0
  39. data/lib/google/cloud/vectorsearch/v1/encryption_spec_pb.rb +24 -0
  40. data/lib/google/cloud/vectorsearch/v1/vectorsearch_service_pb.rb +69 -0
  41. data/lib/google/cloud/vectorsearch/v1/vectorsearch_service_services_pb.rb +71 -0
  42. data/lib/google-cloud-vector_search-v1.rb +21 -0
  43. data/proto_docs/README.md +4 -0
  44. data/proto_docs/google/api/client.rb +593 -0
  45. data/proto_docs/google/api/field_behavior.rb +85 -0
  46. data/proto_docs/google/api/field_info.rb +88 -0
  47. data/proto_docs/google/api/launch_stage.rb +71 -0
  48. data/proto_docs/google/api/resource.rb +227 -0
  49. data/proto_docs/google/cloud/vectorsearch/v1/common.rb +38 -0
  50. data/proto_docs/google/cloud/vectorsearch/v1/data_object.rb +104 -0
  51. data/proto_docs/google/cloud/vectorsearch/v1/data_object_search_service.rb +397 -0
  52. data/proto_docs/google/cloud/vectorsearch/v1/data_object_service.rb +156 -0
  53. data/proto_docs/google/cloud/vectorsearch/v1/embedding_config.rb +76 -0
  54. data/proto_docs/google/cloud/vectorsearch/v1/encryption_spec.rb +40 -0
  55. data/proto_docs/google/cloud/vectorsearch/v1/vectorsearch_service.rb +723 -0
  56. data/proto_docs/google/longrunning/operations.rb +191 -0
  57. data/proto_docs/google/protobuf/any.rb +145 -0
  58. data/proto_docs/google/protobuf/duration.rb +98 -0
  59. data/proto_docs/google/protobuf/empty.rb +34 -0
  60. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  61. data/proto_docs/google/protobuf/struct.rb +108 -0
  62. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  63. data/proto_docs/google/rpc/status.rb +48 -0
  64. metadata +122 -9
@@ -0,0 +1,1831 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/vectorsearch/v1/vectorsearch_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module VectorSearch
26
+ module V1
27
+ module VectorSearchService
28
+ ##
29
+ # Client for the VectorSearchService service.
30
+ #
31
+ # VectorSearchService provides methods for managing Collection resources, and
32
+ # Collection Index resources. The primary resources offered by this service are
33
+ # Collections which are a container for a set of related JSON data objects, and
34
+ # Collection Indexes which enable efficient ANN search across data objects
35
+ # within a Collection.
36
+ #
37
+ class Client
38
+ # @private
39
+ API_VERSION = ""
40
+
41
+ # @private
42
+ DEFAULT_ENDPOINT_TEMPLATE = "vectorsearch.$UNIVERSE_DOMAIN$"
43
+
44
+ include Paths
45
+
46
+ # @private
47
+ attr_reader :vector_search_service_stub
48
+
49
+ ##
50
+ # Configure the VectorSearchService Client class.
51
+ #
52
+ # See {::Google::Cloud::VectorSearch::V1::VectorSearchService::Client::Configuration}
53
+ # for a description of the configuration fields.
54
+ #
55
+ # @example
56
+ #
57
+ # # Modify the configuration for all VectorSearchService clients
58
+ # ::Google::Cloud::VectorSearch::V1::VectorSearchService::Client.configure do |config|
59
+ # config.timeout = 10.0
60
+ # end
61
+ #
62
+ # @yield [config] Configure the Client client.
63
+ # @yieldparam config [Client::Configuration]
64
+ #
65
+ # @return [Client::Configuration]
66
+ #
67
+ def self.configure
68
+ @configure ||= begin
69
+ namespace = ["Google", "Cloud", "VectorSearch", "V1"]
70
+ parent_config = while namespace.any?
71
+ parent_name = namespace.join "::"
72
+ parent_const = const_get parent_name
73
+ break parent_const.configure if parent_const.respond_to? :configure
74
+ namespace.pop
75
+ end
76
+ default_config = Client::Configuration.new parent_config
77
+
78
+ default_config.rpcs.list_collections.timeout = 60.0
79
+ default_config.rpcs.list_collections.retry_policy = {
80
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
81
+ }
82
+
83
+ default_config.rpcs.get_collection.timeout = 60.0
84
+ default_config.rpcs.get_collection.retry_policy = {
85
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
86
+ }
87
+
88
+ default_config.rpcs.create_collection.timeout = 60.0
89
+ default_config.rpcs.create_collection.retry_policy = {
90
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
91
+ }
92
+
93
+ default_config.rpcs.update_collection.timeout = 60.0
94
+ default_config.rpcs.update_collection.retry_policy = {
95
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
96
+ }
97
+
98
+ default_config.rpcs.delete_collection.timeout = 60.0
99
+ default_config.rpcs.delete_collection.retry_policy = {
100
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
101
+ }
102
+
103
+ default_config.rpcs.list_indexes.timeout = 60.0
104
+ default_config.rpcs.list_indexes.retry_policy = {
105
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
106
+ }
107
+
108
+ default_config.rpcs.get_index.timeout = 60.0
109
+ default_config.rpcs.get_index.retry_policy = {
110
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
111
+ }
112
+
113
+ default_config.rpcs.create_index.timeout = 60.0
114
+ default_config.rpcs.create_index.retry_policy = {
115
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
116
+ }
117
+
118
+ default_config.rpcs.delete_index.timeout = 60.0
119
+ default_config.rpcs.delete_index.retry_policy = {
120
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
121
+ }
122
+
123
+ default_config.rpcs.import_data_objects.timeout = 60.0
124
+ default_config.rpcs.import_data_objects.retry_policy = {
125
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
126
+ }
127
+
128
+ default_config
129
+ end
130
+ yield @configure if block_given?
131
+ @configure
132
+ end
133
+
134
+ ##
135
+ # Configure the VectorSearchService Client instance.
136
+ #
137
+ # The configuration is set to the derived mode, meaning that values can be changed,
138
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
139
+ # should be made on {Client.configure}.
140
+ #
141
+ # See {::Google::Cloud::VectorSearch::V1::VectorSearchService::Client::Configuration}
142
+ # for a description of the configuration fields.
143
+ #
144
+ # @yield [config] Configure the Client client.
145
+ # @yieldparam config [Client::Configuration]
146
+ #
147
+ # @return [Client::Configuration]
148
+ #
149
+ def configure
150
+ yield @config if block_given?
151
+ @config
152
+ end
153
+
154
+ ##
155
+ # The effective universe domain
156
+ #
157
+ # @return [String]
158
+ #
159
+ def universe_domain
160
+ @vector_search_service_stub.universe_domain
161
+ end
162
+
163
+ ##
164
+ # Create a new VectorSearchService client object.
165
+ #
166
+ # @example
167
+ #
168
+ # # Create a client using the default configuration
169
+ # client = ::Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
170
+ #
171
+ # # Create a client using a custom configuration
172
+ # client = ::Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new do |config|
173
+ # config.timeout = 10.0
174
+ # end
175
+ #
176
+ # @yield [config] Configure the VectorSearchService client.
177
+ # @yieldparam config [Client::Configuration]
178
+ #
179
+ def initialize
180
+ # These require statements are intentionally placed here to initialize
181
+ # the gRPC module only when it's required.
182
+ # See https://github.com/googleapis/toolkit/issues/446
183
+ require "gapic/grpc"
184
+ require "google/cloud/vectorsearch/v1/vectorsearch_service_services_pb"
185
+
186
+ # Create the configuration object
187
+ @config = Configuration.new Client.configure
188
+
189
+ # Yield the configuration if needed
190
+ yield @config if block_given?
191
+
192
+ # Create credentials
193
+ credentials = @config.credentials
194
+ # Use self-signed JWT if the endpoint is unchanged from default,
195
+ # but only if the default endpoint does not have a region prefix.
196
+ enable_self_signed_jwt = @config.endpoint.nil? ||
197
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
198
+ !@config.endpoint.split(".").first.include?("-"))
199
+ credentials ||= Credentials.default scope: @config.scope,
200
+ enable_self_signed_jwt: enable_self_signed_jwt
201
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
202
+ credentials = Credentials.new credentials, scope: @config.scope
203
+ end
204
+ @quota_project_id = @config.quota_project
205
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
206
+
207
+ @operations_client = Operations.new do |config|
208
+ config.credentials = credentials
209
+ config.quota_project = @quota_project_id
210
+ config.endpoint = @config.endpoint
211
+ config.universe_domain = @config.universe_domain
212
+ end
213
+
214
+ @vector_search_service_stub = ::Gapic::ServiceStub.new(
215
+ ::Google::Cloud::VectorSearch::V1::VectorSearchService::Stub,
216
+ credentials: credentials,
217
+ endpoint: @config.endpoint,
218
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
219
+ universe_domain: @config.universe_domain,
220
+ channel_args: @config.channel_args,
221
+ interceptors: @config.interceptors,
222
+ channel_pool_config: @config.channel_pool,
223
+ logger: @config.logger
224
+ )
225
+
226
+ @vector_search_service_stub.stub_logger&.info do |entry|
227
+ entry.set_system_name
228
+ entry.set_service
229
+ entry.message = "Created client for #{entry.service}"
230
+ entry.set_credentials_fields credentials
231
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
232
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
233
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
234
+ end
235
+
236
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
237
+ config.credentials = credentials
238
+ config.quota_project = @quota_project_id
239
+ config.endpoint = @vector_search_service_stub.endpoint
240
+ config.universe_domain = @vector_search_service_stub.universe_domain
241
+ config.logger = @vector_search_service_stub.logger if config.respond_to? :logger=
242
+ end
243
+ end
244
+
245
+ ##
246
+ # Get the associated client for long-running operations.
247
+ #
248
+ # @return [::Google::Cloud::VectorSearch::V1::VectorSearchService::Operations]
249
+ #
250
+ attr_reader :operations_client
251
+
252
+ ##
253
+ # Get the associated client for mix-in of the Locations.
254
+ #
255
+ # @return [Google::Cloud::Location::Locations::Client]
256
+ #
257
+ attr_reader :location_client
258
+
259
+ ##
260
+ # The logger used for request/response debug logging.
261
+ #
262
+ # @return [Logger]
263
+ #
264
+ def logger
265
+ @vector_search_service_stub.logger
266
+ end
267
+
268
+ # Service calls
269
+
270
+ ##
271
+ # Lists Collections in a given project and location.
272
+ #
273
+ # @overload list_collections(request, options = nil)
274
+ # Pass arguments to `list_collections` via a request object, either of type
275
+ # {::Google::Cloud::VectorSearch::V1::ListCollectionsRequest} or an equivalent Hash.
276
+ #
277
+ # @param request [::Google::Cloud::VectorSearch::V1::ListCollectionsRequest, ::Hash]
278
+ # A request object representing the call parameters. Required. To specify no
279
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
280
+ # @param options [::Gapic::CallOptions, ::Hash]
281
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
282
+ #
283
+ # @overload list_collections(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
284
+ # Pass arguments to `list_collections` via keyword arguments. Note that at
285
+ # least one keyword argument is required. To specify no parameters, or to keep all
286
+ # the default parameter values, pass an empty Hash as a request object (see above).
287
+ #
288
+ # @param parent [::String]
289
+ # Required. Parent value for ListCollectionsRequest
290
+ # @param page_size [::Integer]
291
+ # Optional. Requested page size. Server may return fewer items than
292
+ # requested. If unspecified, server will pick an appropriate default.
293
+ # @param page_token [::String]
294
+ # Optional. A token identifying a page of results the server should return.
295
+ # @param filter [::String]
296
+ # Optional. Filtering results
297
+ # @param order_by [::String]
298
+ # Optional. Hint for how to order the results
299
+ #
300
+ # @yield [response, operation] Access the result along with the RPC operation
301
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::VectorSearch::V1::Collection>]
302
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
303
+ #
304
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::VectorSearch::V1::Collection>]
305
+ #
306
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
307
+ #
308
+ # @example Basic example
309
+ # require "google/cloud/vector_search/v1"
310
+ #
311
+ # # Create a client object. The client can be reused for multiple calls.
312
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
313
+ #
314
+ # # Create a request. To set request fields, pass in keyword arguments.
315
+ # request = Google::Cloud::VectorSearch::V1::ListCollectionsRequest.new
316
+ #
317
+ # # Call the list_collections method.
318
+ # result = client.list_collections request
319
+ #
320
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
321
+ # # over elements, and API calls will be issued to fetch pages as needed.
322
+ # result.each do |item|
323
+ # # Each element is of type ::Google::Cloud::VectorSearch::V1::Collection.
324
+ # p item
325
+ # end
326
+ #
327
+ def list_collections request, options = nil
328
+ raise ::ArgumentError, "request must be provided" if request.nil?
329
+
330
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::ListCollectionsRequest
331
+
332
+ # Converts hash and nil to an options object
333
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
334
+
335
+ # Customize the options with defaults
336
+ metadata = @config.rpcs.list_collections.metadata.to_h
337
+
338
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
339
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
340
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
341
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
342
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
343
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
344
+
345
+ header_params = {}
346
+ if request.parent
347
+ header_params["parent"] = request.parent
348
+ end
349
+
350
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
351
+ metadata[:"x-goog-request-params"] ||= request_params_header
352
+
353
+ options.apply_defaults timeout: @config.rpcs.list_collections.timeout,
354
+ metadata: metadata,
355
+ retry_policy: @config.rpcs.list_collections.retry_policy
356
+
357
+ options.apply_defaults timeout: @config.timeout,
358
+ metadata: @config.metadata,
359
+ retry_policy: @config.retry_policy
360
+
361
+ @vector_search_service_stub.call_rpc :list_collections, request, options: options do |response, operation|
362
+ response = ::Gapic::PagedEnumerable.new @vector_search_service_stub, :list_collections, request, response, operation, options
363
+ yield response, operation if block_given?
364
+ throw :response, response
365
+ end
366
+ rescue ::GRPC::BadStatus => e
367
+ raise ::Google::Cloud::Error.from_error(e)
368
+ end
369
+
370
+ ##
371
+ # Gets details of a single Collection.
372
+ #
373
+ # @overload get_collection(request, options = nil)
374
+ # Pass arguments to `get_collection` via a request object, either of type
375
+ # {::Google::Cloud::VectorSearch::V1::GetCollectionRequest} or an equivalent Hash.
376
+ #
377
+ # @param request [::Google::Cloud::VectorSearch::V1::GetCollectionRequest, ::Hash]
378
+ # A request object representing the call parameters. Required. To specify no
379
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
380
+ # @param options [::Gapic::CallOptions, ::Hash]
381
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
382
+ #
383
+ # @overload get_collection(name: nil)
384
+ # Pass arguments to `get_collection` via keyword arguments. Note that at
385
+ # least one keyword argument is required. To specify no parameters, or to keep all
386
+ # the default parameter values, pass an empty Hash as a request object (see above).
387
+ #
388
+ # @param name [::String]
389
+ # Required. Name of the resource
390
+ #
391
+ # @yield [response, operation] Access the result along with the RPC operation
392
+ # @yieldparam response [::Google::Cloud::VectorSearch::V1::Collection]
393
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
394
+ #
395
+ # @return [::Google::Cloud::VectorSearch::V1::Collection]
396
+ #
397
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
398
+ #
399
+ # @example Basic example
400
+ # require "google/cloud/vector_search/v1"
401
+ #
402
+ # # Create a client object. The client can be reused for multiple calls.
403
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
404
+ #
405
+ # # Create a request. To set request fields, pass in keyword arguments.
406
+ # request = Google::Cloud::VectorSearch::V1::GetCollectionRequest.new
407
+ #
408
+ # # Call the get_collection method.
409
+ # result = client.get_collection request
410
+ #
411
+ # # The returned object is of type Google::Cloud::VectorSearch::V1::Collection.
412
+ # p result
413
+ #
414
+ def get_collection request, options = nil
415
+ raise ::ArgumentError, "request must be provided" if request.nil?
416
+
417
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::GetCollectionRequest
418
+
419
+ # Converts hash and nil to an options object
420
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
421
+
422
+ # Customize the options with defaults
423
+ metadata = @config.rpcs.get_collection.metadata.to_h
424
+
425
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
426
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
427
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
428
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
429
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
430
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
+
432
+ header_params = {}
433
+ if request.name
434
+ header_params["name"] = request.name
435
+ end
436
+
437
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
438
+ metadata[:"x-goog-request-params"] ||= request_params_header
439
+
440
+ options.apply_defaults timeout: @config.rpcs.get_collection.timeout,
441
+ metadata: metadata,
442
+ retry_policy: @config.rpcs.get_collection.retry_policy
443
+
444
+ options.apply_defaults timeout: @config.timeout,
445
+ metadata: @config.metadata,
446
+ retry_policy: @config.retry_policy
447
+
448
+ @vector_search_service_stub.call_rpc :get_collection, request, options: options do |response, operation|
449
+ yield response, operation if block_given?
450
+ end
451
+ rescue ::GRPC::BadStatus => e
452
+ raise ::Google::Cloud::Error.from_error(e)
453
+ end
454
+
455
+ ##
456
+ # Creates a new Collection in a given project and location.
457
+ #
458
+ # @overload create_collection(request, options = nil)
459
+ # Pass arguments to `create_collection` via a request object, either of type
460
+ # {::Google::Cloud::VectorSearch::V1::CreateCollectionRequest} or an equivalent Hash.
461
+ #
462
+ # @param request [::Google::Cloud::VectorSearch::V1::CreateCollectionRequest, ::Hash]
463
+ # A request object representing the call parameters. Required. To specify no
464
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
465
+ # @param options [::Gapic::CallOptions, ::Hash]
466
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
467
+ #
468
+ # @overload create_collection(parent: nil, collection_id: nil, collection: nil, request_id: nil)
469
+ # Pass arguments to `create_collection` via keyword arguments. Note that at
470
+ # least one keyword argument is required. To specify no parameters, or to keep all
471
+ # the default parameter values, pass an empty Hash as a request object (see above).
472
+ #
473
+ # @param parent [::String]
474
+ # Required. Value for parent.
475
+ # @param collection_id [::String]
476
+ # Required. ID of the Collection to create.
477
+ # The id must be 1-63 characters long, and comply with
478
+ # [RFC1035](https://www.ietf.org/rfc/rfc1035.txt).
479
+ # Specifically, it must be 1-63 characters long and match the regular
480
+ # expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?`.
481
+ # @param collection [::Google::Cloud::VectorSearch::V1::Collection, ::Hash]
482
+ # Required. The resource being created
483
+ # @param request_id [::String]
484
+ # Optional. An optional request ID to identify requests. Specify a unique
485
+ # request ID so that if you must retry your request, the server will know to
486
+ # ignore the request if it has already been completed. The server will
487
+ # guarantee that for at least 60 minutes since the first request.
488
+ #
489
+ # For example, consider a situation where you make an initial request and the
490
+ # request times out. If you make the request again with the same request
491
+ # ID, the server can check if original operation with the same request ID
492
+ # was received, and if so, will ignore the second request. This prevents
493
+ # clients from accidentally creating duplicate commitments.
494
+ #
495
+ # The request ID must be a valid UUID with the exception that zero UUID is
496
+ # not supported (00000000-0000-0000-0000-000000000000).
497
+ #
498
+ # @yield [response, operation] Access the result along with the RPC operation
499
+ # @yieldparam response [::Gapic::Operation]
500
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
501
+ #
502
+ # @return [::Gapic::Operation]
503
+ #
504
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
505
+ #
506
+ # @example Basic example
507
+ # require "google/cloud/vector_search/v1"
508
+ #
509
+ # # Create a client object. The client can be reused for multiple calls.
510
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
511
+ #
512
+ # # Create a request. To set request fields, pass in keyword arguments.
513
+ # request = Google::Cloud::VectorSearch::V1::CreateCollectionRequest.new
514
+ #
515
+ # # Call the create_collection method.
516
+ # result = client.create_collection request
517
+ #
518
+ # # The returned object is of type Gapic::Operation. You can use it to
519
+ # # check the status of an operation, cancel it, or wait for results.
520
+ # # Here is how to wait for a response.
521
+ # result.wait_until_done! timeout: 60
522
+ # if result.response?
523
+ # p result.response
524
+ # else
525
+ # puts "No response received."
526
+ # end
527
+ #
528
+ def create_collection request, options = nil
529
+ raise ::ArgumentError, "request must be provided" if request.nil?
530
+
531
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::CreateCollectionRequest
532
+
533
+ # Converts hash and nil to an options object
534
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
535
+
536
+ # Customize the options with defaults
537
+ metadata = @config.rpcs.create_collection.metadata.to_h
538
+
539
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
540
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
541
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
542
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
543
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
544
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
545
+
546
+ header_params = {}
547
+ if request.parent
548
+ header_params["parent"] = request.parent
549
+ end
550
+
551
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
552
+ metadata[:"x-goog-request-params"] ||= request_params_header
553
+
554
+ options.apply_defaults timeout: @config.rpcs.create_collection.timeout,
555
+ metadata: metadata,
556
+ retry_policy: @config.rpcs.create_collection.retry_policy
557
+
558
+ options.apply_defaults timeout: @config.timeout,
559
+ metadata: @config.metadata,
560
+ retry_policy: @config.retry_policy
561
+
562
+ @vector_search_service_stub.call_rpc :create_collection, request, options: options do |response, operation|
563
+ response = ::Gapic::Operation.new response, @operations_client, options: options
564
+ yield response, operation if block_given?
565
+ throw :response, response
566
+ end
567
+ rescue ::GRPC::BadStatus => e
568
+ raise ::Google::Cloud::Error.from_error(e)
569
+ end
570
+
571
+ ##
572
+ # Updates the parameters of a single Collection.
573
+ #
574
+ # @overload update_collection(request, options = nil)
575
+ # Pass arguments to `update_collection` via a request object, either of type
576
+ # {::Google::Cloud::VectorSearch::V1::UpdateCollectionRequest} or an equivalent Hash.
577
+ #
578
+ # @param request [::Google::Cloud::VectorSearch::V1::UpdateCollectionRequest, ::Hash]
579
+ # A request object representing the call parameters. Required. To specify no
580
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
581
+ # @param options [::Gapic::CallOptions, ::Hash]
582
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
583
+ #
584
+ # @overload update_collection(update_mask: nil, collection: nil, request_id: nil)
585
+ # Pass arguments to `update_collection` via keyword arguments. Note that at
586
+ # least one keyword argument is required. To specify no parameters, or to keep all
587
+ # the default parameter values, pass an empty Hash as a request object (see above).
588
+ #
589
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
590
+ # Optional. Field mask is used to specify the fields to be overwritten in the
591
+ # Collection resource by the update.
592
+ # The fields specified in the update_mask are relative to the resource, not
593
+ # the full request. A field will be overwritten if it is in the mask. If the
594
+ # user does not provide a mask then all fields present in the request will be
595
+ # overwritten.
596
+ #
597
+ # The following fields support update: `display_name`, `description`,
598
+ # `labels`, `data_schema`, `vector_schema`.
599
+ # For `data_schema` and `vector_schema`, fields can only be added, not
600
+ # deleted, but `vertex_embedding_config` in `vector_schema` can be added or
601
+ # removed.
602
+ # Partial updates for `data_schema` and `vector_schema` are also supported
603
+ # by using sub-field paths in `update_mask`, e.g.
604
+ # `data_schema.properties.foo` or `vector_schema.my_vector_field`.
605
+ #
606
+ # If `*` is provided in the update_mask, full replacement will be performed.
607
+ # @param collection [::Google::Cloud::VectorSearch::V1::Collection, ::Hash]
608
+ # Required. The resource being updated
609
+ # @param request_id [::String]
610
+ # Optional. An optional request ID to identify requests. Specify a unique
611
+ # request ID so that if you must retry your request, the server will know to
612
+ # ignore the request if it has already been completed. The server will
613
+ # guarantee that for at least 60 minutes since the first request.
614
+ #
615
+ # For example, consider a situation where you make an initial request and the
616
+ # request times out. If you make the request again with the same request
617
+ # ID, the server can check if original operation with the same request ID
618
+ # was received, and if so, will ignore the second request. This prevents
619
+ # clients from accidentally creating duplicate commitments.
620
+ #
621
+ # The request ID must be a valid UUID with the exception that zero UUID is
622
+ # not supported (00000000-0000-0000-0000-000000000000).
623
+ #
624
+ # @yield [response, operation] Access the result along with the RPC operation
625
+ # @yieldparam response [::Gapic::Operation]
626
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
627
+ #
628
+ # @return [::Gapic::Operation]
629
+ #
630
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
631
+ #
632
+ # @example Basic example
633
+ # require "google/cloud/vector_search/v1"
634
+ #
635
+ # # Create a client object. The client can be reused for multiple calls.
636
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
637
+ #
638
+ # # Create a request. To set request fields, pass in keyword arguments.
639
+ # request = Google::Cloud::VectorSearch::V1::UpdateCollectionRequest.new
640
+ #
641
+ # # Call the update_collection method.
642
+ # result = client.update_collection request
643
+ #
644
+ # # The returned object is of type Gapic::Operation. You can use it to
645
+ # # check the status of an operation, cancel it, or wait for results.
646
+ # # Here is how to wait for a response.
647
+ # result.wait_until_done! timeout: 60
648
+ # if result.response?
649
+ # p result.response
650
+ # else
651
+ # puts "No response received."
652
+ # end
653
+ #
654
+ def update_collection request, options = nil
655
+ raise ::ArgumentError, "request must be provided" if request.nil?
656
+
657
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::UpdateCollectionRequest
658
+
659
+ # Converts hash and nil to an options object
660
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
661
+
662
+ # Customize the options with defaults
663
+ metadata = @config.rpcs.update_collection.metadata.to_h
664
+
665
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
666
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
667
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
668
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
669
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
670
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
671
+
672
+ header_params = {}
673
+ if request.collection&.name
674
+ header_params["collection.name"] = request.collection.name
675
+ end
676
+
677
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
678
+ metadata[:"x-goog-request-params"] ||= request_params_header
679
+
680
+ options.apply_defaults timeout: @config.rpcs.update_collection.timeout,
681
+ metadata: metadata,
682
+ retry_policy: @config.rpcs.update_collection.retry_policy
683
+
684
+ options.apply_defaults timeout: @config.timeout,
685
+ metadata: @config.metadata,
686
+ retry_policy: @config.retry_policy
687
+
688
+ @vector_search_service_stub.call_rpc :update_collection, request, options: options do |response, operation|
689
+ response = ::Gapic::Operation.new response, @operations_client, options: options
690
+ yield response, operation if block_given?
691
+ throw :response, response
692
+ end
693
+ rescue ::GRPC::BadStatus => e
694
+ raise ::Google::Cloud::Error.from_error(e)
695
+ end
696
+
697
+ ##
698
+ # Deletes a single Collection.
699
+ #
700
+ # @overload delete_collection(request, options = nil)
701
+ # Pass arguments to `delete_collection` via a request object, either of type
702
+ # {::Google::Cloud::VectorSearch::V1::DeleteCollectionRequest} or an equivalent Hash.
703
+ #
704
+ # @param request [::Google::Cloud::VectorSearch::V1::DeleteCollectionRequest, ::Hash]
705
+ # A request object representing the call parameters. Required. To specify no
706
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
707
+ # @param options [::Gapic::CallOptions, ::Hash]
708
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
709
+ #
710
+ # @overload delete_collection(name: nil, request_id: nil, force: nil)
711
+ # Pass arguments to `delete_collection` via keyword arguments. Note that at
712
+ # least one keyword argument is required. To specify no parameters, or to keep all
713
+ # the default parameter values, pass an empty Hash as a request object (see above).
714
+ #
715
+ # @param name [::String]
716
+ # Required. Name of the resource
717
+ # @param request_id [::String]
718
+ # Optional. An optional request ID to identify requests. Specify a unique
719
+ # request ID so that if you must retry your request, the server will know to
720
+ # ignore the request if it has already been completed. The server will
721
+ # guarantee that for at least 60 minutes after the first request.
722
+ #
723
+ # For example, consider a situation where you make an initial request and the
724
+ # request times out. If you make the request again with the same request
725
+ # ID, the server can check if original operation with the same request ID
726
+ # was received, and if so, will ignore the second request. This prevents
727
+ # clients from accidentally creating duplicate commitments.
728
+ #
729
+ # The request ID must be a valid UUID with the exception that zero UUID is
730
+ # not supported (00000000-0000-0000-0000-000000000000).
731
+ # @param force [::Boolean]
732
+ # Optional. If set to true, any Indexes and DataObjects from this Collection
733
+ # will also be deleted. (Otherwise, the request will only work if the
734
+ # Collection has no Indexes and DataObjects.)
735
+ #
736
+ # @yield [response, operation] Access the result along with the RPC operation
737
+ # @yieldparam response [::Gapic::Operation]
738
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
739
+ #
740
+ # @return [::Gapic::Operation]
741
+ #
742
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
743
+ #
744
+ # @example Basic example
745
+ # require "google/cloud/vector_search/v1"
746
+ #
747
+ # # Create a client object. The client can be reused for multiple calls.
748
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
749
+ #
750
+ # # Create a request. To set request fields, pass in keyword arguments.
751
+ # request = Google::Cloud::VectorSearch::V1::DeleteCollectionRequest.new
752
+ #
753
+ # # Call the delete_collection method.
754
+ # result = client.delete_collection request
755
+ #
756
+ # # The returned object is of type Gapic::Operation. You can use it to
757
+ # # check the status of an operation, cancel it, or wait for results.
758
+ # # Here is how to wait for a response.
759
+ # result.wait_until_done! timeout: 60
760
+ # if result.response?
761
+ # p result.response
762
+ # else
763
+ # puts "No response received."
764
+ # end
765
+ #
766
+ def delete_collection request, options = nil
767
+ raise ::ArgumentError, "request must be provided" if request.nil?
768
+
769
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::DeleteCollectionRequest
770
+
771
+ # Converts hash and nil to an options object
772
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
773
+
774
+ # Customize the options with defaults
775
+ metadata = @config.rpcs.delete_collection.metadata.to_h
776
+
777
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
778
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
779
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
780
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
781
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
782
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
783
+
784
+ header_params = {}
785
+ if request.name
786
+ header_params["name"] = request.name
787
+ end
788
+
789
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
790
+ metadata[:"x-goog-request-params"] ||= request_params_header
791
+
792
+ options.apply_defaults timeout: @config.rpcs.delete_collection.timeout,
793
+ metadata: metadata,
794
+ retry_policy: @config.rpcs.delete_collection.retry_policy
795
+
796
+ options.apply_defaults timeout: @config.timeout,
797
+ metadata: @config.metadata,
798
+ retry_policy: @config.retry_policy
799
+
800
+ @vector_search_service_stub.call_rpc :delete_collection, request, options: options do |response, operation|
801
+ response = ::Gapic::Operation.new response, @operations_client, options: options
802
+ yield response, operation if block_given?
803
+ throw :response, response
804
+ end
805
+ rescue ::GRPC::BadStatus => e
806
+ raise ::Google::Cloud::Error.from_error(e)
807
+ end
808
+
809
+ ##
810
+ # Lists Indexes in a given project and location.
811
+ #
812
+ # @overload list_indexes(request, options = nil)
813
+ # Pass arguments to `list_indexes` via a request object, either of type
814
+ # {::Google::Cloud::VectorSearch::V1::ListIndexesRequest} or an equivalent Hash.
815
+ #
816
+ # @param request [::Google::Cloud::VectorSearch::V1::ListIndexesRequest, ::Hash]
817
+ # A request object representing the call parameters. Required. To specify no
818
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
819
+ # @param options [::Gapic::CallOptions, ::Hash]
820
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
821
+ #
822
+ # @overload list_indexes(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
823
+ # Pass arguments to `list_indexes` via keyword arguments. Note that at
824
+ # least one keyword argument is required. To specify no parameters, or to keep all
825
+ # the default parameter values, pass an empty Hash as a request object (see above).
826
+ #
827
+ # @param parent [::String]
828
+ # Required. Parent value for ListIndexesRequest
829
+ # @param page_size [::Integer]
830
+ # Optional. Requested page size. Server may return fewer items than
831
+ # requested. If unspecified, server will pick an appropriate default.
832
+ # @param page_token [::String]
833
+ # Optional. A token identifying a page of results the server should return.
834
+ # @param filter [::String]
835
+ # Optional. Filtering results
836
+ # @param order_by [::String]
837
+ # Optional. Hint for how to order the results
838
+ #
839
+ # @yield [response, operation] Access the result along with the RPC operation
840
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::VectorSearch::V1::Index>]
841
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
842
+ #
843
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::VectorSearch::V1::Index>]
844
+ #
845
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
846
+ #
847
+ # @example Basic example
848
+ # require "google/cloud/vector_search/v1"
849
+ #
850
+ # # Create a client object. The client can be reused for multiple calls.
851
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
852
+ #
853
+ # # Create a request. To set request fields, pass in keyword arguments.
854
+ # request = Google::Cloud::VectorSearch::V1::ListIndexesRequest.new
855
+ #
856
+ # # Call the list_indexes method.
857
+ # result = client.list_indexes request
858
+ #
859
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
860
+ # # over elements, and API calls will be issued to fetch pages as needed.
861
+ # result.each do |item|
862
+ # # Each element is of type ::Google::Cloud::VectorSearch::V1::Index.
863
+ # p item
864
+ # end
865
+ #
866
+ def list_indexes request, options = nil
867
+ raise ::ArgumentError, "request must be provided" if request.nil?
868
+
869
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::ListIndexesRequest
870
+
871
+ # Converts hash and nil to an options object
872
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
873
+
874
+ # Customize the options with defaults
875
+ metadata = @config.rpcs.list_indexes.metadata.to_h
876
+
877
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
878
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
879
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
880
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
881
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
882
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
883
+
884
+ header_params = {}
885
+ if request.parent
886
+ header_params["parent"] = request.parent
887
+ end
888
+
889
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
890
+ metadata[:"x-goog-request-params"] ||= request_params_header
891
+
892
+ options.apply_defaults timeout: @config.rpcs.list_indexes.timeout,
893
+ metadata: metadata,
894
+ retry_policy: @config.rpcs.list_indexes.retry_policy
895
+
896
+ options.apply_defaults timeout: @config.timeout,
897
+ metadata: @config.metadata,
898
+ retry_policy: @config.retry_policy
899
+
900
+ @vector_search_service_stub.call_rpc :list_indexes, request, options: options do |response, operation|
901
+ response = ::Gapic::PagedEnumerable.new @vector_search_service_stub, :list_indexes, request, response, operation, options
902
+ yield response, operation if block_given?
903
+ throw :response, response
904
+ end
905
+ rescue ::GRPC::BadStatus => e
906
+ raise ::Google::Cloud::Error.from_error(e)
907
+ end
908
+
909
+ ##
910
+ # Gets details of a single Index.
911
+ #
912
+ # @overload get_index(request, options = nil)
913
+ # Pass arguments to `get_index` via a request object, either of type
914
+ # {::Google::Cloud::VectorSearch::V1::GetIndexRequest} or an equivalent Hash.
915
+ #
916
+ # @param request [::Google::Cloud::VectorSearch::V1::GetIndexRequest, ::Hash]
917
+ # A request object representing the call parameters. Required. To specify no
918
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
919
+ # @param options [::Gapic::CallOptions, ::Hash]
920
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
921
+ #
922
+ # @overload get_index(name: nil)
923
+ # Pass arguments to `get_index` via keyword arguments. Note that at
924
+ # least one keyword argument is required. To specify no parameters, or to keep all
925
+ # the default parameter values, pass an empty Hash as a request object (see above).
926
+ #
927
+ # @param name [::String]
928
+ # Required. Name of the resource
929
+ #
930
+ # @yield [response, operation] Access the result along with the RPC operation
931
+ # @yieldparam response [::Google::Cloud::VectorSearch::V1::Index]
932
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
933
+ #
934
+ # @return [::Google::Cloud::VectorSearch::V1::Index]
935
+ #
936
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
937
+ #
938
+ # @example Basic example
939
+ # require "google/cloud/vector_search/v1"
940
+ #
941
+ # # Create a client object. The client can be reused for multiple calls.
942
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
943
+ #
944
+ # # Create a request. To set request fields, pass in keyword arguments.
945
+ # request = Google::Cloud::VectorSearch::V1::GetIndexRequest.new
946
+ #
947
+ # # Call the get_index method.
948
+ # result = client.get_index request
949
+ #
950
+ # # The returned object is of type Google::Cloud::VectorSearch::V1::Index.
951
+ # p result
952
+ #
953
+ def get_index request, options = nil
954
+ raise ::ArgumentError, "request must be provided" if request.nil?
955
+
956
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::GetIndexRequest
957
+
958
+ # Converts hash and nil to an options object
959
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
960
+
961
+ # Customize the options with defaults
962
+ metadata = @config.rpcs.get_index.metadata.to_h
963
+
964
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
965
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
966
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
967
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
968
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
969
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
970
+
971
+ header_params = {}
972
+ if request.name
973
+ header_params["name"] = request.name
974
+ end
975
+
976
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
977
+ metadata[:"x-goog-request-params"] ||= request_params_header
978
+
979
+ options.apply_defaults timeout: @config.rpcs.get_index.timeout,
980
+ metadata: metadata,
981
+ retry_policy: @config.rpcs.get_index.retry_policy
982
+
983
+ options.apply_defaults timeout: @config.timeout,
984
+ metadata: @config.metadata,
985
+ retry_policy: @config.retry_policy
986
+
987
+ @vector_search_service_stub.call_rpc :get_index, request, options: options do |response, operation|
988
+ yield response, operation if block_given?
989
+ end
990
+ rescue ::GRPC::BadStatus => e
991
+ raise ::Google::Cloud::Error.from_error(e)
992
+ end
993
+
994
+ ##
995
+ # Creates a new Index in a given project and location.
996
+ #
997
+ # @overload create_index(request, options = nil)
998
+ # Pass arguments to `create_index` via a request object, either of type
999
+ # {::Google::Cloud::VectorSearch::V1::CreateIndexRequest} or an equivalent Hash.
1000
+ #
1001
+ # @param request [::Google::Cloud::VectorSearch::V1::CreateIndexRequest, ::Hash]
1002
+ # A request object representing the call parameters. Required. To specify no
1003
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1004
+ # @param options [::Gapic::CallOptions, ::Hash]
1005
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1006
+ #
1007
+ # @overload create_index(parent: nil, index_id: nil, index: nil, request_id: nil)
1008
+ # Pass arguments to `create_index` via keyword arguments. Note that at
1009
+ # least one keyword argument is required. To specify no parameters, or to keep all
1010
+ # the default parameter values, pass an empty Hash as a request object (see above).
1011
+ #
1012
+ # @param parent [::String]
1013
+ # Required. The resource name of the Collection for which to create the
1014
+ # Index. Format:
1015
+ # `projects/{project}/locations/{location}/collections/{collection}`
1016
+ # @param index_id [::String]
1017
+ # Required. ID of the Index to create.
1018
+ # The id must be 1-63 characters long, and comply with
1019
+ # [RFC1035](https://www.ietf.org/rfc/rfc1035.txt).
1020
+ # Specifically, it must be 1-63 characters long and match the regular
1021
+ # expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?`.
1022
+ # @param index [::Google::Cloud::VectorSearch::V1::Index, ::Hash]
1023
+ # Required. The resource being created
1024
+ # @param request_id [::String]
1025
+ # Optional. An optional request ID to identify requests. Specify a unique
1026
+ # request ID so that if you must retry your request, the server will know to
1027
+ # ignore the request if it has already been completed. The server will
1028
+ # guarantee that for at least 60 minutes since the first request.
1029
+ #
1030
+ # For example, consider a situation where you make an initial request and the
1031
+ # request times out. If you make the request again with the same request
1032
+ # ID, the server can check if original operation with the same request ID
1033
+ # was received, and if so, will ignore the second request. This prevents
1034
+ # clients from accidentally creating duplicate commitments.
1035
+ #
1036
+ # The request ID must be a valid UUID with the exception that zero UUID is
1037
+ # not supported (00000000-0000-0000-0000-000000000000).
1038
+ #
1039
+ # @yield [response, operation] Access the result along with the RPC operation
1040
+ # @yieldparam response [::Gapic::Operation]
1041
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1042
+ #
1043
+ # @return [::Gapic::Operation]
1044
+ #
1045
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1046
+ #
1047
+ # @example Basic example
1048
+ # require "google/cloud/vector_search/v1"
1049
+ #
1050
+ # # Create a client object. The client can be reused for multiple calls.
1051
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
1052
+ #
1053
+ # # Create a request. To set request fields, pass in keyword arguments.
1054
+ # request = Google::Cloud::VectorSearch::V1::CreateIndexRequest.new
1055
+ #
1056
+ # # Call the create_index method.
1057
+ # result = client.create_index request
1058
+ #
1059
+ # # The returned object is of type Gapic::Operation. You can use it to
1060
+ # # check the status of an operation, cancel it, or wait for results.
1061
+ # # Here is how to wait for a response.
1062
+ # result.wait_until_done! timeout: 60
1063
+ # if result.response?
1064
+ # p result.response
1065
+ # else
1066
+ # puts "No response received."
1067
+ # end
1068
+ #
1069
+ def create_index request, options = nil
1070
+ raise ::ArgumentError, "request must be provided" if request.nil?
1071
+
1072
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::CreateIndexRequest
1073
+
1074
+ # Converts hash and nil to an options object
1075
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1076
+
1077
+ # Customize the options with defaults
1078
+ metadata = @config.rpcs.create_index.metadata.to_h
1079
+
1080
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1081
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1082
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1083
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
1084
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1085
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1086
+
1087
+ header_params = {}
1088
+ if request.parent
1089
+ header_params["parent"] = request.parent
1090
+ end
1091
+
1092
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1093
+ metadata[:"x-goog-request-params"] ||= request_params_header
1094
+
1095
+ options.apply_defaults timeout: @config.rpcs.create_index.timeout,
1096
+ metadata: metadata,
1097
+ retry_policy: @config.rpcs.create_index.retry_policy
1098
+
1099
+ options.apply_defaults timeout: @config.timeout,
1100
+ metadata: @config.metadata,
1101
+ retry_policy: @config.retry_policy
1102
+
1103
+ @vector_search_service_stub.call_rpc :create_index, request, options: options do |response, operation|
1104
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1105
+ yield response, operation if block_given?
1106
+ throw :response, response
1107
+ end
1108
+ rescue ::GRPC::BadStatus => e
1109
+ raise ::Google::Cloud::Error.from_error(e)
1110
+ end
1111
+
1112
+ ##
1113
+ # Updates the parameters of a single Index.
1114
+ #
1115
+ # @overload update_index(request, options = nil)
1116
+ # Pass arguments to `update_index` via a request object, either of type
1117
+ # {::Google::Cloud::VectorSearch::V1::UpdateIndexRequest} or an equivalent Hash.
1118
+ #
1119
+ # @param request [::Google::Cloud::VectorSearch::V1::UpdateIndexRequest, ::Hash]
1120
+ # A request object representing the call parameters. Required. To specify no
1121
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1122
+ # @param options [::Gapic::CallOptions, ::Hash]
1123
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1124
+ #
1125
+ # @overload update_index(index: nil, update_mask: nil, request_id: nil)
1126
+ # Pass arguments to `update_index` via keyword arguments. Note that at
1127
+ # least one keyword argument is required. To specify no parameters, or to keep all
1128
+ # the default parameter values, pass an empty Hash as a request object (see above).
1129
+ #
1130
+ # @param index [::Google::Cloud::VectorSearch::V1::Index, ::Hash]
1131
+ # Required. The resource being updated.
1132
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1133
+ # Optional. Specifies the fields to be overwritten in the Index resource by
1134
+ # the update. The fields specified in the update_mask are relative to the
1135
+ # resource, not the full request. A field will be overwritten if it is in the
1136
+ # mask. If the user does not provide a mask then all fields present in the
1137
+ # request with non-empty values will be overwritten.
1138
+ #
1139
+ # The following fields support update:
1140
+ # * `display_name`
1141
+ # * `description`
1142
+ # * `labels`
1143
+ # * `dedicated_infrastructure.autoscaling_spec.min_replica_count`
1144
+ # * `dedicated_infrastructure.autoscaling_spec.max_replica_count`
1145
+ #
1146
+ # If `*` is provided in the `update_mask`, full replacement of mutable fields
1147
+ # will be performed.
1148
+ # @param request_id [::String]
1149
+ # Optional. An optional request ID to identify requests. Specify a unique
1150
+ # request ID so that if you must retry your request, the server will know to
1151
+ # ignore the request if it has already been completed. The server will
1152
+ # guarantee that for at least 60 minutes since the first request.
1153
+ #
1154
+ # For example, consider a situation where you make an initial request and the
1155
+ # request times out. If you make the request again with the same request
1156
+ # ID, the server can check if original operation with the same request ID
1157
+ # was received, and if so, will ignore the second request. This prevents
1158
+ # clients from accidentally creating duplicate commitments.
1159
+ #
1160
+ # The request ID must be a valid UUID with the exception that zero UUID is
1161
+ # not supported (00000000-0000-0000-0000-000000000000).
1162
+ #
1163
+ # @yield [response, operation] Access the result along with the RPC operation
1164
+ # @yieldparam response [::Gapic::Operation]
1165
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1166
+ #
1167
+ # @return [::Gapic::Operation]
1168
+ #
1169
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1170
+ #
1171
+ # @example Basic example
1172
+ # require "google/cloud/vector_search/v1"
1173
+ #
1174
+ # # Create a client object. The client can be reused for multiple calls.
1175
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
1176
+ #
1177
+ # # Create a request. To set request fields, pass in keyword arguments.
1178
+ # request = Google::Cloud::VectorSearch::V1::UpdateIndexRequest.new
1179
+ #
1180
+ # # Call the update_index method.
1181
+ # result = client.update_index request
1182
+ #
1183
+ # # The returned object is of type Gapic::Operation. You can use it to
1184
+ # # check the status of an operation, cancel it, or wait for results.
1185
+ # # Here is how to wait for a response.
1186
+ # result.wait_until_done! timeout: 60
1187
+ # if result.response?
1188
+ # p result.response
1189
+ # else
1190
+ # puts "No response received."
1191
+ # end
1192
+ #
1193
+ def update_index request, options = nil
1194
+ raise ::ArgumentError, "request must be provided" if request.nil?
1195
+
1196
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::UpdateIndexRequest
1197
+
1198
+ # Converts hash and nil to an options object
1199
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1200
+
1201
+ # Customize the options with defaults
1202
+ metadata = @config.rpcs.update_index.metadata.to_h
1203
+
1204
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1205
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1206
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1207
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
1208
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1209
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1210
+
1211
+ header_params = {}
1212
+ if request.index&.name
1213
+ header_params["index.name"] = request.index.name
1214
+ end
1215
+
1216
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1217
+ metadata[:"x-goog-request-params"] ||= request_params_header
1218
+
1219
+ options.apply_defaults timeout: @config.rpcs.update_index.timeout,
1220
+ metadata: metadata,
1221
+ retry_policy: @config.rpcs.update_index.retry_policy
1222
+
1223
+ options.apply_defaults timeout: @config.timeout,
1224
+ metadata: @config.metadata,
1225
+ retry_policy: @config.retry_policy
1226
+
1227
+ @vector_search_service_stub.call_rpc :update_index, request, options: options do |response, operation|
1228
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1229
+ yield response, operation if block_given?
1230
+ throw :response, response
1231
+ end
1232
+ rescue ::GRPC::BadStatus => e
1233
+ raise ::Google::Cloud::Error.from_error(e)
1234
+ end
1235
+
1236
+ ##
1237
+ # Deletes a single Index.
1238
+ #
1239
+ # @overload delete_index(request, options = nil)
1240
+ # Pass arguments to `delete_index` via a request object, either of type
1241
+ # {::Google::Cloud::VectorSearch::V1::DeleteIndexRequest} or an equivalent Hash.
1242
+ #
1243
+ # @param request [::Google::Cloud::VectorSearch::V1::DeleteIndexRequest, ::Hash]
1244
+ # A request object representing the call parameters. Required. To specify no
1245
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1246
+ # @param options [::Gapic::CallOptions, ::Hash]
1247
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1248
+ #
1249
+ # @overload delete_index(name: nil, request_id: nil)
1250
+ # Pass arguments to `delete_index` via keyword arguments. Note that at
1251
+ # least one keyword argument is required. To specify no parameters, or to keep all
1252
+ # the default parameter values, pass an empty Hash as a request object (see above).
1253
+ #
1254
+ # @param name [::String]
1255
+ # Required. The resource name of the Index to delete.
1256
+ # Format:
1257
+ # `projects/{project}/locations/{location}/collections/{collection}/indexes/{index}`
1258
+ # @param request_id [::String]
1259
+ # Optional. An optional request ID to identify requests. Specify a unique
1260
+ # request ID so that if you must retry your request, the server will know to
1261
+ # ignore the request if it has already been completed. The server will
1262
+ # guarantee that for at least 60 minutes since the first request.
1263
+ #
1264
+ # For example, consider a situation where you make an initial request and the
1265
+ # request times out. If you make the request again with the same request
1266
+ # ID, the server can check if original operation with the same request ID
1267
+ # was received, and if so, will ignore the second request. This prevents
1268
+ # clients from accidentally creating duplicate commitments.
1269
+ #
1270
+ # The request ID must be a valid UUID with the exception that zero UUID is
1271
+ # not supported (00000000-0000-0000-0000-000000000000).
1272
+ #
1273
+ # @yield [response, operation] Access the result along with the RPC operation
1274
+ # @yieldparam response [::Gapic::Operation]
1275
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1276
+ #
1277
+ # @return [::Gapic::Operation]
1278
+ #
1279
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1280
+ #
1281
+ # @example Basic example
1282
+ # require "google/cloud/vector_search/v1"
1283
+ #
1284
+ # # Create a client object. The client can be reused for multiple calls.
1285
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
1286
+ #
1287
+ # # Create a request. To set request fields, pass in keyword arguments.
1288
+ # request = Google::Cloud::VectorSearch::V1::DeleteIndexRequest.new
1289
+ #
1290
+ # # Call the delete_index method.
1291
+ # result = client.delete_index request
1292
+ #
1293
+ # # The returned object is of type Gapic::Operation. You can use it to
1294
+ # # check the status of an operation, cancel it, or wait for results.
1295
+ # # Here is how to wait for a response.
1296
+ # result.wait_until_done! timeout: 60
1297
+ # if result.response?
1298
+ # p result.response
1299
+ # else
1300
+ # puts "No response received."
1301
+ # end
1302
+ #
1303
+ def delete_index request, options = nil
1304
+ raise ::ArgumentError, "request must be provided" if request.nil?
1305
+
1306
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::DeleteIndexRequest
1307
+
1308
+ # Converts hash and nil to an options object
1309
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1310
+
1311
+ # Customize the options with defaults
1312
+ metadata = @config.rpcs.delete_index.metadata.to_h
1313
+
1314
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1315
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1316
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1317
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
1318
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1319
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1320
+
1321
+ header_params = {}
1322
+ if request.name
1323
+ header_params["name"] = request.name
1324
+ end
1325
+
1326
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1327
+ metadata[:"x-goog-request-params"] ||= request_params_header
1328
+
1329
+ options.apply_defaults timeout: @config.rpcs.delete_index.timeout,
1330
+ metadata: metadata,
1331
+ retry_policy: @config.rpcs.delete_index.retry_policy
1332
+
1333
+ options.apply_defaults timeout: @config.timeout,
1334
+ metadata: @config.metadata,
1335
+ retry_policy: @config.retry_policy
1336
+
1337
+ @vector_search_service_stub.call_rpc :delete_index, request, options: options do |response, operation|
1338
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1339
+ yield response, operation if block_given?
1340
+ throw :response, response
1341
+ end
1342
+ rescue ::GRPC::BadStatus => e
1343
+ raise ::Google::Cloud::Error.from_error(e)
1344
+ end
1345
+
1346
+ ##
1347
+ # Initiates a Long-Running Operation to import DataObjects into a Collection.
1348
+ #
1349
+ # @overload import_data_objects(request, options = nil)
1350
+ # Pass arguments to `import_data_objects` via a request object, either of type
1351
+ # {::Google::Cloud::VectorSearch::V1::ImportDataObjectsRequest} or an equivalent Hash.
1352
+ #
1353
+ # @param request [::Google::Cloud::VectorSearch::V1::ImportDataObjectsRequest, ::Hash]
1354
+ # A request object representing the call parameters. Required. To specify no
1355
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1356
+ # @param options [::Gapic::CallOptions, ::Hash]
1357
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1358
+ #
1359
+ # @overload import_data_objects(gcs_import: nil, name: nil)
1360
+ # Pass arguments to `import_data_objects` via keyword arguments. Note that at
1361
+ # least one keyword argument is required. To specify no parameters, or to keep all
1362
+ # the default parameter values, pass an empty Hash as a request object (see above).
1363
+ #
1364
+ # @param gcs_import [::Google::Cloud::VectorSearch::V1::ImportDataObjectsRequest::GcsImportConfig, ::Hash]
1365
+ # The Cloud Storage location of the input content.
1366
+ # @param name [::String]
1367
+ # Required. The resource name of the Collection to import DataObjects into.
1368
+ # Format: `projects/{project}/locations/{location}/collections/{collection}`.
1369
+ #
1370
+ # @yield [response, operation] Access the result along with the RPC operation
1371
+ # @yieldparam response [::Gapic::Operation]
1372
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1373
+ #
1374
+ # @return [::Gapic::Operation]
1375
+ #
1376
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1377
+ #
1378
+ # @example Basic example
1379
+ # require "google/cloud/vector_search/v1"
1380
+ #
1381
+ # # Create a client object. The client can be reused for multiple calls.
1382
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
1383
+ #
1384
+ # # Create a request. To set request fields, pass in keyword arguments.
1385
+ # request = Google::Cloud::VectorSearch::V1::ImportDataObjectsRequest.new
1386
+ #
1387
+ # # Call the import_data_objects method.
1388
+ # result = client.import_data_objects request
1389
+ #
1390
+ # # The returned object is of type Gapic::Operation. You can use it to
1391
+ # # check the status of an operation, cancel it, or wait for results.
1392
+ # # Here is how to wait for a response.
1393
+ # result.wait_until_done! timeout: 60
1394
+ # if result.response?
1395
+ # p result.response
1396
+ # else
1397
+ # puts "No response received."
1398
+ # end
1399
+ #
1400
+ def import_data_objects request, options = nil
1401
+ raise ::ArgumentError, "request must be provided" if request.nil?
1402
+
1403
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::ImportDataObjectsRequest
1404
+
1405
+ # Converts hash and nil to an options object
1406
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1407
+
1408
+ # Customize the options with defaults
1409
+ metadata = @config.rpcs.import_data_objects.metadata.to_h
1410
+
1411
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1412
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1413
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1414
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
1415
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1416
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1417
+
1418
+ header_params = {}
1419
+ if request.name
1420
+ header_params["name"] = request.name
1421
+ end
1422
+
1423
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1424
+ metadata[:"x-goog-request-params"] ||= request_params_header
1425
+
1426
+ options.apply_defaults timeout: @config.rpcs.import_data_objects.timeout,
1427
+ metadata: metadata,
1428
+ retry_policy: @config.rpcs.import_data_objects.retry_policy
1429
+
1430
+ options.apply_defaults timeout: @config.timeout,
1431
+ metadata: @config.metadata,
1432
+ retry_policy: @config.retry_policy
1433
+
1434
+ @vector_search_service_stub.call_rpc :import_data_objects, request, options: options do |response, operation|
1435
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1436
+ yield response, operation if block_given?
1437
+ throw :response, response
1438
+ end
1439
+ rescue ::GRPC::BadStatus => e
1440
+ raise ::Google::Cloud::Error.from_error(e)
1441
+ end
1442
+
1443
+ ##
1444
+ # Initiates a Long-Running Operation to export DataObjects from a Collection.
1445
+ #
1446
+ # @overload export_data_objects(request, options = nil)
1447
+ # Pass arguments to `export_data_objects` via a request object, either of type
1448
+ # {::Google::Cloud::VectorSearch::V1::ExportDataObjectsRequest} or an equivalent Hash.
1449
+ #
1450
+ # @param request [::Google::Cloud::VectorSearch::V1::ExportDataObjectsRequest, ::Hash]
1451
+ # A request object representing the call parameters. Required. To specify no
1452
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1453
+ # @param options [::Gapic::CallOptions, ::Hash]
1454
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1455
+ #
1456
+ # @overload export_data_objects(gcs_destination: nil, name: nil, field_filter: nil)
1457
+ # Pass arguments to `export_data_objects` via keyword arguments. Note that at
1458
+ # least one keyword argument is required. To specify no parameters, or to keep all
1459
+ # the default parameter values, pass an empty Hash as a request object (see above).
1460
+ #
1461
+ # @param gcs_destination [::Google::Cloud::VectorSearch::V1::ExportDataObjectsRequest::GcsExportDestination, ::Hash]
1462
+ # The Cloud Storage location where user wants to export Data Objects.
1463
+ # @param name [::String]
1464
+ # Required. The resource name of the Collection from which we want to export
1465
+ # Data Objects. Format:
1466
+ # `projects/{project}/locations/{location}/collections/{collection}`.
1467
+ # @param field_filter [::Google::Cloud::VectorSearch::V1::ExportDataObjectsRequest::FieldFilter, ::Hash]
1468
+ # Optional. Restricts which top-level Data Object fields appear in each
1469
+ # exported JSONL record. If unset, every field is exported (the existing
1470
+ # behavior). The primary use case is excluding the per-object `etag` so
1471
+ # that the exported records can be imported into a Collection in a
1472
+ # different region without optimistic-concurrency conflicts.
1473
+ #
1474
+ # Allowed field names are `id`, `data`, `vectors`, `etag`.
1475
+ #
1476
+ # @yield [response, operation] Access the result along with the RPC operation
1477
+ # @yieldparam response [::Gapic::Operation]
1478
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1479
+ #
1480
+ # @return [::Gapic::Operation]
1481
+ #
1482
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1483
+ #
1484
+ # @example Basic example
1485
+ # require "google/cloud/vector_search/v1"
1486
+ #
1487
+ # # Create a client object. The client can be reused for multiple calls.
1488
+ # client = Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new
1489
+ #
1490
+ # # Create a request. To set request fields, pass in keyword arguments.
1491
+ # request = Google::Cloud::VectorSearch::V1::ExportDataObjectsRequest.new
1492
+ #
1493
+ # # Call the export_data_objects method.
1494
+ # result = client.export_data_objects request
1495
+ #
1496
+ # # The returned object is of type Gapic::Operation. You can use it to
1497
+ # # check the status of an operation, cancel it, or wait for results.
1498
+ # # Here is how to wait for a response.
1499
+ # result.wait_until_done! timeout: 60
1500
+ # if result.response?
1501
+ # p result.response
1502
+ # else
1503
+ # puts "No response received."
1504
+ # end
1505
+ #
1506
+ def export_data_objects request, options = nil
1507
+ raise ::ArgumentError, "request must be provided" if request.nil?
1508
+
1509
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::ExportDataObjectsRequest
1510
+
1511
+ # Converts hash and nil to an options object
1512
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1513
+
1514
+ # Customize the options with defaults
1515
+ metadata = @config.rpcs.export_data_objects.metadata.to_h
1516
+
1517
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1518
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1519
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1520
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
1521
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1522
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1523
+
1524
+ header_params = {}
1525
+ if request.name
1526
+ header_params["name"] = request.name
1527
+ end
1528
+
1529
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1530
+ metadata[:"x-goog-request-params"] ||= request_params_header
1531
+
1532
+ options.apply_defaults timeout: @config.rpcs.export_data_objects.timeout,
1533
+ metadata: metadata,
1534
+ retry_policy: @config.rpcs.export_data_objects.retry_policy
1535
+
1536
+ options.apply_defaults timeout: @config.timeout,
1537
+ metadata: @config.metadata,
1538
+ retry_policy: @config.retry_policy
1539
+
1540
+ @vector_search_service_stub.call_rpc :export_data_objects, request, options: options do |response, operation|
1541
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1542
+ yield response, operation if block_given?
1543
+ throw :response, response
1544
+ end
1545
+ rescue ::GRPC::BadStatus => e
1546
+ raise ::Google::Cloud::Error.from_error(e)
1547
+ end
1548
+
1549
+ ##
1550
+ # Configuration class for the VectorSearchService API.
1551
+ #
1552
+ # This class represents the configuration for VectorSearchService,
1553
+ # providing control over timeouts, retry behavior, logging, transport
1554
+ # parameters, and other low-level controls. Certain parameters can also be
1555
+ # applied individually to specific RPCs. See
1556
+ # {::Google::Cloud::VectorSearch::V1::VectorSearchService::Client::Configuration::Rpcs}
1557
+ # for a list of RPCs that can be configured independently.
1558
+ #
1559
+ # Configuration can be applied globally to all clients, or to a single client
1560
+ # on construction.
1561
+ #
1562
+ # @example
1563
+ #
1564
+ # # Modify the global config, setting the timeout for
1565
+ # # list_collections to 20 seconds,
1566
+ # # and all remaining timeouts to 10 seconds.
1567
+ # ::Google::Cloud::VectorSearch::V1::VectorSearchService::Client.configure do |config|
1568
+ # config.timeout = 10.0
1569
+ # config.rpcs.list_collections.timeout = 20.0
1570
+ # end
1571
+ #
1572
+ # # Apply the above configuration only to a new client.
1573
+ # client = ::Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new do |config|
1574
+ # config.timeout = 10.0
1575
+ # config.rpcs.list_collections.timeout = 20.0
1576
+ # end
1577
+ #
1578
+ # @!attribute [rw] endpoint
1579
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1580
+ # nil, indicating to use the default endpoint in the current universe domain.
1581
+ # @return [::String,nil]
1582
+ # @!attribute [rw] credentials
1583
+ # Credentials to send with calls. You may provide any of the following types:
1584
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1585
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1586
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1587
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1588
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1589
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1590
+ # * (`nil`) indicating no credentials
1591
+ #
1592
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
1593
+ # is deprecated. Providing an unvalidated credential configuration to
1594
+ # Google APIs can compromise the security of your systems and data.
1595
+ #
1596
+ # @example
1597
+ #
1598
+ # # The recommended way to provide credentials is to use the `make_creds` method
1599
+ # # on the appropriate credentials class for your environment.
1600
+ #
1601
+ # require "googleauth"
1602
+ #
1603
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
1604
+ # json_key_io: ::File.open("/path/to/keyfile.json")
1605
+ # )
1606
+ #
1607
+ # client = ::Google::Cloud::VectorSearch::V1::VectorSearchService::Client.new do |config|
1608
+ # config.credentials = credentials
1609
+ # end
1610
+ #
1611
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
1612
+ # external source for authentication to Google Cloud, you must validate it before
1613
+ # providing it to a Google API client library. Providing an unvalidated credential
1614
+ # configuration to Google APIs can compromise the security of your systems and data.
1615
+ # For more information, refer to [Validate credential configurations from external
1616
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1617
+ # @return [::Object]
1618
+ # @!attribute [rw] scope
1619
+ # The OAuth scopes
1620
+ # @return [::Array<::String>]
1621
+ # @!attribute [rw] lib_name
1622
+ # The library name as recorded in instrumentation and logging
1623
+ # @return [::String]
1624
+ # @!attribute [rw] lib_version
1625
+ # The library version as recorded in instrumentation and logging
1626
+ # @return [::String]
1627
+ # @!attribute [rw] channel_args
1628
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1629
+ # `GRPC::Core::Channel` object is provided as the credential.
1630
+ # @return [::Hash]
1631
+ # @!attribute [rw] interceptors
1632
+ # An array of interceptors that are run before calls are executed.
1633
+ # @return [::Array<::GRPC::ClientInterceptor>]
1634
+ # @!attribute [rw] timeout
1635
+ # The call timeout in seconds.
1636
+ # @return [::Numeric]
1637
+ # @!attribute [rw] metadata
1638
+ # Additional gRPC headers to be sent with the call.
1639
+ # @return [::Hash{::Symbol=>::String}]
1640
+ # @!attribute [rw] retry_policy
1641
+ # The retry policy. The value is a hash with the following keys:
1642
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1643
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1644
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1645
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
1646
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1647
+ # trigger a retry.
1648
+ # @return [::Hash]
1649
+ # @!attribute [rw] quota_project
1650
+ # A separate project against which to charge quota.
1651
+ # @return [::String]
1652
+ # @!attribute [rw] universe_domain
1653
+ # The universe domain within which to make requests. This determines the
1654
+ # default endpoint URL. The default value of nil uses the environment
1655
+ # universe (usually the default "googleapis.com" universe).
1656
+ # @return [::String,nil]
1657
+ # @!attribute [rw] logger
1658
+ # A custom logger to use for request/response debug logging, or the value
1659
+ # `:default` (the default) to construct a default logger, or `nil` to
1660
+ # explicitly disable logging.
1661
+ # @return [::Logger,:default,nil]
1662
+ #
1663
+ class Configuration
1664
+ extend ::Gapic::Config
1665
+
1666
+ # @private
1667
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1668
+ DEFAULT_ENDPOINT = "vectorsearch.googleapis.com"
1669
+
1670
+ config_attr :endpoint, nil, ::String, nil
1671
+ config_attr :credentials, nil do |value|
1672
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1673
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
1674
+ allowed.any? { |klass| klass === value }
1675
+ end
1676
+ config_attr :scope, nil, ::String, ::Array, nil
1677
+ config_attr :lib_name, nil, ::String, nil
1678
+ config_attr :lib_version, nil, ::String, nil
1679
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1680
+ config_attr :interceptors, nil, ::Array, nil
1681
+ config_attr :timeout, nil, ::Numeric, nil
1682
+ config_attr :metadata, nil, ::Hash, nil
1683
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1684
+ config_attr :quota_project, nil, ::String, nil
1685
+ config_attr :universe_domain, nil, ::String, nil
1686
+ config_attr :logger, :default, ::Logger, nil, :default
1687
+
1688
+ # @private
1689
+ def initialize parent_config = nil
1690
+ @parent_config = parent_config unless parent_config.nil?
1691
+
1692
+ yield self if block_given?
1693
+ end
1694
+
1695
+ ##
1696
+ # Configurations for individual RPCs
1697
+ # @return [Rpcs]
1698
+ #
1699
+ def rpcs
1700
+ @rpcs ||= begin
1701
+ parent_rpcs = nil
1702
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1703
+ Rpcs.new parent_rpcs
1704
+ end
1705
+ end
1706
+
1707
+ ##
1708
+ # Configuration for the channel pool
1709
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1710
+ #
1711
+ def channel_pool
1712
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
1713
+ end
1714
+
1715
+ ##
1716
+ # Configuration RPC class for the VectorSearchService API.
1717
+ #
1718
+ # Includes fields providing the configuration for each RPC in this service.
1719
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1720
+ # the following configuration fields:
1721
+ #
1722
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1723
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1724
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1725
+ # include the following keys:
1726
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1727
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1728
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1729
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
1730
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1731
+ # trigger a retry.
1732
+ #
1733
+ class Rpcs
1734
+ ##
1735
+ # RPC-specific configuration for `list_collections`
1736
+ # @return [::Gapic::Config::Method]
1737
+ #
1738
+ attr_reader :list_collections
1739
+ ##
1740
+ # RPC-specific configuration for `get_collection`
1741
+ # @return [::Gapic::Config::Method]
1742
+ #
1743
+ attr_reader :get_collection
1744
+ ##
1745
+ # RPC-specific configuration for `create_collection`
1746
+ # @return [::Gapic::Config::Method]
1747
+ #
1748
+ attr_reader :create_collection
1749
+ ##
1750
+ # RPC-specific configuration for `update_collection`
1751
+ # @return [::Gapic::Config::Method]
1752
+ #
1753
+ attr_reader :update_collection
1754
+ ##
1755
+ # RPC-specific configuration for `delete_collection`
1756
+ # @return [::Gapic::Config::Method]
1757
+ #
1758
+ attr_reader :delete_collection
1759
+ ##
1760
+ # RPC-specific configuration for `list_indexes`
1761
+ # @return [::Gapic::Config::Method]
1762
+ #
1763
+ attr_reader :list_indexes
1764
+ ##
1765
+ # RPC-specific configuration for `get_index`
1766
+ # @return [::Gapic::Config::Method]
1767
+ #
1768
+ attr_reader :get_index
1769
+ ##
1770
+ # RPC-specific configuration for `create_index`
1771
+ # @return [::Gapic::Config::Method]
1772
+ #
1773
+ attr_reader :create_index
1774
+ ##
1775
+ # RPC-specific configuration for `update_index`
1776
+ # @return [::Gapic::Config::Method]
1777
+ #
1778
+ attr_reader :update_index
1779
+ ##
1780
+ # RPC-specific configuration for `delete_index`
1781
+ # @return [::Gapic::Config::Method]
1782
+ #
1783
+ attr_reader :delete_index
1784
+ ##
1785
+ # RPC-specific configuration for `import_data_objects`
1786
+ # @return [::Gapic::Config::Method]
1787
+ #
1788
+ attr_reader :import_data_objects
1789
+ ##
1790
+ # RPC-specific configuration for `export_data_objects`
1791
+ # @return [::Gapic::Config::Method]
1792
+ #
1793
+ attr_reader :export_data_objects
1794
+
1795
+ # @private
1796
+ def initialize parent_rpcs = nil
1797
+ list_collections_config = parent_rpcs.list_collections if parent_rpcs.respond_to? :list_collections
1798
+ @list_collections = ::Gapic::Config::Method.new list_collections_config
1799
+ get_collection_config = parent_rpcs.get_collection if parent_rpcs.respond_to? :get_collection
1800
+ @get_collection = ::Gapic::Config::Method.new get_collection_config
1801
+ create_collection_config = parent_rpcs.create_collection if parent_rpcs.respond_to? :create_collection
1802
+ @create_collection = ::Gapic::Config::Method.new create_collection_config
1803
+ update_collection_config = parent_rpcs.update_collection if parent_rpcs.respond_to? :update_collection
1804
+ @update_collection = ::Gapic::Config::Method.new update_collection_config
1805
+ delete_collection_config = parent_rpcs.delete_collection if parent_rpcs.respond_to? :delete_collection
1806
+ @delete_collection = ::Gapic::Config::Method.new delete_collection_config
1807
+ list_indexes_config = parent_rpcs.list_indexes if parent_rpcs.respond_to? :list_indexes
1808
+ @list_indexes = ::Gapic::Config::Method.new list_indexes_config
1809
+ get_index_config = parent_rpcs.get_index if parent_rpcs.respond_to? :get_index
1810
+ @get_index = ::Gapic::Config::Method.new get_index_config
1811
+ create_index_config = parent_rpcs.create_index if parent_rpcs.respond_to? :create_index
1812
+ @create_index = ::Gapic::Config::Method.new create_index_config
1813
+ update_index_config = parent_rpcs.update_index if parent_rpcs.respond_to? :update_index
1814
+ @update_index = ::Gapic::Config::Method.new update_index_config
1815
+ delete_index_config = parent_rpcs.delete_index if parent_rpcs.respond_to? :delete_index
1816
+ @delete_index = ::Gapic::Config::Method.new delete_index_config
1817
+ import_data_objects_config = parent_rpcs.import_data_objects if parent_rpcs.respond_to? :import_data_objects
1818
+ @import_data_objects = ::Gapic::Config::Method.new import_data_objects_config
1819
+ export_data_objects_config = parent_rpcs.export_data_objects if parent_rpcs.respond_to? :export_data_objects
1820
+ @export_data_objects = ::Gapic::Config::Method.new export_data_objects_config
1821
+
1822
+ yield self if block_given?
1823
+ end
1824
+ end
1825
+ end
1826
+ end
1827
+ end
1828
+ end
1829
+ end
1830
+ end
1831
+ end