google-cloud-discovery_engine-v1 0.a → 0.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.
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,493 @@
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/search_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module DiscoveryEngine
25
+ module V1
26
+ module SearchService
27
+ ##
28
+ # Client for the SearchService service.
29
+ #
30
+ # Service for search.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :search_service_stub
37
+
38
+ ##
39
+ # Configure the SearchService Client class.
40
+ #
41
+ # See {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all SearchService clients
47
+ # ::Google::Cloud::DiscoveryEngine::V1::SearchService::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 SearchService 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::SearchService::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 SearchService client object.
100
+ #
101
+ # @example
102
+ #
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new
105
+ #
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the SearchService 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/search_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
+ @search_service_stub = ::Gapic::ServiceStub.new(
142
+ ::Google::Cloud::DiscoveryEngine::V1::SearchService::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
+ # Performs a search.
154
+ #
155
+ # @overload search(request, options = nil)
156
+ # Pass arguments to `search` via a request object, either of type
157
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest} or an equivalent Hash.
158
+ #
159
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::SearchRequest, ::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 search(serving_config: nil, branch: nil, query: nil, page_size: nil, page_token: nil, offset: nil, user_info: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil)
166
+ # Pass arguments to `search` 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 serving_config [::String]
171
+ # Required. The resource name of the Search serving config, such as
172
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`.
173
+ # This field is used to identify the serving configuration name, set
174
+ # of models used to make the search.
175
+ # @param branch [::String]
176
+ # The branch resource name, such as
177
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0`.
178
+ #
179
+ # Use `default_branch` as the branch ID or leave this field empty, to search
180
+ # documents under the default branch.
181
+ # @param query [::String]
182
+ # Raw search query.
183
+ # @param page_size [::Integer]
184
+ # Maximum number of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to
185
+ # return. If unspecified, defaults to a reasonable value. The maximum allowed
186
+ # value is 100. Values above 100 will be coerced to 100.
187
+ #
188
+ # If this field is negative, an `INVALID_ARGUMENT` is returned.
189
+ # @param page_token [::String]
190
+ # A page token received from a previous
191
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search}
192
+ # call. Provide this to retrieve the subsequent page.
193
+ #
194
+ # When paginating, all other parameters provided to
195
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search}
196
+ # must match the call that provided the page token. Otherwise, an
197
+ # `INVALID_ARGUMENT` error is returned.
198
+ # @param offset [::Integer]
199
+ # A 0-indexed integer that specifies the current offset (that is, starting
200
+ # result location, amongst the
201
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s deemed by the API as
202
+ # relevant) in search results. This field is only considered if
203
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#page_token page_token} is
204
+ # unset.
205
+ #
206
+ # If this field is negative, an `INVALID_ARGUMENT` is returned.
207
+ # @param user_info [::Google::Cloud::DiscoveryEngine::V1::UserInfo, ::Hash]
208
+ # Information about the end user.
209
+ # Highly recommended for analytics. The user_agent string in UserInfo will
210
+ # be used to deduce device_type for analytics.
211
+ # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
212
+ # Additional search parameters.
213
+ #
214
+ # For public website search only, supported values are:
215
+ #
216
+ # * `user_country_code`: string. Default empty. If set to non-empty, results
217
+ # are restricted or boosted based on the location provided.
218
+ # * `search_type`: double. Default empty. Enables non-webpage searching
219
+ # depending on the value. The only valid non-default value is 1,
220
+ # which enables image searching.
221
+ # @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::QueryExpansionSpec, ::Hash]
222
+ # The query expansion specification that specifies the conditions under which
223
+ # query expansion will occur.
224
+ # @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SpellCorrectionSpec, ::Hash]
225
+ # The spell correction specification that specifies the mode under
226
+ # which spell correction will take effect.
227
+ # @param user_pseudo_id [::String]
228
+ # A unique identifier for tracking visitors. For example, this could be
229
+ # implemented with an HTTP cookie, which should be able to uniquely identify
230
+ # a visitor on a single device. This unique identifier should not change if
231
+ # the visitor logs in or out of the website.
232
+ #
233
+ # This field should NOT have a fixed value such as `unknown_visitor`.
234
+ #
235
+ # This should be the same identifier as
236
+ # {::Google::Cloud::DiscoveryEngine::V1::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
237
+ # and
238
+ # {::Google::Cloud::DiscoveryEngine::V1::CompleteQueryRequest#user_pseudo_id CompleteQueryRequest.user_pseudo_id}
239
+ #
240
+ # The field must be a UTF-8 encoded string with a length limit of 128
241
+ # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
242
+ # @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ContentSearchSpec, ::Hash]
243
+ # The content search spec that configs the desired behavior of content
244
+ # search.
245
+ # @param safe_search [::Boolean]
246
+ # Whether to turn on safe search. This is only supported for
247
+ # [ContentConfig.PUBLIC_WEBSITE][].
248
+ # @param user_labels [::Hash{::String => ::String}]
249
+ # The user labels applied to a resource must meet the following requirements:
250
+ #
251
+ # * Each resource can have multiple labels, up to a maximum of 64.
252
+ # * Each label must be a key-value pair.
253
+ # * Keys have a minimum length of 1 character and a maximum length of 63
254
+ # characters and cannot be empty. Values can be empty and have a maximum
255
+ # length of 63 characters.
256
+ # * Keys and values can contain only lowercase letters, numeric characters,
257
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
258
+ # international characters are allowed.
259
+ # * The key portion of a label must be unique. However, you can use the same
260
+ # key with multiple resources.
261
+ # * Keys must start with a lowercase letter or international character.
262
+ #
263
+ # See [Google Cloud
264
+ # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
265
+ # for more details.
266
+ #
267
+ # @yield [response, operation] Access the result along with the RPC operation
268
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult>]
269
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
270
+ #
271
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult>]
272
+ #
273
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
274
+ #
275
+ # @example Basic example
276
+ # require "google/cloud/discovery_engine/v1"
277
+ #
278
+ # # Create a client object. The client can be reused for multiple calls.
279
+ # client = Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new
280
+ #
281
+ # # Create a request. To set request fields, pass in keyword arguments.
282
+ # request = Google::Cloud::DiscoveryEngine::V1::SearchRequest.new
283
+ #
284
+ # # Call the search method.
285
+ # result = client.search request
286
+ #
287
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
288
+ # # over elements, and API calls will be issued to fetch pages as needed.
289
+ # result.each do |item|
290
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult.
291
+ # p item
292
+ # end
293
+ #
294
+ def search request, options = nil
295
+ raise ::ArgumentError, "request must be provided" if request.nil?
296
+
297
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest
298
+
299
+ # Converts hash and nil to an options object
300
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
301
+
302
+ # Customize the options with defaults
303
+ metadata = @config.rpcs.search.metadata.to_h
304
+
305
+ # Set x-goog-api-client and x-goog-user-project headers
306
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
307
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
308
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
309
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
310
+
311
+ header_params = {}
312
+ if request.serving_config
313
+ header_params["serving_config"] = request.serving_config
314
+ end
315
+
316
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
317
+ metadata[:"x-goog-request-params"] ||= request_params_header
318
+
319
+ options.apply_defaults timeout: @config.rpcs.search.timeout,
320
+ metadata: metadata,
321
+ retry_policy: @config.rpcs.search.retry_policy
322
+
323
+ options.apply_defaults timeout: @config.timeout,
324
+ metadata: @config.metadata,
325
+ retry_policy: @config.retry_policy
326
+
327
+ @search_service_stub.call_rpc :search, request, options: options do |response, operation|
328
+ response = ::Gapic::PagedEnumerable.new @search_service_stub, :search, request, response, operation, options
329
+ yield response, operation if block_given?
330
+ return response
331
+ end
332
+ rescue ::GRPC::BadStatus => e
333
+ raise ::Google::Cloud::Error.from_error(e)
334
+ end
335
+
336
+ ##
337
+ # Configuration class for the SearchService API.
338
+ #
339
+ # This class represents the configuration for SearchService,
340
+ # providing control over timeouts, retry behavior, logging, transport
341
+ # parameters, and other low-level controls. Certain parameters can also be
342
+ # applied individually to specific RPCs. See
343
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client::Configuration::Rpcs}
344
+ # for a list of RPCs that can be configured independently.
345
+ #
346
+ # Configuration can be applied globally to all clients, or to a single client
347
+ # on construction.
348
+ #
349
+ # @example
350
+ #
351
+ # # Modify the global config, setting the timeout for
352
+ # # search to 20 seconds,
353
+ # # and all remaining timeouts to 10 seconds.
354
+ # ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.configure do |config|
355
+ # config.timeout = 10.0
356
+ # config.rpcs.search.timeout = 20.0
357
+ # end
358
+ #
359
+ # # Apply the above configuration only to a new client.
360
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new do |config|
361
+ # config.timeout = 10.0
362
+ # config.rpcs.search.timeout = 20.0
363
+ # end
364
+ #
365
+ # @!attribute [rw] endpoint
366
+ # The hostname or hostname:port of the service endpoint.
367
+ # Defaults to `"discoveryengine.googleapis.com"`.
368
+ # @return [::String]
369
+ # @!attribute [rw] credentials
370
+ # Credentials to send with calls. You may provide any of the following types:
371
+ # * (`String`) The path to a service account key file in JSON format
372
+ # * (`Hash`) A service account key as a Hash
373
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
374
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
375
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
376
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
377
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
378
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
379
+ # * (`nil`) indicating no credentials
380
+ # @return [::Object]
381
+ # @!attribute [rw] scope
382
+ # The OAuth scopes
383
+ # @return [::Array<::String>]
384
+ # @!attribute [rw] lib_name
385
+ # The library name as recorded in instrumentation and logging
386
+ # @return [::String]
387
+ # @!attribute [rw] lib_version
388
+ # The library version as recorded in instrumentation and logging
389
+ # @return [::String]
390
+ # @!attribute [rw] channel_args
391
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
392
+ # `GRPC::Core::Channel` object is provided as the credential.
393
+ # @return [::Hash]
394
+ # @!attribute [rw] interceptors
395
+ # An array of interceptors that are run before calls are executed.
396
+ # @return [::Array<::GRPC::ClientInterceptor>]
397
+ # @!attribute [rw] timeout
398
+ # The call timeout in seconds.
399
+ # @return [::Numeric]
400
+ # @!attribute [rw] metadata
401
+ # Additional gRPC headers to be sent with the call.
402
+ # @return [::Hash{::Symbol=>::String}]
403
+ # @!attribute [rw] retry_policy
404
+ # The retry policy. The value is a hash with the following keys:
405
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
406
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
407
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
408
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
409
+ # trigger a retry.
410
+ # @return [::Hash]
411
+ # @!attribute [rw] quota_project
412
+ # A separate project against which to charge quota.
413
+ # @return [::String]
414
+ #
415
+ class Configuration
416
+ extend ::Gapic::Config
417
+
418
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
419
+
420
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
421
+ config_attr :credentials, nil do |value|
422
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
423
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
424
+ allowed.any? { |klass| klass === value }
425
+ end
426
+ config_attr :scope, nil, ::String, ::Array, nil
427
+ config_attr :lib_name, nil, ::String, nil
428
+ config_attr :lib_version, nil, ::String, nil
429
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
430
+ config_attr :interceptors, nil, ::Array, nil
431
+ config_attr :timeout, nil, ::Numeric, nil
432
+ config_attr :metadata, nil, ::Hash, nil
433
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
434
+ config_attr :quota_project, nil, ::String, nil
435
+
436
+ # @private
437
+ def initialize parent_config = nil
438
+ @parent_config = parent_config unless parent_config.nil?
439
+
440
+ yield self if block_given?
441
+ end
442
+
443
+ ##
444
+ # Configurations for individual RPCs
445
+ # @return [Rpcs]
446
+ #
447
+ def rpcs
448
+ @rpcs ||= begin
449
+ parent_rpcs = nil
450
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
451
+ Rpcs.new parent_rpcs
452
+ end
453
+ end
454
+
455
+ ##
456
+ # Configuration RPC class for the SearchService API.
457
+ #
458
+ # Includes fields providing the configuration for each RPC in this service.
459
+ # Each configuration object is of type `Gapic::Config::Method` and includes
460
+ # the following configuration fields:
461
+ #
462
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
463
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
464
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
465
+ # include the following keys:
466
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
467
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
468
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
469
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
470
+ # trigger a retry.
471
+ #
472
+ class Rpcs
473
+ ##
474
+ # RPC-specific configuration for `search`
475
+ # @return [::Gapic::Config::Method]
476
+ #
477
+ attr_reader :search
478
+
479
+ # @private
480
+ def initialize parent_rpcs = nil
481
+ search_config = parent_rpcs.search if parent_rpcs.respond_to? :search
482
+ @search = ::Gapic::Config::Method.new search_config
483
+
484
+ yield self if block_given?
485
+ end
486
+ end
487
+ end
488
+ end
489
+ end
490
+ end
491
+ end
492
+ end
493
+ 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 SearchService
26
+ # Credentials for the SearchService 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,131 @@
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 SearchService
25
+ # Path helper methods for the SearchService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Branch resource string.
29
+ #
30
+ # @overload branch_path(project:, location:, data_store:, branch:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`
34
+ #
35
+ # @param project [String]
36
+ # @param location [String]
37
+ # @param data_store [String]
38
+ # @param branch [String]
39
+ #
40
+ # @overload branch_path(project:, location:, collection:, data_store:, branch:)
41
+ # The resource will be in the following format:
42
+ #
43
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`
44
+ #
45
+ # @param project [String]
46
+ # @param location [String]
47
+ # @param collection [String]
48
+ # @param data_store [String]
49
+ # @param branch [String]
50
+ #
51
+ # @return [::String]
52
+ def branch_path **args
53
+ resources = {
54
+ "branch:data_store:location:project" => (proc do |project:, location:, data_store:, branch:|
55
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
56
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
57
+ raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
58
+
59
+ "projects/#{project}/locations/#{location}/dataStores/#{data_store}/branches/#{branch}"
60
+ end),
61
+ "branch:collection:data_store:location:project" => (proc do |project:, location:, collection:, data_store:, branch:|
62
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
63
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
64
+ raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
65
+ raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
66
+
67
+ "projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}/branches/#{branch}"
68
+ end)
69
+ }
70
+
71
+ resource = resources[args.keys.sort.join(":")]
72
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
73
+ resource.call(**args)
74
+ end
75
+
76
+ ##
77
+ # Create a fully-qualified ServingConfig resource string.
78
+ #
79
+ # @overload serving_config_path(project:, location:, data_store:, serving_config:)
80
+ # The resource will be in the following format:
81
+ #
82
+ # `projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}`
83
+ #
84
+ # @param project [String]
85
+ # @param location [String]
86
+ # @param data_store [String]
87
+ # @param serving_config [String]
88
+ #
89
+ # @overload serving_config_path(project:, location:, collection:, data_store:, serving_config:)
90
+ # The resource will be in the following format:
91
+ #
92
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}`
93
+ #
94
+ # @param project [String]
95
+ # @param location [String]
96
+ # @param collection [String]
97
+ # @param data_store [String]
98
+ # @param serving_config [String]
99
+ #
100
+ # @return [::String]
101
+ def serving_config_path **args
102
+ resources = {
103
+ "data_store:location:project:serving_config" => (proc do |project:, location:, data_store:, serving_config:|
104
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
105
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
106
+ raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
107
+
108
+ "projects/#{project}/locations/#{location}/dataStores/#{data_store}/servingConfigs/#{serving_config}"
109
+ end),
110
+ "collection:data_store:location:project:serving_config" => (proc do |project:, location:, collection:, data_store:, serving_config:|
111
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
112
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
113
+ raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
114
+ raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
115
+
116
+ "projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}/servingConfigs/#{serving_config}"
117
+ end)
118
+ }
119
+
120
+ resource = resources[args.keys.sort.join(":")]
121
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
122
+ resource.call(**args)
123
+ end
124
+
125
+ extend self
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end