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,484 @@
|
|
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/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module DiscoveryEngine
|
26
|
+
module V1
|
27
|
+
module ServingConfigService
|
28
|
+
##
|
29
|
+
# Client for the ServingConfigService service.
|
30
|
+
#
|
31
|
+
# Service for operations related to
|
32
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ServingConfig ServingConfig}.
|
33
|
+
#
|
34
|
+
class Client
|
35
|
+
# @private
|
36
|
+
API_VERSION = ""
|
37
|
+
|
38
|
+
# @private
|
39
|
+
DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
|
40
|
+
|
41
|
+
include Paths
|
42
|
+
|
43
|
+
# @private
|
44
|
+
attr_reader :serving_config_service_stub
|
45
|
+
|
46
|
+
##
|
47
|
+
# Configure the ServingConfigService Client class.
|
48
|
+
#
|
49
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Client::Configuration}
|
50
|
+
# for a description of the configuration fields.
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
#
|
54
|
+
# # Modify the configuration for all ServingConfigService clients
|
55
|
+
# ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Client.configure do |config|
|
56
|
+
# config.timeout = 10.0
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# @yield [config] Configure the Client client.
|
60
|
+
# @yieldparam config [Client::Configuration]
|
61
|
+
#
|
62
|
+
# @return [Client::Configuration]
|
63
|
+
#
|
64
|
+
def self.configure
|
65
|
+
@configure ||= begin
|
66
|
+
namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
|
67
|
+
parent_config = while namespace.any?
|
68
|
+
parent_name = namespace.join "::"
|
69
|
+
parent_const = const_get parent_name
|
70
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
71
|
+
namespace.pop
|
72
|
+
end
|
73
|
+
default_config = Client::Configuration.new parent_config
|
74
|
+
|
75
|
+
default_config
|
76
|
+
end
|
77
|
+
yield @configure if block_given?
|
78
|
+
@configure
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Configure the ServingConfigService Client instance.
|
83
|
+
#
|
84
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
85
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
86
|
+
# should be made on {Client.configure}.
|
87
|
+
#
|
88
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Client::Configuration}
|
89
|
+
# for a description of the configuration fields.
|
90
|
+
#
|
91
|
+
# @yield [config] Configure the Client client.
|
92
|
+
# @yieldparam config [Client::Configuration]
|
93
|
+
#
|
94
|
+
# @return [Client::Configuration]
|
95
|
+
#
|
96
|
+
def configure
|
97
|
+
yield @config if block_given?
|
98
|
+
@config
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# The effective universe domain
|
103
|
+
#
|
104
|
+
# @return [String]
|
105
|
+
#
|
106
|
+
def universe_domain
|
107
|
+
@serving_config_service_stub.universe_domain
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# Create a new ServingConfigService client object.
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
#
|
115
|
+
# # Create a client using the default configuration
|
116
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Client.new
|
117
|
+
#
|
118
|
+
# # Create a client using a custom configuration
|
119
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Client.new do |config|
|
120
|
+
# config.timeout = 10.0
|
121
|
+
# end
|
122
|
+
#
|
123
|
+
# @yield [config] Configure the ServingConfigService 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/discoveryengine/v1/serving_config_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.nil? ||
|
144
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
145
|
+
!@config.endpoint.split(".").first.include?("-"))
|
146
|
+
credentials ||= Credentials.default scope: @config.scope,
|
147
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
148
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
149
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
150
|
+
end
|
151
|
+
@quota_project_id = @config.quota_project
|
152
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
153
|
+
|
154
|
+
@serving_config_service_stub = ::Gapic::ServiceStub.new(
|
155
|
+
::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Stub,
|
156
|
+
credentials: credentials,
|
157
|
+
endpoint: @config.endpoint,
|
158
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
159
|
+
universe_domain: @config.universe_domain,
|
160
|
+
channel_args: @config.channel_args,
|
161
|
+
interceptors: @config.interceptors,
|
162
|
+
channel_pool_config: @config.channel_pool,
|
163
|
+
logger: @config.logger
|
164
|
+
)
|
165
|
+
|
166
|
+
@serving_config_service_stub.stub_logger&.info do |entry|
|
167
|
+
entry.set_system_name
|
168
|
+
entry.set_service
|
169
|
+
entry.message = "Created client for #{entry.service}"
|
170
|
+
entry.set_credentials_fields credentials
|
171
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
172
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
173
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
174
|
+
end
|
175
|
+
|
176
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
177
|
+
config.credentials = credentials
|
178
|
+
config.quota_project = @quota_project_id
|
179
|
+
config.endpoint = @serving_config_service_stub.endpoint
|
180
|
+
config.universe_domain = @serving_config_service_stub.universe_domain
|
181
|
+
config.logger = @serving_config_service_stub.logger if config.respond_to? :logger=
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# Get the associated client for mix-in of the Locations.
|
187
|
+
#
|
188
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
189
|
+
#
|
190
|
+
attr_reader :location_client
|
191
|
+
|
192
|
+
##
|
193
|
+
# The logger used for request/response debug logging.
|
194
|
+
#
|
195
|
+
# @return [Logger]
|
196
|
+
#
|
197
|
+
def logger
|
198
|
+
@serving_config_service_stub.logger
|
199
|
+
end
|
200
|
+
|
201
|
+
# Service calls
|
202
|
+
|
203
|
+
##
|
204
|
+
# Updates a ServingConfig.
|
205
|
+
#
|
206
|
+
# Returns a NOT_FOUND error if the ServingConfig does not exist.
|
207
|
+
#
|
208
|
+
# @overload update_serving_config(request, options = nil)
|
209
|
+
# Pass arguments to `update_serving_config` via a request object, either of type
|
210
|
+
# {::Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest} or an equivalent Hash.
|
211
|
+
#
|
212
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest, ::Hash]
|
213
|
+
# A request object representing the call parameters. Required. To specify no
|
214
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
215
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
216
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
217
|
+
#
|
218
|
+
# @overload update_serving_config(serving_config: nil, update_mask: nil)
|
219
|
+
# Pass arguments to `update_serving_config` via keyword arguments. Note that at
|
220
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
221
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
222
|
+
#
|
223
|
+
# @param serving_config [::Google::Cloud::DiscoveryEngine::V1::ServingConfig, ::Hash]
|
224
|
+
# Required. The ServingConfig to update.
|
225
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
226
|
+
# Indicates which fields in the provided
|
227
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ServingConfig ServingConfig} to update.
|
228
|
+
# The following are NOT supported:
|
229
|
+
#
|
230
|
+
# * {::Google::Cloud::DiscoveryEngine::V1::ServingConfig#name ServingConfig.name}
|
231
|
+
#
|
232
|
+
# If not set, all supported fields are updated.
|
233
|
+
#
|
234
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
235
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::ServingConfig]
|
236
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
237
|
+
#
|
238
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::ServingConfig]
|
239
|
+
#
|
240
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
241
|
+
#
|
242
|
+
# @example Basic example
|
243
|
+
# require "google/cloud/discovery_engine/v1"
|
244
|
+
#
|
245
|
+
# # Create a client object. The client can be reused for multiple calls.
|
246
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Client.new
|
247
|
+
#
|
248
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
249
|
+
# request = Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest.new
|
250
|
+
#
|
251
|
+
# # Call the update_serving_config method.
|
252
|
+
# result = client.update_serving_config request
|
253
|
+
#
|
254
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::ServingConfig.
|
255
|
+
# p result
|
256
|
+
#
|
257
|
+
def update_serving_config request, options = nil
|
258
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
259
|
+
|
260
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::UpdateServingConfigRequest
|
261
|
+
|
262
|
+
# Converts hash and nil to an options object
|
263
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
264
|
+
|
265
|
+
# Customize the options with defaults
|
266
|
+
metadata = @config.rpcs.update_serving_config.metadata.to_h
|
267
|
+
|
268
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
269
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
270
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
271
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
272
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
273
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
274
|
+
|
275
|
+
header_params = {}
|
276
|
+
if request.serving_config&.name
|
277
|
+
header_params["serving_config.name"] = request.serving_config.name
|
278
|
+
end
|
279
|
+
|
280
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
281
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
282
|
+
|
283
|
+
options.apply_defaults timeout: @config.rpcs.update_serving_config.timeout,
|
284
|
+
metadata: metadata,
|
285
|
+
retry_policy: @config.rpcs.update_serving_config.retry_policy
|
286
|
+
|
287
|
+
options.apply_defaults timeout: @config.timeout,
|
288
|
+
metadata: @config.metadata,
|
289
|
+
retry_policy: @config.retry_policy
|
290
|
+
|
291
|
+
@serving_config_service_stub.call_rpc :update_serving_config, request, options: options do |response, operation|
|
292
|
+
yield response, operation if block_given?
|
293
|
+
end
|
294
|
+
rescue ::GRPC::BadStatus => e
|
295
|
+
raise ::Google::Cloud::Error.from_error(e)
|
296
|
+
end
|
297
|
+
|
298
|
+
##
|
299
|
+
# Configuration class for the ServingConfigService API.
|
300
|
+
#
|
301
|
+
# This class represents the configuration for ServingConfigService,
|
302
|
+
# providing control over timeouts, retry behavior, logging, transport
|
303
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
304
|
+
# applied individually to specific RPCs. See
|
305
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Client::Configuration::Rpcs}
|
306
|
+
# for a list of RPCs that can be configured independently.
|
307
|
+
#
|
308
|
+
# Configuration can be applied globally to all clients, or to a single client
|
309
|
+
# on construction.
|
310
|
+
#
|
311
|
+
# @example
|
312
|
+
#
|
313
|
+
# # Modify the global config, setting the timeout for
|
314
|
+
# # update_serving_config to 20 seconds,
|
315
|
+
# # and all remaining timeouts to 10 seconds.
|
316
|
+
# ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Client.configure do |config|
|
317
|
+
# config.timeout = 10.0
|
318
|
+
# config.rpcs.update_serving_config.timeout = 20.0
|
319
|
+
# end
|
320
|
+
#
|
321
|
+
# # Apply the above configuration only to a new client.
|
322
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ServingConfigService::Client.new do |config|
|
323
|
+
# config.timeout = 10.0
|
324
|
+
# config.rpcs.update_serving_config.timeout = 20.0
|
325
|
+
# end
|
326
|
+
#
|
327
|
+
# @!attribute [rw] endpoint
|
328
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
329
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
330
|
+
# @return [::String,nil]
|
331
|
+
# @!attribute [rw] credentials
|
332
|
+
# Credentials to send with calls. You may provide any of the following types:
|
333
|
+
# * (`String`) The path to a service account key file in JSON format
|
334
|
+
# * (`Hash`) A service account key as a Hash
|
335
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
336
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
337
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
338
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
339
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
340
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
341
|
+
# * (`nil`) indicating no credentials
|
342
|
+
#
|
343
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
344
|
+
# external source for authentication to Google Cloud, you must validate it before
|
345
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
346
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
347
|
+
# For more information, refer to [Validate credential configurations from external
|
348
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
349
|
+
# @return [::Object]
|
350
|
+
# @!attribute [rw] scope
|
351
|
+
# The OAuth scopes
|
352
|
+
# @return [::Array<::String>]
|
353
|
+
# @!attribute [rw] lib_name
|
354
|
+
# The library name as recorded in instrumentation and logging
|
355
|
+
# @return [::String]
|
356
|
+
# @!attribute [rw] lib_version
|
357
|
+
# The library version as recorded in instrumentation and logging
|
358
|
+
# @return [::String]
|
359
|
+
# @!attribute [rw] channel_args
|
360
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
361
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
362
|
+
# @return [::Hash]
|
363
|
+
# @!attribute [rw] interceptors
|
364
|
+
# An array of interceptors that are run before calls are executed.
|
365
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
366
|
+
# @!attribute [rw] timeout
|
367
|
+
# The call timeout in seconds.
|
368
|
+
# @return [::Numeric]
|
369
|
+
# @!attribute [rw] metadata
|
370
|
+
# Additional gRPC headers to be sent with the call.
|
371
|
+
# @return [::Hash{::Symbol=>::String}]
|
372
|
+
# @!attribute [rw] retry_policy
|
373
|
+
# The retry policy. The value is a hash with the following keys:
|
374
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
375
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
376
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
377
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
378
|
+
# trigger a retry.
|
379
|
+
# @return [::Hash]
|
380
|
+
# @!attribute [rw] quota_project
|
381
|
+
# A separate project against which to charge quota.
|
382
|
+
# @return [::String]
|
383
|
+
# @!attribute [rw] universe_domain
|
384
|
+
# The universe domain within which to make requests. This determines the
|
385
|
+
# default endpoint URL. The default value of nil uses the environment
|
386
|
+
# universe (usually the default "googleapis.com" universe).
|
387
|
+
# @return [::String,nil]
|
388
|
+
# @!attribute [rw] logger
|
389
|
+
# A custom logger to use for request/response debug logging, or the value
|
390
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
391
|
+
# explicitly disable logging.
|
392
|
+
# @return [::Logger,:default,nil]
|
393
|
+
#
|
394
|
+
class Configuration
|
395
|
+
extend ::Gapic::Config
|
396
|
+
|
397
|
+
# @private
|
398
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
399
|
+
DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
|
400
|
+
|
401
|
+
config_attr :endpoint, nil, ::String, nil
|
402
|
+
config_attr :credentials, nil do |value|
|
403
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
404
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
405
|
+
allowed.any? { |klass| klass === value }
|
406
|
+
end
|
407
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
408
|
+
config_attr :lib_name, nil, ::String, nil
|
409
|
+
config_attr :lib_version, nil, ::String, nil
|
410
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
411
|
+
config_attr :interceptors, nil, ::Array, nil
|
412
|
+
config_attr :timeout, nil, ::Numeric, nil
|
413
|
+
config_attr :metadata, nil, ::Hash, nil
|
414
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
415
|
+
config_attr :quota_project, nil, ::String, nil
|
416
|
+
config_attr :universe_domain, nil, ::String, nil
|
417
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
418
|
+
|
419
|
+
# @private
|
420
|
+
def initialize parent_config = nil
|
421
|
+
@parent_config = parent_config unless parent_config.nil?
|
422
|
+
|
423
|
+
yield self if block_given?
|
424
|
+
end
|
425
|
+
|
426
|
+
##
|
427
|
+
# Configurations for individual RPCs
|
428
|
+
# @return [Rpcs]
|
429
|
+
#
|
430
|
+
def rpcs
|
431
|
+
@rpcs ||= begin
|
432
|
+
parent_rpcs = nil
|
433
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
434
|
+
Rpcs.new parent_rpcs
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
##
|
439
|
+
# Configuration for the channel pool
|
440
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
441
|
+
#
|
442
|
+
def channel_pool
|
443
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
444
|
+
end
|
445
|
+
|
446
|
+
##
|
447
|
+
# Configuration RPC class for the ServingConfigService API.
|
448
|
+
#
|
449
|
+
# Includes fields providing the configuration for each RPC in this service.
|
450
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
451
|
+
# the following configuration fields:
|
452
|
+
#
|
453
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
454
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
455
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
456
|
+
# include the following keys:
|
457
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
458
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
459
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
460
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
461
|
+
# trigger a retry.
|
462
|
+
#
|
463
|
+
class Rpcs
|
464
|
+
##
|
465
|
+
# RPC-specific configuration for `update_serving_config`
|
466
|
+
# @return [::Gapic::Config::Method]
|
467
|
+
#
|
468
|
+
attr_reader :update_serving_config
|
469
|
+
|
470
|
+
# @private
|
471
|
+
def initialize parent_rpcs = nil
|
472
|
+
update_serving_config_config = parent_rpcs.update_serving_config if parent_rpcs.respond_to? :update_serving_config
|
473
|
+
@update_serving_config = ::Gapic::Config::Method.new update_serving_config_config
|
474
|
+
|
475
|
+
yield self if block_given?
|
476
|
+
end
|
477
|
+
end
|
478
|
+
end
|
479
|
+
end
|
480
|
+
end
|
481
|
+
end
|
482
|
+
end
|
483
|
+
end
|
484
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module DiscoveryEngine
|
24
|
+
module V1
|
25
|
+
module ServingConfigService
|
26
|
+
# Credentials for the ServingConfigService API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
33
|
+
"GOOGLE_CLOUD_KEYFILE",
|
34
|
+
"GCLOUD_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
37
|
+
"GCLOUD_KEYFILE_JSON"
|
38
|
+
]
|
39
|
+
self.paths = [
|
40
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
41
|
+
]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,101 @@
|
|
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
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module DiscoveryEngine
|
23
|
+
module V1
|
24
|
+
module ServingConfigService
|
25
|
+
# Path helper methods for the ServingConfigService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified ServingConfig resource string.
|
29
|
+
#
|
30
|
+
# @overload serving_config_path(project:, location:, data_store:, serving_config:)
|
31
|
+
# The resource will be in the following format:
|
32
|
+
#
|
33
|
+
# `projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}`
|
34
|
+
#
|
35
|
+
# @param project [String]
|
36
|
+
# @param location [String]
|
37
|
+
# @param data_store [String]
|
38
|
+
# @param serving_config [String]
|
39
|
+
#
|
40
|
+
# @overload serving_config_path(project:, location:, collection:, data_store:, serving_config:)
|
41
|
+
# The resource will be in the following format:
|
42
|
+
#
|
43
|
+
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}`
|
44
|
+
#
|
45
|
+
# @param project [String]
|
46
|
+
# @param location [String]
|
47
|
+
# @param collection [String]
|
48
|
+
# @param data_store [String]
|
49
|
+
# @param serving_config [String]
|
50
|
+
#
|
51
|
+
# @overload serving_config_path(project:, location:, collection:, engine:, serving_config:)
|
52
|
+
# The resource will be in the following format:
|
53
|
+
#
|
54
|
+
# `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config}`
|
55
|
+
#
|
56
|
+
# @param project [String]
|
57
|
+
# @param location [String]
|
58
|
+
# @param collection [String]
|
59
|
+
# @param engine [String]
|
60
|
+
# @param serving_config [String]
|
61
|
+
#
|
62
|
+
# @return [::String]
|
63
|
+
def serving_config_path **args
|
64
|
+
resources = {
|
65
|
+
"data_store:location:project:serving_config" => (proc do |project:, location:, data_store:, serving_config:|
|
66
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
67
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
68
|
+
raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
|
69
|
+
|
70
|
+
"projects/#{project}/locations/#{location}/dataStores/#{data_store}/servingConfigs/#{serving_config}"
|
71
|
+
end),
|
72
|
+
"collection:data_store:location:project:serving_config" => (proc do |project:, location:, collection:, data_store:, serving_config:|
|
73
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
74
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
75
|
+
raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
|
76
|
+
raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
|
77
|
+
|
78
|
+
"projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}/servingConfigs/#{serving_config}"
|
79
|
+
end),
|
80
|
+
"collection:engine:location:project:serving_config" => (proc do |project:, location:, collection:, engine:, serving_config:|
|
81
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
82
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
83
|
+
raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
|
84
|
+
raise ::ArgumentError, "engine cannot contain /" if engine.to_s.include? "/"
|
85
|
+
|
86
|
+
"projects/#{project}/locations/#{location}/collections/#{collection}/engines/#{engine}/servingConfigs/#{serving_config}"
|
87
|
+
end)
|
88
|
+
}
|
89
|
+
|
90
|
+
resource = resources[args.keys.sort.join(":")]
|
91
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
92
|
+
resource.call(**args)
|
93
|
+
end
|
94
|
+
|
95
|
+
extend self
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|