google-cloud-discovery_engine-v1 1.0.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/operations.rb +14 -0
  3. data/lib/google/cloud/discovery_engine/v1/control_service/client.rb +6 -6
  4. data/lib/google/cloud/discovery_engine/v1/control_service/rest/client.rb +6 -6
  5. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +15 -12
  6. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +15 -12
  7. data/lib/google/cloud/discovery_engine/v1/data_store_service/client.rb +10 -1
  8. data/lib/google/cloud/discovery_engine/v1/data_store_service/rest/client.rb +10 -1
  9. data/lib/google/cloud/discovery_engine/v1/data_store_service/rest/operations.rb +14 -0
  10. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +109 -1
  11. data/lib/google/cloud/discovery_engine/v1/document_service/paths.rb +25 -0
  12. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +102 -1
  13. data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +14 -0
  14. data/lib/google/cloud/discovery_engine/v1/document_service/rest/service_stub.rb +66 -0
  15. data/lib/google/cloud/discovery_engine/v1/engine_service/rest/operations.rb +14 -0
  16. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/client.rb +219 -3
  17. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/paths.rb +85 -0
  18. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/client.rb +126 -3
  19. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/service_stub.rb +60 -0
  20. data/lib/google/cloud/discovery_engine/v1/project_service/rest/operations.rb +14 -0
  21. data/lib/google/cloud/discovery_engine/v1/rank_service/client.rb +1 -1
  22. data/lib/google/cloud/discovery_engine/v1/rank_service/rest/client.rb +1 -1
  23. data/lib/google/cloud/discovery_engine/v1/recommendation_service/client.rb +2 -1
  24. data/lib/google/cloud/discovery_engine/v1/recommendation_service/rest/client.rb +2 -1
  25. data/lib/google/cloud/discovery_engine/v1/rest.rb +1 -0
  26. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +14 -0
  27. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +11 -4
  28. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +11 -4
  29. data/lib/google/cloud/discovery_engine/v1/search_tuning_service/client.rb +571 -0
  30. data/lib/google/cloud/discovery_engine/v1/search_tuning_service/credentials.rb +47 -0
  31. data/lib/google/cloud/discovery_engine/v1/search_tuning_service/operations.rb +809 -0
  32. data/lib/google/cloud/discovery_engine/v1/search_tuning_service/paths.rb +78 -0
  33. data/lib/google/cloud/discovery_engine/v1/search_tuning_service/rest/client.rb +531 -0
  34. data/lib/google/cloud/discovery_engine/v1/search_tuning_service/rest/operations.rb +1128 -0
  35. data/lib/google/cloud/discovery_engine/v1/search_tuning_service/rest/service_stub.rb +188 -0
  36. data/lib/google/cloud/discovery_engine/v1/search_tuning_service/rest.rb +53 -0
  37. data/lib/google/cloud/discovery_engine/v1/search_tuning_service.rb +56 -0
  38. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/client.rb +5 -1
  39. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/client.rb +5 -1
  40. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/operations.rb +14 -0
  41. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +139 -0
  42. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +132 -0
  43. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +14 -0
  44. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +68 -0
  45. data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
  46. data/lib/google/cloud/discovery_engine/v1.rb +1 -0
  47. data/lib/google/cloud/discoveryengine/v1/answer_pb.rb +2 -1
  48. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +1 -1
  49. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +2 -1
  50. data/lib/google/cloud/discoveryengine/v1/custom_tuning_model_pb.rb +48 -0
  51. data/lib/google/cloud/discoveryengine/v1/data_store_pb.rb +4 -1
  52. data/lib/google/cloud/discoveryengine/v1/data_store_service_pb.rb +1 -1
  53. data/lib/google/cloud/discoveryengine/v1/document_pb.rb +4 -1
  54. data/lib/google/cloud/discoveryengine/v1/document_service_pb.rb +11 -1
  55. data/lib/google/cloud/discoveryengine/v1/document_service_services_pb.rb +4 -0
  56. data/lib/google/cloud/discoveryengine/v1/engine_pb.rb +1 -1
  57. data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_pb.rb +23 -1
  58. data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_services_pb.rb +4 -0
  59. data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +1 -1
  60. data/lib/google/cloud/discoveryengine/v1/purge_config_pb.rb +8 -1
  61. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +5 -1
  62. data/lib/google/cloud/discoveryengine/v1/search_tuning_service_pb.rb +61 -0
  63. data/lib/google/cloud/discoveryengine/v1/search_tuning_service_services_pb.rb +47 -0
  64. data/lib/google/cloud/discoveryengine/v1/site_search_engine_service_pb.rb +1 -1
  65. data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +1 -1
  66. data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +2 -1
  67. data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +5 -0
  68. data/proto_docs/google/cloud/discoveryengine/v1/answer.rb +62 -7
  69. data/proto_docs/google/cloud/discoveryengine/v1/control.rb +6 -4
  70. data/proto_docs/google/cloud/discoveryengine/v1/control_service.rb +6 -6
  71. data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +68 -24
  72. data/proto_docs/google/cloud/discoveryengine/v1/custom_tuning_model.rb +99 -0
  73. data/proto_docs/google/cloud/discoveryengine/v1/data_store.rb +88 -0
  74. data/proto_docs/google/cloud/discoveryengine/v1/data_store_service.rb +10 -0
  75. data/proto_docs/google/cloud/discoveryengine/v1/document.rb +22 -0
  76. data/proto_docs/google/cloud/discoveryengine/v1/document_processing_config.rb +9 -5
  77. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +120 -0
  78. data/proto_docs/google/cloud/discoveryengine/v1/engine.rb +5 -1
  79. data/proto_docs/google/cloud/discoveryengine/v1/grounded_generation_service.rb +385 -1
  80. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +13 -7
  81. data/proto_docs/google/cloud/discoveryengine/v1/project.rb +1 -1
  82. data/proto_docs/google/cloud/discoveryengine/v1/purge_config.rb +115 -0
  83. data/proto_docs/google/cloud/discoveryengine/v1/rank_service.rb +1 -1
  84. data/proto_docs/google/cloud/discoveryengine/v1/recommendation_service.rb +2 -1
  85. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +156 -16
  86. data/proto_docs/google/cloud/discoveryengine/v1/search_tuning_service.rb +172 -0
  87. data/proto_docs/google/cloud/discoveryengine/v1/site_search_engine_service.rb +5 -0
  88. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +5 -1
  89. metadata +17 -3
