google-cloud-discovery_engine-v1 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +5 -1
  3. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +5 -1
  4. data/lib/google/cloud/discovery_engine/v1/data_store_service/paths.rb +49 -0
  5. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +49 -21
  6. data/lib/google/cloud/discovery_engine/v1/document_service/paths.rb +21 -0
  7. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +49 -21
  8. data/lib/google/cloud/discovery_engine/v1/recommendation_service/client.rb +553 -0
  9. data/lib/google/cloud/discovery_engine/v1/recommendation_service/credentials.rb +47 -0
  10. data/lib/google/cloud/discovery_engine/v1/recommendation_service/paths.rb +154 -0
  11. data/lib/google/cloud/discovery_engine/v1/recommendation_service/rest/client.rb +520 -0
  12. data/lib/google/cloud/discovery_engine/v1/recommendation_service/rest/service_stub.rb +145 -0
  13. data/lib/google/cloud/discovery_engine/v1/recommendation_service/rest.rb +52 -0
  14. data/lib/google/cloud/discovery_engine/v1/recommendation_service.rb +55 -0
  15. data/lib/google/cloud/discovery_engine/v1/rest.rb +1 -0
  16. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +12 -6
  17. data/lib/google/cloud/discovery_engine/v1/search_service/paths.rb +45 -0
  18. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +12 -6
  19. data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
  20. data/lib/google/cloud/discovery_engine/v1.rb +1 -0
  21. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +1 -1
  22. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +1 -1
  23. data/lib/google/cloud/discoveryengine/v1/data_store_pb.rb +3 -1
  24. data/lib/google/cloud/discoveryengine/v1/document_pb.rb +3 -1
  25. data/lib/google/cloud/discoveryengine/v1/document_service_pb.rb +3 -1
  26. data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +13 -1
  27. data/lib/google/cloud/discoveryengine/v1/purge_config_pb.rb +1 -1
  28. data/lib/google/cloud/discoveryengine/v1/recommendation_service_pb.rb +55 -0
  29. data/lib/google/cloud/discoveryengine/v1/recommendation_service_services_pb.rb +45 -0
  30. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +4 -1
  31. data/proto_docs/google/api/client.rb +4 -0
  32. data/proto_docs/google/cloud/discoveryengine/v1/common.rb +9 -1
  33. data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +5 -0
  34. data/proto_docs/google/cloud/discoveryengine/v1/data_store.rb +16 -0
  35. data/proto_docs/google/cloud/discoveryengine/v1/document.rb +7 -0
  36. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +4 -0
  37. data/proto_docs/google/cloud/discoveryengine/v1/engine.rb +2 -2
  38. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +311 -22
  39. data/proto_docs/google/cloud/discoveryengine/v1/purge_config.rb +3 -0
  40. data/proto_docs/google/cloud/discoveryengine/v1/recommendation_service.rb +228 -0
  41. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +129 -21
  42. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +16 -11
  43. metadata +12 -2
