google-cloud-retail-v2 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/retail/v2/catalog_service/client.rb +2 -2
  4. data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +2 -2
  5. data/lib/google/cloud/retail/v2/common_pb.rb +6 -0
  6. data/lib/google/cloud/retail/v2/completion_service/client.rb +11 -4
  7. data/lib/google/cloud/retail/v2/completion_service/operations.rb +2 -2
  8. data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +11 -4
  9. data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +2 -2
  10. data/lib/google/cloud/retail/v2/completion_service/rest.rb +1 -1
  11. data/lib/google/cloud/retail/v2/completion_service.rb +1 -1
  12. data/lib/google/cloud/retail/v2/completion_service_pb.rb +1 -0
  13. data/lib/google/cloud/retail/v2/completion_service_services_pb.rb +1 -1
  14. data/lib/google/cloud/retail/v2/control_service/client.rb +2 -2
  15. data/lib/google/cloud/retail/v2/control_service/rest/client.rb +2 -2
  16. data/lib/google/cloud/retail/v2/model_pb.rb +70 -0
  17. data/lib/google/cloud/retail/v2/model_service/client.rb +1126 -0
  18. data/lib/google/cloud/retail/v2/model_service/credentials.rb +51 -0
  19. data/lib/google/cloud/retail/v2/model_service/operations.rb +768 -0
  20. data/lib/google/cloud/retail/v2/model_service/paths.rb +73 -0
  21. data/lib/google/cloud/retail/v2/model_service/rest/client.rb +904 -0
  22. data/lib/google/cloud/retail/v2/model_service/rest/operations.rb +828 -0
  23. data/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb +525 -0
  24. data/lib/google/cloud/retail/v2/model_service/rest.rb +64 -0
  25. data/lib/google/cloud/retail/v2/model_service.rb +67 -0
  26. data/lib/google/cloud/retail/v2/model_service_pb.rb +80 -0
  27. data/lib/google/cloud/retail/v2/model_service_services_pb.rb +73 -0
  28. data/lib/google/cloud/retail/v2/prediction_service/client.rb +5 -2
  29. data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +5 -2
  30. data/lib/google/cloud/retail/v2/product_service/client.rb +18 -17
  31. data/lib/google/cloud/retail/v2/product_service/operations.rb +2 -2
  32. data/lib/google/cloud/retail/v2/product_service/rest/client.rb +18 -17
  33. data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +2 -2
  34. data/lib/google/cloud/retail/v2/product_service_services_pb.rb +16 -15
  35. data/lib/google/cloud/retail/v2/rest.rb +1 -0
  36. data/lib/google/cloud/retail/v2/search_service/client.rb +11 -4
  37. data/lib/google/cloud/retail/v2/search_service/rest/client.rb +11 -4
  38. data/lib/google/cloud/retail/v2/search_service_pb.rb +14 -0
  39. data/lib/google/cloud/retail/v2/serving_config_service/client.rb +2 -2
  40. data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +2 -2
  41. data/lib/google/cloud/retail/v2/user_event_pb.rb +1 -0
  42. data/lib/google/cloud/retail/v2/user_event_service/client.rb +3 -3
  43. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +2 -2
  44. data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +3 -3
  45. data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +2 -2
  46. data/lib/google/cloud/retail/v2/version.rb +1 -1
  47. data/lib/google/cloud/retail/v2.rb +1 -0
  48. data/proto_docs/google/api/client.rb +57 -3
  49. data/proto_docs/google/cloud/retail/v2/catalog.rb +11 -6
  50. data/proto_docs/google/cloud/retail/v2/common.rb +15 -1
  51. data/proto_docs/google/cloud/retail/v2/completion_service.rb +10 -2
  52. data/proto_docs/google/cloud/retail/v2/import_config.rb +1 -1
  53. data/proto_docs/google/cloud/retail/v2/model.rb +228 -0
  54. data/proto_docs/google/cloud/retail/v2/model_service.rb +172 -0
  55. data/proto_docs/google/cloud/retail/v2/prediction_service.rb +3 -0
  56. data/proto_docs/google/cloud/retail/v2/product.rb +2 -3
  57. data/proto_docs/google/cloud/retail/v2/search_service.rb +56 -2
  58. data/proto_docs/google/cloud/retail/v2/serving_config.rb +3 -3
  59. data/proto_docs/google/cloud/retail/v2/user_event.rb +7 -0
  60. data/proto_docs/google/cloud/retail/v2/user_event_service.rb +1 -1
  61. metadata +16 -2
