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,956 @@
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/document_service_pb"
21
+ require "google/cloud/discovery_engine/v1/document_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DiscoveryEngine
26
+ module V1
27
+ module DocumentService
28
+ module Rest
29
+ ##
30
+ # REST client for the DocumentService service.
31
+ #
32
+ # Service for ingesting {::Google::Cloud::DiscoveryEngine::V1::Document Document}
33
+ # information of the customer's website.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :document_service_stub
40
+
41
+ ##
42
+ # Configure the DocumentService Client class.
43
+ #
44
+ # See {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all DocumentService clients
50
+ # ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 30.0
71
+ default_config.retry_policy = {
72
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
73
+ }
74
+
75
+ default_config.rpcs.import_documents.timeout = 300.0
76
+ default_config.rpcs.import_documents.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config
81
+ end
82
+ yield @configure if block_given?
83
+ @configure
84
+ end
85
+
86
+ ##
87
+ # Configure the DocumentService Client instance.
88
+ #
89
+ # The configuration is set to the derived mode, meaning that values can be changed,
90
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
91
+ # should be made on {Client.configure}.
92
+ #
93
+ # See {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client::Configuration}
94
+ # for a description of the configuration fields.
95
+ #
96
+ # @yield [config] Configure the Client client.
97
+ # @yieldparam config [Client::Configuration]
98
+ #
99
+ # @return [Client::Configuration]
100
+ #
101
+ def configure
102
+ yield @config if block_given?
103
+ @config
104
+ end
105
+
106
+ ##
107
+ # Create a new DocumentService REST client object.
108
+ #
109
+ # @example
110
+ #
111
+ # # Create a client using the default configuration
112
+ # client = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client.new
113
+ #
114
+ # # Create a client using a custom configuration
115
+ # client = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client.new do |config|
116
+ # config.timeout = 10.0
117
+ # end
118
+ #
119
+ # @yield [config] Configure the DocumentService client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ def initialize
123
+ # Create the configuration object
124
+ @config = Configuration.new Client.configure
125
+
126
+ # Yield the configuration if needed
127
+ yield @config if block_given?
128
+
129
+ # Create credentials
130
+ credentials = @config.credentials
131
+ # Use self-signed JWT if the endpoint is unchanged from default,
132
+ # but only if the default endpoint does not have a region prefix.
133
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
134
+ !@config.endpoint.split(".").first.include?("-")
135
+ credentials ||= Credentials.default scope: @config.scope,
136
+ enable_self_signed_jwt: enable_self_signed_jwt
137
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
138
+ credentials = Credentials.new credentials, scope: @config.scope
139
+ end
140
+
141
+ @quota_project_id = @config.quota_project
142
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
143
+
144
+ @operations_client = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Operations.new do |config|
145
+ config.credentials = credentials
146
+ config.quota_project = @quota_project_id
147
+ config.endpoint = @config.endpoint
148
+ end
149
+
150
+ @document_service_stub = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
151
+ end
152
+
153
+ ##
154
+ # Get the associated client for long-running operations.
155
+ #
156
+ # @return [::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Operations]
157
+ #
158
+ attr_reader :operations_client
159
+
160
+ # Service calls
161
+
162
+ ##
163
+ # Gets a {::Google::Cloud::DiscoveryEngine::V1::Document Document}.
164
+ #
165
+ # @overload get_document(request, options = nil)
166
+ # Pass arguments to `get_document` via a request object, either of type
167
+ # {::Google::Cloud::DiscoveryEngine::V1::GetDocumentRequest} or an equivalent Hash.
168
+ #
169
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::GetDocumentRequest, ::Hash]
170
+ # A request object representing the call parameters. Required. To specify no
171
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
172
+ # @param options [::Gapic::CallOptions, ::Hash]
173
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
174
+ #
175
+ # @overload get_document(name: nil)
176
+ # Pass arguments to `get_document` via keyword arguments. Note that at
177
+ # least one keyword argument is required. To specify no parameters, or to keep all
178
+ # the default parameter values, pass an empty Hash as a request object (see above).
179
+ #
180
+ # @param name [::String]
181
+ # Required. Full resource name of
182
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, such as
183
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
184
+ #
185
+ # If the caller does not have permission to access the
186
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, regardless of whether
187
+ # or not it exists, a `PERMISSION_DENIED` error is returned.
188
+ #
189
+ # If the requested {::Google::Cloud::DiscoveryEngine::V1::Document Document} does
190
+ # not exist, a `NOT_FOUND` error is returned.
191
+ # @yield [result, operation] Access the result along with the TransportOperation object
192
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::Document]
193
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
194
+ #
195
+ # @return [::Google::Cloud::DiscoveryEngine::V1::Document]
196
+ #
197
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
198
+ def get_document request, options = nil
199
+ raise ::ArgumentError, "request must be provided" if request.nil?
200
+
201
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::GetDocumentRequest
202
+
203
+ # Converts hash and nil to an options object
204
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
205
+
206
+ # Customize the options with defaults
207
+ call_metadata = @config.rpcs.get_document.metadata.to_h
208
+
209
+ # Set x-goog-api-client and x-goog-user-project headers
210
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
211
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
212
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
213
+ transports_version_send: [:rest]
214
+
215
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
216
+
217
+ options.apply_defaults timeout: @config.rpcs.get_document.timeout,
218
+ metadata: call_metadata,
219
+ retry_policy: @config.rpcs.get_document.retry_policy
220
+
221
+ options.apply_defaults timeout: @config.timeout,
222
+ metadata: @config.metadata,
223
+ retry_policy: @config.retry_policy
224
+
225
+ @document_service_stub.get_document request, options do |result, operation|
226
+ yield result, operation if block_given?
227
+ return result
228
+ end
229
+ rescue ::Gapic::Rest::Error => e
230
+ raise ::Google::Cloud::Error.from_error(e)
231
+ end
232
+
233
+ ##
234
+ # Gets a list of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s.
235
+ #
236
+ # @overload list_documents(request, options = nil)
237
+ # Pass arguments to `list_documents` via a request object, either of type
238
+ # {::Google::Cloud::DiscoveryEngine::V1::ListDocumentsRequest} or an equivalent Hash.
239
+ #
240
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ListDocumentsRequest, ::Hash]
241
+ # A request object representing the call parameters. Required. To specify no
242
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
243
+ # @param options [::Gapic::CallOptions, ::Hash]
244
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
245
+ #
246
+ # @overload list_documents(parent: nil, page_size: nil, page_token: nil)
247
+ # Pass arguments to `list_documents` via keyword arguments. Note that at
248
+ # least one keyword argument is required. To specify no parameters, or to keep all
249
+ # the default parameter values, pass an empty Hash as a request object (see above).
250
+ #
251
+ # @param parent [::String]
252
+ # Required. The parent branch resource name, such as
253
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
254
+ # Use `default_branch` as the branch ID, to list documents under the default
255
+ # branch.
256
+ #
257
+ # If the caller does not have permission to list [Documents][]s under this
258
+ # branch, regardless of whether or not this branch exists, a
259
+ # `PERMISSION_DENIED` error is returned.
260
+ # @param page_size [::Integer]
261
+ # Maximum number of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to
262
+ # return. If unspecified, defaults to 100. The maximum allowed value is 1000.
263
+ # Values above 1000 will be coerced to 1000.
264
+ #
265
+ # If this field is negative, an `INVALID_ARGUMENT` error is returned.
266
+ # @param page_token [::String]
267
+ # A page token
268
+ # {::Google::Cloud::DiscoveryEngine::V1::ListDocumentsResponse#next_page_token ListDocumentsResponse.next_page_token},
269
+ # received from a previous
270
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client#list_documents DocumentService.ListDocuments}
271
+ # call. Provide this to retrieve the subsequent page.
272
+ #
273
+ # When paginating, all other parameters provided to
274
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client#list_documents DocumentService.ListDocuments}
275
+ # must match the call that provided the page token. Otherwise, an
276
+ # `INVALID_ARGUMENT` error is returned.
277
+ # @yield [result, operation] Access the result along with the TransportOperation object
278
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Document>]
279
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
280
+ #
281
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Document>]
282
+ #
283
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
284
+ def list_documents request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ListDocumentsRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ call_metadata = @config.rpcs.list_documents.metadata.to_h
294
+
295
+ # Set x-goog-api-client and x-goog-user-project headers
296
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
299
+ transports_version_send: [:rest]
300
+
301
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
302
+
303
+ options.apply_defaults timeout: @config.rpcs.list_documents.timeout,
304
+ metadata: call_metadata,
305
+ retry_policy: @config.rpcs.list_documents.retry_policy
306
+
307
+ options.apply_defaults timeout: @config.timeout,
308
+ metadata: @config.metadata,
309
+ retry_policy: @config.retry_policy
310
+
311
+ @document_service_stub.list_documents request, options do |result, operation|
312
+ result = ::Gapic::Rest::PagedEnumerable.new @document_service_stub, :list_documents, "documents", request, result, options
313
+ yield result, operation if block_given?
314
+ return result
315
+ end
316
+ rescue ::Gapic::Rest::Error => e
317
+ raise ::Google::Cloud::Error.from_error(e)
318
+ end
319
+
320
+ ##
321
+ # Creates a {::Google::Cloud::DiscoveryEngine::V1::Document Document}.
322
+ #
323
+ # @overload create_document(request, options = nil)
324
+ # Pass arguments to `create_document` via a request object, either of type
325
+ # {::Google::Cloud::DiscoveryEngine::V1::CreateDocumentRequest} or an equivalent Hash.
326
+ #
327
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::CreateDocumentRequest, ::Hash]
328
+ # A request object representing the call parameters. Required. To specify no
329
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
330
+ # @param options [::Gapic::CallOptions, ::Hash]
331
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
332
+ #
333
+ # @overload create_document(parent: nil, document: nil, document_id: nil)
334
+ # Pass arguments to `create_document` via keyword arguments. Note that at
335
+ # least one keyword argument is required. To specify no parameters, or to keep all
336
+ # the default parameter values, pass an empty Hash as a request object (see above).
337
+ #
338
+ # @param parent [::String]
339
+ # Required. The parent resource name, such as
340
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
341
+ # @param document [::Google::Cloud::DiscoveryEngine::V1::Document, ::Hash]
342
+ # Required. The {::Google::Cloud::DiscoveryEngine::V1::Document Document} to
343
+ # create.
344
+ # @param document_id [::String]
345
+ # Required. The ID to use for the
346
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, which will become the
347
+ # final component of the
348
+ # {::Google::Cloud::DiscoveryEngine::V1::Document#name Document.name}.
349
+ #
350
+ # If the caller does not have permission to create the
351
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, regardless of whether
352
+ # or not it exists, a `PERMISSION_DENIED` error is returned.
353
+ #
354
+ # This field must be unique among all
355
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s with the same
356
+ # {::Google::Cloud::DiscoveryEngine::V1::CreateDocumentRequest#parent parent}.
357
+ # Otherwise, an `ALREADY_EXISTS` error is returned.
358
+ #
359
+ # This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034)
360
+ # standard with a length limit of 63 characters. Otherwise, an
361
+ # `INVALID_ARGUMENT` error is returned.
362
+ # @yield [result, operation] Access the result along with the TransportOperation object
363
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::Document]
364
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
365
+ #
366
+ # @return [::Google::Cloud::DiscoveryEngine::V1::Document]
367
+ #
368
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
369
+ def create_document request, options = nil
370
+ raise ::ArgumentError, "request must be provided" if request.nil?
371
+
372
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CreateDocumentRequest
373
+
374
+ # Converts hash and nil to an options object
375
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
376
+
377
+ # Customize the options with defaults
378
+ call_metadata = @config.rpcs.create_document.metadata.to_h
379
+
380
+ # Set x-goog-api-client and x-goog-user-project headers
381
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
382
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
383
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
384
+ transports_version_send: [:rest]
385
+
386
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
387
+
388
+ options.apply_defaults timeout: @config.rpcs.create_document.timeout,
389
+ metadata: call_metadata,
390
+ retry_policy: @config.rpcs.create_document.retry_policy
391
+
392
+ options.apply_defaults timeout: @config.timeout,
393
+ metadata: @config.metadata,
394
+ retry_policy: @config.retry_policy
395
+
396
+ @document_service_stub.create_document request, options do |result, operation|
397
+ yield result, operation if block_given?
398
+ return result
399
+ end
400
+ rescue ::Gapic::Rest::Error => e
401
+ raise ::Google::Cloud::Error.from_error(e)
402
+ end
403
+
404
+ ##
405
+ # Updates a {::Google::Cloud::DiscoveryEngine::V1::Document Document}.
406
+ #
407
+ # @overload update_document(request, options = nil)
408
+ # Pass arguments to `update_document` via a request object, either of type
409
+ # {::Google::Cloud::DiscoveryEngine::V1::UpdateDocumentRequest} or an equivalent Hash.
410
+ #
411
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::UpdateDocumentRequest, ::Hash]
412
+ # A request object representing the call parameters. Required. To specify no
413
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
414
+ # @param options [::Gapic::CallOptions, ::Hash]
415
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
416
+ #
417
+ # @overload update_document(document: nil, allow_missing: nil)
418
+ # Pass arguments to `update_document` via keyword arguments. Note that at
419
+ # least one keyword argument is required. To specify no parameters, or to keep all
420
+ # the default parameter values, pass an empty Hash as a request object (see above).
421
+ #
422
+ # @param document [::Google::Cloud::DiscoveryEngine::V1::Document, ::Hash]
423
+ # Required. The document to update/create.
424
+ #
425
+ # If the caller does not have permission to update the
426
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, regardless of whether
427
+ # or not it exists, a `PERMISSION_DENIED` error is returned.
428
+ #
429
+ # If the {::Google::Cloud::DiscoveryEngine::V1::Document Document} to update does
430
+ # not exist and
431
+ # {::Google::Cloud::DiscoveryEngine::V1::UpdateDocumentRequest#allow_missing allow_missing}
432
+ # is not set, a `NOT_FOUND` error is returned.
433
+ # @param allow_missing [::Boolean]
434
+ # If set to true, and the
435
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document} is not found, a new
436
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document} will be created.
437
+ # @yield [result, operation] Access the result along with the TransportOperation object
438
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::Document]
439
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
440
+ #
441
+ # @return [::Google::Cloud::DiscoveryEngine::V1::Document]
442
+ #
443
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
444
+ def update_document request, options = nil
445
+ raise ::ArgumentError, "request must be provided" if request.nil?
446
+
447
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::UpdateDocumentRequest
448
+
449
+ # Converts hash and nil to an options object
450
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
451
+
452
+ # Customize the options with defaults
453
+ call_metadata = @config.rpcs.update_document.metadata.to_h
454
+
455
+ # Set x-goog-api-client and x-goog-user-project headers
456
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
457
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
458
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
459
+ transports_version_send: [:rest]
460
+
461
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
462
+
463
+ options.apply_defaults timeout: @config.rpcs.update_document.timeout,
464
+ metadata: call_metadata,
465
+ retry_policy: @config.rpcs.update_document.retry_policy
466
+
467
+ options.apply_defaults timeout: @config.timeout,
468
+ metadata: @config.metadata,
469
+ retry_policy: @config.retry_policy
470
+
471
+ @document_service_stub.update_document request, options do |result, operation|
472
+ yield result, operation if block_given?
473
+ return result
474
+ end
475
+ rescue ::Gapic::Rest::Error => e
476
+ raise ::Google::Cloud::Error.from_error(e)
477
+ end
478
+
479
+ ##
480
+ # Deletes a {::Google::Cloud::DiscoveryEngine::V1::Document Document}.
481
+ #
482
+ # @overload delete_document(request, options = nil)
483
+ # Pass arguments to `delete_document` via a request object, either of type
484
+ # {::Google::Cloud::DiscoveryEngine::V1::DeleteDocumentRequest} or an equivalent Hash.
485
+ #
486
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::DeleteDocumentRequest, ::Hash]
487
+ # A request object representing the call parameters. Required. To specify no
488
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
489
+ # @param options [::Gapic::CallOptions, ::Hash]
490
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
491
+ #
492
+ # @overload delete_document(name: nil)
493
+ # Pass arguments to `delete_document` via keyword arguments. Note that at
494
+ # least one keyword argument is required. To specify no parameters, or to keep all
495
+ # the default parameter values, pass an empty Hash as a request object (see above).
496
+ #
497
+ # @param name [::String]
498
+ # Required. Full resource name of
499
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, such as
500
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
501
+ #
502
+ # If the caller does not have permission to delete the
503
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, regardless of whether
504
+ # or not it exists, a `PERMISSION_DENIED` error is returned.
505
+ #
506
+ # If the {::Google::Cloud::DiscoveryEngine::V1::Document Document} to delete does
507
+ # not exist, a `NOT_FOUND` error is returned.
508
+ # @yield [result, operation] Access the result along with the TransportOperation object
509
+ # @yieldparam result [::Google::Protobuf::Empty]
510
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
511
+ #
512
+ # @return [::Google::Protobuf::Empty]
513
+ #
514
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
515
+ def delete_document request, options = nil
516
+ raise ::ArgumentError, "request must be provided" if request.nil?
517
+
518
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::DeleteDocumentRequest
519
+
520
+ # Converts hash and nil to an options object
521
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
522
+
523
+ # Customize the options with defaults
524
+ call_metadata = @config.rpcs.delete_document.metadata.to_h
525
+
526
+ # Set x-goog-api-client and x-goog-user-project headers
527
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
528
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
529
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
530
+ transports_version_send: [:rest]
531
+
532
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
533
+
534
+ options.apply_defaults timeout: @config.rpcs.delete_document.timeout,
535
+ metadata: call_metadata,
536
+ retry_policy: @config.rpcs.delete_document.retry_policy
537
+
538
+ options.apply_defaults timeout: @config.timeout,
539
+ metadata: @config.metadata,
540
+ retry_policy: @config.retry_policy
541
+
542
+ @document_service_stub.delete_document request, options do |result, operation|
543
+ yield result, operation if block_given?
544
+ return result
545
+ end
546
+ rescue ::Gapic::Rest::Error => e
547
+ raise ::Google::Cloud::Error.from_error(e)
548
+ end
549
+
550
+ ##
551
+ # Bulk import of multiple
552
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s. Request processing
553
+ # may be synchronous. Non-existing items will be created.
554
+ #
555
+ # Note: It is possible for a subset of the
556
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to be successfully
557
+ # updated.
558
+ #
559
+ # @overload import_documents(request, options = nil)
560
+ # Pass arguments to `import_documents` via a request object, either of type
561
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest} or an equivalent Hash.
562
+ #
563
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest, ::Hash]
564
+ # A request object representing the call parameters. Required. To specify no
565
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
566
+ # @param options [::Gapic::CallOptions, ::Hash]
567
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
568
+ #
569
+ # @overload import_documents(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil, reconciliation_mode: nil, auto_generate_ids: nil, id_field: nil)
570
+ # Pass arguments to `import_documents` via keyword arguments. Note that at
571
+ # least one keyword argument is required. To specify no parameters, or to keep all
572
+ # the default parameter values, pass an empty Hash as a request object (see above).
573
+ #
574
+ # @param inline_source [::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest::InlineSource, ::Hash]
575
+ # The Inline source for the input content for documents.
576
+ # @param gcs_source [::Google::Cloud::DiscoveryEngine::V1::GcsSource, ::Hash]
577
+ # Cloud Storage location for the input content.
578
+ # @param bigquery_source [::Google::Cloud::DiscoveryEngine::V1::BigQuerySource, ::Hash]
579
+ # BigQuery input source.
580
+ # @param parent [::String]
581
+ # Required. The parent branch resource name, such as
582
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
583
+ # Requires create/update permission.
584
+ # @param error_config [::Google::Cloud::DiscoveryEngine::V1::ImportErrorConfig, ::Hash]
585
+ # The desired location of errors incurred during the Import.
586
+ # @param reconciliation_mode [::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest::ReconciliationMode]
587
+ # The mode of reconciliation between existing documents and the documents to
588
+ # be imported. Defaults to
589
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}.
590
+ # @param auto_generate_ids [::Boolean]
591
+ # Whether to automatically generate IDs for the documents if absent.
592
+ #
593
+ # If set to `true`,
594
+ # {::Google::Cloud::DiscoveryEngine::V1::Document#id Document.id}s are
595
+ # automatically generated based on the hash of the payload, where IDs may not
596
+ # be consistent during multiple imports. In which case
597
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest::ReconciliationMode::FULL ReconciliationMode.FULL}
598
+ # is highly recommended to avoid duplicate contents. If unset or set to
599
+ # `false`, {::Google::Cloud::DiscoveryEngine::V1::Document#id Document.id}s have
600
+ # to be specified using
601
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest#id_field id_field},
602
+ # otherwises, documents without IDs will fail to be imported.
603
+ #
604
+ # Only set this field when using
605
+ # {::Google::Cloud::DiscoveryEngine::V1::GcsSource GcsSource} or
606
+ # {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource BigQuerySource}, and when
607
+ # {::Google::Cloud::DiscoveryEngine::V1::GcsSource#data_schema GcsSource.data_schema}
608
+ # or
609
+ # {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource#data_schema BigQuerySource.data_schema}
610
+ # is `custom`. Otherwise, an INVALID_ARGUMENT error is thrown.
611
+ # @param id_field [::String]
612
+ # The field in the Cloud Storage and BigQuery sources that indicates the
613
+ # unique IDs of the documents.
614
+ #
615
+ # For {::Google::Cloud::DiscoveryEngine::V1::GcsSource GcsSource} it is the key of
616
+ # the JSON field. For instance, `my_id` for JSON `{"my_id": "some_uuid"}`.
617
+ # For {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource BigQuerySource} it is
618
+ # the column name of the BigQuery table where the unique ids are stored.
619
+ #
620
+ # The values of the JSON field or the BigQuery column will be used as the
621
+ # {::Google::Cloud::DiscoveryEngine::V1::Document#id Document.id}s. The JSON field
622
+ # or the BigQuery column must be of string type, and the values must be set
623
+ # as valid strings conform to [RFC-1034](https://tools.ietf.org/html/rfc1034)
624
+ # with 1-63 characters. Otherwise, documents without valid IDs will fail to
625
+ # be imported.
626
+ #
627
+ # Only set this field when using
628
+ # {::Google::Cloud::DiscoveryEngine::V1::GcsSource GcsSource} or
629
+ # {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource BigQuerySource}, and when
630
+ # {::Google::Cloud::DiscoveryEngine::V1::GcsSource#data_schema GcsSource.data_schema}
631
+ # or
632
+ # {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource#data_schema BigQuerySource.data_schema}
633
+ # is `custom`. And only set this field when
634
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest#auto_generate_ids auto_generate_ids}
635
+ # is unset or set as `false`. Otherwise, an INVALID_ARGUMENT error is thrown.
636
+ #
637
+ # If it is unset, a default value `_id` is used when importing from the
638
+ # allowed data sources.
639
+ # @yield [result, operation] Access the result along with the TransportOperation object
640
+ # @yieldparam result [::Gapic::Operation]
641
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
642
+ #
643
+ # @return [::Gapic::Operation]
644
+ #
645
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
646
+ def import_documents request, options = nil
647
+ raise ::ArgumentError, "request must be provided" if request.nil?
648
+
649
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest
650
+
651
+ # Converts hash and nil to an options object
652
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
653
+
654
+ # Customize the options with defaults
655
+ call_metadata = @config.rpcs.import_documents.metadata.to_h
656
+
657
+ # Set x-goog-api-client and x-goog-user-project headers
658
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
659
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
660
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
661
+ transports_version_send: [:rest]
662
+
663
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
664
+
665
+ options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
666
+ metadata: call_metadata,
667
+ retry_policy: @config.rpcs.import_documents.retry_policy
668
+
669
+ options.apply_defaults timeout: @config.timeout,
670
+ metadata: @config.metadata,
671
+ retry_policy: @config.retry_policy
672
+
673
+ @document_service_stub.import_documents request, options do |result, operation|
674
+ result = ::Gapic::Operation.new result, @operations_client, options: options
675
+ yield result, operation if block_given?
676
+ return result
677
+ end
678
+ rescue ::Gapic::Rest::Error => e
679
+ raise ::Google::Cloud::Error.from_error(e)
680
+ end
681
+
682
+ ##
683
+ # Permanently deletes all selected
684
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s in a branch.
685
+ #
686
+ # This process is asynchronous. Depending on the number of
687
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to be deleted, this
688
+ # operation can take hours to complete. Before the delete operation
689
+ # completes, some {::Google::Cloud::DiscoveryEngine::V1::Document Document}s might
690
+ # still be returned by
691
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client#get_document DocumentService.GetDocument}
692
+ # or
693
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client#list_documents DocumentService.ListDocuments}.
694
+ #
695
+ # To get a list of the {::Google::Cloud::DiscoveryEngine::V1::Document Document}s
696
+ # to be deleted, set
697
+ # {::Google::Cloud::DiscoveryEngine::V1::PurgeDocumentsRequest#force PurgeDocumentsRequest.force}
698
+ # to false.
699
+ #
700
+ # @overload purge_documents(request, options = nil)
701
+ # Pass arguments to `purge_documents` via a request object, either of type
702
+ # {::Google::Cloud::DiscoveryEngine::V1::PurgeDocumentsRequest} or an equivalent Hash.
703
+ #
704
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::PurgeDocumentsRequest, ::Hash]
705
+ # A request object representing the call parameters. Required. To specify no
706
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
707
+ # @param options [::Gapic::CallOptions, ::Hash]
708
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
709
+ #
710
+ # @overload purge_documents(parent: nil, filter: nil, force: nil)
711
+ # Pass arguments to `purge_documents` via keyword arguments. Note that at
712
+ # least one keyword argument is required. To specify no parameters, or to keep all
713
+ # the default parameter values, pass an empty Hash as a request object (see above).
714
+ #
715
+ # @param parent [::String]
716
+ # Required. The parent resource name, such as
717
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
718
+ # @param filter [::String]
719
+ # Required. Filter matching documents to purge. Only currently supported
720
+ # value is
721
+ # `*` (all items).
722
+ # @param force [::Boolean]
723
+ # Actually performs the purge. If `force` is set to false, return the
724
+ # expected purge count without deleting any documents.
725
+ # @yield [result, operation] Access the result along with the TransportOperation object
726
+ # @yieldparam result [::Gapic::Operation]
727
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
728
+ #
729
+ # @return [::Gapic::Operation]
730
+ #
731
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
732
+ def purge_documents request, options = nil
733
+ raise ::ArgumentError, "request must be provided" if request.nil?
734
+
735
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::PurgeDocumentsRequest
736
+
737
+ # Converts hash and nil to an options object
738
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
739
+
740
+ # Customize the options with defaults
741
+ call_metadata = @config.rpcs.purge_documents.metadata.to_h
742
+
743
+ # Set x-goog-api-client and x-goog-user-project headers
744
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
745
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
746
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
747
+ transports_version_send: [:rest]
748
+
749
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
750
+
751
+ options.apply_defaults timeout: @config.rpcs.purge_documents.timeout,
752
+ metadata: call_metadata,
753
+ retry_policy: @config.rpcs.purge_documents.retry_policy
754
+
755
+ options.apply_defaults timeout: @config.timeout,
756
+ metadata: @config.metadata,
757
+ retry_policy: @config.retry_policy
758
+
759
+ @document_service_stub.purge_documents request, options do |result, operation|
760
+ result = ::Gapic::Operation.new result, @operations_client, options: options
761
+ yield result, operation if block_given?
762
+ return result
763
+ end
764
+ rescue ::Gapic::Rest::Error => e
765
+ raise ::Google::Cloud::Error.from_error(e)
766
+ end
767
+
768
+ ##
769
+ # Configuration class for the DocumentService REST API.
770
+ #
771
+ # This class represents the configuration for DocumentService REST,
772
+ # providing control over timeouts, retry behavior, logging, transport
773
+ # parameters, and other low-level controls. Certain parameters can also be
774
+ # applied individually to specific RPCs. See
775
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client::Configuration::Rpcs}
776
+ # for a list of RPCs that can be configured independently.
777
+ #
778
+ # Configuration can be applied globally to all clients, or to a single client
779
+ # on construction.
780
+ #
781
+ # @example
782
+ #
783
+ # # Modify the global config, setting the timeout for
784
+ # # get_document to 20 seconds,
785
+ # # and all remaining timeouts to 10 seconds.
786
+ # ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client.configure do |config|
787
+ # config.timeout = 10.0
788
+ # config.rpcs.get_document.timeout = 20.0
789
+ # end
790
+ #
791
+ # # Apply the above configuration only to a new client.
792
+ # client = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client.new do |config|
793
+ # config.timeout = 10.0
794
+ # config.rpcs.get_document.timeout = 20.0
795
+ # end
796
+ #
797
+ # @!attribute [rw] endpoint
798
+ # The hostname or hostname:port of the service endpoint.
799
+ # Defaults to `"discoveryengine.googleapis.com"`.
800
+ # @return [::String]
801
+ # @!attribute [rw] credentials
802
+ # Credentials to send with calls. You may provide any of the following types:
803
+ # * (`String`) The path to a service account key file in JSON format
804
+ # * (`Hash`) A service account key as a Hash
805
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
806
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
807
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
808
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
809
+ # * (`nil`) indicating no credentials
810
+ # @return [::Object]
811
+ # @!attribute [rw] scope
812
+ # The OAuth scopes
813
+ # @return [::Array<::String>]
814
+ # @!attribute [rw] lib_name
815
+ # The library name as recorded in instrumentation and logging
816
+ # @return [::String]
817
+ # @!attribute [rw] lib_version
818
+ # The library version as recorded in instrumentation and logging
819
+ # @return [::String]
820
+ # @!attribute [rw] timeout
821
+ # The call timeout in seconds.
822
+ # @return [::Numeric]
823
+ # @!attribute [rw] metadata
824
+ # Additional headers to be sent with the call.
825
+ # @return [::Hash{::Symbol=>::String}]
826
+ # @!attribute [rw] retry_policy
827
+ # The retry policy. The value is a hash with the following keys:
828
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
829
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
830
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
831
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
832
+ # trigger a retry.
833
+ # @return [::Hash]
834
+ # @!attribute [rw] quota_project
835
+ # A separate project against which to charge quota.
836
+ # @return [::String]
837
+ #
838
+ class Configuration
839
+ extend ::Gapic::Config
840
+
841
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
842
+
843
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
844
+ config_attr :credentials, nil do |value|
845
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
846
+ allowed.any? { |klass| klass === value }
847
+ end
848
+ config_attr :scope, nil, ::String, ::Array, nil
849
+ config_attr :lib_name, nil, ::String, nil
850
+ config_attr :lib_version, nil, ::String, nil
851
+ config_attr :timeout, nil, ::Numeric, nil
852
+ config_attr :metadata, nil, ::Hash, nil
853
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
854
+ config_attr :quota_project, nil, ::String, nil
855
+
856
+ # @private
857
+ def initialize parent_config = nil
858
+ @parent_config = parent_config unless parent_config.nil?
859
+
860
+ yield self if block_given?
861
+ end
862
+
863
+ ##
864
+ # Configurations for individual RPCs
865
+ # @return [Rpcs]
866
+ #
867
+ def rpcs
868
+ @rpcs ||= begin
869
+ parent_rpcs = nil
870
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
871
+ Rpcs.new parent_rpcs
872
+ end
873
+ end
874
+
875
+ ##
876
+ # Configuration RPC class for the DocumentService API.
877
+ #
878
+ # Includes fields providing the configuration for each RPC in this service.
879
+ # Each configuration object is of type `Gapic::Config::Method` and includes
880
+ # the following configuration fields:
881
+ #
882
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
883
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
884
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
885
+ # include the following keys:
886
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
887
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
888
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
889
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
890
+ # trigger a retry.
891
+ #
892
+ class Rpcs
893
+ ##
894
+ # RPC-specific configuration for `get_document`
895
+ # @return [::Gapic::Config::Method]
896
+ #
897
+ attr_reader :get_document
898
+ ##
899
+ # RPC-specific configuration for `list_documents`
900
+ # @return [::Gapic::Config::Method]
901
+ #
902
+ attr_reader :list_documents
903
+ ##
904
+ # RPC-specific configuration for `create_document`
905
+ # @return [::Gapic::Config::Method]
906
+ #
907
+ attr_reader :create_document
908
+ ##
909
+ # RPC-specific configuration for `update_document`
910
+ # @return [::Gapic::Config::Method]
911
+ #
912
+ attr_reader :update_document
913
+ ##
914
+ # RPC-specific configuration for `delete_document`
915
+ # @return [::Gapic::Config::Method]
916
+ #
917
+ attr_reader :delete_document
918
+ ##
919
+ # RPC-specific configuration for `import_documents`
920
+ # @return [::Gapic::Config::Method]
921
+ #
922
+ attr_reader :import_documents
923
+ ##
924
+ # RPC-specific configuration for `purge_documents`
925
+ # @return [::Gapic::Config::Method]
926
+ #
927
+ attr_reader :purge_documents
928
+
929
+ # @private
930
+ def initialize parent_rpcs = nil
931
+ get_document_config = parent_rpcs.get_document if parent_rpcs.respond_to? :get_document
932
+ @get_document = ::Gapic::Config::Method.new get_document_config
933
+ list_documents_config = parent_rpcs.list_documents if parent_rpcs.respond_to? :list_documents
934
+ @list_documents = ::Gapic::Config::Method.new list_documents_config
935
+ create_document_config = parent_rpcs.create_document if parent_rpcs.respond_to? :create_document
936
+ @create_document = ::Gapic::Config::Method.new create_document_config
937
+ update_document_config = parent_rpcs.update_document if parent_rpcs.respond_to? :update_document
938
+ @update_document = ::Gapic::Config::Method.new update_document_config
939
+ delete_document_config = parent_rpcs.delete_document if parent_rpcs.respond_to? :delete_document
940
+ @delete_document = ::Gapic::Config::Method.new delete_document_config
941
+ import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
942
+ @import_documents = ::Gapic::Config::Method.new import_documents_config
943
+ purge_documents_config = parent_rpcs.purge_documents if parent_rpcs.respond_to? :purge_documents
944
+ @purge_documents = ::Gapic::Config::Method.new purge_documents_config
945
+
946
+ yield self if block_given?
947
+ end
948
+ end
949
+ end
950
+ end
951
+ end
952
+ end
953
+ end
954
+ end
955
+ end
956
+ end