google-cloud-retail-v2 0.8.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/google/cloud/retail/v2/catalog_pb.rb +55 -0
- data/lib/google/cloud/retail/v2/catalog_service/client.rb +718 -0
- data/lib/google/cloud/retail/v2/catalog_service/paths.rb +38 -0
- data/lib/google/cloud/retail/v2/catalog_service_pb.rb +34 -0
- data/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +38 -0
- data/lib/google/cloud/retail/v2/common_pb.rb +86 -0
- data/lib/google/cloud/retail/v2/completion_service/client.rb +7 -3
- data/lib/google/cloud/retail/v2/completion_service/operations.rb +3 -0
- data/lib/google/cloud/retail/v2/control_pb.rb +33 -0
- data/lib/google/cloud/retail/v2/control_service/client.rb +807 -0
- data/lib/google/cloud/retail/v2/control_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/control_service/paths.rb +73 -0
- data/lib/google/cloud/retail/v2/control_service.rb +49 -0
- data/lib/google/cloud/retail/v2/control_service_pb.rb +57 -0
- data/lib/google/cloud/retail/v2/control_service_services_pb.rb +65 -0
- data/lib/google/cloud/retail/v2/prediction_service/client.rb +28 -13
- data/lib/google/cloud/retail/v2/product_pb.rb +1 -0
- data/lib/google/cloud/retail/v2/product_service/client.rb +87 -42
- data/lib/google/cloud/retail/v2/product_service/operations.rb +3 -0
- data/lib/google/cloud/retail/v2/product_service_services_pb.rb +67 -23
- data/lib/google/cloud/retail/v2/search_service/client.rb +15 -2
- data/lib/google/cloud/retail/v2/search_service_pb.rb +5 -0
- data/lib/google/cloud/retail/v2/serving_config_pb.rb +44 -0
- data/lib/google/cloud/retail/v2/serving_config_service/client.rb +998 -0
- data/lib/google/cloud/retail/v2/serving_config_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/serving_config_service/paths.rb +73 -0
- data/lib/google/cloud/retail/v2/serving_config_service.rb +49 -0
- data/lib/google/cloud/retail/v2/serving_config_service_pb.rb +66 -0
- data/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb +74 -0
- data/lib/google/cloud/retail/v2/user_event_service/client.rb +2 -2
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +3 -0
- data/lib/google/cloud/retail/v2/user_event_service_pb.rb +0 -1
- data/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +2 -2
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/lib/google/cloud/retail/v2.rb +2 -0
- data/proto_docs/google/cloud/retail/v2/catalog.rb +233 -0
- data/proto_docs/google/cloud/retail/v2/catalog_service.rb +133 -0
- data/proto_docs/google/cloud/retail/v2/common.rb +314 -4
- data/proto_docs/google/cloud/retail/v2/completion_service.rb +9 -4
- data/proto_docs/google/cloud/retail/v2/control.rb +76 -0
- data/proto_docs/google/cloud/retail/v2/control_service.rb +122 -0
- data/proto_docs/google/cloud/retail/v2/import_config.rb +20 -35
- data/proto_docs/google/cloud/retail/v2/prediction_service.rb +27 -12
- data/proto_docs/google/cloud/retail/v2/product.rb +7 -1
- data/proto_docs/google/cloud/retail/v2/product_service.rb +49 -21
- data/proto_docs/google/cloud/retail/v2/search_service.rb +72 -13
- data/proto_docs/google/cloud/retail/v2/serving_config.rb +238 -0
- data/proto_docs/google/cloud/retail/v2/serving_config_service.rb +143 -0
- data/proto_docs/google/protobuf/empty.rb +0 -2
- metadata +29 -11
@@ -0,0 +1,998 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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/serving_config_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Retail
|
25
|
+
module V2
|
26
|
+
module ServingConfigService
|
27
|
+
##
|
28
|
+
# Client for the ServingConfigService service.
|
29
|
+
#
|
30
|
+
# Service for modifying ServingConfig.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :serving_config_service_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the ServingConfigService Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
#
|
46
|
+
# # Modify the configuration for all ServingConfigService clients
|
47
|
+
# ::Google::Cloud::Retail::V2::ServingConfigService::Client.configure do |config|
|
48
|
+
# config.timeout = 10.0
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# @yield [config] Configure the Client client.
|
52
|
+
# @yieldparam config [Client::Configuration]
|
53
|
+
#
|
54
|
+
# @return [Client::Configuration]
|
55
|
+
#
|
56
|
+
def self.configure
|
57
|
+
@configure ||= begin
|
58
|
+
namespace = ["Google", "Cloud", "Retail", "V2"]
|
59
|
+
parent_config = while namespace.any?
|
60
|
+
parent_name = namespace.join "::"
|
61
|
+
parent_const = const_get parent_name
|
62
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
63
|
+
namespace.pop
|
64
|
+
end
|
65
|
+
default_config = Client::Configuration.new parent_config
|
66
|
+
|
67
|
+
default_config
|
68
|
+
end
|
69
|
+
yield @configure if block_given?
|
70
|
+
@configure
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Configure the ServingConfigService Client instance.
|
75
|
+
#
|
76
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
77
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
78
|
+
# should be made on {Client.configure}.
|
79
|
+
#
|
80
|
+
# See {::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration}
|
81
|
+
# for a description of the configuration fields.
|
82
|
+
#
|
83
|
+
# @yield [config] Configure the Client client.
|
84
|
+
# @yieldparam config [Client::Configuration]
|
85
|
+
#
|
86
|
+
# @return [Client::Configuration]
|
87
|
+
#
|
88
|
+
def configure
|
89
|
+
yield @config if block_given?
|
90
|
+
@config
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Create a new ServingConfigService client object.
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
#
|
98
|
+
# # Create a client using the default configuration
|
99
|
+
# client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new
|
100
|
+
#
|
101
|
+
# # Create a client using a custom configuration
|
102
|
+
# client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config|
|
103
|
+
# config.timeout = 10.0
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# @yield [config] Configure the ServingConfigService client.
|
107
|
+
# @yieldparam config [Client::Configuration]
|
108
|
+
#
|
109
|
+
def initialize
|
110
|
+
# These require statements are intentionally placed here to initialize
|
111
|
+
# the gRPC module only when it's required.
|
112
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
113
|
+
require "gapic/grpc"
|
114
|
+
require "google/cloud/retail/v2/serving_config_service_services_pb"
|
115
|
+
|
116
|
+
# Create the configuration object
|
117
|
+
@config = Configuration.new Client.configure
|
118
|
+
|
119
|
+
# Yield the configuration if needed
|
120
|
+
yield @config if block_given?
|
121
|
+
|
122
|
+
# Create credentials
|
123
|
+
credentials = @config.credentials
|
124
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
125
|
+
# but only if the default endpoint does not have a region prefix.
|
126
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
127
|
+
!@config.endpoint.split(".").first.include?("-")
|
128
|
+
credentials ||= Credentials.default scope: @config.scope,
|
129
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
130
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
131
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
132
|
+
end
|
133
|
+
@quota_project_id = @config.quota_project
|
134
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
135
|
+
|
136
|
+
@serving_config_service_stub = ::Gapic::ServiceStub.new(
|
137
|
+
::Google::Cloud::Retail::V2::ServingConfigService::Stub,
|
138
|
+
credentials: credentials,
|
139
|
+
endpoint: @config.endpoint,
|
140
|
+
channel_args: @config.channel_args,
|
141
|
+
interceptors: @config.interceptors
|
142
|
+
)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Service calls
|
146
|
+
|
147
|
+
##
|
148
|
+
# Creates a ServingConfig.
|
149
|
+
#
|
150
|
+
# A maximum of 100 {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}s are
|
151
|
+
# allowed in a {::Google::Cloud::Retail::V2::Catalog Catalog}, otherwise a
|
152
|
+
# FAILED_PRECONDITION error is returned.
|
153
|
+
#
|
154
|
+
# @overload create_serving_config(request, options = nil)
|
155
|
+
# Pass arguments to `create_serving_config` via a request object, either of type
|
156
|
+
# {::Google::Cloud::Retail::V2::CreateServingConfigRequest} or an equivalent Hash.
|
157
|
+
#
|
158
|
+
# @param request [::Google::Cloud::Retail::V2::CreateServingConfigRequest, ::Hash]
|
159
|
+
# A request object representing the call parameters. Required. To specify no
|
160
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
161
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
162
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
163
|
+
#
|
164
|
+
# @overload create_serving_config(parent: nil, serving_config: nil, serving_config_id: nil)
|
165
|
+
# Pass arguments to `create_serving_config` via keyword arguments. Note that at
|
166
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
167
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
168
|
+
#
|
169
|
+
# @param parent [::String]
|
170
|
+
# Required. Full resource name of parent. Format:
|
171
|
+
# `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
|
172
|
+
# @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash]
|
173
|
+
# Required. The ServingConfig to create.
|
174
|
+
# @param serving_config_id [::String]
|
175
|
+
# Required. The ID to use for the ServingConfig, which will become the final
|
176
|
+
# component of the ServingConfig's resource name.
|
177
|
+
#
|
178
|
+
# This value should be 4-63 characters, and valid characters
|
179
|
+
# are /[a-z][0-9]-_/.
|
180
|
+
#
|
181
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
182
|
+
# @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig]
|
183
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
184
|
+
#
|
185
|
+
# @return [::Google::Cloud::Retail::V2::ServingConfig]
|
186
|
+
#
|
187
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
188
|
+
#
|
189
|
+
# @example Basic example
|
190
|
+
# require "google/cloud/retail/v2"
|
191
|
+
#
|
192
|
+
# # Create a client object. The client can be reused for multiple calls.
|
193
|
+
# client = Google::Cloud::Retail::V2::ServingConfigService::Client.new
|
194
|
+
#
|
195
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
196
|
+
# request = Google::Cloud::Retail::V2::CreateServingConfigRequest.new
|
197
|
+
#
|
198
|
+
# # Call the create_serving_config method.
|
199
|
+
# result = client.create_serving_config request
|
200
|
+
#
|
201
|
+
# # The returned object is of type Google::Cloud::Retail::V2::ServingConfig.
|
202
|
+
# p result
|
203
|
+
#
|
204
|
+
def create_serving_config request, options = nil
|
205
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
206
|
+
|
207
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateServingConfigRequest
|
208
|
+
|
209
|
+
# Converts hash and nil to an options object
|
210
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
211
|
+
|
212
|
+
# Customize the options with defaults
|
213
|
+
metadata = @config.rpcs.create_serving_config.metadata.to_h
|
214
|
+
|
215
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
216
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
217
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
218
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
219
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
220
|
+
|
221
|
+
header_params = {}
|
222
|
+
if request.parent
|
223
|
+
header_params["parent"] = request.parent
|
224
|
+
end
|
225
|
+
|
226
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
227
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
228
|
+
|
229
|
+
options.apply_defaults timeout: @config.rpcs.create_serving_config.timeout,
|
230
|
+
metadata: metadata,
|
231
|
+
retry_policy: @config.rpcs.create_serving_config.retry_policy
|
232
|
+
|
233
|
+
options.apply_defaults timeout: @config.timeout,
|
234
|
+
metadata: @config.metadata,
|
235
|
+
retry_policy: @config.retry_policy
|
236
|
+
|
237
|
+
@serving_config_service_stub.call_rpc :create_serving_config, request, options: options do |response, operation|
|
238
|
+
yield response, operation if block_given?
|
239
|
+
return response
|
240
|
+
end
|
241
|
+
rescue ::GRPC::BadStatus => e
|
242
|
+
raise ::Google::Cloud::Error.from_error(e)
|
243
|
+
end
|
244
|
+
|
245
|
+
##
|
246
|
+
# Deletes a ServingConfig.
|
247
|
+
#
|
248
|
+
# Returns a NotFound error if the ServingConfig does not exist.
|
249
|
+
#
|
250
|
+
# @overload delete_serving_config(request, options = nil)
|
251
|
+
# Pass arguments to `delete_serving_config` via a request object, either of type
|
252
|
+
# {::Google::Cloud::Retail::V2::DeleteServingConfigRequest} or an equivalent Hash.
|
253
|
+
#
|
254
|
+
# @param request [::Google::Cloud::Retail::V2::DeleteServingConfigRequest, ::Hash]
|
255
|
+
# A request object representing the call parameters. Required. To specify no
|
256
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
257
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
258
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
259
|
+
#
|
260
|
+
# @overload delete_serving_config(name: nil)
|
261
|
+
# Pass arguments to `delete_serving_config` via keyword arguments. Note that at
|
262
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
263
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
264
|
+
#
|
265
|
+
# @param name [::String]
|
266
|
+
# Required. The resource name of the ServingConfig to delete. Format:
|
267
|
+
# projects/\\{project_number}/locations/\\{location_id}/catalogs/\\{catalog_id}/servingConfigs/\\{serving_config_id}
|
268
|
+
#
|
269
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
270
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
271
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
272
|
+
#
|
273
|
+
# @return [::Google::Protobuf::Empty]
|
274
|
+
#
|
275
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
276
|
+
#
|
277
|
+
# @example Basic example
|
278
|
+
# require "google/cloud/retail/v2"
|
279
|
+
#
|
280
|
+
# # Create a client object. The client can be reused for multiple calls.
|
281
|
+
# client = Google::Cloud::Retail::V2::ServingConfigService::Client.new
|
282
|
+
#
|
283
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
284
|
+
# request = Google::Cloud::Retail::V2::DeleteServingConfigRequest.new
|
285
|
+
#
|
286
|
+
# # Call the delete_serving_config method.
|
287
|
+
# result = client.delete_serving_config request
|
288
|
+
#
|
289
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
290
|
+
# p result
|
291
|
+
#
|
292
|
+
def delete_serving_config request, options = nil
|
293
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
294
|
+
|
295
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteServingConfigRequest
|
296
|
+
|
297
|
+
# Converts hash and nil to an options object
|
298
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
299
|
+
|
300
|
+
# Customize the options with defaults
|
301
|
+
metadata = @config.rpcs.delete_serving_config.metadata.to_h
|
302
|
+
|
303
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
304
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
305
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
306
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
307
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
308
|
+
|
309
|
+
header_params = {}
|
310
|
+
if request.name
|
311
|
+
header_params["name"] = request.name
|
312
|
+
end
|
313
|
+
|
314
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
315
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
316
|
+
|
317
|
+
options.apply_defaults timeout: @config.rpcs.delete_serving_config.timeout,
|
318
|
+
metadata: metadata,
|
319
|
+
retry_policy: @config.rpcs.delete_serving_config.retry_policy
|
320
|
+
|
321
|
+
options.apply_defaults timeout: @config.timeout,
|
322
|
+
metadata: @config.metadata,
|
323
|
+
retry_policy: @config.retry_policy
|
324
|
+
|
325
|
+
@serving_config_service_stub.call_rpc :delete_serving_config, request, options: options do |response, operation|
|
326
|
+
yield response, operation if block_given?
|
327
|
+
return response
|
328
|
+
end
|
329
|
+
rescue ::GRPC::BadStatus => e
|
330
|
+
raise ::Google::Cloud::Error.from_error(e)
|
331
|
+
end
|
332
|
+
|
333
|
+
##
|
334
|
+
# Updates a ServingConfig.
|
335
|
+
#
|
336
|
+
# @overload update_serving_config(request, options = nil)
|
337
|
+
# Pass arguments to `update_serving_config` via a request object, either of type
|
338
|
+
# {::Google::Cloud::Retail::V2::UpdateServingConfigRequest} or an equivalent Hash.
|
339
|
+
#
|
340
|
+
# @param request [::Google::Cloud::Retail::V2::UpdateServingConfigRequest, ::Hash]
|
341
|
+
# A request object representing the call parameters. Required. To specify no
|
342
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
343
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
344
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
345
|
+
#
|
346
|
+
# @overload update_serving_config(serving_config: nil, update_mask: nil)
|
347
|
+
# Pass arguments to `update_serving_config` via keyword arguments. Note that at
|
348
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
349
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
350
|
+
#
|
351
|
+
# @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash]
|
352
|
+
# Required. The ServingConfig to update.
|
353
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
354
|
+
# Indicates which fields in the provided
|
355
|
+
# {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} to update. The
|
356
|
+
# following are NOT supported:
|
357
|
+
#
|
358
|
+
# * {::Google::Cloud::Retail::V2::ServingConfig#name ServingConfig.name}
|
359
|
+
#
|
360
|
+
# If not set, all supported fields are updated.
|
361
|
+
#
|
362
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
363
|
+
# @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig]
|
364
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
365
|
+
#
|
366
|
+
# @return [::Google::Cloud::Retail::V2::ServingConfig]
|
367
|
+
#
|
368
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
369
|
+
#
|
370
|
+
# @example Basic example
|
371
|
+
# require "google/cloud/retail/v2"
|
372
|
+
#
|
373
|
+
# # Create a client object. The client can be reused for multiple calls.
|
374
|
+
# client = Google::Cloud::Retail::V2::ServingConfigService::Client.new
|
375
|
+
#
|
376
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
377
|
+
# request = Google::Cloud::Retail::V2::UpdateServingConfigRequest.new
|
378
|
+
#
|
379
|
+
# # Call the update_serving_config method.
|
380
|
+
# result = client.update_serving_config request
|
381
|
+
#
|
382
|
+
# # The returned object is of type Google::Cloud::Retail::V2::ServingConfig.
|
383
|
+
# p result
|
384
|
+
#
|
385
|
+
def update_serving_config request, options = nil
|
386
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
387
|
+
|
388
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateServingConfigRequest
|
389
|
+
|
390
|
+
# Converts hash and nil to an options object
|
391
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
392
|
+
|
393
|
+
# Customize the options with defaults
|
394
|
+
metadata = @config.rpcs.update_serving_config.metadata.to_h
|
395
|
+
|
396
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
397
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
398
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
399
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
400
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
401
|
+
|
402
|
+
header_params = {}
|
403
|
+
if request.serving_config&.name
|
404
|
+
header_params["serving_config.name"] = request.serving_config.name
|
405
|
+
end
|
406
|
+
|
407
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
408
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
409
|
+
|
410
|
+
options.apply_defaults timeout: @config.rpcs.update_serving_config.timeout,
|
411
|
+
metadata: metadata,
|
412
|
+
retry_policy: @config.rpcs.update_serving_config.retry_policy
|
413
|
+
|
414
|
+
options.apply_defaults timeout: @config.timeout,
|
415
|
+
metadata: @config.metadata,
|
416
|
+
retry_policy: @config.retry_policy
|
417
|
+
|
418
|
+
@serving_config_service_stub.call_rpc :update_serving_config, request, options: options do |response, operation|
|
419
|
+
yield response, operation if block_given?
|
420
|
+
return response
|
421
|
+
end
|
422
|
+
rescue ::GRPC::BadStatus => e
|
423
|
+
raise ::Google::Cloud::Error.from_error(e)
|
424
|
+
end
|
425
|
+
|
426
|
+
##
|
427
|
+
# Gets a ServingConfig.
|
428
|
+
#
|
429
|
+
# Returns a NotFound error if the ServingConfig does not exist.
|
430
|
+
#
|
431
|
+
# @overload get_serving_config(request, options = nil)
|
432
|
+
# Pass arguments to `get_serving_config` via a request object, either of type
|
433
|
+
# {::Google::Cloud::Retail::V2::GetServingConfigRequest} or an equivalent Hash.
|
434
|
+
#
|
435
|
+
# @param request [::Google::Cloud::Retail::V2::GetServingConfigRequest, ::Hash]
|
436
|
+
# A request object representing the call parameters. Required. To specify no
|
437
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
438
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
439
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
440
|
+
#
|
441
|
+
# @overload get_serving_config(name: nil)
|
442
|
+
# Pass arguments to `get_serving_config` via keyword arguments. Note that at
|
443
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
444
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
445
|
+
#
|
446
|
+
# @param name [::String]
|
447
|
+
# Required. The resource name of the ServingConfig to get. Format:
|
448
|
+
# projects/\\{project_number}/locations/\\{location_id}/catalogs/\\{catalog_id}/servingConfigs/\\{serving_config_id}
|
449
|
+
#
|
450
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
451
|
+
# @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig]
|
452
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
453
|
+
#
|
454
|
+
# @return [::Google::Cloud::Retail::V2::ServingConfig]
|
455
|
+
#
|
456
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
457
|
+
#
|
458
|
+
# @example Basic example
|
459
|
+
# require "google/cloud/retail/v2"
|
460
|
+
#
|
461
|
+
# # Create a client object. The client can be reused for multiple calls.
|
462
|
+
# client = Google::Cloud::Retail::V2::ServingConfigService::Client.new
|
463
|
+
#
|
464
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
465
|
+
# request = Google::Cloud::Retail::V2::GetServingConfigRequest.new
|
466
|
+
#
|
467
|
+
# # Call the get_serving_config method.
|
468
|
+
# result = client.get_serving_config request
|
469
|
+
#
|
470
|
+
# # The returned object is of type Google::Cloud::Retail::V2::ServingConfig.
|
471
|
+
# p result
|
472
|
+
#
|
473
|
+
def get_serving_config request, options = nil
|
474
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
475
|
+
|
476
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetServingConfigRequest
|
477
|
+
|
478
|
+
# Converts hash and nil to an options object
|
479
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
480
|
+
|
481
|
+
# Customize the options with defaults
|
482
|
+
metadata = @config.rpcs.get_serving_config.metadata.to_h
|
483
|
+
|
484
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
485
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
486
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
487
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
488
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
489
|
+
|
490
|
+
header_params = {}
|
491
|
+
if request.name
|
492
|
+
header_params["name"] = request.name
|
493
|
+
end
|
494
|
+
|
495
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
496
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
497
|
+
|
498
|
+
options.apply_defaults timeout: @config.rpcs.get_serving_config.timeout,
|
499
|
+
metadata: metadata,
|
500
|
+
retry_policy: @config.rpcs.get_serving_config.retry_policy
|
501
|
+
|
502
|
+
options.apply_defaults timeout: @config.timeout,
|
503
|
+
metadata: @config.metadata,
|
504
|
+
retry_policy: @config.retry_policy
|
505
|
+
|
506
|
+
@serving_config_service_stub.call_rpc :get_serving_config, request, options: options do |response, operation|
|
507
|
+
yield response, operation if block_given?
|
508
|
+
return response
|
509
|
+
end
|
510
|
+
rescue ::GRPC::BadStatus => e
|
511
|
+
raise ::Google::Cloud::Error.from_error(e)
|
512
|
+
end
|
513
|
+
|
514
|
+
##
|
515
|
+
# Lists all ServingConfigs linked to this catalog.
|
516
|
+
#
|
517
|
+
# @overload list_serving_configs(request, options = nil)
|
518
|
+
# Pass arguments to `list_serving_configs` via a request object, either of type
|
519
|
+
# {::Google::Cloud::Retail::V2::ListServingConfigsRequest} or an equivalent Hash.
|
520
|
+
#
|
521
|
+
# @param request [::Google::Cloud::Retail::V2::ListServingConfigsRequest, ::Hash]
|
522
|
+
# A request object representing the call parameters. Required. To specify no
|
523
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
524
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
525
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
526
|
+
#
|
527
|
+
# @overload list_serving_configs(parent: nil, page_size: nil, page_token: nil)
|
528
|
+
# Pass arguments to `list_serving_configs` via keyword arguments. Note that at
|
529
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
530
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
531
|
+
#
|
532
|
+
# @param parent [::String]
|
533
|
+
# Required. The catalog resource name. Format:
|
534
|
+
# projects/\\{project_number}/locations/\\{location_id}/catalogs/\\{catalog_id}
|
535
|
+
# @param page_size [::Integer]
|
536
|
+
# Optional. Maximum number of results to return. If unspecified, defaults
|
537
|
+
# to 100. If a value greater than 100 is provided, at most 100 results are
|
538
|
+
# returned.
|
539
|
+
# @param page_token [::String]
|
540
|
+
# Optional. A page token, received from a previous `ListServingConfigs` call.
|
541
|
+
# Provide this to retrieve the subsequent page.
|
542
|
+
#
|
543
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
544
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>]
|
545
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
546
|
+
#
|
547
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>]
|
548
|
+
#
|
549
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
550
|
+
#
|
551
|
+
# @example Basic example
|
552
|
+
# require "google/cloud/retail/v2"
|
553
|
+
#
|
554
|
+
# # Create a client object. The client can be reused for multiple calls.
|
555
|
+
# client = Google::Cloud::Retail::V2::ServingConfigService::Client.new
|
556
|
+
#
|
557
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
558
|
+
# request = Google::Cloud::Retail::V2::ListServingConfigsRequest.new
|
559
|
+
#
|
560
|
+
# # Call the list_serving_configs method.
|
561
|
+
# result = client.list_serving_configs request
|
562
|
+
#
|
563
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
564
|
+
# # iterate over all elements by calling #each, and the enumerable
|
565
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
566
|
+
# # methods are also available for managing paging directly.
|
567
|
+
# result.each do |response|
|
568
|
+
# # Each element is of type ::Google::Cloud::Retail::V2::ServingConfig.
|
569
|
+
# p response
|
570
|
+
# end
|
571
|
+
#
|
572
|
+
def list_serving_configs request, options = nil
|
573
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
574
|
+
|
575
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListServingConfigsRequest
|
576
|
+
|
577
|
+
# Converts hash and nil to an options object
|
578
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
579
|
+
|
580
|
+
# Customize the options with defaults
|
581
|
+
metadata = @config.rpcs.list_serving_configs.metadata.to_h
|
582
|
+
|
583
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
584
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
585
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
586
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
587
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
588
|
+
|
589
|
+
header_params = {}
|
590
|
+
if request.parent
|
591
|
+
header_params["parent"] = request.parent
|
592
|
+
end
|
593
|
+
|
594
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
595
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
596
|
+
|
597
|
+
options.apply_defaults timeout: @config.rpcs.list_serving_configs.timeout,
|
598
|
+
metadata: metadata,
|
599
|
+
retry_policy: @config.rpcs.list_serving_configs.retry_policy
|
600
|
+
|
601
|
+
options.apply_defaults timeout: @config.timeout,
|
602
|
+
metadata: @config.metadata,
|
603
|
+
retry_policy: @config.retry_policy
|
604
|
+
|
605
|
+
@serving_config_service_stub.call_rpc :list_serving_configs, request, options: options do |response, operation|
|
606
|
+
response = ::Gapic::PagedEnumerable.new @serving_config_service_stub, :list_serving_configs, request, response, operation, options
|
607
|
+
yield response, operation if block_given?
|
608
|
+
return response
|
609
|
+
end
|
610
|
+
rescue ::GRPC::BadStatus => e
|
611
|
+
raise ::Google::Cloud::Error.from_error(e)
|
612
|
+
end
|
613
|
+
|
614
|
+
##
|
615
|
+
# Enables a Control on the specified ServingConfig.
|
616
|
+
# The control is added in the last position of the list of controls
|
617
|
+
# it belongs to (e.g. if it's a facet spec control it will be applied
|
618
|
+
# in the last position of servingConfig.facetSpecIds)
|
619
|
+
# Returns a ALREADY_EXISTS error if the control has already been applied.
|
620
|
+
# Returns a FAILED_PRECONDITION error if the addition could exceed maximum
|
621
|
+
# number of control allowed for that type of control.
|
622
|
+
#
|
623
|
+
# @overload add_control(request, options = nil)
|
624
|
+
# Pass arguments to `add_control` via a request object, either of type
|
625
|
+
# {::Google::Cloud::Retail::V2::AddControlRequest} or an equivalent Hash.
|
626
|
+
#
|
627
|
+
# @param request [::Google::Cloud::Retail::V2::AddControlRequest, ::Hash]
|
628
|
+
# A request object representing the call parameters. Required. To specify no
|
629
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
630
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
631
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
632
|
+
#
|
633
|
+
# @overload add_control(serving_config: nil, control_id: nil)
|
634
|
+
# Pass arguments to `add_control` via keyword arguments. Note that at
|
635
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
636
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
637
|
+
#
|
638
|
+
# @param serving_config [::String]
|
639
|
+
# Required. The source ServingConfig resource name . Format:
|
640
|
+
# projects/\\{project_number}/locations/\\{location_id}/catalogs/\\{catalog_id}/servingConfigs/\\{serving_config_id}
|
641
|
+
# @param control_id [::String]
|
642
|
+
# Required. The id of the control to apply. Assumed to be in the same catalog
|
643
|
+
# as the serving config - if id is not found a NOT_FOUND error is returned.
|
644
|
+
#
|
645
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
646
|
+
# @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig]
|
647
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
648
|
+
#
|
649
|
+
# @return [::Google::Cloud::Retail::V2::ServingConfig]
|
650
|
+
#
|
651
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
652
|
+
#
|
653
|
+
# @example Basic example
|
654
|
+
# require "google/cloud/retail/v2"
|
655
|
+
#
|
656
|
+
# # Create a client object. The client can be reused for multiple calls.
|
657
|
+
# client = Google::Cloud::Retail::V2::ServingConfigService::Client.new
|
658
|
+
#
|
659
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
660
|
+
# request = Google::Cloud::Retail::V2::AddControlRequest.new
|
661
|
+
#
|
662
|
+
# # Call the add_control method.
|
663
|
+
# result = client.add_control request
|
664
|
+
#
|
665
|
+
# # The returned object is of type Google::Cloud::Retail::V2::ServingConfig.
|
666
|
+
# p result
|
667
|
+
#
|
668
|
+
def add_control request, options = nil
|
669
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
670
|
+
|
671
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddControlRequest
|
672
|
+
|
673
|
+
# Converts hash and nil to an options object
|
674
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
675
|
+
|
676
|
+
# Customize the options with defaults
|
677
|
+
metadata = @config.rpcs.add_control.metadata.to_h
|
678
|
+
|
679
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
680
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
681
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
682
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
683
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
684
|
+
|
685
|
+
header_params = {}
|
686
|
+
if request.serving_config
|
687
|
+
header_params["serving_config"] = request.serving_config
|
688
|
+
end
|
689
|
+
|
690
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
691
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
692
|
+
|
693
|
+
options.apply_defaults timeout: @config.rpcs.add_control.timeout,
|
694
|
+
metadata: metadata,
|
695
|
+
retry_policy: @config.rpcs.add_control.retry_policy
|
696
|
+
|
697
|
+
options.apply_defaults timeout: @config.timeout,
|
698
|
+
metadata: @config.metadata,
|
699
|
+
retry_policy: @config.retry_policy
|
700
|
+
|
701
|
+
@serving_config_service_stub.call_rpc :add_control, request, options: options do |response, operation|
|
702
|
+
yield response, operation if block_given?
|
703
|
+
return response
|
704
|
+
end
|
705
|
+
rescue ::GRPC::BadStatus => e
|
706
|
+
raise ::Google::Cloud::Error.from_error(e)
|
707
|
+
end
|
708
|
+
|
709
|
+
##
|
710
|
+
# Disables a Control on the specified ServingConfig.
|
711
|
+
# The control is removed from the ServingConfig.
|
712
|
+
# Returns a NOT_FOUND error if the Control is not enabled for the
|
713
|
+
# ServingConfig.
|
714
|
+
#
|
715
|
+
# @overload remove_control(request, options = nil)
|
716
|
+
# Pass arguments to `remove_control` via a request object, either of type
|
717
|
+
# {::Google::Cloud::Retail::V2::RemoveControlRequest} or an equivalent Hash.
|
718
|
+
#
|
719
|
+
# @param request [::Google::Cloud::Retail::V2::RemoveControlRequest, ::Hash]
|
720
|
+
# A request object representing the call parameters. Required. To specify no
|
721
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
722
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
723
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
724
|
+
#
|
725
|
+
# @overload remove_control(serving_config: nil, control_id: nil)
|
726
|
+
# Pass arguments to `remove_control` via keyword arguments. Note that at
|
727
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
728
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
729
|
+
#
|
730
|
+
# @param serving_config [::String]
|
731
|
+
# Required. The source ServingConfig resource name . Format:
|
732
|
+
# projects/\\{project_number}/locations/\\{location_id}/catalogs/\\{catalog_id}/servingConfigs/\\{serving_config_id}
|
733
|
+
# @param control_id [::String]
|
734
|
+
# Required. The id of the control to apply. Assumed to be in the same catalog
|
735
|
+
# as the serving config.
|
736
|
+
#
|
737
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
738
|
+
# @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig]
|
739
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
740
|
+
#
|
741
|
+
# @return [::Google::Cloud::Retail::V2::ServingConfig]
|
742
|
+
#
|
743
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
744
|
+
#
|
745
|
+
# @example Basic example
|
746
|
+
# require "google/cloud/retail/v2"
|
747
|
+
#
|
748
|
+
# # Create a client object. The client can be reused for multiple calls.
|
749
|
+
# client = Google::Cloud::Retail::V2::ServingConfigService::Client.new
|
750
|
+
#
|
751
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
752
|
+
# request = Google::Cloud::Retail::V2::RemoveControlRequest.new
|
753
|
+
#
|
754
|
+
# # Call the remove_control method.
|
755
|
+
# result = client.remove_control request
|
756
|
+
#
|
757
|
+
# # The returned object is of type Google::Cloud::Retail::V2::ServingConfig.
|
758
|
+
# p result
|
759
|
+
#
|
760
|
+
def remove_control request, options = nil
|
761
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
762
|
+
|
763
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveControlRequest
|
764
|
+
|
765
|
+
# Converts hash and nil to an options object
|
766
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
767
|
+
|
768
|
+
# Customize the options with defaults
|
769
|
+
metadata = @config.rpcs.remove_control.metadata.to_h
|
770
|
+
|
771
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
772
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
773
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
774
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
775
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
776
|
+
|
777
|
+
header_params = {}
|
778
|
+
if request.serving_config
|
779
|
+
header_params["serving_config"] = request.serving_config
|
780
|
+
end
|
781
|
+
|
782
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
783
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
784
|
+
|
785
|
+
options.apply_defaults timeout: @config.rpcs.remove_control.timeout,
|
786
|
+
metadata: metadata,
|
787
|
+
retry_policy: @config.rpcs.remove_control.retry_policy
|
788
|
+
|
789
|
+
options.apply_defaults timeout: @config.timeout,
|
790
|
+
metadata: @config.metadata,
|
791
|
+
retry_policy: @config.retry_policy
|
792
|
+
|
793
|
+
@serving_config_service_stub.call_rpc :remove_control, request, options: options do |response, operation|
|
794
|
+
yield response, operation if block_given?
|
795
|
+
return response
|
796
|
+
end
|
797
|
+
rescue ::GRPC::BadStatus => e
|
798
|
+
raise ::Google::Cloud::Error.from_error(e)
|
799
|
+
end
|
800
|
+
|
801
|
+
##
|
802
|
+
# Configuration class for the ServingConfigService API.
|
803
|
+
#
|
804
|
+
# This class represents the configuration for ServingConfigService,
|
805
|
+
# providing control over timeouts, retry behavior, logging, transport
|
806
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
807
|
+
# applied individually to specific RPCs. See
|
808
|
+
# {::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration::Rpcs}
|
809
|
+
# for a list of RPCs that can be configured independently.
|
810
|
+
#
|
811
|
+
# Configuration can be applied globally to all clients, or to a single client
|
812
|
+
# on construction.
|
813
|
+
#
|
814
|
+
# @example
|
815
|
+
#
|
816
|
+
# # Modify the global config, setting the timeout for
|
817
|
+
# # create_serving_config to 20 seconds,
|
818
|
+
# # and all remaining timeouts to 10 seconds.
|
819
|
+
# ::Google::Cloud::Retail::V2::ServingConfigService::Client.configure do |config|
|
820
|
+
# config.timeout = 10.0
|
821
|
+
# config.rpcs.create_serving_config.timeout = 20.0
|
822
|
+
# end
|
823
|
+
#
|
824
|
+
# # Apply the above configuration only to a new client.
|
825
|
+
# client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config|
|
826
|
+
# config.timeout = 10.0
|
827
|
+
# config.rpcs.create_serving_config.timeout = 20.0
|
828
|
+
# end
|
829
|
+
#
|
830
|
+
# @!attribute [rw] endpoint
|
831
|
+
# The hostname or hostname:port of the service endpoint.
|
832
|
+
# Defaults to `"retail.googleapis.com"`.
|
833
|
+
# @return [::String]
|
834
|
+
# @!attribute [rw] credentials
|
835
|
+
# Credentials to send with calls. You may provide any of the following types:
|
836
|
+
# * (`String`) The path to a service account key file in JSON format
|
837
|
+
# * (`Hash`) A service account key as a Hash
|
838
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
839
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
840
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
841
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
842
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
843
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
844
|
+
# * (`nil`) indicating no credentials
|
845
|
+
# @return [::Object]
|
846
|
+
# @!attribute [rw] scope
|
847
|
+
# The OAuth scopes
|
848
|
+
# @return [::Array<::String>]
|
849
|
+
# @!attribute [rw] lib_name
|
850
|
+
# The library name as recorded in instrumentation and logging
|
851
|
+
# @return [::String]
|
852
|
+
# @!attribute [rw] lib_version
|
853
|
+
# The library version as recorded in instrumentation and logging
|
854
|
+
# @return [::String]
|
855
|
+
# @!attribute [rw] channel_args
|
856
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
857
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
858
|
+
# @return [::Hash]
|
859
|
+
# @!attribute [rw] interceptors
|
860
|
+
# An array of interceptors that are run before calls are executed.
|
861
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
862
|
+
# @!attribute [rw] timeout
|
863
|
+
# The call timeout in seconds.
|
864
|
+
# @return [::Numeric]
|
865
|
+
# @!attribute [rw] metadata
|
866
|
+
# Additional gRPC headers to be sent with the call.
|
867
|
+
# @return [::Hash{::Symbol=>::String}]
|
868
|
+
# @!attribute [rw] retry_policy
|
869
|
+
# The retry policy. The value is a hash with the following keys:
|
870
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
871
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
872
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
873
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
874
|
+
# trigger a retry.
|
875
|
+
# @return [::Hash]
|
876
|
+
# @!attribute [rw] quota_project
|
877
|
+
# A separate project against which to charge quota.
|
878
|
+
# @return [::String]
|
879
|
+
#
|
880
|
+
class Configuration
|
881
|
+
extend ::Gapic::Config
|
882
|
+
|
883
|
+
config_attr :endpoint, "retail.googleapis.com", ::String
|
884
|
+
config_attr :credentials, nil do |value|
|
885
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
886
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
887
|
+
allowed.any? { |klass| klass === value }
|
888
|
+
end
|
889
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
890
|
+
config_attr :lib_name, nil, ::String, nil
|
891
|
+
config_attr :lib_version, nil, ::String, nil
|
892
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
893
|
+
config_attr :interceptors, nil, ::Array, nil
|
894
|
+
config_attr :timeout, nil, ::Numeric, nil
|
895
|
+
config_attr :metadata, nil, ::Hash, nil
|
896
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
897
|
+
config_attr :quota_project, nil, ::String, nil
|
898
|
+
|
899
|
+
# @private
|
900
|
+
def initialize parent_config = nil
|
901
|
+
@parent_config = parent_config unless parent_config.nil?
|
902
|
+
|
903
|
+
yield self if block_given?
|
904
|
+
end
|
905
|
+
|
906
|
+
##
|
907
|
+
# Configurations for individual RPCs
|
908
|
+
# @return [Rpcs]
|
909
|
+
#
|
910
|
+
def rpcs
|
911
|
+
@rpcs ||= begin
|
912
|
+
parent_rpcs = nil
|
913
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
914
|
+
Rpcs.new parent_rpcs
|
915
|
+
end
|
916
|
+
end
|
917
|
+
|
918
|
+
##
|
919
|
+
# Configuration RPC class for the ServingConfigService API.
|
920
|
+
#
|
921
|
+
# Includes fields providing the configuration for each RPC in this service.
|
922
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
923
|
+
# the following configuration fields:
|
924
|
+
#
|
925
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
926
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
927
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
928
|
+
# include the following keys:
|
929
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
930
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
931
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
932
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
933
|
+
# trigger a retry.
|
934
|
+
#
|
935
|
+
class Rpcs
|
936
|
+
##
|
937
|
+
# RPC-specific configuration for `create_serving_config`
|
938
|
+
# @return [::Gapic::Config::Method]
|
939
|
+
#
|
940
|
+
attr_reader :create_serving_config
|
941
|
+
##
|
942
|
+
# RPC-specific configuration for `delete_serving_config`
|
943
|
+
# @return [::Gapic::Config::Method]
|
944
|
+
#
|
945
|
+
attr_reader :delete_serving_config
|
946
|
+
##
|
947
|
+
# RPC-specific configuration for `update_serving_config`
|
948
|
+
# @return [::Gapic::Config::Method]
|
949
|
+
#
|
950
|
+
attr_reader :update_serving_config
|
951
|
+
##
|
952
|
+
# RPC-specific configuration for `get_serving_config`
|
953
|
+
# @return [::Gapic::Config::Method]
|
954
|
+
#
|
955
|
+
attr_reader :get_serving_config
|
956
|
+
##
|
957
|
+
# RPC-specific configuration for `list_serving_configs`
|
958
|
+
# @return [::Gapic::Config::Method]
|
959
|
+
#
|
960
|
+
attr_reader :list_serving_configs
|
961
|
+
##
|
962
|
+
# RPC-specific configuration for `add_control`
|
963
|
+
# @return [::Gapic::Config::Method]
|
964
|
+
#
|
965
|
+
attr_reader :add_control
|
966
|
+
##
|
967
|
+
# RPC-specific configuration for `remove_control`
|
968
|
+
# @return [::Gapic::Config::Method]
|
969
|
+
#
|
970
|
+
attr_reader :remove_control
|
971
|
+
|
972
|
+
# @private
|
973
|
+
def initialize parent_rpcs = nil
|
974
|
+
create_serving_config_config = parent_rpcs.create_serving_config if parent_rpcs.respond_to? :create_serving_config
|
975
|
+
@create_serving_config = ::Gapic::Config::Method.new create_serving_config_config
|
976
|
+
delete_serving_config_config = parent_rpcs.delete_serving_config if parent_rpcs.respond_to? :delete_serving_config
|
977
|
+
@delete_serving_config = ::Gapic::Config::Method.new delete_serving_config_config
|
978
|
+
update_serving_config_config = parent_rpcs.update_serving_config if parent_rpcs.respond_to? :update_serving_config
|
979
|
+
@update_serving_config = ::Gapic::Config::Method.new update_serving_config_config
|
980
|
+
get_serving_config_config = parent_rpcs.get_serving_config if parent_rpcs.respond_to? :get_serving_config
|
981
|
+
@get_serving_config = ::Gapic::Config::Method.new get_serving_config_config
|
982
|
+
list_serving_configs_config = parent_rpcs.list_serving_configs if parent_rpcs.respond_to? :list_serving_configs
|
983
|
+
@list_serving_configs = ::Gapic::Config::Method.new list_serving_configs_config
|
984
|
+
add_control_config = parent_rpcs.add_control if parent_rpcs.respond_to? :add_control
|
985
|
+
@add_control = ::Gapic::Config::Method.new add_control_config
|
986
|
+
remove_control_config = parent_rpcs.remove_control if parent_rpcs.respond_to? :remove_control
|
987
|
+
@remove_control = ::Gapic::Config::Method.new remove_control_config
|
988
|
+
|
989
|
+
yield self if block_given?
|
990
|
+
end
|
991
|
+
end
|
992
|
+
end
|
993
|
+
end
|
994
|
+
end
|
995
|
+
end
|
996
|
+
end
|
997
|
+
end
|
998
|
+
end
|