google-cloud-discovery_engine-v1 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +186 -4
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +181 -4
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +72 -0
- data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +8 -2
- data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +8 -2
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/client.rb +1 -3
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/client.rb +1 -3
- data/lib/google/cloud/discovery_engine/v1/rank_service/client.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1/rank_service/rest/client.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1/recommendation_service/client.rb +3 -3
- data/lib/google/cloud/discovery_engine/v1/recommendation_service/rest/client.rb +3 -3
- data/lib/google/cloud/discovery_engine/v1/rest.rb +1 -0
- data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +44 -12
- data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +44 -12
- data/lib/google/cloud/discovery_engine/v1/serving_config_service/client.rb +484 -0
- data/lib/google/cloud/discovery_engine/v1/serving_config_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/serving_config_service/paths.rb +101 -0
- data/lib/google/cloud/discovery_engine/v1/serving_config_service/rest/client.rb +451 -0
- data/lib/google/cloud/discovery_engine/v1/serving_config_service/rest/service_stub.rb +159 -0
- data/lib/google/cloud/discovery_engine/v1/serving_config_service/rest.rb +53 -0
- data/lib/google/cloud/discovery_engine/v1/serving_config_service.rb +56 -0
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/client.rb +316 -3
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/paths.rb +49 -0
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/client.rb +295 -3
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/service_stub.rb +206 -0
- data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +21 -9
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +21 -9
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +8 -0
- data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1.rb +1 -0
- data/lib/google/cloud/discoveryengine/v1/answer_pb.rb +4 -1
- data/lib/google/cloud/discoveryengine/v1/common_pb.rb +4 -1
- data/lib/google/cloud/discoveryengine/v1/control_pb.rb +7 -1
- data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +12 -1
- data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +8 -0
- data/lib/google/cloud/discoveryengine/v1/data_store_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1/document_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/engine_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_pb.rb +6 -1
- data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/safety_pb.rb +47 -0
- data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +5 -1
- data/lib/google/cloud/discoveryengine/v1/serving_config_pb.rb +52 -0
- data/lib/google/cloud/discoveryengine/v1/serving_config_service_pb.rb +51 -0
- data/lib/google/cloud/discoveryengine/v1/serving_config_service_services_pb.rb +48 -0
- data/lib/google/cloud/discoveryengine/v1/session_pb.rb +3 -1
- data/lib/google/cloud/discoveryengine/v1/site_search_engine_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1/site_search_engine_service_pb.rb +10 -1
- data/lib/google/cloud/discoveryengine/v1/site_search_engine_service_services_pb.rb +7 -0
- data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +1 -1
- data/proto_docs/google/api/client.rb +6 -0
- data/proto_docs/google/cloud/discoveryengine/v1/answer.rb +53 -2
- data/proto_docs/google/cloud/discoveryengine/v1/chunk.rb +2 -1
- data/proto_docs/google/cloud/discoveryengine/v1/common.rb +40 -0
- data/proto_docs/google/cloud/discoveryengine/v1/control.rb +122 -7
- data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +159 -2
- data/proto_docs/google/cloud/discoveryengine/v1/data_store.rb +25 -4
- data/proto_docs/google/cloud/discoveryengine/v1/document.rb +7 -2
- data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1/engine.rb +16 -3
- data/proto_docs/google/cloud/discoveryengine/v1/grounded_generation_service.rb +90 -12
- data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +19 -1
- data/proto_docs/google/cloud/discoveryengine/v1/purge_config.rb +9 -5
- data/proto_docs/google/cloud/discoveryengine/v1/rank_service.rb +3 -1
- data/proto_docs/google/cloud/discoveryengine/v1/recommendation_service.rb +3 -3
- data/proto_docs/google/cloud/discoveryengine/v1/safety.rb +108 -0
- data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +109 -8
- data/proto_docs/google/cloud/discoveryengine/v1/serving_config.rb +261 -0
- data/proto_docs/google/cloud/discoveryengine/v1/serving_config_service.rb +44 -0
- data/proto_docs/google/cloud/discoveryengine/v1/session.rb +18 -0
- data/proto_docs/google/cloud/discoveryengine/v1/site_search_engine.rb +19 -2
- data/proto_docs/google/cloud/discoveryengine/v1/site_search_engine_service.rb +146 -4
- data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +34 -0
- data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +12 -4
- metadata +17 -3
@@ -0,0 +1,451 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/discoveryengine/v1/serving_config_service_pb"
|
21
|
+
require "google/cloud/discovery_engine/v1/serving_config_service/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module DiscoveryEngine
|
27
|
+
module V1
|
28
|
+
module ServingConfigService
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the ServingConfigService service.
|
32
|
+
#
|
33
|
+
# Service for operations related to
|
34
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ServingConfig ServingConfig}.
|
35
|
+
#
|
36
|
+
class Client
|
37
|
+
# @private
|
38
|
+
API_VERSION = ""
|
39
|
+
|
40
|
+
# @private
|
41
|
+
DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
|
42
|
+
|
43
|
+
include Paths
|
44
|
+
|
45
|
+
# @private
|
46
|
+
attr_reader :serving_config_service_stub
|
47
|
+
|
48
|
+
##
|
49
|
+
# Configure the ServingConfigService Client class.
|
50
|
+
#
|
51
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client::Configuration}
|
52
|
+
# for a description of the configuration fields.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
#
|
56
|
+
# # Modify the configuration for all ServingConfigService clients
|
57
|
+
# ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client.configure do |config|
|
58
|
+
# config.timeout = 10.0
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# @yield [config] Configure the Client client.
|
62
|
+
# @yieldparam config [Client::Configuration]
|
63
|
+
#
|
64
|
+
# @return [Client::Configuration]
|
65
|
+
#
|
66
|
+
def self.configure
|
67
|
+
@configure ||= begin
|
68
|
+
namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
|
69
|
+
parent_config = while namespace.any?
|
70
|
+
parent_name = namespace.join "::"
|
71
|
+
parent_const = const_get parent_name
|
72
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
73
|
+
namespace.pop
|
74
|
+
end
|
75
|
+
default_config = Client::Configuration.new parent_config
|
76
|
+
|
77
|
+
default_config
|
78
|
+
end
|
79
|
+
yield @configure if block_given?
|
80
|
+
@configure
|
81
|
+
end
|
82
|
+
|
83
|
+
##
|
84
|
+
# Configure the ServingConfigService Client instance.
|
85
|
+
#
|
86
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
87
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
88
|
+
# should be made on {Client.configure}.
|
89
|
+
#
|
90
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client::Configuration}
|
91
|
+
# for a description of the configuration fields.
|
92
|
+
#
|
93
|
+
# @yield [config] Configure the Client client.
|
94
|
+
# @yieldparam config [Client::Configuration]
|
95
|
+
#
|
96
|
+
# @return [Client::Configuration]
|
97
|
+
#
|
98
|
+
def configure
|
99
|
+
yield @config if block_given?
|
100
|
+
@config
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# The effective universe domain
|
105
|
+
#
|
106
|
+
# @return [String]
|
107
|
+
#
|
108
|
+
def universe_domain
|
109
|
+
@serving_config_service_stub.universe_domain
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Create a new ServingConfigService REST client object.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
#
|
117
|
+
# # Create a client using the default configuration
|
118
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client.new
|
119
|
+
#
|
120
|
+
# # Create a client using a custom configuration
|
121
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client.new do |config|
|
122
|
+
# config.timeout = 10.0
|
123
|
+
# end
|
124
|
+
#
|
125
|
+
# @yield [config] Configure the ServingConfigService client.
|
126
|
+
# @yieldparam config [Client::Configuration]
|
127
|
+
#
|
128
|
+
def initialize
|
129
|
+
# Create the configuration object
|
130
|
+
@config = Configuration.new Client.configure
|
131
|
+
|
132
|
+
# Yield the configuration if needed
|
133
|
+
yield @config if block_given?
|
134
|
+
|
135
|
+
# Create credentials
|
136
|
+
credentials = @config.credentials
|
137
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
138
|
+
# but only if the default endpoint does not have a region prefix.
|
139
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
140
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
141
|
+
!@config.endpoint.split(".").first.include?("-"))
|
142
|
+
credentials ||= Credentials.default scope: @config.scope,
|
143
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
144
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
145
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
146
|
+
end
|
147
|
+
|
148
|
+
@quota_project_id = @config.quota_project
|
149
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
150
|
+
|
151
|
+
@serving_config_service_stub = ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::ServiceStub.new(
|
152
|
+
endpoint: @config.endpoint,
|
153
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
154
|
+
universe_domain: @config.universe_domain,
|
155
|
+
credentials: credentials,
|
156
|
+
logger: @config.logger
|
157
|
+
)
|
158
|
+
|
159
|
+
@serving_config_service_stub.logger(stub: true)&.info do |entry|
|
160
|
+
entry.set_system_name
|
161
|
+
entry.set_service
|
162
|
+
entry.message = "Created client for #{entry.service}"
|
163
|
+
entry.set_credentials_fields credentials
|
164
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
165
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
166
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
167
|
+
end
|
168
|
+
|
169
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
170
|
+
config.credentials = credentials
|
171
|
+
config.quota_project = @quota_project_id
|
172
|
+
config.endpoint = @serving_config_service_stub.endpoint
|
173
|
+
config.universe_domain = @serving_config_service_stub.universe_domain
|
174
|
+
config.logger = @serving_config_service_stub.logger if config.respond_to? :logger=
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# Get the associated client for mix-in of the Locations.
|
180
|
+
#
|
181
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
182
|
+
#
|
183
|
+
attr_reader :location_client
|
184
|
+
|
185
|
+
##
|
186
|
+
# The logger used for request/response debug logging.
|
187
|
+
#
|
188
|
+
# @return [Logger]
|
189
|
+
#
|
190
|
+
def logger
|
191
|
+
@serving_config_service_stub.logger
|
192
|
+
end
|
193
|
+
|
194
|
+
# Service calls
|
195
|
+
|
196
|
+
##
|
197
|
+
# Updates a ServingConfig.
|
198
|
+
#
|
199
|
+
# Returns a NOT_FOUND error if the ServingConfig does not exist.
|
200
|
+
#
|
201
|
+
# @overload update_serving_config(request, options = nil)
|
202
|
+
# Pass arguments to `update_serving_config` via a request object, either of type
|
203
|
+
# {::Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest} or an equivalent Hash.
|
204
|
+
#
|
205
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest, ::Hash]
|
206
|
+
# A request object representing the call parameters. Required. To specify no
|
207
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
208
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
209
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
210
|
+
#
|
211
|
+
# @overload update_serving_config(serving_config: nil, update_mask: nil)
|
212
|
+
# Pass arguments to `update_serving_config` via keyword arguments. Note that at
|
213
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
214
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
215
|
+
#
|
216
|
+
# @param serving_config [::Google::Cloud::DiscoveryEngine::V1::ServingConfig, ::Hash]
|
217
|
+
# Required. The ServingConfig to update.
|
218
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
219
|
+
# Indicates which fields in the provided
|
220
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ServingConfig ServingConfig} to update.
|
221
|
+
# The following are NOT supported:
|
222
|
+
#
|
223
|
+
# * {::Google::Cloud::DiscoveryEngine::V1::ServingConfig#name ServingConfig.name}
|
224
|
+
#
|
225
|
+
# If not set, all supported fields are updated.
|
226
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
227
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::ServingConfig]
|
228
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
229
|
+
#
|
230
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::ServingConfig]
|
231
|
+
#
|
232
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
233
|
+
#
|
234
|
+
# @example Basic example
|
235
|
+
# require "google/cloud/discovery_engine/v1"
|
236
|
+
#
|
237
|
+
# # Create a client object. The client can be reused for multiple calls.
|
238
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client.new
|
239
|
+
#
|
240
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
241
|
+
# request = Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest.new
|
242
|
+
#
|
243
|
+
# # Call the update_serving_config method.
|
244
|
+
# result = client.update_serving_config request
|
245
|
+
#
|
246
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::ServingConfig.
|
247
|
+
# p result
|
248
|
+
#
|
249
|
+
def update_serving_config request, options = nil
|
250
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
251
|
+
|
252
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest
|
253
|
+
|
254
|
+
# Converts hash and nil to an options object
|
255
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
256
|
+
|
257
|
+
# Customize the options with defaults
|
258
|
+
call_metadata = @config.rpcs.update_serving_config.metadata.to_h
|
259
|
+
|
260
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
261
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
262
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
263
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
|
264
|
+
transports_version_send: [:rest]
|
265
|
+
|
266
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
267
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
268
|
+
|
269
|
+
options.apply_defaults timeout: @config.rpcs.update_serving_config.timeout,
|
270
|
+
metadata: call_metadata,
|
271
|
+
retry_policy: @config.rpcs.update_serving_config.retry_policy
|
272
|
+
|
273
|
+
options.apply_defaults timeout: @config.timeout,
|
274
|
+
metadata: @config.metadata,
|
275
|
+
retry_policy: @config.retry_policy
|
276
|
+
|
277
|
+
@serving_config_service_stub.update_serving_config request, options do |result, operation|
|
278
|
+
yield result, operation if block_given?
|
279
|
+
end
|
280
|
+
rescue ::Gapic::Rest::Error => e
|
281
|
+
raise ::Google::Cloud::Error.from_error(e)
|
282
|
+
end
|
283
|
+
|
284
|
+
##
|
285
|
+
# Configuration class for the ServingConfigService REST API.
|
286
|
+
#
|
287
|
+
# This class represents the configuration for ServingConfigService REST,
|
288
|
+
# providing control over timeouts, retry behavior, logging, transport
|
289
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
290
|
+
# applied individually to specific RPCs. See
|
291
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client::Configuration::Rpcs}
|
292
|
+
# for a list of RPCs that can be configured independently.
|
293
|
+
#
|
294
|
+
# Configuration can be applied globally to all clients, or to a single client
|
295
|
+
# on construction.
|
296
|
+
#
|
297
|
+
# @example
|
298
|
+
#
|
299
|
+
# # Modify the global config, setting the timeout for
|
300
|
+
# # update_serving_config to 20 seconds,
|
301
|
+
# # and all remaining timeouts to 10 seconds.
|
302
|
+
# ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client.configure do |config|
|
303
|
+
# config.timeout = 10.0
|
304
|
+
# config.rpcs.update_serving_config.timeout = 20.0
|
305
|
+
# end
|
306
|
+
#
|
307
|
+
# # Apply the above configuration only to a new client.
|
308
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client.new do |config|
|
309
|
+
# config.timeout = 10.0
|
310
|
+
# config.rpcs.update_serving_config.timeout = 20.0
|
311
|
+
# end
|
312
|
+
#
|
313
|
+
# @!attribute [rw] endpoint
|
314
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
315
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
316
|
+
# @return [::String,nil]
|
317
|
+
# @!attribute [rw] credentials
|
318
|
+
# Credentials to send with calls. You may provide any of the following types:
|
319
|
+
# * (`String`) The path to a service account key file in JSON format
|
320
|
+
# * (`Hash`) A service account key as a Hash
|
321
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
322
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
323
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
324
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
325
|
+
# * (`nil`) indicating no credentials
|
326
|
+
#
|
327
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
328
|
+
# external source for authentication to Google Cloud, you must validate it before
|
329
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
330
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
331
|
+
# For more information, refer to [Validate credential configurations from external
|
332
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
333
|
+
# @return [::Object]
|
334
|
+
# @!attribute [rw] scope
|
335
|
+
# The OAuth scopes
|
336
|
+
# @return [::Array<::String>]
|
337
|
+
# @!attribute [rw] lib_name
|
338
|
+
# The library name as recorded in instrumentation and logging
|
339
|
+
# @return [::String]
|
340
|
+
# @!attribute [rw] lib_version
|
341
|
+
# The library version as recorded in instrumentation and logging
|
342
|
+
# @return [::String]
|
343
|
+
# @!attribute [rw] timeout
|
344
|
+
# The call timeout in seconds.
|
345
|
+
# @return [::Numeric]
|
346
|
+
# @!attribute [rw] metadata
|
347
|
+
# Additional headers to be sent with the call.
|
348
|
+
# @return [::Hash{::Symbol=>::String}]
|
349
|
+
# @!attribute [rw] retry_policy
|
350
|
+
# The retry policy. The value is a hash with the following keys:
|
351
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
352
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
353
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
354
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
355
|
+
# trigger a retry.
|
356
|
+
# @return [::Hash]
|
357
|
+
# @!attribute [rw] quota_project
|
358
|
+
# A separate project against which to charge quota.
|
359
|
+
# @return [::String]
|
360
|
+
# @!attribute [rw] universe_domain
|
361
|
+
# The universe domain within which to make requests. This determines the
|
362
|
+
# default endpoint URL. The default value of nil uses the environment
|
363
|
+
# universe (usually the default "googleapis.com" universe).
|
364
|
+
# @return [::String,nil]
|
365
|
+
# @!attribute [rw] logger
|
366
|
+
# A custom logger to use for request/response debug logging, or the value
|
367
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
368
|
+
# explicitly disable logging.
|
369
|
+
# @return [::Logger,:default,nil]
|
370
|
+
#
|
371
|
+
class Configuration
|
372
|
+
extend ::Gapic::Config
|
373
|
+
|
374
|
+
# @private
|
375
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
376
|
+
DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
|
377
|
+
|
378
|
+
config_attr :endpoint, nil, ::String, nil
|
379
|
+
config_attr :credentials, nil do |value|
|
380
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
381
|
+
allowed.any? { |klass| klass === value }
|
382
|
+
end
|
383
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
384
|
+
config_attr :lib_name, nil, ::String, nil
|
385
|
+
config_attr :lib_version, nil, ::String, nil
|
386
|
+
config_attr :timeout, nil, ::Numeric, nil
|
387
|
+
config_attr :metadata, nil, ::Hash, nil
|
388
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
389
|
+
config_attr :quota_project, nil, ::String, nil
|
390
|
+
config_attr :universe_domain, nil, ::String, nil
|
391
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
392
|
+
|
393
|
+
# @private
|
394
|
+
def initialize parent_config = nil
|
395
|
+
@parent_config = parent_config unless parent_config.nil?
|
396
|
+
|
397
|
+
yield self if block_given?
|
398
|
+
end
|
399
|
+
|
400
|
+
##
|
401
|
+
# Configurations for individual RPCs
|
402
|
+
# @return [Rpcs]
|
403
|
+
#
|
404
|
+
def rpcs
|
405
|
+
@rpcs ||= begin
|
406
|
+
parent_rpcs = nil
|
407
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
408
|
+
Rpcs.new parent_rpcs
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
##
|
413
|
+
# Configuration RPC class for the ServingConfigService API.
|
414
|
+
#
|
415
|
+
# Includes fields providing the configuration for each RPC in this service.
|
416
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
417
|
+
# the following configuration fields:
|
418
|
+
#
|
419
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
420
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
421
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
422
|
+
# include the following keys:
|
423
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
424
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
425
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
426
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
427
|
+
# trigger a retry.
|
428
|
+
#
|
429
|
+
class Rpcs
|
430
|
+
##
|
431
|
+
# RPC-specific configuration for `update_serving_config`
|
432
|
+
# @return [::Gapic::Config::Method]
|
433
|
+
#
|
434
|
+
attr_reader :update_serving_config
|
435
|
+
|
436
|
+
# @private
|
437
|
+
def initialize parent_rpcs = nil
|
438
|
+
update_serving_config_config = parent_rpcs.update_serving_config if parent_rpcs.respond_to? :update_serving_config
|
439
|
+
@update_serving_config = ::Gapic::Config::Method.new update_serving_config_config
|
440
|
+
|
441
|
+
yield self if block_given?
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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/discoveryengine/v1/serving_config_service_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module DiscoveryEngine
|
24
|
+
module V1
|
25
|
+
module ServingConfigService
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the ServingConfigService service.
|
29
|
+
# Service stub contains baseline method implementations
|
30
|
+
# including transcoding, making the REST call, and deserialing the response.
|
31
|
+
#
|
32
|
+
class ServiceStub
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
35
|
+
# These require statements are intentionally placed here to initialize
|
36
|
+
# the REST modules only when it's required.
|
37
|
+
require "gapic/rest"
|
38
|
+
|
39
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
40
|
+
endpoint_template: endpoint_template,
|
41
|
+
universe_domain: universe_domain,
|
42
|
+
credentials: credentials,
|
43
|
+
numeric_enums: true,
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# The effective universe domain
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
#
|
54
|
+
def universe_domain
|
55
|
+
@client_stub.universe_domain
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# The effective endpoint
|
60
|
+
#
|
61
|
+
# @return [String]
|
62
|
+
#
|
63
|
+
def endpoint
|
64
|
+
@client_stub.endpoint
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Baseline implementation for the update_serving_config REST call
|
78
|
+
#
|
79
|
+
# @param request_pb [::Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest]
|
80
|
+
# A request object representing the call parameters. Required.
|
81
|
+
# @param options [::Gapic::CallOptions]
|
82
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
83
|
+
#
|
84
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
85
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::ServingConfig]
|
86
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
87
|
+
#
|
88
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::ServingConfig]
|
89
|
+
# A result object deserialized from the server's reply
|
90
|
+
def update_serving_config request_pb, options = nil
|
91
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
92
|
+
|
93
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_update_serving_config_request request_pb
|
94
|
+
query_string_params = if query_string_params.any?
|
95
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
96
|
+
else
|
97
|
+
{}
|
98
|
+
end
|
99
|
+
|
100
|
+
response = @client_stub.make_http_request(
|
101
|
+
verb,
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "update_serving_config",
|
106
|
+
options: options
|
107
|
+
)
|
108
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
109
|
+
result = ::Google::Cloud::DiscoveryEngine::V1::ServingConfig.decode_json response.body, ignore_unknown_fields: true
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# @private
|
118
|
+
#
|
119
|
+
# GRPC transcoding helper method for the update_serving_config REST call
|
120
|
+
#
|
121
|
+
# @param request_pb [::Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest]
|
122
|
+
# A request object representing the call parameters. Required.
|
123
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
124
|
+
# Uri, Body, Query string parameters
|
125
|
+
def self.transcode_update_serving_config_request request_pb
|
126
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
127
|
+
.with_bindings(
|
128
|
+
uri_method: :patch,
|
129
|
+
uri_template: "/v1/{serving_config.name}",
|
130
|
+
body: "serving_config",
|
131
|
+
matches: [
|
132
|
+
["serving_config.name", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false]
|
133
|
+
]
|
134
|
+
)
|
135
|
+
.with_bindings(
|
136
|
+
uri_method: :patch,
|
137
|
+
uri_template: "/v1/{serving_config.name}",
|
138
|
+
body: "serving_config",
|
139
|
+
matches: [
|
140
|
+
["serving_config.name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false]
|
141
|
+
]
|
142
|
+
)
|
143
|
+
.with_bindings(
|
144
|
+
uri_method: :patch,
|
145
|
+
uri_template: "/v1/{serving_config.name}",
|
146
|
+
body: "serving_config",
|
147
|
+
matches: [
|
148
|
+
["serving_config.name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/servingConfigs/[^/]+/?$}, false]
|
149
|
+
]
|
150
|
+
)
|
151
|
+
transcoder.transcode request_pb
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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 "gapic/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/discovery_engine/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/discovery_engine/v1/serving_config_service/credentials"
|
26
|
+
require "google/cloud/discovery_engine/v1/serving_config_service/paths"
|
27
|
+
require "google/cloud/discovery_engine/v1/serving_config_service/rest/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module DiscoveryEngine
|
32
|
+
module V1
|
33
|
+
##
|
34
|
+
# Service for operations related to
|
35
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ServingConfig ServingConfig}.
|
36
|
+
#
|
37
|
+
# To load this service and instantiate a REST client:
|
38
|
+
#
|
39
|
+
# require "google/cloud/discovery_engine/v1/serving_config_service/rest"
|
40
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Rest::Client.new
|
41
|
+
#
|
42
|
+
module ServingConfigService
|
43
|
+
# Client for the REST transport
|
44
|
+
module Rest
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
53
|
+
require "google/cloud/discovery_engine/v1/serving_config_service/rest/helpers" if ::File.file? helper_path
|