@@ -0,0 +1,1126 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/retail/v2/model_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Retail
26
+ module V2
27
+ module ModelService
28
+ ##
29
+ # Client for the ModelService service.
30
+ #
31
+ # Service for performing CRUD operations on models.
32
+ # Recommendation models contain all the metadata necessary to generate a set of
33
+ # models for the `Predict()` API. A model is queried
34
+ # indirectly via a ServingConfig, which associates a model with a
35
+ # given Placement (e.g. Frequently Bought Together on Home Page).
36
+ #
37
+ # This service allows you to do the following:
38
+ #
39
+ # * Initiate training of a model.
40
+ # * Pause training of an existing model.
41
+ # * List all the available models along with their metadata.
42
+ # * Control their tuning schedule.
43
+ #
44
+ class Client
45
+ include Paths
46
+
47
+ # @private
48
+ attr_reader :model_service_stub
49
+
50
+ ##
51
+ # Configure the ModelService Client class.
52
+ #
53
+ # See {::Google::Cloud::Retail::V2::ModelService::Client::Configuration}
54
+ # for a description of the configuration fields.
55
+ #
56
+ # @example
57
+ #
58
+ # # Modify the configuration for all ModelService clients
59
+ # ::Google::Cloud::Retail::V2::ModelService::Client.configure do |config|
60
+ # config.timeout = 10.0
61
+ # end
62
+ #
63
+ # @yield [config] Configure the Client client.
64
+ # @yieldparam config [Client::Configuration]
65
+ #
66
+ # @return [Client::Configuration]
67
+ #
68
+ def self.configure
69
+ @configure ||= begin
70
+ namespace = ["Google", "Cloud", "Retail", "V2"]
71
+ parent_config = while namespace.any?
72
+ parent_name = namespace.join "::"
73
+ parent_const = const_get parent_name
74
+ break parent_const.configure if parent_const.respond_to? :configure
75
+ namespace.pop
76
+ end
77
+ default_config = Client::Configuration.new parent_config
78
+
79
+ default_config.timeout = 60.0
80
+ default_config.retry_policy = {
81
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
82
+ }
83
+
84
+ default_config
85
+ end
86
+ yield @configure if block_given?
87
+ @configure
88
+ end
89
+
90
+ ##
91
+ # Configure the ModelService Client instance.
92
+ #
93
+ # The configuration is set to the derived mode, meaning that values can be changed,
94
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
95
+ # should be made on {Client.configure}.
96
+ #
97
+ # See {::Google::Cloud::Retail::V2::ModelService::Client::Configuration}
98
+ # for a description of the configuration fields.
99
+ #
100
+ # @yield [config] Configure the Client client.
101
+ # @yieldparam config [Client::Configuration]
102
+ #
103
+ # @return [Client::Configuration]
104
+ #
105
+ def configure
106
+ yield @config if block_given?
107
+ @config
108
+ end
109
+
110
+ ##
111
+ # Create a new ModelService client object.
112
+ #
113
+ # @example
114
+ #
115
+ # # Create a client using the default configuration
116
+ # client = ::Google::Cloud::Retail::V2::ModelService::Client.new
117
+ #
118
+ # # Create a client using a custom configuration
119
+ # client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config|
120
+ # config.timeout = 10.0
121
+ # end
122
+ #
123
+ # @yield [config] Configure the ModelService client.
124
+ # @yieldparam config [Client::Configuration]
125
+ #
126
+ def initialize
127
+ # These require statements are intentionally placed here to initialize
128
+ # the gRPC module only when it's required.
129
+ # See https://github.com/googleapis/toolkit/issues/446
130
+ require "gapic/grpc"
131
+ require "google/cloud/retail/v2/model_service_services_pb"
132
+
133
+ # Create the configuration object
134
+ @config = Configuration.new Client.configure
135
+
136
+ # Yield the configuration if needed
137
+ yield @config if block_given?
138
+
139
+ # Create credentials
140
+ credentials = @config.credentials
141
+ # Use self-signed JWT if the endpoint is unchanged from default,
142
+ # but only if the default endpoint does not have a region prefix.
143
+ enable_self_signed_jwt = @config.endpoint == Client.configure.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
+ end
158
+
159
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
160
+ config.credentials = credentials
161
+ config.quota_project = @quota_project_id
162
+ config.endpoint = @config.endpoint
163
+ end
164
+
165
+ @model_service_stub = ::Gapic::ServiceStub.new(
166
+ ::Google::Cloud::Retail::V2::ModelService::Stub,
167
+ credentials: credentials,
168
+ endpoint: @config.endpoint,
169
+ channel_args: @config.channel_args,
170
+ interceptors: @config.interceptors
171
+ )
172
+ end
173
+
174
+ ##
175
+ # Get the associated client for long-running operations.
176
+ #
177
+ # @return [::Google::Cloud::Retail::V2::ModelService::Operations]
178
+ #
179
+ attr_reader :operations_client
180
+
181
+ ##
182
+ # Get the associated client for mix-in of the Locations.
183
+ #
184
+ # @return [Google::Cloud::Location::Locations::Client]
185
+ #
186
+ attr_reader :location_client
187
+
188
+ # Service calls
189
+
190
+ ##
191
+ # Creates a new model.
192
+ #
193
+ # @overload create_model(request, options = nil)
194
+ # Pass arguments to `create_model` via a request object, either of type
195
+ # {::Google::Cloud::Retail::V2::CreateModelRequest} or an equivalent Hash.
196
+ #
197
+ # @param request [::Google::Cloud::Retail::V2::CreateModelRequest, ::Hash]
198
+ # A request object representing the call parameters. Required. To specify no
199
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
200
+ # @param options [::Gapic::CallOptions, ::Hash]
201
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
202
+ #
203
+ # @overload create_model(parent: nil, model: nil, dry_run: nil)
204
+ # Pass arguments to `create_model` via keyword arguments. Note that at
205
+ # least one keyword argument is required. To specify no parameters, or to keep all
206
+ # the default parameter values, pass an empty Hash as a request object (see above).
207
+ #
208
+ # @param parent [::String]
209
+ # Required. The parent resource under which to create the model. Format:
210
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
211
+ # @param model [::Google::Cloud::Retail::V2::Model, ::Hash]
212
+ # Required. The payload of the {::Google::Cloud::Retail::V2::Model Model} to
213
+ # create.
214
+ # @param dry_run [::Boolean]
215
+ # Optional. Whether to run a dry run to validate the request (without
216
+ # actually creating the model).
217
+ #
218
+ # @yield [response, operation] Access the result along with the RPC operation
219
+ # @yieldparam response [::Gapic::Operation]
220
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
221
+ #
222
+ # @return [::Gapic::Operation]
223
+ #
224
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
225
+ #
226
+ # @example Basic example
227
+ # require "google/cloud/retail/v2"
228
+ #
229
+ # # Create a client object. The client can be reused for multiple calls.
230
+ # client = Google::Cloud::Retail::V2::ModelService::Client.new
231
+ #
232
+ # # Create a request. To set request fields, pass in keyword arguments.
233
+ # request = Google::Cloud::Retail::V2::CreateModelRequest.new
234
+ #
235
+ # # Call the create_model method.
236
+ # result = client.create_model request
237
+ #
238
+ # # The returned object is of type Gapic::Operation. You can use it to
239
+ # # check the status of an operation, cancel it, or wait for results.
240
+ # # Here is how to wait for a response.
241
+ # result.wait_until_done! timeout: 60
242
+ # if result.response?
243
+ # p result.response
244
+ # else
245
+ # puts "No response received."
246
+ # end
247
+ #
248
+ def create_model request, options = nil
249
+ raise ::ArgumentError, "request must be provided" if request.nil?
250
+
251
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateModelRequest
252
+
253
+ # Converts hash and nil to an options object
254
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
255
+
256
+ # Customize the options with defaults
257
+ metadata = @config.rpcs.create_model.metadata.to_h
258
+
259
+ # Set x-goog-api-client and x-goog-user-project headers
260
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
261
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
262
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
263
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
264
+
265
+ header_params = {}
266
+ if request.parent
267
+ header_params["parent"] = request.parent
268
+ end
269
+
270
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
271
+ metadata[:"x-goog-request-params"] ||= request_params_header
272
+
273
+ options.apply_defaults timeout: @config.rpcs.create_model.timeout,
274
+ metadata: metadata,
275
+ retry_policy: @config.rpcs.create_model.retry_policy
276
+
277
+ options.apply_defaults timeout: @config.timeout,
278
+ metadata: @config.metadata,
279
+ retry_policy: @config.retry_policy
280
+
281
+ @model_service_stub.call_rpc :create_model, request, options: options do |response, operation|
282
+ response = ::Gapic::Operation.new response, @operations_client, options: options
283
+ yield response, operation if block_given?
284
+ return response
285
+ end
286
+ rescue ::GRPC::BadStatus => e
287
+ raise ::Google::Cloud::Error.from_error(e)
288
+ end
289
+
290
+ ##
291
+ # Gets a model.
292
+ #
293
+ # @overload get_model(request, options = nil)
294
+ # Pass arguments to `get_model` via a request object, either of type
295
+ # {::Google::Cloud::Retail::V2::GetModelRequest} or an equivalent Hash.
296
+ #
297
+ # @param request [::Google::Cloud::Retail::V2::GetModelRequest, ::Hash]
298
+ # A request object representing the call parameters. Required. To specify no
299
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
300
+ # @param options [::Gapic::CallOptions, ::Hash]
301
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
302
+ #
303
+ # @overload get_model(name: nil)
304
+ # Pass arguments to `get_model` via keyword arguments. Note that at
305
+ # least one keyword argument is required. To specify no parameters, or to keep all
306
+ # the default parameter values, pass an empty Hash as a request object (see above).
307
+ #
308
+ # @param name [::String]
309
+ # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to
310
+ # get. Format:
311
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}`
312
+ #
313
+ # @yield [response, operation] Access the result along with the RPC operation
314
+ # @yieldparam response [::Google::Cloud::Retail::V2::Model]
315
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
316
+ #
317
+ # @return [::Google::Cloud::Retail::V2::Model]
318
+ #
319
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
320
+ #
321
+ # @example Basic example
322
+ # require "google/cloud/retail/v2"
323
+ #
324
+ # # Create a client object. The client can be reused for multiple calls.
325
+ # client = Google::Cloud::Retail::V2::ModelService::Client.new
326
+ #
327
+ # # Create a request. To set request fields, pass in keyword arguments.
328
+ # request = Google::Cloud::Retail::V2::GetModelRequest.new
329
+ #
330
+ # # Call the get_model method.
331
+ # result = client.get_model request
332
+ #
333
+ # # The returned object is of type Google::Cloud::Retail::V2::Model.
334
+ # p result
335
+ #
336
+ def get_model request, options = nil
337
+ raise ::ArgumentError, "request must be provided" if request.nil?
338
+
339
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetModelRequest
340
+
341
+ # Converts hash and nil to an options object
342
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
343
+
344
+ # Customize the options with defaults
345
+ metadata = @config.rpcs.get_model.metadata.to_h
346
+
347
+ # Set x-goog-api-client and x-goog-user-project headers
348
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
349
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
350
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
351
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
352
+
353
+ header_params = {}
354
+ if request.name
355
+ header_params["name"] = request.name
356
+ end
357
+
358
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
359
+ metadata[:"x-goog-request-params"] ||= request_params_header
360
+
361
+ options.apply_defaults timeout: @config.rpcs.get_model.timeout,
362
+ metadata: metadata,
363
+ retry_policy: @config.rpcs.get_model.retry_policy
364
+
365
+ options.apply_defaults timeout: @config.timeout,
366
+ metadata: @config.metadata,
367
+ retry_policy: @config.retry_policy
368
+
369
+ @model_service_stub.call_rpc :get_model, request, options: options do |response, operation|
370
+ yield response, operation if block_given?
371
+ return response
372
+ end
373
+ rescue ::GRPC::BadStatus => e
374
+ raise ::Google::Cloud::Error.from_error(e)
375
+ end
376
+
377
+ ##
378
+ # Pauses the training of an existing model.
379
+ #
380
+ # @overload pause_model(request, options = nil)
381
+ # Pass arguments to `pause_model` via a request object, either of type
382
+ # {::Google::Cloud::Retail::V2::PauseModelRequest} or an equivalent Hash.
383
+ #
384
+ # @param request [::Google::Cloud::Retail::V2::PauseModelRequest, ::Hash]
385
+ # A request object representing the call parameters. Required. To specify no
386
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
387
+ # @param options [::Gapic::CallOptions, ::Hash]
388
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
389
+ #
390
+ # @overload pause_model(name: nil)
391
+ # Pass arguments to `pause_model` via keyword arguments. Note that at
392
+ # least one keyword argument is required. To specify no parameters, or to keep all
393
+ # the default parameter values, pass an empty Hash as a request object (see above).
394
+ #
395
+ # @param name [::String]
396
+ # Required. The name of the model to pause.
397
+ # Format:
398
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
399
+ #
400
+ # @yield [response, operation] Access the result along with the RPC operation
401
+ # @yieldparam response [::Google::Cloud::Retail::V2::Model]
402
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
403
+ #
404
+ # @return [::Google::Cloud::Retail::V2::Model]
405
+ #
406
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
407
+ #
408
+ # @example Basic example
409
+ # require "google/cloud/retail/v2"
410
+ #
411
+ # # Create a client object. The client can be reused for multiple calls.
412
+ # client = Google::Cloud::Retail::V2::ModelService::Client.new
413
+ #
414
+ # # Create a request. To set request fields, pass in keyword arguments.
415
+ # request = Google::Cloud::Retail::V2::PauseModelRequest.new
416
+ #
417
+ # # Call the pause_model method.
418
+ # result = client.pause_model request
419
+ #
420
+ # # The returned object is of type Google::Cloud::Retail::V2::Model.
421
+ # p result
422
+ #
423
+ def pause_model request, options = nil
424
+ raise ::ArgumentError, "request must be provided" if request.nil?
425
+
426
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PauseModelRequest
427
+
428
+ # Converts hash and nil to an options object
429
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
430
+
431
+ # Customize the options with defaults
432
+ metadata = @config.rpcs.pause_model.metadata.to_h
433
+
434
+ # Set x-goog-api-client and x-goog-user-project headers
435
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
436
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
437
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
438
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
439
+
440
+ header_params = {}
441
+ if request.name
442
+ header_params["name"] = request.name
443
+ end
444
+
445
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
446
+ metadata[:"x-goog-request-params"] ||= request_params_header
447
+
448
+ options.apply_defaults timeout: @config.rpcs.pause_model.timeout,
449
+ metadata: metadata,
450
+ retry_policy: @config.rpcs.pause_model.retry_policy
451
+
452
+ options.apply_defaults timeout: @config.timeout,
453
+ metadata: @config.metadata,
454
+ retry_policy: @config.retry_policy
455
+
456
+ @model_service_stub.call_rpc :pause_model, request, options: options do |response, operation|
457
+ yield response, operation if block_given?
458
+ return response
459
+ end
460
+ rescue ::GRPC::BadStatus => e
461
+ raise ::Google::Cloud::Error.from_error(e)
462
+ end
463
+
464
+ ##
465
+ # Resumes the training of an existing model.
466
+ #
467
+ # @overload resume_model(request, options = nil)
468
+ # Pass arguments to `resume_model` via a request object, either of type
469
+ # {::Google::Cloud::Retail::V2::ResumeModelRequest} or an equivalent Hash.
470
+ #
471
+ # @param request [::Google::Cloud::Retail::V2::ResumeModelRequest, ::Hash]
472
+ # A request object representing the call parameters. Required. To specify no
473
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
474
+ # @param options [::Gapic::CallOptions, ::Hash]
475
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
476
+ #
477
+ # @overload resume_model(name: nil)
478
+ # Pass arguments to `resume_model` via keyword arguments. Note that at
479
+ # least one keyword argument is required. To specify no parameters, or to keep all
480
+ # the default parameter values, pass an empty Hash as a request object (see above).
481
+ #
482
+ # @param name [::String]
483
+ # Required. The name of the model to resume.
484
+ # Format:
485
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
486
+ #
487
+ # @yield [response, operation] Access the result along with the RPC operation
488
+ # @yieldparam response [::Google::Cloud::Retail::V2::Model]
489
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
490
+ #
491
+ # @return [::Google::Cloud::Retail::V2::Model]
492
+ #
493
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
494
+ #
495
+ # @example Basic example
496
+ # require "google/cloud/retail/v2"
497
+ #
498
+ # # Create a client object. The client can be reused for multiple calls.
499
+ # client = Google::Cloud::Retail::V2::ModelService::Client.new
500
+ #
501
+ # # Create a request. To set request fields, pass in keyword arguments.
502
+ # request = Google::Cloud::Retail::V2::ResumeModelRequest.new
503
+ #
504
+ # # Call the resume_model method.
505
+ # result = client.resume_model request
506
+ #
507
+ # # The returned object is of type Google::Cloud::Retail::V2::Model.
508
+ # p result
509
+ #
510
+ def resume_model request, options = nil
511
+ raise ::ArgumentError, "request must be provided" if request.nil?
512
+
513
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ResumeModelRequest
514
+
515
+ # Converts hash and nil to an options object
516
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
517
+
518
+ # Customize the options with defaults
519
+ metadata = @config.rpcs.resume_model.metadata.to_h
520
+
521
+ # Set x-goog-api-client and x-goog-user-project headers
522
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
523
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
524
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
525
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
526
+
527
+ header_params = {}
528
+ if request.name
529
+ header_params["name"] = request.name
530
+ end
531
+
532
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
533
+ metadata[:"x-goog-request-params"] ||= request_params_header
534
+
535
+ options.apply_defaults timeout: @config.rpcs.resume_model.timeout,
536
+ metadata: metadata,
537
+ retry_policy: @config.rpcs.resume_model.retry_policy
538
+
539
+ options.apply_defaults timeout: @config.timeout,
540
+ metadata: @config.metadata,
541
+ retry_policy: @config.retry_policy
542
+
543
+ @model_service_stub.call_rpc :resume_model, request, options: options do |response, operation|
544
+ yield response, operation if block_given?
545
+ return response
546
+ end
547
+ rescue ::GRPC::BadStatus => e
548
+ raise ::Google::Cloud::Error.from_error(e)
549
+ end
550
+
551
+ ##
552
+ # Deletes an existing model.
553
+ #
554
+ # @overload delete_model(request, options = nil)
555
+ # Pass arguments to `delete_model` via a request object, either of type
556
+ # {::Google::Cloud::Retail::V2::DeleteModelRequest} or an equivalent Hash.
557
+ #
558
+ # @param request [::Google::Cloud::Retail::V2::DeleteModelRequest, ::Hash]
559
+ # A request object representing the call parameters. Required. To specify no
560
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
561
+ # @param options [::Gapic::CallOptions, ::Hash]
562
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
563
+ #
564
+ # @overload delete_model(name: nil)
565
+ # Pass arguments to `delete_model` via keyword arguments. Note that at
566
+ # least one keyword argument is required. To specify no parameters, or to keep all
567
+ # the default parameter values, pass an empty Hash as a request object (see above).
568
+ #
569
+ # @param name [::String]
570
+ # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to
571
+ # delete. Format:
572
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
573
+ #
574
+ # @yield [response, operation] Access the result along with the RPC operation
575
+ # @yieldparam response [::Google::Protobuf::Empty]
576
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
577
+ #
578
+ # @return [::Google::Protobuf::Empty]
579
+ #
580
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
581
+ #
582
+ # @example Basic example
583
+ # require "google/cloud/retail/v2"
584
+ #
585
+ # # Create a client object. The client can be reused for multiple calls.
586
+ # client = Google::Cloud::Retail::V2::ModelService::Client.new
587
+ #
588
+ # # Create a request. To set request fields, pass in keyword arguments.
589
+ # request = Google::Cloud::Retail::V2::DeleteModelRequest.new
590
+ #
591
+ # # Call the delete_model method.
592
+ # result = client.delete_model request
593
+ #
594
+ # # The returned object is of type Google::Protobuf::Empty.
595
+ # p result
596
+ #
597
+ def delete_model request, options = nil
598
+ raise ::ArgumentError, "request must be provided" if request.nil?
599
+
600
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteModelRequest
601
+
602
+ # Converts hash and nil to an options object
603
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
604
+
605
+ # Customize the options with defaults
606
+ metadata = @config.rpcs.delete_model.metadata.to_h
607
+
608
+ # Set x-goog-api-client and x-goog-user-project headers
609
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
610
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
611
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
612
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
613
+
614
+ header_params = {}
615
+ if request.name
616
+ header_params["name"] = request.name
617
+ end
618
+
619
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
620
+ metadata[:"x-goog-request-params"] ||= request_params_header
621
+
622
+ options.apply_defaults timeout: @config.rpcs.delete_model.timeout,
623
+ metadata: metadata,
624
+ retry_policy: @config.rpcs.delete_model.retry_policy
625
+
626
+ options.apply_defaults timeout: @config.timeout,
627
+ metadata: @config.metadata,
628
+ retry_policy: @config.retry_policy
629
+
630
+ @model_service_stub.call_rpc :delete_model, request, options: options do |response, operation|
631
+ yield response, operation if block_given?
632
+ return response
633
+ end
634
+ rescue ::GRPC::BadStatus => e
635
+ raise ::Google::Cloud::Error.from_error(e)
636
+ end
637
+
638
+ ##
639
+ # Lists all the models linked to this event store.
640
+ #
641
+ # @overload list_models(request, options = nil)
642
+ # Pass arguments to `list_models` via a request object, either of type
643
+ # {::Google::Cloud::Retail::V2::ListModelsRequest} or an equivalent Hash.
644
+ #
645
+ # @param request [::Google::Cloud::Retail::V2::ListModelsRequest, ::Hash]
646
+ # A request object representing the call parameters. Required. To specify no
647
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
648
+ # @param options [::Gapic::CallOptions, ::Hash]
649
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
650
+ #
651
+ # @overload list_models(parent: nil, page_size: nil, page_token: nil)
652
+ # Pass arguments to `list_models` via keyword arguments. Note that at
653
+ # least one keyword argument is required. To specify no parameters, or to keep all
654
+ # the default parameter values, pass an empty Hash as a request object (see above).
655
+ #
656
+ # @param parent [::String]
657
+ # Required. The parent for which to list models.
658
+ # Format:
659
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
660
+ # @param page_size [::Integer]
661
+ # Optional. Maximum number of results to return. If unspecified, defaults
662
+ # to 50. Max allowed value is 1000.
663
+ # @param page_token [::String]
664
+ # Optional. A page token, received from a previous `ListModels`
665
+ # call. Provide this to retrieve the subsequent page.
666
+ #
667
+ # @yield [response, operation] Access the result along with the RPC operation
668
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Model>]
669
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
670
+ #
671
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Model>]
672
+ #
673
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
674
+ #
675
+ # @example Basic example
676
+ # require "google/cloud/retail/v2"
677
+ #
678
+ # # Create a client object. The client can be reused for multiple calls.
679
+ # client = Google::Cloud::Retail::V2::ModelService::Client.new
680
+ #
681
+ # # Create a request. To set request fields, pass in keyword arguments.
682
+ # request = Google::Cloud::Retail::V2::ListModelsRequest.new
683
+ #
684
+ # # Call the list_models method.
685
+ # result = client.list_models request
686
+ #
687
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
688
+ # # over elements, and API calls will be issued to fetch pages as needed.
689
+ # result.each do |item|
690
+ # # Each element is of type ::Google::Cloud::Retail::V2::Model.
691
+ # p item
692
+ # end
693
+ #
694
+ def list_models request, options = nil
695
+ raise ::ArgumentError, "request must be provided" if request.nil?
696
+
697
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListModelsRequest
698
+
699
+ # Converts hash and nil to an options object
700
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
701
+
702
+ # Customize the options with defaults
703
+ metadata = @config.rpcs.list_models.metadata.to_h
704
+
705
+ # Set x-goog-api-client and x-goog-user-project headers
706
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
707
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
708
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
709
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
710
+
711
+ header_params = {}
712
+ if request.parent
713
+ header_params["parent"] = request.parent
714
+ end
715
+
716
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
717
+ metadata[:"x-goog-request-params"] ||= request_params_header
718
+
719
+ options.apply_defaults timeout: @config.rpcs.list_models.timeout,
720
+ metadata: metadata,
721
+ retry_policy: @config.rpcs.list_models.retry_policy
722
+
723
+ options.apply_defaults timeout: @config.timeout,
724
+ metadata: @config.metadata,
725
+ retry_policy: @config.retry_policy
726
+
727
+ @model_service_stub.call_rpc :list_models, request, options: options do |response, operation|
728
+ response = ::Gapic::PagedEnumerable.new @model_service_stub, :list_models, request, response, operation, options
729
+ yield response, operation if block_given?
730
+ return response
731
+ end
732
+ rescue ::GRPC::BadStatus => e
733
+ raise ::Google::Cloud::Error.from_error(e)
734
+ end
735
+
736
+ ##
737
+ # Update of model metadata. Only fields that
738
+ # currently can be updated are: `filtering_option` and
739
+ # `periodic_tuning_state`.
740
+ # If other values are provided, this API method ignores them.
741
+ #
742
+ # @overload update_model(request, options = nil)
743
+ # Pass arguments to `update_model` via a request object, either of type
744
+ # {::Google::Cloud::Retail::V2::UpdateModelRequest} or an equivalent Hash.
745
+ #
746
+ # @param request [::Google::Cloud::Retail::V2::UpdateModelRequest, ::Hash]
747
+ # A request object representing the call parameters. Required. To specify no
748
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
749
+ # @param options [::Gapic::CallOptions, ::Hash]
750
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
751
+ #
752
+ # @overload update_model(model: nil, update_mask: nil)
753
+ # Pass arguments to `update_model` via keyword arguments. Note that at
754
+ # least one keyword argument is required. To specify no parameters, or to keep all
755
+ # the default parameter values, pass an empty Hash as a request object (see above).
756
+ #
757
+ # @param model [::Google::Cloud::Retail::V2::Model, ::Hash]
758
+ # Required. The body of the updated {::Google::Cloud::Retail::V2::Model Model}.
759
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
760
+ # Optional. Indicates which fields in the provided 'model' to
761
+ # update. If not set, by default updates all fields.
762
+ #
763
+ # @yield [response, operation] Access the result along with the RPC operation
764
+ # @yieldparam response [::Google::Cloud::Retail::V2::Model]
765
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
766
+ #
767
+ # @return [::Google::Cloud::Retail::V2::Model]
768
+ #
769
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
770
+ #
771
+ # @example Basic example
772
+ # require "google/cloud/retail/v2"
773
+ #
774
+ # # Create a client object. The client can be reused for multiple calls.
775
+ # client = Google::Cloud::Retail::V2::ModelService::Client.new
776
+ #
777
+ # # Create a request. To set request fields, pass in keyword arguments.
778
+ # request = Google::Cloud::Retail::V2::UpdateModelRequest.new
779
+ #
780
+ # # Call the update_model method.
781
+ # result = client.update_model request
782
+ #
783
+ # # The returned object is of type Google::Cloud::Retail::V2::Model.
784
+ # p result
785
+ #
786
+ def update_model request, options = nil
787
+ raise ::ArgumentError, "request must be provided" if request.nil?
788
+
789
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateModelRequest
790
+
791
+ # Converts hash and nil to an options object
792
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
793
+
794
+ # Customize the options with defaults
795
+ metadata = @config.rpcs.update_model.metadata.to_h
796
+
797
+ # Set x-goog-api-client and x-goog-user-project headers
798
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
799
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
800
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
801
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
802
+
803
+ header_params = {}
804
+ if request.model&.name
805
+ header_params["model.name"] = request.model.name
806
+ end
807
+
808
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
809
+ metadata[:"x-goog-request-params"] ||= request_params_header
810
+
811
+ options.apply_defaults timeout: @config.rpcs.update_model.timeout,
812
+ metadata: metadata,
813
+ retry_policy: @config.rpcs.update_model.retry_policy
814
+
815
+ options.apply_defaults timeout: @config.timeout,
816
+ metadata: @config.metadata,
817
+ retry_policy: @config.retry_policy
818
+
819
+ @model_service_stub.call_rpc :update_model, request, options: options do |response, operation|
820
+ yield response, operation if block_given?
821
+ return response
822
+ end
823
+ rescue ::GRPC::BadStatus => e
824
+ raise ::Google::Cloud::Error.from_error(e)
825
+ end
826
+
827
+ ##
828
+ # Tunes an existing model.
829
+ #
830
+ # @overload tune_model(request, options = nil)
831
+ # Pass arguments to `tune_model` via a request object, either of type
832
+ # {::Google::Cloud::Retail::V2::TuneModelRequest} or an equivalent Hash.
833
+ #
834
+ # @param request [::Google::Cloud::Retail::V2::TuneModelRequest, ::Hash]
835
+ # A request object representing the call parameters. Required. To specify no
836
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
837
+ # @param options [::Gapic::CallOptions, ::Hash]
838
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
839
+ #
840
+ # @overload tune_model(name: nil)
841
+ # Pass arguments to `tune_model` via keyword arguments. Note that at
842
+ # least one keyword argument is required. To specify no parameters, or to keep all
843
+ # the default parameter values, pass an empty Hash as a request object (see above).
844
+ #
845
+ # @param name [::String]
846
+ # Required. The resource name of the model to tune.
847
+ # Format:
848
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
849
+ #
850
+ # @yield [response, operation] Access the result along with the RPC operation
851
+ # @yieldparam response [::Gapic::Operation]
852
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
853
+ #
854
+ # @return [::Gapic::Operation]
855
+ #
856
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
857
+ #
858
+ # @example Basic example
859
+ # require "google/cloud/retail/v2"
860
+ #
861
+ # # Create a client object. The client can be reused for multiple calls.
862
+ # client = Google::Cloud::Retail::V2::ModelService::Client.new
863
+ #
864
+ # # Create a request. To set request fields, pass in keyword arguments.
865
+ # request = Google::Cloud::Retail::V2::TuneModelRequest.new
866
+ #
867
+ # # Call the tune_model method.
868
+ # result = client.tune_model request
869
+ #
870
+ # # The returned object is of type Gapic::Operation. You can use it to
871
+ # # check the status of an operation, cancel it, or wait for results.
872
+ # # Here is how to wait for a response.
873
+ # result.wait_until_done! timeout: 60
874
+ # if result.response?
875
+ # p result.response
876
+ # else
877
+ # puts "No response received."
878
+ # end
879
+ #
880
+ def tune_model request, options = nil
881
+ raise ::ArgumentError, "request must be provided" if request.nil?
882
+
883
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::TuneModelRequest
884
+
885
+ # Converts hash and nil to an options object
886
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
887
+
888
+ # Customize the options with defaults
889
+ metadata = @config.rpcs.tune_model.metadata.to_h
890
+
891
+ # Set x-goog-api-client and x-goog-user-project headers
892
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
893
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
894
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
895
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
896
+
897
+ header_params = {}
898
+ if request.name
899
+ header_params["name"] = request.name
900
+ end
901
+
902
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
903
+ metadata[:"x-goog-request-params"] ||= request_params_header
904
+
905
+ options.apply_defaults timeout: @config.rpcs.tune_model.timeout,
906
+ metadata: metadata,
907
+ retry_policy: @config.rpcs.tune_model.retry_policy
908
+
909
+ options.apply_defaults timeout: @config.timeout,
910
+ metadata: @config.metadata,
911
+ retry_policy: @config.retry_policy
912
+
913
+ @model_service_stub.call_rpc :tune_model, request, options: options do |response, operation|
914
+ response = ::Gapic::Operation.new response, @operations_client, options: options
915
+ yield response, operation if block_given?
916
+ return response
917
+ end
918
+ rescue ::GRPC::BadStatus => e
919
+ raise ::Google::Cloud::Error.from_error(e)
920
+ end
921
+
922
+ ##
923
+ # Configuration class for the ModelService API.
924
+ #
925
+ # This class represents the configuration for ModelService,
926
+ # providing control over timeouts, retry behavior, logging, transport
927
+ # parameters, and other low-level controls. Certain parameters can also be
928
+ # applied individually to specific RPCs. See
929
+ # {::Google::Cloud::Retail::V2::ModelService::Client::Configuration::Rpcs}
930
+ # for a list of RPCs that can be configured independently.
931
+ #
932
+ # Configuration can be applied globally to all clients, or to a single client
933
+ # on construction.
934
+ #
935
+ # @example
936
+ #
937
+ # # Modify the global config, setting the timeout for
938
+ # # create_model to 20 seconds,
939
+ # # and all remaining timeouts to 10 seconds.
940
+ # ::Google::Cloud::Retail::V2::ModelService::Client.configure do |config|
941
+ # config.timeout = 10.0
942
+ # config.rpcs.create_model.timeout = 20.0
943
+ # end
944
+ #
945
+ # # Apply the above configuration only to a new client.
946
+ # client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config|
947
+ # config.timeout = 10.0
948
+ # config.rpcs.create_model.timeout = 20.0
949
+ # end
950
+ #
951
+ # @!attribute [rw] endpoint
952
+ # The hostname or hostname:port of the service endpoint.
953
+ # Defaults to `"retail.googleapis.com"`.
954
+ # @return [::String]
955
+ # @!attribute [rw] credentials
956
+ # Credentials to send with calls. You may provide any of the following types:
957
+ # * (`String`) The path to a service account key file in JSON format
958
+ # * (`Hash`) A service account key as a Hash
959
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
960
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
961
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
962
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
963
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
964
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
965
+ # * (`nil`) indicating no credentials
966
+ # @return [::Object]
967
+ # @!attribute [rw] scope
968
+ # The OAuth scopes
969
+ # @return [::Array<::String>]
970
+ # @!attribute [rw] lib_name
971
+ # The library name as recorded in instrumentation and logging
972
+ # @return [::String]
973
+ # @!attribute [rw] lib_version
974
+ # The library version as recorded in instrumentation and logging
975
+ # @return [::String]
976
+ # @!attribute [rw] channel_args
977
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
978
+ # `GRPC::Core::Channel` object is provided as the credential.
979
+ # @return [::Hash]
980
+ # @!attribute [rw] interceptors
981
+ # An array of interceptors that are run before calls are executed.
982
+ # @return [::Array<::GRPC::ClientInterceptor>]
983
+ # @!attribute [rw] timeout
984
+ # The call timeout in seconds.
985
+ # @return [::Numeric]
986
+ # @!attribute [rw] metadata
987
+ # Additional gRPC headers to be sent with the call.
988
+ # @return [::Hash{::Symbol=>::String}]
989
+ # @!attribute [rw] retry_policy
990
+ # The retry policy. The value is a hash with the following keys:
991
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
992
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
993
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
994
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
995
+ # trigger a retry.
996
+ # @return [::Hash]
997
+ # @!attribute [rw] quota_project
998
+ # A separate project against which to charge quota.
999
+ # @return [::String]
1000
+ #
1001
+ class Configuration
1002
+ extend ::Gapic::Config
1003
+
1004
+ config_attr :endpoint, "retail.googleapis.com", ::String
1005
+ config_attr :credentials, nil do |value|
1006
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1007
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1008
+ allowed.any? { |klass| klass === value }
1009
+ end
1010
+ config_attr :scope, nil, ::String, ::Array, nil
1011
+ config_attr :lib_name, nil, ::String, nil
1012
+ config_attr :lib_version, nil, ::String, nil
1013
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1014
+ config_attr :interceptors, nil, ::Array, nil
1015
+ config_attr :timeout, nil, ::Numeric, nil
1016
+ config_attr :metadata, nil, ::Hash, nil
1017
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1018
+ config_attr :quota_project, nil, ::String, nil
1019
+
1020
+ # @private
1021
+ def initialize parent_config = nil
1022
+ @parent_config = parent_config unless parent_config.nil?
1023
+
1024
+ yield self if block_given?
1025
+ end
1026
+
1027
+ ##
1028
+ # Configurations for individual RPCs
1029
+ # @return [Rpcs]
1030
+ #
1031
+ def rpcs
1032
+ @rpcs ||= begin
1033
+ parent_rpcs = nil
1034
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1035
+ Rpcs.new parent_rpcs
1036
+ end
1037
+ end
1038
+
1039
+ ##
1040
+ # Configuration RPC class for the ModelService API.
1041
+ #
1042
+ # Includes fields providing the configuration for each RPC in this service.
1043
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1044
+ # the following configuration fields:
1045
+ #
1046
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1047
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1048
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1049
+ # include the following keys:
1050
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1051
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1052
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1053
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1054
+ # trigger a retry.
1055
+ #
1056
+ class Rpcs
1057
+ ##
1058
+ # RPC-specific configuration for `create_model`
1059
+ # @return [::Gapic::Config::Method]
1060
+ #
1061
+ attr_reader :create_model
1062
+ ##
1063
+ # RPC-specific configuration for `get_model`
1064
+ # @return [::Gapic::Config::Method]
1065
+ #
1066
+ attr_reader :get_model
1067
+ ##
1068
+ # RPC-specific configuration for `pause_model`
1069
+ # @return [::Gapic::Config::Method]
1070
+ #
1071
+ attr_reader :pause_model
1072
+ ##
1073
+ # RPC-specific configuration for `resume_model`
1074
+ # @return [::Gapic::Config::Method]
1075
+ #
1076
+ attr_reader :resume_model
1077
+ ##
1078
+ # RPC-specific configuration for `delete_model`
1079
+ # @return [::Gapic::Config::Method]
1080
+ #
1081
+ attr_reader :delete_model
1082
+ ##
1083
+ # RPC-specific configuration for `list_models`
1084
+ # @return [::Gapic::Config::Method]
1085
+ #
1086
+ attr_reader :list_models
1087
+ ##
1088
+ # RPC-specific configuration for `update_model`
1089
+ # @return [::Gapic::Config::Method]
1090
+ #
1091
+ attr_reader :update_model
1092
+ ##
1093
+ # RPC-specific configuration for `tune_model`
1094
+ # @return [::Gapic::Config::Method]
1095
+ #
1096
+ attr_reader :tune_model
1097
+
1098
+ # @private
1099
+ def initialize parent_rpcs = nil
1100
+ create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model
1101
+ @create_model = ::Gapic::Config::Method.new create_model_config
1102
+ get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model
1103
+ @get_model = ::Gapic::Config::Method.new get_model_config
1104
+ pause_model_config = parent_rpcs.pause_model if parent_rpcs.respond_to? :pause_model
1105
+ @pause_model = ::Gapic::Config::Method.new pause_model_config
1106
+ resume_model_config = parent_rpcs.resume_model if parent_rpcs.respond_to? :resume_model
1107
+ @resume_model = ::Gapic::Config::Method.new resume_model_config
1108
+ delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model
1109
+ @delete_model = ::Gapic::Config::Method.new delete_model_config
1110
+ list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models
1111
+ @list_models = ::Gapic::Config::Method.new list_models_config
1112
+ update_model_config = parent_rpcs.update_model if parent_rpcs.respond_to? :update_model
1113
+ @update_model = ::Gapic::Config::Method.new update_model_config
1114
+ tune_model_config = parent_rpcs.tune_model if parent_rpcs.respond_to? :tune_model
1115
+ @tune_model = ::Gapic::Config::Method.new tune_model_config
1116
+
1117
+ yield self if block_given?
1118
+ end
1119
+ end
1120
+ end
1121
+ end
1122
+ end
1123
+ end
1124
+ end
1125
+ end
1126
+ end