@@ -0,0 +1,571 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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/discoveryengine/v1/search_tuning_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DiscoveryEngine
26
+ module V1
27
+ module SearchTuningService
28
+ ##
29
+ # Client for the SearchTuningService service.
30
+ #
31
+ # Service for search tuning.
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
39
+
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :search_tuning_service_stub
44
+
45
+ ##
46
+ # Configure the SearchTuningService Client class.
47
+ #
48
+ # See {::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all SearchTuningService clients
54
+ # ::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config
75
+ end
76
+ yield @configure if block_given?
77
+ @configure
78
+ end
79
+
80
+ ##
81
+ # Configure the SearchTuningService Client instance.
82
+ #
83
+ # The configuration is set to the derived mode, meaning that values can be changed,
84
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
85
+ # should be made on {Client.configure}.
86
+ #
87
+ # See {::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client::Configuration}
88
+ # for a description of the configuration fields.
89
+ #
90
+ # @yield [config] Configure the Client client.
91
+ # @yieldparam config [Client::Configuration]
92
+ #
93
+ # @return [Client::Configuration]
94
+ #
95
+ def configure
96
+ yield @config if block_given?
97
+ @config
98
+ end
99
+
100
+ ##
101
+ # The effective universe domain
102
+ #
103
+ # @return [String]
104
+ #
105
+ def universe_domain
106
+ @search_tuning_service_stub.universe_domain
107
+ end
108
+
109
+ ##
110
+ # Create a new SearchTuningService client object.
111
+ #
112
+ # @example
113
+ #
114
+ # # Create a client using the default configuration
115
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client.new
116
+ #
117
+ # # Create a client using a custom configuration
118
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client.new do |config|
119
+ # config.timeout = 10.0
120
+ # end
121
+ #
122
+ # @yield [config] Configure the SearchTuningService client.
123
+ # @yieldparam config [Client::Configuration]
124
+ #
125
+ def initialize
126
+ # These require statements are intentionally placed here to initialize
127
+ # the gRPC module only when it's required.
128
+ # See https://github.com/googleapis/toolkit/issues/446
129
+ require "gapic/grpc"
130
+ require "google/cloud/discoveryengine/v1/search_tuning_service_services_pb"
131
+
132
+ # Create the configuration object
133
+ @config = Configuration.new Client.configure
134
+
135
+ # Yield the configuration if needed
136
+ yield @config if block_given?
137
+
138
+ # Create credentials
139
+ credentials = @config.credentials
140
+ # Use self-signed JWT if the endpoint is unchanged from default,
141
+ # but only if the default endpoint does not have a region prefix.
142
+ enable_self_signed_jwt = @config.endpoint.nil? ||
143
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
144
+ !@config.endpoint.split(".").first.include?("-"))
145
+ credentials ||= Credentials.default scope: @config.scope,
146
+ enable_self_signed_jwt: enable_self_signed_jwt
147
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
148
+ credentials = Credentials.new credentials, scope: @config.scope
149
+ end
150
+ @quota_project_id = @config.quota_project
151
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
152
+
153
+ @operations_client = Operations.new do |config|
154
+ config.credentials = credentials
155
+ config.quota_project = @quota_project_id
156
+ config.endpoint = @config.endpoint
157
+ config.universe_domain = @config.universe_domain
158
+ end
159
+
160
+ @search_tuning_service_stub = ::Gapic::ServiceStub.new(
161
+ ::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Stub,
162
+ credentials: credentials,
163
+ endpoint: @config.endpoint,
164
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
165
+ universe_domain: @config.universe_domain,
166
+ channel_args: @config.channel_args,
167
+ interceptors: @config.interceptors,
168
+ channel_pool_config: @config.channel_pool
169
+ )
170
+
171
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
172
+ config.credentials = credentials
173
+ config.quota_project = @quota_project_id
174
+ config.endpoint = @search_tuning_service_stub.endpoint
175
+ config.universe_domain = @search_tuning_service_stub.universe_domain
176
+ end
177
+ end
178
+
179
+ ##
180
+ # Get the associated client for long-running operations.
181
+ #
182
+ # @return [::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Operations]
183
+ #
184
+ attr_reader :operations_client
185
+
186
+ ##
187
+ # Get the associated client for mix-in of the Locations.
188
+ #
189
+ # @return [Google::Cloud::Location::Locations::Client]
190
+ #
191
+ attr_reader :location_client
192
+
193
+ # Service calls
194
+
195
+ ##
196
+ # Trains a custom model.
197
+ #
198
+ # @overload train_custom_model(request, options = nil)
199
+ # Pass arguments to `train_custom_model` via a request object, either of type
200
+ # {::Google::Cloud::DiscoveryEngine::V1::TrainCustomModelRequest} or an equivalent Hash.
201
+ #
202
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::TrainCustomModelRequest, ::Hash]
203
+ # A request object representing the call parameters. Required. To specify no
204
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
205
+ # @param options [::Gapic::CallOptions, ::Hash]
206
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
207
+ #
208
+ # @overload train_custom_model(gcs_training_input: nil, data_store: nil, model_type: nil, error_config: nil, model_id: nil)
209
+ # Pass arguments to `train_custom_model` via keyword arguments. Note that at
210
+ # least one keyword argument is required. To specify no parameters, or to keep all
211
+ # the default parameter values, pass an empty Hash as a request object (see above).
212
+ #
213
+ # @param gcs_training_input [::Google::Cloud::DiscoveryEngine::V1::TrainCustomModelRequest::GcsTrainingInput, ::Hash]
214
+ # Cloud Storage training input.
215
+ # @param data_store [::String]
216
+ # Required. The resource name of the Data Store, such as
217
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`.
218
+ # This field is used to identify the data store where to train the models.
219
+ # @param model_type [::String]
220
+ # Model to be trained. Supported values are:
221
+ #
222
+ # * **search-tuning**: Fine tuning the search system based on data provided.
223
+ # @param error_config [::Google::Cloud::DiscoveryEngine::V1::ImportErrorConfig, ::Hash]
224
+ # The desired location of errors incurred during the data ingestion and
225
+ # training.
226
+ # @param model_id [::String]
227
+ # If not provided, a UUID will be generated.
228
+ #
229
+ # @yield [response, operation] Access the result along with the RPC operation
230
+ # @yieldparam response [::Gapic::Operation]
231
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
232
+ #
233
+ # @return [::Gapic::Operation]
234
+ #
235
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
236
+ #
237
+ # @example Basic example
238
+ # require "google/cloud/discovery_engine/v1"
239
+ #
240
+ # # Create a client object. The client can be reused for multiple calls.
241
+ # client = Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client.new
242
+ #
243
+ # # Create a request. To set request fields, pass in keyword arguments.
244
+ # request = Google::Cloud::DiscoveryEngine::V1::TrainCustomModelRequest.new
245
+ #
246
+ # # Call the train_custom_model method.
247
+ # result = client.train_custom_model request
248
+ #
249
+ # # The returned object is of type Gapic::Operation. You can use it to
250
+ # # check the status of an operation, cancel it, or wait for results.
251
+ # # Here is how to wait for a response.
252
+ # result.wait_until_done! timeout: 60
253
+ # if result.response?
254
+ # p result.response
255
+ # else
256
+ # puts "No response received."
257
+ # end
258
+ #
259
+ def train_custom_model request, options = nil
260
+ raise ::ArgumentError, "request must be provided" if request.nil?
261
+
262
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::TrainCustomModelRequest
263
+
264
+ # Converts hash and nil to an options object
265
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
266
+
267
+ # Customize the options with defaults
268
+ metadata = @config.rpcs.train_custom_model.metadata.to_h
269
+
270
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
271
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
272
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
273
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
274
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
275
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
276
+
277
+ header_params = {}
278
+ if request.data_store
279
+ header_params["data_store"] = request.data_store
280
+ end
281
+
282
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
283
+ metadata[:"x-goog-request-params"] ||= request_params_header
284
+
285
+ options.apply_defaults timeout: @config.rpcs.train_custom_model.timeout,
286
+ metadata: metadata,
287
+ retry_policy: @config.rpcs.train_custom_model.retry_policy
288
+
289
+ options.apply_defaults timeout: @config.timeout,
290
+ metadata: @config.metadata,
291
+ retry_policy: @config.retry_policy
292
+
293
+ @search_tuning_service_stub.call_rpc :train_custom_model, request, options: options do |response, operation|
294
+ response = ::Gapic::Operation.new response, @operations_client, options: options
295
+ yield response, operation if block_given?
296
+ return response
297
+ end
298
+ rescue ::GRPC::BadStatus => e
299
+ raise ::Google::Cloud::Error.from_error(e)
300
+ end
301
+
302
+ ##
303
+ # Gets a list of all the custom models.
304
+ #
305
+ # @overload list_custom_models(request, options = nil)
306
+ # Pass arguments to `list_custom_models` via a request object, either of type
307
+ # {::Google::Cloud::DiscoveryEngine::V1::ListCustomModelsRequest} or an equivalent Hash.
308
+ #
309
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ListCustomModelsRequest, ::Hash]
310
+ # A request object representing the call parameters. Required. To specify no
311
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
312
+ # @param options [::Gapic::CallOptions, ::Hash]
313
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
314
+ #
315
+ # @overload list_custom_models(data_store: nil)
316
+ # Pass arguments to `list_custom_models` via keyword arguments. Note that at
317
+ # least one keyword argument is required. To specify no parameters, or to keep all
318
+ # the default parameter values, pass an empty Hash as a request object (see above).
319
+ #
320
+ # @param data_store [::String]
321
+ # Required. The resource name of the parent Data Store, such as
322
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`.
323
+ # This field is used to identify the data store where to fetch the models
324
+ # from.
325
+ #
326
+ # @yield [response, operation] Access the result along with the RPC operation
327
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::ListCustomModelsResponse]
328
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
329
+ #
330
+ # @return [::Google::Cloud::DiscoveryEngine::V1::ListCustomModelsResponse]
331
+ #
332
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
333
+ #
334
+ # @example Basic example
335
+ # require "google/cloud/discovery_engine/v1"
336
+ #
337
+ # # Create a client object. The client can be reused for multiple calls.
338
+ # client = Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client.new
339
+ #
340
+ # # Create a request. To set request fields, pass in keyword arguments.
341
+ # request = Google::Cloud::DiscoveryEngine::V1::ListCustomModelsRequest.new
342
+ #
343
+ # # Call the list_custom_models method.
344
+ # result = client.list_custom_models request
345
+ #
346
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1::ListCustomModelsResponse.
347
+ # p result
348
+ #
349
+ def list_custom_models request, options = nil
350
+ raise ::ArgumentError, "request must be provided" if request.nil?
351
+
352
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ListCustomModelsRequest
353
+
354
+ # Converts hash and nil to an options object
355
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
356
+
357
+ # Customize the options with defaults
358
+ metadata = @config.rpcs.list_custom_models.metadata.to_h
359
+
360
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
361
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
362
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
363
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
364
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
365
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
366
+
367
+ header_params = {}
368
+ if request.data_store
369
+ header_params["data_store"] = request.data_store
370
+ end
371
+
372
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
373
+ metadata[:"x-goog-request-params"] ||= request_params_header
374
+
375
+ options.apply_defaults timeout: @config.rpcs.list_custom_models.timeout,
376
+ metadata: metadata,
377
+ retry_policy: @config.rpcs.list_custom_models.retry_policy
378
+
379
+ options.apply_defaults timeout: @config.timeout,
380
+ metadata: @config.metadata,
381
+ retry_policy: @config.retry_policy
382
+
383
+ @search_tuning_service_stub.call_rpc :list_custom_models, request, options: options do |response, operation|
384
+ yield response, operation if block_given?
385
+ return response
386
+ end
387
+ rescue ::GRPC::BadStatus => e
388
+ raise ::Google::Cloud::Error.from_error(e)
389
+ end
390
+
391
+ ##
392
+ # Configuration class for the SearchTuningService API.
393
+ #
394
+ # This class represents the configuration for SearchTuningService,
395
+ # providing control over timeouts, retry behavior, logging, transport
396
+ # parameters, and other low-level controls. Certain parameters can also be
397
+ # applied individually to specific RPCs. See
398
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client::Configuration::Rpcs}
399
+ # for a list of RPCs that can be configured independently.
400
+ #
401
+ # Configuration can be applied globally to all clients, or to a single client
402
+ # on construction.
403
+ #
404
+ # @example
405
+ #
406
+ # # Modify the global config, setting the timeout for
407
+ # # train_custom_model to 20 seconds,
408
+ # # and all remaining timeouts to 10 seconds.
409
+ # ::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client.configure do |config|
410
+ # config.timeout = 10.0
411
+ # config.rpcs.train_custom_model.timeout = 20.0
412
+ # end
413
+ #
414
+ # # Apply the above configuration only to a new client.
415
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SearchTuningService::Client.new do |config|
416
+ # config.timeout = 10.0
417
+ # config.rpcs.train_custom_model.timeout = 20.0
418
+ # end
419
+ #
420
+ # @!attribute [rw] endpoint
421
+ # A custom service endpoint, as a hostname or hostname:port. The default is
422
+ # nil, indicating to use the default endpoint in the current universe domain.
423
+ # @return [::String,nil]
424
+ # @!attribute [rw] credentials
425
+ # Credentials to send with calls. You may provide any of the following types:
426
+ # * (`String`) The path to a service account key file in JSON format
427
+ # * (`Hash`) A service account key as a Hash
428
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
429
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
430
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
431
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
432
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
433
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
434
+ # * (`nil`) indicating no credentials
435
+ # @return [::Object]
436
+ # @!attribute [rw] scope
437
+ # The OAuth scopes
438
+ # @return [::Array<::String>]
439
+ # @!attribute [rw] lib_name
440
+ # The library name as recorded in instrumentation and logging
441
+ # @return [::String]
442
+ # @!attribute [rw] lib_version
443
+ # The library version as recorded in instrumentation and logging
444
+ # @return [::String]
445
+ # @!attribute [rw] channel_args
446
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
447
+ # `GRPC::Core::Channel` object is provided as the credential.
448
+ # @return [::Hash]
449
+ # @!attribute [rw] interceptors
450
+ # An array of interceptors that are run before calls are executed.
451
+ # @return [::Array<::GRPC::ClientInterceptor>]
452
+ # @!attribute [rw] timeout
453
+ # The call timeout in seconds.
454
+ # @return [::Numeric]
455
+ # @!attribute [rw] metadata
456
+ # Additional gRPC headers to be sent with the call.
457
+ # @return [::Hash{::Symbol=>::String}]
458
+ # @!attribute [rw] retry_policy
459
+ # The retry policy. The value is a hash with the following keys:
460
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
461
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
462
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
463
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
464
+ # trigger a retry.
465
+ # @return [::Hash]
466
+ # @!attribute [rw] quota_project
467
+ # A separate project against which to charge quota.
468
+ # @return [::String]
469
+ # @!attribute [rw] universe_domain
470
+ # The universe domain within which to make requests. This determines the
471
+ # default endpoint URL. The default value of nil uses the environment
472
+ # universe (usually the default "googleapis.com" universe).
473
+ # @return [::String,nil]
474
+ #
475
+ class Configuration
476
+ extend ::Gapic::Config
477
+
478
+ # @private
479
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
480
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
481
+
482
+ config_attr :endpoint, nil, ::String, nil
483
+ config_attr :credentials, nil do |value|
484
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
485
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
486
+ allowed.any? { |klass| klass === value }
487
+ end
488
+ config_attr :scope, nil, ::String, ::Array, nil
489
+ config_attr :lib_name, nil, ::String, nil
490
+ config_attr :lib_version, nil, ::String, nil
491
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
492
+ config_attr :interceptors, nil, ::Array, nil
493
+ config_attr :timeout, nil, ::Numeric, nil
494
+ config_attr :metadata, nil, ::Hash, nil
495
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
496
+ config_attr :quota_project, nil, ::String, nil
497
+ config_attr :universe_domain, nil, ::String, nil
498
+
499
+ # @private
500
+ def initialize parent_config = nil
501
+ @parent_config = parent_config unless parent_config.nil?
502
+
503
+ yield self if block_given?
504
+ end
505
+
506
+ ##
507
+ # Configurations for individual RPCs
508
+ # @return [Rpcs]
509
+ #
510
+ def rpcs
511
+ @rpcs ||= begin
512
+ parent_rpcs = nil
513
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
514
+ Rpcs.new parent_rpcs
515
+ end
516
+ end
517
+
518
+ ##
519
+ # Configuration for the channel pool
520
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
521
+ #
522
+ def channel_pool
523
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
524
+ end
525
+
526
+ ##
527
+ # Configuration RPC class for the SearchTuningService API.
528
+ #
529
+ # Includes fields providing the configuration for each RPC in this service.
530
+ # Each configuration object is of type `Gapic::Config::Method` and includes
531
+ # the following configuration fields:
532
+ #
533
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
534
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
535
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
536
+ # include the following keys:
537
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
538
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
539
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
540
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
541
+ # trigger a retry.
542
+ #
543
+ class Rpcs
544
+ ##
545
+ # RPC-specific configuration for `train_custom_model`
546
+ # @return [::Gapic::Config::Method]
547
+ #
548
+ attr_reader :train_custom_model
549
+ ##
550
+ # RPC-specific configuration for `list_custom_models`
551
+ # @return [::Gapic::Config::Method]
552
+ #
553
+ attr_reader :list_custom_models
554
+
555
+ # @private
556
+ def initialize parent_rpcs = nil
557
+ train_custom_model_config = parent_rpcs.train_custom_model if parent_rpcs.respond_to? :train_custom_model
558
+ @train_custom_model = ::Gapic::Config::Method.new train_custom_model_config
559
+ list_custom_models_config = parent_rpcs.list_custom_models if parent_rpcs.respond_to? :list_custom_models
560
+ @list_custom_models = ::Gapic::Config::Method.new list_custom_models_config
561
+
562
+ yield self if block_given?
563
+ end
564
+ end
565
+ end
566
+ end
567
+ end
568
+ end
569
+ end
570
+ end
571
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module DiscoveryEngine
24
+ module V1
25
+ module SearchTuningService
26
+ # Credentials for the SearchTuningService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "GOOGLE_CLOUD_CREDENTIALS",
33
+ "GOOGLE_CLOUD_KEYFILE",
34
+ "GCLOUD_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
36
+ "GOOGLE_CLOUD_KEYFILE_JSON",
37
+ "GCLOUD_KEYFILE_JSON"
38
+ ]
39
+ self.paths = [
40
+ "~/.config/google_cloud/application_default_credentials.json"
41
+ ]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end