google-cloud-discovery_engine-v1 1.0.1 → 1.1.0

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