google-cloud-discovery_engine-v1 0.a → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +431 -0
  6. data/lib/google/cloud/discovery_engine/v1/completion_service/credentials.rb +47 -0
  7. data/lib/google/cloud/discovery_engine/v1/completion_service/paths.rb +78 -0
  8. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +388 -0
  9. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/service_stub.rb +114 -0
  10. data/lib/google/cloud/discovery_engine/v1/completion_service/rest.rb +52 -0
  11. data/lib/google/cloud/discovery_engine/v1/completion_service.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +1155 -0
  13. data/lib/google/cloud/discovery_engine/v1/document_service/credentials.rb +47 -0
  14. data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +770 -0
  15. data/lib/google/cloud/discovery_engine/v1/document_service/paths.rb +135 -0
  16. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +956 -0
  17. data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +935 -0
  18. data/lib/google/cloud/discovery_engine/v1/document_service/rest/service_stub.rb +518 -0
  19. data/lib/google/cloud/discovery_engine/v1/document_service/rest.rb +54 -0
  20. data/lib/google/cloud/discovery_engine/v1/document_service.rb +57 -0
  21. data/lib/google/cloud/discovery_engine/v1/rest.rb +41 -0
  22. data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +839 -0
  23. data/lib/google/cloud/discovery_engine/v1/schema_service/credentials.rb +47 -0
  24. data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +770 -0
  25. data/lib/google/cloud/discovery_engine/v1/schema_service/paths.rb +127 -0
  26. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +679 -0
  27. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +935 -0
  28. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/service_stub.rb +382 -0
  29. data/lib/google/cloud/discovery_engine/v1/schema_service/rest.rb +53 -0
  30. data/lib/google/cloud/discovery_engine/v1/schema_service.rb +56 -0
  31. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +493 -0
  32. data/lib/google/cloud/discovery_engine/v1/search_service/credentials.rb +47 -0
  33. data/lib/google/cloud/discovery_engine/v1/search_service/paths.rb +131 -0
  34. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +446 -0
  35. data/lib/google/cloud/discovery_engine/v1/search_service/rest/service_stub.rb +116 -0
  36. data/lib/google/cloud/discovery_engine/v1/search_service/rest.rb +52 -0
  37. data/lib/google/cloud/discovery_engine/v1/search_service.rb +55 -0
  38. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +640 -0
  39. data/lib/google/cloud/discovery_engine/v1/user_event_service/credentials.rb +47 -0
  40. data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +770 -0
  41. data/lib/google/cloud/discovery_engine/v1/user_event_service/paths.rb +131 -0
  42. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +544 -0
  43. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +935 -0
  44. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +250 -0
  45. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest.rb +53 -0
  46. data/lib/google/cloud/discovery_engine/v1/user_event_service.rb +56 -0
  47. data/lib/google/cloud/discovery_engine/v1/version.rb +7 -2
  48. data/lib/google/cloud/discovery_engine/v1.rb +49 -0
  49. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +45 -0
  50. data/lib/google/cloud/discoveryengine/v1/completion_service_pb.rb +49 -0
  51. data/lib/google/cloud/discoveryengine/v1/completion_service_services_pb.rb +45 -0
  52. data/lib/google/cloud/discoveryengine/v1/document_pb.rb +48 -0
  53. data/lib/google/cloud/discoveryengine/v1/document_service_pb.rb +58 -0
  54. data/lib/google/cloud/discoveryengine/v1/document_service_services_pb.rb +79 -0
  55. data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +66 -0
  56. data/lib/google/cloud/discoveryengine/v1/purge_config_pb.rb +49 -0
  57. data/lib/google/cloud/discoveryengine/v1/schema_pb.rb +47 -0
  58. data/lib/google/cloud/discoveryengine/v1/schema_service_pb.rb +61 -0
  59. data/lib/google/cloud/discoveryengine/v1/schema_service_services_pb.rb +53 -0
  60. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +61 -0
  61. data/lib/google/cloud/discoveryengine/v1/search_service_services_pb.rb +45 -0
  62. data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +58 -0
  63. data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +53 -0
  64. data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +59 -0
  65. data/lib/google-cloud-discovery_engine-v1.rb +21 -0
  66. data/proto_docs/README.md +4 -0
  67. data/proto_docs/google/api/client.rb +381 -0
  68. data/proto_docs/google/api/field_behavior.rb +71 -0
  69. data/proto_docs/google/api/httpbody.rb +80 -0
  70. data/proto_docs/google/api/launch_stage.rb +71 -0
  71. data/proto_docs/google/api/resource.rb +222 -0
  72. data/proto_docs/google/cloud/discoveryengine/v1/common.rb +89 -0
  73. data/proto_docs/google/cloud/discoveryengine/v1/completion_service.rb +98 -0
  74. data/proto_docs/google/cloud/discoveryengine/v1/document.rb +105 -0
  75. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +180 -0
  76. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +336 -0
  77. data/proto_docs/google/cloud/discoveryengine/v1/purge_config.rb +84 -0
  78. data/proto_docs/google/cloud/discoveryengine/v1/schema.rb +45 -0
  79. data/proto_docs/google/cloud/discoveryengine/v1/schema_service.rb +177 -0
  80. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +294 -0
  81. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +466 -0
  82. data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +64 -0
  83. data/proto_docs/google/longrunning/operations.rb +164 -0
  84. data/proto_docs/google/protobuf/any.rb +144 -0
  85. data/proto_docs/google/protobuf/duration.rb +98 -0
  86. data/proto_docs/google/protobuf/empty.rb +34 -0
  87. data/proto_docs/google/protobuf/struct.rb +96 -0
  88. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  89. data/proto_docs/google/rpc/status.rb +48 -0
  90. data/proto_docs/google/type/date.rb +53 -0
  91. metadata +243 -12
