google-cloud-document_ai-v1beta3 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb +54 -39
  3. data/lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb +54 -39
  4. data/lib/google/cloud/document_ai/v1beta3/document_processor_service/rest.rb +1 -1
  5. data/lib/google/cloud/document_ai/v1beta3/document_processor_service.rb +1 -1
  6. data/lib/google/cloud/document_ai/v1beta3/document_service/client.rb +618 -0
  7. data/lib/google/cloud/document_ai/v1beta3/document_service/credentials.rb +51 -0
  8. data/lib/google/cloud/document_ai/v1beta3/document_service/operations.rb +770 -0
  9. data/lib/google/cloud/document_ai/v1beta3/document_service/paths.rb +90 -0
  10. data/lib/google/cloud/document_ai/v1beta3/document_service/rest/client.rb +530 -0
  11. data/lib/google/cloud/document_ai/v1beta3/document_service/rest/operations.rb +815 -0
  12. data/lib/google/cloud/document_ai/v1beta3/document_service/rest/service_stub.rb +227 -0
  13. data/lib/google/cloud/document_ai/v1beta3/document_service/rest.rb +54 -0
  14. data/lib/google/cloud/document_ai/v1beta3/document_service.rb +56 -0
  15. data/lib/google/cloud/document_ai/v1beta3/rest.rb +1 -0
  16. data/lib/google/cloud/document_ai/v1beta3/version.rb +1 -1
  17. data/lib/google/cloud/document_ai/v1beta3.rb +1 -0
  18. data/lib/google/cloud/documentai/v1beta3/dataset_pb.rb +55 -0
  19. data/lib/google/cloud/documentai/v1beta3/document_io_pb.rb +1 -1
  20. data/lib/google/cloud/documentai/v1beta3/document_pb.rb +2 -1
  21. data/lib/google/cloud/documentai/v1beta3/document_processor_service_pb.rb +4 -1
  22. data/lib/google/cloud/documentai/v1beta3/document_processor_service_services_pb.rb +8 -6
  23. data/lib/google/cloud/documentai/v1beta3/document_schema_pb.rb +3 -1
  24. data/lib/google/cloud/documentai/v1beta3/document_service_pb.rb +57 -0
  25. data/lib/google/cloud/documentai/v1beta3/document_service_services_pb.rb +49 -0
  26. data/lib/google/cloud/documentai/v1beta3/processor_pb.rb +1 -1
  27. data/proto_docs/google/cloud/documentai/v1beta3/dataset.rb +125 -0
  28. data/proto_docs/google/cloud/documentai/v1beta3/document.rb +88 -27
  29. data/proto_docs/google/cloud/documentai/v1beta3/document_io.rb +10 -1
  30. data/proto_docs/google/cloud/documentai/v1beta3/document_processor_service.rb +258 -123
  31. data/proto_docs/google/cloud/documentai/v1beta3/document_schema.rb +44 -13
  32. data/proto_docs/google/cloud/documentai/v1beta3/document_service.rb +73 -0
  33. data/proto_docs/google/cloud/documentai/v1beta3/processor.rb +11 -9
  34. data/proto_docs/google/cloud/documentai/v1beta3/processor_type.rb +3 -2
  35. metadata +16 -2