@@ -0,0 +1,553 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/discoveryengine/v1/recommendation_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DiscoveryEngine
26
+ module V1
27
+ module RecommendationService
28
+ ##
29
+ # Client for the RecommendationService service.
30
+ #
31
+ # Service for making recommendations.
32
+ #
33
+ class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
36
+
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :recommendation_service_stub
41
+
42
+ ##
43
+ # Configure the RecommendationService Client class.
44
+ #
45
+ # See {::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all RecommendationService clients
51
+ # ::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.timeout = 5.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the RecommendationService Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # The effective universe domain
104
+ #
105
+ # @return [String]
106
+ #
107
+ def universe_domain
108
+ @recommendation_service_stub.universe_domain
109
+ end
110
+
111
+ ##
112
+ # Create a new RecommendationService client object.
113
+ #
114
+ # @example
115
+ #
116
+ # # Create a client using the default configuration
117
+ # client = ::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client.new
118
+ #
119
+ # # Create a client using a custom configuration
120
+ # client = ::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client.new do |config|
121
+ # config.timeout = 10.0
122
+ # end
123
+ #
124
+ # @yield [config] Configure the RecommendationService client.
125
+ # @yieldparam config [Client::Configuration]
126
+ #
127
+ def initialize
128
+ # These require statements are intentionally placed here to initialize
129
+ # the gRPC module only when it's required.
130
+ # See https://github.com/googleapis/toolkit/issues/446
131
+ require "gapic/grpc"
132
+ require "google/cloud/discoveryengine/v1/recommendation_service_services_pb"
133
+
134
+ # Create the configuration object
135
+ @config = Configuration.new Client.configure
136
+
137
+ # Yield the configuration if needed
138
+ yield @config if block_given?
139
+
140
+ # Create credentials
141
+ credentials = @config.credentials
142
+ # Use self-signed JWT if the endpoint is unchanged from default,
143
+ # but only if the default endpoint does not have a region prefix.
144
+ enable_self_signed_jwt = @config.endpoint.nil? ||
145
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
146
+ !@config.endpoint.split(".").first.include?("-"))
147
+ credentials ||= Credentials.default scope: @config.scope,
148
+ enable_self_signed_jwt: enable_self_signed_jwt
149
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
150
+ credentials = Credentials.new credentials, scope: @config.scope
151
+ end
152
+ @quota_project_id = @config.quota_project
153
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
154
+
155
+ @recommendation_service_stub = ::Gapic::ServiceStub.new(
156
+ ::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Stub,
157
+ credentials: credentials,
158
+ endpoint: @config.endpoint,
159
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
160
+ universe_domain: @config.universe_domain,
161
+ channel_args: @config.channel_args,
162
+ interceptors: @config.interceptors,
163
+ channel_pool_config: @config.channel_pool
164
+ )
165
+
166
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
167
+ config.credentials = credentials
168
+ config.quota_project = @quota_project_id
169
+ config.endpoint = @recommendation_service_stub.endpoint
170
+ config.universe_domain = @recommendation_service_stub.universe_domain
171
+ end
172
+ end
173
+
174
+ ##
175
+ # Get the associated client for mix-in of the Locations.
176
+ #
177
+ # @return [Google::Cloud::Location::Locations::Client]
178
+ #
179
+ attr_reader :location_client
180
+
181
+ # Service calls
182
+
183
+ ##
184
+ # Makes a recommendation, which requires a contextual user event.
185
+ #
186
+ # @overload recommend(request, options = nil)
187
+ # Pass arguments to `recommend` via a request object, either of type
188
+ # {::Google::Cloud::DiscoveryEngine::V1::RecommendRequest} or an equivalent Hash.
189
+ #
190
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::RecommendRequest, ::Hash]
191
+ # A request object representing the call parameters. Required. To specify no
192
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
193
+ # @param options [::Gapic::CallOptions, ::Hash]
194
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
195
+ #
196
+ # @overload recommend(serving_config: nil, user_event: nil, page_size: nil, filter: nil, validate_only: nil, params: nil, user_labels: nil)
197
+ # Pass arguments to `recommend` via keyword arguments. Note that at
198
+ # least one keyword argument is required. To specify no parameters, or to keep all
199
+ # the default parameter values, pass an empty Hash as a request object (see above).
200
+ #
201
+ # @param serving_config [::String]
202
+ # Required. Full resource name of a [ServingConfig][]:
203
+ # `projects/*/locations/global/collections/*/engines/*/servingConfigs/*`, or
204
+ # `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*`
205
+ #
206
+ # One default serving config is created along with your recommendation engine
207
+ # creation. The engine ID will be used as the ID of the default serving
208
+ # config. For example, for Engine
209
+ # `projects/*/locations/global/collections/*/engines/my-engine`, you can use
210
+ # `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine`
211
+ # for your
212
+ # {::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client#recommend RecommendationService.Recommend}
213
+ # requests.
214
+ # @param user_event [::Google::Cloud::DiscoveryEngine::V1::UserEvent, ::Hash]
215
+ # Required. Context about the user, what they are looking at and what action
216
+ # they took to trigger the Recommend request. Note that this user event
217
+ # detail won't be ingested to userEvent logs. Thus, a separate userEvent
218
+ # write request is required for event logging.
219
+ #
220
+ # Don't set
221
+ # {::Google::Cloud::DiscoveryEngine::V1::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
222
+ # or
223
+ # {::Google::Cloud::DiscoveryEngine::V1::UserInfo#user_id UserEvent.user_info.user_id}
224
+ # to the same fixed ID for different users. If you are trying to receive
225
+ # non-personalized recommendations (not recommended; this can negatively
226
+ # impact model performance), instead set
227
+ # {::Google::Cloud::DiscoveryEngine::V1::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
228
+ # to a random unique ID and leave
229
+ # {::Google::Cloud::DiscoveryEngine::V1::UserInfo#user_id UserEvent.user_info.user_id}
230
+ # unset.
231
+ # @param page_size [::Integer]
232
+ # Maximum number of results to return. Set this property
233
+ # to the number of recommendation results needed. If zero, the service will
234
+ # choose a reasonable default. The maximum allowed value is 100. Values
235
+ # above 100 will be coerced to 100.
236
+ # @param filter [::String]
237
+ # Filter for restricting recommendation results with a length limit of 5,000
238
+ # characters. Currently, only filter expressions on the `filter_tags`
239
+ # attribute is supported.
240
+ #
241
+ #
242
+ # Examples:
243
+ #
244
+ # * `(filter_tags: ANY("Red", "Blue") OR filter_tags: ANY("Hot", "Cold"))`
245
+ # * `(filter_tags: ANY("Red", "Blue")) AND NOT (filter_tags: ANY("Green"))`
246
+ #
247
+ # If `attributeFilteringSyntax` is set to true under the `params` field, then
248
+ # attribute-based expressions are expected instead of the above described
249
+ # tag-based syntax. Examples:
250
+ #
251
+ # * (launguage: ANY("en", "es")) AND NOT (categories: ANY("Movie"))
252
+ # * (available: true) AND
253
+ # (launguage: ANY("en", "es")) OR (categories: ANY("Movie"))
254
+ #
255
+ # If your filter blocks all results, the API will return generic
256
+ # (unfiltered) popular Documents. If you only want results strictly matching
257
+ # the filters, set `strictFiltering` to True in
258
+ # {::Google::Cloud::DiscoveryEngine::V1::RecommendRequest#params RecommendRequest.params}
259
+ # to receive empty results instead.
260
+ #
261
+ # Note that the API will never return
262
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s with `storageStatus`
263
+ # of `EXPIRED` or `DELETED` regardless of filter choices.
264
+ # @param validate_only [::Boolean]
265
+ # Use validate only mode for this recommendation query. If set to true, a
266
+ # fake model will be used that returns arbitrary Document IDs.
267
+ # Note that the validate only mode should only be used for testing the API,
268
+ # or if the model is not ready.
269
+ # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
270
+ # Additional domain specific parameters for the recommendations.
271
+ #
272
+ # Allowed values:
273
+ #
274
+ # * `returnDocument`: Boolean. If set to true, the associated Document
275
+ # object will be returned in
276
+ # {::Google::Cloud::DiscoveryEngine::V1::RecommendResponse::RecommendationResult#document RecommendResponse.RecommendationResult.document}.
277
+ # * `returnScore`: Boolean. If set to true, the recommendation 'score'
278
+ # corresponding to each returned Document will be set in
279
+ # {::Google::Cloud::DiscoveryEngine::V1::RecommendResponse::RecommendationResult#metadata RecommendResponse.RecommendationResult.metadata}.
280
+ # The given 'score' indicates the probability of a Document conversion
281
+ # given the user's context and history.
282
+ # * `strictFiltering`: Boolean. True by default. If set to false, the service
283
+ # will return generic (unfiltered) popular Documents instead of empty if
284
+ # your filter blocks all recommendation results.
285
+ # * `diversityLevel`: String. Default empty. If set to be non-empty, then
286
+ # it needs to be one of:
287
+ # * `no-diversity`
288
+ # * `low-diversity`
289
+ # * `medium-diversity`
290
+ # * `high-diversity`
291
+ # * `auto-diversity`
292
+ # This gives request-level control and adjusts recommendation results
293
+ # based on Document category.
294
+ # * `attributeFilteringSyntax`: Boolean. False by default. If set to true,
295
+ # the `filter` field is interpreted according to the new,
296
+ # attribute-based syntax.
297
+ # @param user_labels [::Hash{::String => ::String}]
298
+ # The user labels applied to a resource must meet the following requirements:
299
+ #
300
+ # * Each resource can have multiple labels, up to a maximum of 64.
301
+ # * Each label must be a key-value pair.
302
+ # * Keys have a minimum length of 1 character and a maximum length of 63
303
+ # characters and cannot be empty. Values can be empty and have a maximum
304
+ # length of 63 characters.
305
+ # * Keys and values can contain only lowercase letters, numeric characters,
306
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
307
+ # international characters are allowed.
308
+ # * The key portion of a label must be unique. However, you can use the same
309
+ # key with multiple resources.
310
+ # * Keys must start with a lowercase letter or international character.
311
+ #
312
+ # See [Requirements for
313
+ # labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
314
+ # for more details.
315
+ #
316
+ # @yield [response, operation] Access the result along with the RPC operation
317
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::RecommendResponse]
318
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
319
+ #
320
+ # @return [::Google::Cloud::DiscoveryEngine::V1::RecommendResponse]
321
+ #
322
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
323
+ #
324
+ # @example Basic example
325
+ # require "google/cloud/discovery_engine/v1"
326
+ #
327
+ # # Create a client object. The client can be reused for multiple calls.
328
+ # client = Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client.new
329
+ #
330
+ # # Create a request. To set request fields, pass in keyword arguments.
331
+ # request = Google::Cloud::DiscoveryEngine::V1::RecommendRequest.new
332
+ #
333
+ # # Call the recommend method.
334
+ # result = client.recommend request
335
+ #
336
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1::RecommendResponse.
337
+ # p result
338
+ #
339
+ def recommend request, options = nil
340
+ raise ::ArgumentError, "request must be provided" if request.nil?
341
+
342
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::RecommendRequest
343
+
344
+ # Converts hash and nil to an options object
345
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
346
+
347
+ # Customize the options with defaults
348
+ metadata = @config.rpcs.recommend.metadata.to_h
349
+
350
+ # Set x-goog-api-client and x-goog-user-project headers
351
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
352
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
353
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
354
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
355
+
356
+ header_params = {}
357
+ if request.serving_config
358
+ header_params["serving_config"] = request.serving_config
359
+ end
360
+
361
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
362
+ metadata[:"x-goog-request-params"] ||= request_params_header
363
+
364
+ options.apply_defaults timeout: @config.rpcs.recommend.timeout,
365
+ metadata: metadata,
366
+ retry_policy: @config.rpcs.recommend.retry_policy
367
+
368
+ options.apply_defaults timeout: @config.timeout,
369
+ metadata: @config.metadata,
370
+ retry_policy: @config.retry_policy
371
+
372
+ @recommendation_service_stub.call_rpc :recommend, request, options: options do |response, operation|
373
+ yield response, operation if block_given?
374
+ return response
375
+ end
376
+ rescue ::GRPC::BadStatus => e
377
+ raise ::Google::Cloud::Error.from_error(e)
378
+ end
379
+
380
+ ##
381
+ # Configuration class for the RecommendationService API.
382
+ #
383
+ # This class represents the configuration for RecommendationService,
384
+ # providing control over timeouts, retry behavior, logging, transport
385
+ # parameters, and other low-level controls. Certain parameters can also be
386
+ # applied individually to specific RPCs. See
387
+ # {::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client::Configuration::Rpcs}
388
+ # for a list of RPCs that can be configured independently.
389
+ #
390
+ # Configuration can be applied globally to all clients, or to a single client
391
+ # on construction.
392
+ #
393
+ # @example
394
+ #
395
+ # # Modify the global config, setting the timeout for
396
+ # # recommend to 20 seconds,
397
+ # # and all remaining timeouts to 10 seconds.
398
+ # ::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client.configure do |config|
399
+ # config.timeout = 10.0
400
+ # config.rpcs.recommend.timeout = 20.0
401
+ # end
402
+ #
403
+ # # Apply the above configuration only to a new client.
404
+ # client = ::Google::Cloud::DiscoveryEngine::V1::RecommendationService::Client.new do |config|
405
+ # config.timeout = 10.0
406
+ # config.rpcs.recommend.timeout = 20.0
407
+ # end
408
+ #
409
+ # @!attribute [rw] endpoint
410
+ # A custom service endpoint, as a hostname or hostname:port. The default is
411
+ # nil, indicating to use the default endpoint in the current universe domain.
412
+ # @return [::String,nil]
413
+ # @!attribute [rw] credentials
414
+ # Credentials to send with calls. You may provide any of the following types:
415
+ # * (`String`) The path to a service account key file in JSON format
416
+ # * (`Hash`) A service account key as a Hash
417
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
418
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
419
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
420
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
421
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
422
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
423
+ # * (`nil`) indicating no credentials
424
+ # @return [::Object]
425
+ # @!attribute [rw] scope
426
+ # The OAuth scopes
427
+ # @return [::Array<::String>]
428
+ # @!attribute [rw] lib_name
429
+ # The library name as recorded in instrumentation and logging
430
+ # @return [::String]
431
+ # @!attribute [rw] lib_version
432
+ # The library version as recorded in instrumentation and logging
433
+ # @return [::String]
434
+ # @!attribute [rw] channel_args
435
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
436
+ # `GRPC::Core::Channel` object is provided as the credential.
437
+ # @return [::Hash]
438
+ # @!attribute [rw] interceptors
439
+ # An array of interceptors that are run before calls are executed.
440
+ # @return [::Array<::GRPC::ClientInterceptor>]
441
+ # @!attribute [rw] timeout
442
+ # The call timeout in seconds.
443
+ # @return [::Numeric]
444
+ # @!attribute [rw] metadata
445
+ # Additional gRPC headers to be sent with the call.
446
+ # @return [::Hash{::Symbol=>::String}]
447
+ # @!attribute [rw] retry_policy
448
+ # The retry policy. The value is a hash with the following keys:
449
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
450
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
451
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
452
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
453
+ # trigger a retry.
454
+ # @return [::Hash]
455
+ # @!attribute [rw] quota_project
456
+ # A separate project against which to charge quota.
457
+ # @return [::String]
458
+ # @!attribute [rw] universe_domain
459
+ # The universe domain within which to make requests. This determines the
460
+ # default endpoint URL. The default value of nil uses the environment
461
+ # universe (usually the default "googleapis.com" universe).
462
+ # @return [::String,nil]
463
+ #
464
+ class Configuration
465
+ extend ::Gapic::Config
466
+
467
+ # @private
468
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
469
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
470
+
471
+ config_attr :endpoint, nil, ::String, nil
472
+ config_attr :credentials, nil do |value|
473
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
474
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
475
+ allowed.any? { |klass| klass === value }
476
+ end
477
+ config_attr :scope, nil, ::String, ::Array, nil
478
+ config_attr :lib_name, nil, ::String, nil
479
+ config_attr :lib_version, nil, ::String, nil
480
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
481
+ config_attr :interceptors, nil, ::Array, nil
482
+ config_attr :timeout, nil, ::Numeric, nil
483
+ config_attr :metadata, nil, ::Hash, nil
484
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
485
+ config_attr :quota_project, nil, ::String, nil
486
+ config_attr :universe_domain, nil, ::String, nil
487
+
488
+ # @private
489
+ def initialize parent_config = nil
490
+ @parent_config = parent_config unless parent_config.nil?
491
+
492
+ yield self if block_given?
493
+ end
494
+
495
+ ##
496
+ # Configurations for individual RPCs
497
+ # @return [Rpcs]
498
+ #
499
+ def rpcs
500
+ @rpcs ||= begin
501
+ parent_rpcs = nil
502
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
503
+ Rpcs.new parent_rpcs
504
+ end
505
+ end
506
+
507
+ ##
508
+ # Configuration for the channel pool
509
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
510
+ #
511
+ def channel_pool
512
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
513
+ end
514
+
515
+ ##
516
+ # Configuration RPC class for the RecommendationService API.
517
+ #
518
+ # Includes fields providing the configuration for each RPC in this service.
519
+ # Each configuration object is of type `Gapic::Config::Method` and includes
520
+ # the following configuration fields:
521
+ #
522
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
523
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
524
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
525
+ # include the following keys:
526
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
527
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
528
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
529
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
530
+ # trigger a retry.
531
+ #
532
+ class Rpcs
533
+ ##
534
+ # RPC-specific configuration for `recommend`
535
+ # @return [::Gapic::Config::Method]
536
+ #
537
+ attr_reader :recommend
538
+
539
+ # @private
540
+ def initialize parent_rpcs = nil
541
+ recommend_config = parent_rpcs.recommend if parent_rpcs.respond_to? :recommend
542
+ @recommend = ::Gapic::Config::Method.new recommend_config
543
+
544
+ yield self if block_given?
545
+ end
546
+ end
547
+ end
548
+ end
549
+ end
550
+ end
551
+ end
552
+ end
553
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module DiscoveryEngine
24
+ module V1
25
+ module RecommendationService
26
+ # Credentials for the RecommendationService 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