@@ -0,0 +1,431 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/discoveryengine/v1/completion_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module DiscoveryEngine
25
+ module V1
26
+ module CompletionService
27
+ ##
28
+ # Client for the CompletionService service.
29
+ #
30
+ # Service for Auto-Completion.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :completion_service_stub
37
+
38
+ ##
39
+ # Configure the CompletionService Client class.
40
+ #
41
+ # See {::Google::Cloud::DiscoveryEngine::V1::CompletionService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all CompletionService clients
47
+ # ::Google::Cloud::DiscoveryEngine::V1::CompletionService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config.timeout = 5.0
68
+ default_config.retry_policy = {
69
+ initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14]
70
+ }
71
+
72
+ default_config
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the CompletionService Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::DiscoveryEngine::V1::CompletionService::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # Create a new CompletionService client object.
100
+ #
101
+ # @example
102
+ #
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::DiscoveryEngine::V1::CompletionService::Client.new
105
+ #
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::DiscoveryEngine::V1::CompletionService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the CompletionService client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/cloud/discoveryengine/v1/completion_service_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
132
+ !@config.endpoint.split(".").first.include?("-")
133
+ credentials ||= Credentials.default scope: @config.scope,
134
+ enable_self_signed_jwt: enable_self_signed_jwt
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
136
+ credentials = Credentials.new credentials, scope: @config.scope
137
+ end
138
+ @quota_project_id = @config.quota_project
139
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
+
141
+ @completion_service_stub = ::Gapic::ServiceStub.new(
142
+ ::Google::Cloud::DiscoveryEngine::V1::CompletionService::Stub,
143
+ credentials: credentials,
144
+ endpoint: @config.endpoint,
145
+ channel_args: @config.channel_args,
146
+ interceptors: @config.interceptors
147
+ )
148
+ end
149
+
150
+ # Service calls
151
+
152
+ ##
153
+ # Completes the specified user input with keyword suggestions.
154
+ #
155
+ # @overload complete_query(request, options = nil)
156
+ # Pass arguments to `complete_query` via a request object, either of type
157
+ # {::Google::Cloud::DiscoveryEngine::V1::CompleteQueryRequest} or an equivalent Hash.
158
+ #
159
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::CompleteQueryRequest, ::Hash]
160
+ # A request object representing the call parameters. Required. To specify no
161
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
162
+ # @param options [::Gapic::CallOptions, ::Hash]
163
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
164
+ #
165
+ # @overload complete_query(data_store: nil, query: nil, query_model: nil, user_pseudo_id: nil)
166
+ # Pass arguments to `complete_query` via keyword arguments. Note that at
167
+ # least one keyword argument is required. To specify no parameters, or to keep all
168
+ # the default parameter values, pass an empty Hash as a request object (see above).
169
+ #
170
+ # @param data_store [::String]
171
+ # Required. The parent data store resource name for which the completion is
172
+ # performed, such as
173
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`.
174
+ # @param query [::String]
175
+ # Required. The typeahead input used to fetch suggestions. Maximum length is
176
+ # 128 characters.
177
+ # @param query_model [::String]
178
+ # Selects data model of query suggestions for serving. Currently supported
179
+ # values:
180
+ #
181
+ # * `document` - Using suggestions generated from user-imported documents.
182
+ # * `search-history` - Using suggestions generated from the past history of
183
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search}
184
+ # API calls. Do not use it when there is no traffic for Search API.
185
+ # * `user-event` - Using suggestions generated from user-imported search
186
+ # events.
187
+ #
188
+ # Default values:
189
+ #
190
+ # * `document` is the default model for regular dataStores.
191
+ # * `search-history` is the default model for
192
+ # [IndustryVertical.SITE_SEARCH][google.cloud.discoveryengine.v1.IndustryVertical.SITE_SEARCH]
193
+ # dataStores.
194
+ # @param user_pseudo_id [::String]
195
+ # A unique identifier for tracking visitors. For example, this could be
196
+ # implemented with an HTTP cookie, which should be able to uniquely identify
197
+ # a visitor on a single device. This unique identifier should not change if
198
+ # the visitor logs in or out of the website.
199
+ #
200
+ # This field should NOT have a fixed value such as `unknown_visitor`.
201
+ #
202
+ # This should be the same identifier as
203
+ # {::Google::Cloud::DiscoveryEngine::V1::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
204
+ # and
205
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#user_pseudo_id SearchRequest.user_pseudo_id}.
206
+ #
207
+ # The field must be a UTF-8 encoded string with a length limit of 128
208
+ # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
209
+ #
210
+ # @yield [response, operation] Access the result along with the RPC operation
211
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::CompleteQueryResponse]
212
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
213
+ #
214
+ # @return [::Google::Cloud::DiscoveryEngine::V1::CompleteQueryResponse]
215
+ #
216
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
217
+ #
218
+ # @example Basic example
219
+ # require "google/cloud/discovery_engine/v1"
220
+ #
221
+ # # Create a client object. The client can be reused for multiple calls.
222
+ # client = Google::Cloud::DiscoveryEngine::V1::CompletionService::Client.new
223
+ #
224
+ # # Create a request. To set request fields, pass in keyword arguments.
225
+ # request = Google::Cloud::DiscoveryEngine::V1::CompleteQueryRequest.new
226
+ #
227
+ # # Call the complete_query method.
228
+ # result = client.complete_query request
229
+ #
230
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1::CompleteQueryResponse.
231
+ # p result
232
+ #
233
+ def complete_query request, options = nil
234
+ raise ::ArgumentError, "request must be provided" if request.nil?
235
+
236
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CompleteQueryRequest
237
+
238
+ # Converts hash and nil to an options object
239
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
240
+
241
+ # Customize the options with defaults
242
+ metadata = @config.rpcs.complete_query.metadata.to_h
243
+
244
+ # Set x-goog-api-client and x-goog-user-project headers
245
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
246
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
247
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
248
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
249
+
250
+ header_params = {}
251
+ if request.data_store
252
+ header_params["data_store"] = request.data_store
253
+ end
254
+
255
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
256
+ metadata[:"x-goog-request-params"] ||= request_params_header
257
+
258
+ options.apply_defaults timeout: @config.rpcs.complete_query.timeout,
259
+ metadata: metadata,
260
+ retry_policy: @config.rpcs.complete_query.retry_policy
261
+
262
+ options.apply_defaults timeout: @config.timeout,
263
+ metadata: @config.metadata,
264
+ retry_policy: @config.retry_policy
265
+
266
+ @completion_service_stub.call_rpc :complete_query, request, options: options do |response, operation|
267
+ yield response, operation if block_given?
268
+ return response
269
+ end
270
+ rescue ::GRPC::BadStatus => e
271
+ raise ::Google::Cloud::Error.from_error(e)
272
+ end
273
+
274
+ ##
275
+ # Configuration class for the CompletionService API.
276
+ #
277
+ # This class represents the configuration for CompletionService,
278
+ # providing control over timeouts, retry behavior, logging, transport
279
+ # parameters, and other low-level controls. Certain parameters can also be
280
+ # applied individually to specific RPCs. See
281
+ # {::Google::Cloud::DiscoveryEngine::V1::CompletionService::Client::Configuration::Rpcs}
282
+ # for a list of RPCs that can be configured independently.
283
+ #
284
+ # Configuration can be applied globally to all clients, or to a single client
285
+ # on construction.
286
+ #
287
+ # @example
288
+ #
289
+ # # Modify the global config, setting the timeout for
290
+ # # complete_query to 20 seconds,
291
+ # # and all remaining timeouts to 10 seconds.
292
+ # ::Google::Cloud::DiscoveryEngine::V1::CompletionService::Client.configure do |config|
293
+ # config.timeout = 10.0
294
+ # config.rpcs.complete_query.timeout = 20.0
295
+ # end
296
+ #
297
+ # # Apply the above configuration only to a new client.
298
+ # client = ::Google::Cloud::DiscoveryEngine::V1::CompletionService::Client.new do |config|
299
+ # config.timeout = 10.0
300
+ # config.rpcs.complete_query.timeout = 20.0
301
+ # end
302
+ #
303
+ # @!attribute [rw] endpoint
304
+ # The hostname or hostname:port of the service endpoint.
305
+ # Defaults to `"discoveryengine.googleapis.com"`.
306
+ # @return [::String]
307
+ # @!attribute [rw] credentials
308
+ # Credentials to send with calls. You may provide any of the following types:
309
+ # * (`String`) The path to a service account key file in JSON format
310
+ # * (`Hash`) A service account key as a Hash
311
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
312
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
313
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
314
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
315
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
316
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
317
+ # * (`nil`) indicating no credentials
318
+ # @return [::Object]
319
+ # @!attribute [rw] scope
320
+ # The OAuth scopes
321
+ # @return [::Array<::String>]
322
+ # @!attribute [rw] lib_name
323
+ # The library name as recorded in instrumentation and logging
324
+ # @return [::String]
325
+ # @!attribute [rw] lib_version
326
+ # The library version as recorded in instrumentation and logging
327
+ # @return [::String]
328
+ # @!attribute [rw] channel_args
329
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
330
+ # `GRPC::Core::Channel` object is provided as the credential.
331
+ # @return [::Hash]
332
+ # @!attribute [rw] interceptors
333
+ # An array of interceptors that are run before calls are executed.
334
+ # @return [::Array<::GRPC::ClientInterceptor>]
335
+ # @!attribute [rw] timeout
336
+ # The call timeout in seconds.
337
+ # @return [::Numeric]
338
+ # @!attribute [rw] metadata
339
+ # Additional gRPC headers to be sent with the call.
340
+ # @return [::Hash{::Symbol=>::String}]
341
+ # @!attribute [rw] retry_policy
342
+ # The retry policy. The value is a hash with the following keys:
343
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
344
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
345
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
346
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
347
+ # trigger a retry.
348
+ # @return [::Hash]
349
+ # @!attribute [rw] quota_project
350
+ # A separate project against which to charge quota.
351
+ # @return [::String]
352
+ #
353
+ class Configuration
354
+ extend ::Gapic::Config
355
+
356
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
357
+
358
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
359
+ config_attr :credentials, nil do |value|
360
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
361
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
362
+ allowed.any? { |klass| klass === value }
363
+ end
364
+ config_attr :scope, nil, ::String, ::Array, nil
365
+ config_attr :lib_name, nil, ::String, nil
366
+ config_attr :lib_version, nil, ::String, nil
367
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
368
+ config_attr :interceptors, nil, ::Array, nil
369
+ config_attr :timeout, nil, ::Numeric, nil
370
+ config_attr :metadata, nil, ::Hash, nil
371
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
372
+ config_attr :quota_project, nil, ::String, nil
373
+
374
+ # @private
375
+ def initialize parent_config = nil
376
+ @parent_config = parent_config unless parent_config.nil?
377
+
378
+ yield self if block_given?
379
+ end
380
+
381
+ ##
382
+ # Configurations for individual RPCs
383
+ # @return [Rpcs]
384
+ #
385
+ def rpcs
386
+ @rpcs ||= begin
387
+ parent_rpcs = nil
388
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
389
+ Rpcs.new parent_rpcs
390
+ end
391
+ end
392
+
393
+ ##
394
+ # Configuration RPC class for the CompletionService API.
395
+ #
396
+ # Includes fields providing the configuration for each RPC in this service.
397
+ # Each configuration object is of type `Gapic::Config::Method` and includes
398
+ # the following configuration fields:
399
+ #
400
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
401
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
402
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
403
+ # include the following keys:
404
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
405
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
406
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
407
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
408
+ # trigger a retry.
409
+ #
410
+ class Rpcs
411
+ ##
412
+ # RPC-specific configuration for `complete_query`
413
+ # @return [::Gapic::Config::Method]
414
+ #
415
+ attr_reader :complete_query
416
+
417
+ # @private
418
+ def initialize parent_rpcs = nil
419
+ complete_query_config = parent_rpcs.complete_query if parent_rpcs.respond_to? :complete_query
420
+ @complete_query = ::Gapic::Config::Method.new complete_query_config
421
+
422
+ yield self if block_given?
423
+ end
424
+ end
425
+ end
426
+ end
427
+ end
428
+ end
429
+ end
430
+ end
431
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module DiscoveryEngine
24
+ module V1
25
+ module CompletionService
26
+ # Credentials for the CompletionService 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,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module DiscoveryEngine
23
+ module V1
24
+ module CompletionService
25
+ # Path helper methods for the CompletionService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified DataStore resource string.
29
+ #
30
+ # @overload data_store_path(project:, location:, data_store:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/locations/{location}/dataStores/{data_store}`
34
+ #
35
+ # @param project [String]
36
+ # @param location [String]
37
+ # @param data_store [String]
38
+ #
39
+ # @overload data_store_path(project:, location:, collection:, data_store:)
40
+ # The resource will be in the following format:
41
+ #
42
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
43
+ #
44
+ # @param project [String]
45
+ # @param location [String]
46
+ # @param collection [String]
47
+ # @param data_store [String]
48
+ #
49
+ # @return [::String]
50
+ def data_store_path **args
51
+ resources = {
52
+ "data_store:location:project" => (proc do |project:, location:, data_store:|
53
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
54
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
55
+
56
+ "projects/#{project}/locations/#{location}/dataStores/#{data_store}"
57
+ end),
58
+ "collection:data_store:location:project" => (proc do |project:, location:, collection:, data_store:|
59
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
60
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
61
+ raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
62
+
63
+ "projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}"
64
+ end)
65
+ }
66
+
67
+ resource = resources[args.keys.sort.join(":")]
68
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
69
+ resource.call(**args)
70
+ end
71
+
72
+ extend self
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end