@@ -0,0 +1,618 @@
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/documentai/v1beta3/document_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DocumentAI
26
+ module V1beta3
27
+ module DocumentService
28
+ ##
29
+ # Client for the DocumentService service.
30
+ #
31
+ # Service to call Cloud DocumentAI to manage document collection (dataset).
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :document_service_stub
38
+
39
+ ##
40
+ # Configure the DocumentService Client class.
41
+ #
42
+ # See {::Google::Cloud::DocumentAI::V1beta3::DocumentService::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # @example
46
+ #
47
+ # # Modify the configuration for all DocumentService clients
48
+ # ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "DocumentAI", "V1beta3"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config
69
+ end
70
+ yield @configure if block_given?
71
+ @configure
72
+ end
73
+
74
+ ##
75
+ # Configure the DocumentService Client instance.
76
+ #
77
+ # The configuration is set to the derived mode, meaning that values can be changed,
78
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
79
+ # should be made on {Client.configure}.
80
+ #
81
+ # See {::Google::Cloud::DocumentAI::V1beta3::DocumentService::Client::Configuration}
82
+ # for a description of the configuration fields.
83
+ #
84
+ # @yield [config] Configure the Client client.
85
+ # @yieldparam config [Client::Configuration]
86
+ #
87
+ # @return [Client::Configuration]
88
+ #
89
+ def configure
90
+ yield @config if block_given?
91
+ @config
92
+ end
93
+
94
+ ##
95
+ # Create a new DocumentService client object.
96
+ #
97
+ # @example
98
+ #
99
+ # # Create a client using the default configuration
100
+ # client = ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.new
101
+ #
102
+ # # Create a client using a custom configuration
103
+ # client = ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.new do |config|
104
+ # config.timeout = 10.0
105
+ # end
106
+ #
107
+ # @yield [config] Configure the DocumentService client.
108
+ # @yieldparam config [Client::Configuration]
109
+ #
110
+ def initialize
111
+ # These require statements are intentionally placed here to initialize
112
+ # the gRPC module only when it's required.
113
+ # See https://github.com/googleapis/toolkit/issues/446
114
+ require "gapic/grpc"
115
+ require "google/cloud/documentai/v1beta3/document_service_services_pb"
116
+
117
+ # Create the configuration object
118
+ @config = Configuration.new Client.configure
119
+
120
+ # Yield the configuration if needed
121
+ yield @config if block_given?
122
+
123
+ # Create credentials
124
+ credentials = @config.credentials
125
+ # Use self-signed JWT if the endpoint is unchanged from default,
126
+ # but only if the default endpoint does not have a region prefix.
127
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
128
+ !@config.endpoint.split(".").first.include?("-")
129
+ credentials ||= Credentials.default scope: @config.scope,
130
+ enable_self_signed_jwt: enable_self_signed_jwt
131
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
132
+ credentials = Credentials.new credentials, scope: @config.scope
133
+ end
134
+ @quota_project_id = @config.quota_project
135
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
136
+
137
+ @operations_client = Operations.new do |config|
138
+ config.credentials = credentials
139
+ config.quota_project = @quota_project_id
140
+ config.endpoint = @config.endpoint
141
+ end
142
+
143
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
144
+ config.credentials = credentials
145
+ config.quota_project = @quota_project_id
146
+ config.endpoint = @config.endpoint
147
+ end
148
+
149
+ @document_service_stub = ::Gapic::ServiceStub.new(
150
+ ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Stub,
151
+ credentials: credentials,
152
+ endpoint: @config.endpoint,
153
+ channel_args: @config.channel_args,
154
+ interceptors: @config.interceptors
155
+ )
156
+ end
157
+
158
+ ##
159
+ # Get the associated client for long-running operations.
160
+ #
161
+ # @return [::Google::Cloud::DocumentAI::V1beta3::DocumentService::Operations]
162
+ #
163
+ attr_reader :operations_client
164
+
165
+ ##
166
+ # Get the associated client for mix-in of the Locations.
167
+ #
168
+ # @return [Google::Cloud::Location::Locations::Client]
169
+ #
170
+ attr_reader :location_client
171
+
172
+ # Service calls
173
+
174
+ ##
175
+ # Updates metadata associated with a dataset.
176
+ #
177
+ # @overload update_dataset(request, options = nil)
178
+ # Pass arguments to `update_dataset` via a request object, either of type
179
+ # {::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetRequest} or an equivalent Hash.
180
+ #
181
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetRequest, ::Hash]
182
+ # A request object representing the call parameters. Required. To specify no
183
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
184
+ # @param options [::Gapic::CallOptions, ::Hash]
185
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
186
+ #
187
+ # @overload update_dataset(dataset: nil, update_mask: nil)
188
+ # Pass arguments to `update_dataset` via keyword arguments. Note that at
189
+ # least one keyword argument is required. To specify no parameters, or to keep all
190
+ # the default parameter values, pass an empty Hash as a request object (see above).
191
+ #
192
+ # @param dataset [::Google::Cloud::DocumentAI::V1beta3::Dataset, ::Hash]
193
+ # Required. The `name` field of the `Dataset` is used to identify the
194
+ # resource to be updated.
195
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
196
+ # The update mask applies to the resource.
197
+ #
198
+ # @yield [response, operation] Access the result along with the RPC operation
199
+ # @yieldparam response [::Gapic::Operation]
200
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
201
+ #
202
+ # @return [::Gapic::Operation]
203
+ #
204
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
205
+ #
206
+ # @example Basic example
207
+ # require "google/cloud/document_ai/v1beta3"
208
+ #
209
+ # # Create a client object. The client can be reused for multiple calls.
210
+ # client = Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.new
211
+ #
212
+ # # Create a request. To set request fields, pass in keyword arguments.
213
+ # request = Google::Cloud::DocumentAI::V1beta3::UpdateDatasetRequest.new
214
+ #
215
+ # # Call the update_dataset method.
216
+ # result = client.update_dataset request
217
+ #
218
+ # # The returned object is of type Gapic::Operation. You can use it to
219
+ # # check the status of an operation, cancel it, or wait for results.
220
+ # # Here is how to wait for a response.
221
+ # result.wait_until_done! timeout: 60
222
+ # if result.response?
223
+ # p result.response
224
+ # else
225
+ # puts "No response received."
226
+ # end
227
+ #
228
+ def update_dataset request, options = nil
229
+ raise ::ArgumentError, "request must be provided" if request.nil?
230
+
231
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetRequest
232
+
233
+ # Converts hash and nil to an options object
234
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
235
+
236
+ # Customize the options with defaults
237
+ metadata = @config.rpcs.update_dataset.metadata.to_h
238
+
239
+ # Set x-goog-api-client and x-goog-user-project headers
240
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
241
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
242
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
243
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
244
+
245
+ header_params = {}
246
+ if request.dataset&.name
247
+ header_params["dataset.name"] = request.dataset.name
248
+ end
249
+
250
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
251
+ metadata[:"x-goog-request-params"] ||= request_params_header
252
+
253
+ options.apply_defaults timeout: @config.rpcs.update_dataset.timeout,
254
+ metadata: metadata,
255
+ retry_policy: @config.rpcs.update_dataset.retry_policy
256
+
257
+ options.apply_defaults timeout: @config.timeout,
258
+ metadata: @config.metadata,
259
+ retry_policy: @config.retry_policy
260
+
261
+ @document_service_stub.call_rpc :update_dataset, request, options: options do |response, operation|
262
+ response = ::Gapic::Operation.new response, @operations_client, options: options
263
+ yield response, operation if block_given?
264
+ return response
265
+ end
266
+ rescue ::GRPC::BadStatus => e
267
+ raise ::Google::Cloud::Error.from_error(e)
268
+ end
269
+
270
+ ##
271
+ # Gets the `DatasetSchema` of a `Dataset`.
272
+ #
273
+ # @overload get_dataset_schema(request, options = nil)
274
+ # Pass arguments to `get_dataset_schema` via a request object, either of type
275
+ # {::Google::Cloud::DocumentAI::V1beta3::GetDatasetSchemaRequest} or an equivalent Hash.
276
+ #
277
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::GetDatasetSchemaRequest, ::Hash]
278
+ # A request object representing the call parameters. Required. To specify no
279
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
280
+ # @param options [::Gapic::CallOptions, ::Hash]
281
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
282
+ #
283
+ # @overload get_dataset_schema(name: nil, visible_fields_only: nil)
284
+ # Pass arguments to `get_dataset_schema` via keyword arguments. Note that at
285
+ # least one keyword argument is required. To specify no parameters, or to keep all
286
+ # the default parameter values, pass an empty Hash as a request object (see above).
287
+ #
288
+ # @param name [::String]
289
+ # Required. The dataset schema resource name.
290
+ # Format:
291
+ # projects/\\{project}/locations/\\{location}/processors/\\{processor}/dataset/datasetSchema
292
+ # @param visible_fields_only [::Boolean]
293
+ # If set, only returns the visible fields of the schema.
294
+ #
295
+ # @yield [response, operation] Access the result along with the RPC operation
296
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema]
297
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
298
+ #
299
+ # @return [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema]
300
+ #
301
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
302
+ #
303
+ # @example Basic example
304
+ # require "google/cloud/document_ai/v1beta3"
305
+ #
306
+ # # Create a client object. The client can be reused for multiple calls.
307
+ # client = Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.new
308
+ #
309
+ # # Create a request. To set request fields, pass in keyword arguments.
310
+ # request = Google::Cloud::DocumentAI::V1beta3::GetDatasetSchemaRequest.new
311
+ #
312
+ # # Call the get_dataset_schema method.
313
+ # result = client.get_dataset_schema request
314
+ #
315
+ # # The returned object is of type Google::Cloud::DocumentAI::V1beta3::DatasetSchema.
316
+ # p result
317
+ #
318
+ def get_dataset_schema request, options = nil
319
+ raise ::ArgumentError, "request must be provided" if request.nil?
320
+
321
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetDatasetSchemaRequest
322
+
323
+ # Converts hash and nil to an options object
324
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
325
+
326
+ # Customize the options with defaults
327
+ metadata = @config.rpcs.get_dataset_schema.metadata.to_h
328
+
329
+ # Set x-goog-api-client and x-goog-user-project headers
330
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
331
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
332
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
333
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
334
+
335
+ header_params = {}
336
+ if request.name
337
+ header_params["name"] = request.name
338
+ end
339
+
340
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
341
+ metadata[:"x-goog-request-params"] ||= request_params_header
342
+
343
+ options.apply_defaults timeout: @config.rpcs.get_dataset_schema.timeout,
344
+ metadata: metadata,
345
+ retry_policy: @config.rpcs.get_dataset_schema.retry_policy
346
+
347
+ options.apply_defaults timeout: @config.timeout,
348
+ metadata: @config.metadata,
349
+ retry_policy: @config.retry_policy
350
+
351
+ @document_service_stub.call_rpc :get_dataset_schema, request, options: options do |response, operation|
352
+ yield response, operation if block_given?
353
+ return response
354
+ end
355
+ rescue ::GRPC::BadStatus => e
356
+ raise ::Google::Cloud::Error.from_error(e)
357
+ end
358
+
359
+ ##
360
+ # Updates a `DatasetSchema`.
361
+ #
362
+ # @overload update_dataset_schema(request, options = nil)
363
+ # Pass arguments to `update_dataset_schema` via a request object, either of type
364
+ # {::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetSchemaRequest} or an equivalent Hash.
365
+ #
366
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetSchemaRequest, ::Hash]
367
+ # A request object representing the call parameters. Required. To specify no
368
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
369
+ # @param options [::Gapic::CallOptions, ::Hash]
370
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
371
+ #
372
+ # @overload update_dataset_schema(dataset_schema: nil, update_mask: nil)
373
+ # Pass arguments to `update_dataset_schema` via keyword arguments. Note that at
374
+ # least one keyword argument is required. To specify no parameters, or to keep all
375
+ # the default parameter values, pass an empty Hash as a request object (see above).
376
+ #
377
+ # @param dataset_schema [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema, ::Hash]
378
+ # Required. The name field of the `DatasetSchema` is used to identify the
379
+ # resource to be updated.
380
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
381
+ # The update mask applies to the resource.
382
+ #
383
+ # @yield [response, operation] Access the result along with the RPC operation
384
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema]
385
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
386
+ #
387
+ # @return [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema]
388
+ #
389
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
390
+ #
391
+ # @example Basic example
392
+ # require "google/cloud/document_ai/v1beta3"
393
+ #
394
+ # # Create a client object. The client can be reused for multiple calls.
395
+ # client = Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.new
396
+ #
397
+ # # Create a request. To set request fields, pass in keyword arguments.
398
+ # request = Google::Cloud::DocumentAI::V1beta3::UpdateDatasetSchemaRequest.new
399
+ #
400
+ # # Call the update_dataset_schema method.
401
+ # result = client.update_dataset_schema request
402
+ #
403
+ # # The returned object is of type Google::Cloud::DocumentAI::V1beta3::DatasetSchema.
404
+ # p result
405
+ #
406
+ def update_dataset_schema request, options = nil
407
+ raise ::ArgumentError, "request must be provided" if request.nil?
408
+
409
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetSchemaRequest
410
+
411
+ # Converts hash and nil to an options object
412
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
413
+
414
+ # Customize the options with defaults
415
+ metadata = @config.rpcs.update_dataset_schema.metadata.to_h
416
+
417
+ # Set x-goog-api-client and x-goog-user-project headers
418
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
419
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
420
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
421
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
422
+
423
+ header_params = {}
424
+ if request.dataset_schema&.name
425
+ header_params["dataset_schema.name"] = request.dataset_schema.name
426
+ end
427
+
428
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
429
+ metadata[:"x-goog-request-params"] ||= request_params_header
430
+
431
+ options.apply_defaults timeout: @config.rpcs.update_dataset_schema.timeout,
432
+ metadata: metadata,
433
+ retry_policy: @config.rpcs.update_dataset_schema.retry_policy
434
+
435
+ options.apply_defaults timeout: @config.timeout,
436
+ metadata: @config.metadata,
437
+ retry_policy: @config.retry_policy
438
+
439
+ @document_service_stub.call_rpc :update_dataset_schema, request, options: options do |response, operation|
440
+ yield response, operation if block_given?
441
+ return response
442
+ end
443
+ rescue ::GRPC::BadStatus => e
444
+ raise ::Google::Cloud::Error.from_error(e)
445
+ end
446
+
447
+ ##
448
+ # Configuration class for the DocumentService API.
449
+ #
450
+ # This class represents the configuration for DocumentService,
451
+ # providing control over timeouts, retry behavior, logging, transport
452
+ # parameters, and other low-level controls. Certain parameters can also be
453
+ # applied individually to specific RPCs. See
454
+ # {::Google::Cloud::DocumentAI::V1beta3::DocumentService::Client::Configuration::Rpcs}
455
+ # for a list of RPCs that can be configured independently.
456
+ #
457
+ # Configuration can be applied globally to all clients, or to a single client
458
+ # on construction.
459
+ #
460
+ # @example
461
+ #
462
+ # # Modify the global config, setting the timeout for
463
+ # # update_dataset to 20 seconds,
464
+ # # and all remaining timeouts to 10 seconds.
465
+ # ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.configure do |config|
466
+ # config.timeout = 10.0
467
+ # config.rpcs.update_dataset.timeout = 20.0
468
+ # end
469
+ #
470
+ # # Apply the above configuration only to a new client.
471
+ # client = ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.new do |config|
472
+ # config.timeout = 10.0
473
+ # config.rpcs.update_dataset.timeout = 20.0
474
+ # end
475
+ #
476
+ # @!attribute [rw] endpoint
477
+ # The hostname or hostname:port of the service endpoint.
478
+ # Defaults to `"documentai.googleapis.com"`.
479
+ # @return [::String]
480
+ # @!attribute [rw] credentials
481
+ # Credentials to send with calls. You may provide any of the following types:
482
+ # * (`String`) The path to a service account key file in JSON format
483
+ # * (`Hash`) A service account key as a Hash
484
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
485
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
486
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
487
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
488
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
489
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
490
+ # * (`nil`) indicating no credentials
491
+ # @return [::Object]
492
+ # @!attribute [rw] scope
493
+ # The OAuth scopes
494
+ # @return [::Array<::String>]
495
+ # @!attribute [rw] lib_name
496
+ # The library name as recorded in instrumentation and logging
497
+ # @return [::String]
498
+ # @!attribute [rw] lib_version
499
+ # The library version as recorded in instrumentation and logging
500
+ # @return [::String]
501
+ # @!attribute [rw] channel_args
502
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
503
+ # `GRPC::Core::Channel` object is provided as the credential.
504
+ # @return [::Hash]
505
+ # @!attribute [rw] interceptors
506
+ # An array of interceptors that are run before calls are executed.
507
+ # @return [::Array<::GRPC::ClientInterceptor>]
508
+ # @!attribute [rw] timeout
509
+ # The call timeout in seconds.
510
+ # @return [::Numeric]
511
+ # @!attribute [rw] metadata
512
+ # Additional gRPC headers to be sent with the call.
513
+ # @return [::Hash{::Symbol=>::String}]
514
+ # @!attribute [rw] retry_policy
515
+ # The retry policy. The value is a hash with the following keys:
516
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
517
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
518
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
519
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
520
+ # trigger a retry.
521
+ # @return [::Hash]
522
+ # @!attribute [rw] quota_project
523
+ # A separate project against which to charge quota.
524
+ # @return [::String]
525
+ #
526
+ class Configuration
527
+ extend ::Gapic::Config
528
+
529
+ DEFAULT_ENDPOINT = "documentai.googleapis.com"
530
+
531
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
532
+ config_attr :credentials, nil do |value|
533
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
534
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
535
+ allowed.any? { |klass| klass === value }
536
+ end
537
+ config_attr :scope, nil, ::String, ::Array, nil
538
+ config_attr :lib_name, nil, ::String, nil
539
+ config_attr :lib_version, nil, ::String, nil
540
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
541
+ config_attr :interceptors, nil, ::Array, nil
542
+ config_attr :timeout, nil, ::Numeric, nil
543
+ config_attr :metadata, nil, ::Hash, nil
544
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
545
+ config_attr :quota_project, nil, ::String, nil
546
+
547
+ # @private
548
+ def initialize parent_config = nil
549
+ @parent_config = parent_config unless parent_config.nil?
550
+
551
+ yield self if block_given?
552
+ end
553
+
554
+ ##
555
+ # Configurations for individual RPCs
556
+ # @return [Rpcs]
557
+ #
558
+ def rpcs
559
+ @rpcs ||= begin
560
+ parent_rpcs = nil
561
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
562
+ Rpcs.new parent_rpcs
563
+ end
564
+ end
565
+
566
+ ##
567
+ # Configuration RPC class for the DocumentService API.
568
+ #
569
+ # Includes fields providing the configuration for each RPC in this service.
570
+ # Each configuration object is of type `Gapic::Config::Method` and includes
571
+ # the following configuration fields:
572
+ #
573
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
574
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
575
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
576
+ # include the following keys:
577
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
578
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
579
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
580
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
581
+ # trigger a retry.
582
+ #
583
+ class Rpcs
584
+ ##
585
+ # RPC-specific configuration for `update_dataset`
586
+ # @return [::Gapic::Config::Method]
587
+ #
588
+ attr_reader :update_dataset
589
+ ##
590
+ # RPC-specific configuration for `get_dataset_schema`
591
+ # @return [::Gapic::Config::Method]
592
+ #
593
+ attr_reader :get_dataset_schema
594
+ ##
595
+ # RPC-specific configuration for `update_dataset_schema`
596
+ # @return [::Gapic::Config::Method]
597
+ #
598
+ attr_reader :update_dataset_schema
599
+
600
+ # @private
601
+ def initialize parent_rpcs = nil
602
+ update_dataset_config = parent_rpcs.update_dataset if parent_rpcs.respond_to? :update_dataset
603
+ @update_dataset = ::Gapic::Config::Method.new update_dataset_config
604
+ get_dataset_schema_config = parent_rpcs.get_dataset_schema if parent_rpcs.respond_to? :get_dataset_schema
605
+ @get_dataset_schema = ::Gapic::Config::Method.new get_dataset_schema_config
606
+ update_dataset_schema_config = parent_rpcs.update_dataset_schema if parent_rpcs.respond_to? :update_dataset_schema
607
+ @update_dataset_schema = ::Gapic::Config::Method.new update_dataset_schema_config
608
+
609
+ yield self if block_given?
610
+ end
611
+ end
612
+ end
613
+ end
614
+ end
615
+ end
616
+ end
617
+ end
618
+ end
@@ -0,0 +1,51 @@
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 DocumentAI
24
+ module V1beta3
25
+ module DocumentService
26
+ # Credentials for the DocumentService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "DOCUMENT_AI_CREDENTIALS",
33
+ "DOCUMENT_AI_KEYFILE",
34
+ "GOOGLE_CLOUD_CREDENTIALS",
35
+ "GOOGLE_CLOUD_KEYFILE",
36
+ "GCLOUD_KEYFILE",
37
+ "DOCUMENT_AI_CREDENTIALS_JSON",
38
+ "DOCUMENT_AI_KEYFILE_JSON",
39
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
40
+ "GOOGLE_CLOUD_KEYFILE_JSON",
41
+ "GCLOUD_KEYFILE_JSON"
42
+ ]
43
+ self.paths = [
44
+ "~/.config/google_cloud/application_default_credentials.json"
45
+ ]
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end