google-cloud-document_ai-v1 1.2.0 → 1.3.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.
- checksums.yaml +4 -4
- data/README.md +30 -20
- data/lib/google/cloud/document_ai/v1/document_processor_service/client.rb +43 -23
- data/lib/google/cloud/document_ai/v1/document_processor_service/operations.rb +12 -15
- data/lib/google/cloud/document_ai/v1/document_processor_service/rest/client.rb +43 -23
- data/lib/google/cloud/document_ai/v1/document_processor_service/rest/operations.rb +43 -38
- data/lib/google/cloud/document_ai/v1/document_processor_service/rest/service_stub.rb +190 -134
- data/lib/google/cloud/document_ai/v1/version.rb +1 -1
- data/proto_docs/google/api/client.rb +39 -0
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95e3b111b3b85ac1d382e6552710500818a94dc3cc9e5f7e5727c3bde78e7ddf
|
4
|
+
data.tar.gz: c96bb3ac981ed6f2bba567108bd359b4353bcaaad1d9d290acd4f010719b58f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b19f36cb6a3655f32c3312f69f337baac598185de2fca8c336f81f8cd182d11ed56a4ec0b39cfada8f64c80f8b98dbf77d1d66c21c00130f158caa84b8c331d0
|
7
|
+
data.tar.gz: efcf52b2b8ce093713e490998ac704dc87acc56138f6398b847d76e1a37ce9d4d152e20f003d6e66c208cfcbd139e8a83f3e993b4cbdc543da5a0f87143d5515
|
data/README.md
CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
|
|
43
43
|
See also the [Product Documentation](https://cloud.google.com/document-ai/docs)
|
44
44
|
for general usage information.
|
45
45
|
|
46
|
-
##
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
## Debug Logging
|
47
|
+
|
48
|
+
This library comes with opt-in Debug Logging that can help you troubleshoot
|
49
|
+
your application's integration with the API. When logging is activated, key
|
50
|
+
events such as requests and responses, along with data payloads and metadata
|
51
|
+
such as headers and client configuration, are logged to the standard error
|
52
|
+
stream.
|
53
|
+
|
54
|
+
**WARNING:** Client Library Debug Logging includes your data payloads in
|
55
|
+
plaintext, which could include sensitive data such as PII for yourself or your
|
56
|
+
customers, private keys, or other security data that could be compromising if
|
57
|
+
leaked. Always practice good data hygiene with your application logs, and follow
|
58
|
+
the principle of least access. Google also recommends that Client Library Debug
|
59
|
+
Logging be enabled only temporarily during active debugging, and not used
|
60
|
+
permanently in production.
|
61
|
+
|
62
|
+
To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
|
63
|
+
to the value `all`. Alternatively, you can set the value to a comma-delimited
|
64
|
+
list of client library gem names. This will select the default logging behavior,
|
65
|
+
which writes logs to the standard error stream. On a local workstation, this may
|
66
|
+
result in logs appearing on the console. When running on a Google Cloud hosting
|
67
|
+
service such as [Google Cloud Run](https://cloud.google.com/run), this generally
|
68
|
+
results in logs appearing alongside your application logs in the
|
69
|
+
[Google Cloud Logging](https://cloud.google.com/logging/) service.
|
70
|
+
|
71
|
+
You can customize logging by modifying the `logger` configuration when
|
72
|
+
constructing a client object. For example:
|
55
73
|
|
56
74
|
```ruby
|
75
|
+
require "google/cloud/document_ai/v1"
|
57
76
|
require "logger"
|
58
77
|
|
59
|
-
|
60
|
-
|
61
|
-
def logger
|
62
|
-
LOGGER
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
67
|
-
module GRPC
|
68
|
-
extend MyLogger
|
78
|
+
client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new do |config|
|
79
|
+
config.logger = Logger.new "my-app.log"
|
69
80
|
end
|
70
81
|
```
|
71
82
|
|
72
|
-
|
73
83
|
## Google Cloud Samples
|
74
84
|
|
75
85
|
To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
|
@@ -183,14 +183,26 @@ module Google
|
|
183
183
|
universe_domain: @config.universe_domain,
|
184
184
|
channel_args: @config.channel_args,
|
185
185
|
interceptors: @config.interceptors,
|
186
|
-
channel_pool_config: @config.channel_pool
|
186
|
+
channel_pool_config: @config.channel_pool,
|
187
|
+
logger: @config.logger
|
187
188
|
)
|
188
189
|
|
190
|
+
@document_processor_service_stub.stub_logger&.info do |entry|
|
191
|
+
entry.set_system_name
|
192
|
+
entry.set_service
|
193
|
+
entry.message = "Created client for #{entry.service}"
|
194
|
+
entry.set_credentials_fields credentials
|
195
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
196
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
197
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
198
|
+
end
|
199
|
+
|
189
200
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
190
201
|
config.credentials = credentials
|
191
202
|
config.quota_project = @quota_project_id
|
192
203
|
config.endpoint = @document_processor_service_stub.endpoint
|
193
204
|
config.universe_domain = @document_processor_service_stub.universe_domain
|
205
|
+
config.logger = @document_processor_service_stub.logger if config.respond_to? :logger=
|
194
206
|
end
|
195
207
|
end
|
196
208
|
|
@@ -208,6 +220,15 @@ module Google
|
|
208
220
|
#
|
209
221
|
attr_reader :location_client
|
210
222
|
|
223
|
+
##
|
224
|
+
# The logger used for request/response debug logging.
|
225
|
+
#
|
226
|
+
# @return [Logger]
|
227
|
+
#
|
228
|
+
def logger
|
229
|
+
@document_processor_service_stub.logger
|
230
|
+
end
|
231
|
+
|
211
232
|
# Service calls
|
212
233
|
|
213
234
|
##
|
@@ -324,7 +345,6 @@ module Google
|
|
324
345
|
|
325
346
|
@document_processor_service_stub.call_rpc :process_document, request, options: options do |response, operation|
|
326
347
|
yield response, operation if block_given?
|
327
|
-
return response
|
328
348
|
end
|
329
349
|
rescue ::GRPC::BadStatus => e
|
330
350
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -444,7 +464,7 @@ module Google
|
|
444
464
|
@document_processor_service_stub.call_rpc :batch_process_documents, request, options: options do |response, operation|
|
445
465
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
446
466
|
yield response, operation if block_given?
|
447
|
-
|
467
|
+
throw :response, response
|
448
468
|
end
|
449
469
|
rescue ::GRPC::BadStatus => e
|
450
470
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -533,7 +553,6 @@ module Google
|
|
533
553
|
|
534
554
|
@document_processor_service_stub.call_rpc :fetch_processor_types, request, options: options do |response, operation|
|
535
555
|
yield response, operation if block_given?
|
536
|
-
return response
|
537
556
|
end
|
538
557
|
rescue ::GRPC::BadStatus => e
|
539
558
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -631,7 +650,7 @@ module Google
|
|
631
650
|
@document_processor_service_stub.call_rpc :list_processor_types, request, options: options do |response, operation|
|
632
651
|
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processor_types, request, response, operation, options
|
633
652
|
yield response, operation if block_given?
|
634
|
-
|
653
|
+
throw :response, response
|
635
654
|
end
|
636
655
|
rescue ::GRPC::BadStatus => e
|
637
656
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -717,7 +736,6 @@ module Google
|
|
717
736
|
|
718
737
|
@document_processor_service_stub.call_rpc :get_processor_type, request, options: options do |response, operation|
|
719
738
|
yield response, operation if block_given?
|
720
|
-
return response
|
721
739
|
end
|
722
740
|
rescue ::GRPC::BadStatus => e
|
723
741
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -816,7 +834,7 @@ module Google
|
|
816
834
|
@document_processor_service_stub.call_rpc :list_processors, request, options: options do |response, operation|
|
817
835
|
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processors, request, response, operation, options
|
818
836
|
yield response, operation if block_given?
|
819
|
-
|
837
|
+
throw :response, response
|
820
838
|
end
|
821
839
|
rescue ::GRPC::BadStatus => e
|
822
840
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -902,7 +920,6 @@ module Google
|
|
902
920
|
|
903
921
|
@document_processor_service_stub.call_rpc :get_processor, request, options: options do |response, operation|
|
904
922
|
yield response, operation if block_given?
|
905
|
-
return response
|
906
923
|
end
|
907
924
|
rescue ::GRPC::BadStatus => e
|
908
925
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1015,7 +1032,7 @@ module Google
|
|
1015
1032
|
@document_processor_service_stub.call_rpc :train_processor_version, request, options: options do |response, operation|
|
1016
1033
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1017
1034
|
yield response, operation if block_given?
|
1018
|
-
|
1035
|
+
throw :response, response
|
1019
1036
|
end
|
1020
1037
|
rescue ::GRPC::BadStatus => e
|
1021
1038
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1101,7 +1118,6 @@ module Google
|
|
1101
1118
|
|
1102
1119
|
@document_processor_service_stub.call_rpc :get_processor_version, request, options: options do |response, operation|
|
1103
1120
|
yield response, operation if block_given?
|
1104
|
-
return response
|
1105
1121
|
end
|
1106
1122
|
rescue ::GRPC::BadStatus => e
|
1107
1123
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1201,7 +1217,7 @@ module Google
|
|
1201
1217
|
@document_processor_service_stub.call_rpc :list_processor_versions, request, options: options do |response, operation|
|
1202
1218
|
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processor_versions, request, response, operation, options
|
1203
1219
|
yield response, operation if block_given?
|
1204
|
-
|
1220
|
+
throw :response, response
|
1205
1221
|
end
|
1206
1222
|
rescue ::GRPC::BadStatus => e
|
1207
1223
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1296,7 +1312,7 @@ module Google
|
|
1296
1312
|
@document_processor_service_stub.call_rpc :delete_processor_version, request, options: options do |response, operation|
|
1297
1313
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1298
1314
|
yield response, operation if block_given?
|
1299
|
-
|
1315
|
+
throw :response, response
|
1300
1316
|
end
|
1301
1317
|
rescue ::GRPC::BadStatus => e
|
1302
1318
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1390,7 +1406,7 @@ module Google
|
|
1390
1406
|
@document_processor_service_stub.call_rpc :deploy_processor_version, request, options: options do |response, operation|
|
1391
1407
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1392
1408
|
yield response, operation if block_given?
|
1393
|
-
|
1409
|
+
throw :response, response
|
1394
1410
|
end
|
1395
1411
|
rescue ::GRPC::BadStatus => e
|
1396
1412
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1484,7 +1500,7 @@ module Google
|
|
1484
1500
|
@document_processor_service_stub.call_rpc :undeploy_processor_version, request, options: options do |response, operation|
|
1485
1501
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1486
1502
|
yield response, operation if block_given?
|
1487
|
-
|
1503
|
+
throw :response, response
|
1488
1504
|
end
|
1489
1505
|
rescue ::GRPC::BadStatus => e
|
1490
1506
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1584,7 +1600,6 @@ module Google
|
|
1584
1600
|
|
1585
1601
|
@document_processor_service_stub.call_rpc :create_processor, request, options: options do |response, operation|
|
1586
1602
|
yield response, operation if block_given?
|
1587
|
-
return response
|
1588
1603
|
end
|
1589
1604
|
rescue ::GRPC::BadStatus => e
|
1590
1605
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1679,7 +1694,7 @@ module Google
|
|
1679
1694
|
@document_processor_service_stub.call_rpc :delete_processor, request, options: options do |response, operation|
|
1680
1695
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1681
1696
|
yield response, operation if block_given?
|
1682
|
-
|
1697
|
+
throw :response, response
|
1683
1698
|
end
|
1684
1699
|
rescue ::GRPC::BadStatus => e
|
1685
1700
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1773,7 +1788,7 @@ module Google
|
|
1773
1788
|
@document_processor_service_stub.call_rpc :enable_processor, request, options: options do |response, operation|
|
1774
1789
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1775
1790
|
yield response, operation if block_given?
|
1776
|
-
|
1791
|
+
throw :response, response
|
1777
1792
|
end
|
1778
1793
|
rescue ::GRPC::BadStatus => e
|
1779
1794
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1867,7 +1882,7 @@ module Google
|
|
1867
1882
|
@document_processor_service_stub.call_rpc :disable_processor, request, options: options do |response, operation|
|
1868
1883
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1869
1884
|
yield response, operation if block_given?
|
1870
|
-
|
1885
|
+
throw :response, response
|
1871
1886
|
end
|
1872
1887
|
rescue ::GRPC::BadStatus => e
|
1873
1888
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1972,7 +1987,7 @@ module Google
|
|
1972
1987
|
@document_processor_service_stub.call_rpc :set_default_processor_version, request, options: options do |response, operation|
|
1973
1988
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1974
1989
|
yield response, operation if block_given?
|
1975
|
-
|
1990
|
+
throw :response, response
|
1976
1991
|
end
|
1977
1992
|
rescue ::GRPC::BadStatus => e
|
1978
1993
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2077,7 +2092,7 @@ module Google
|
|
2077
2092
|
@document_processor_service_stub.call_rpc :review_document, request, options: options do |response, operation|
|
2078
2093
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
2079
2094
|
yield response, operation if block_given?
|
2080
|
-
|
2095
|
+
throw :response, response
|
2081
2096
|
end
|
2082
2097
|
rescue ::GRPC::BadStatus => e
|
2083
2098
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2178,7 +2193,7 @@ module Google
|
|
2178
2193
|
@document_processor_service_stub.call_rpc :evaluate_processor_version, request, options: options do |response, operation|
|
2179
2194
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
2180
2195
|
yield response, operation if block_given?
|
2181
|
-
|
2196
|
+
throw :response, response
|
2182
2197
|
end
|
2183
2198
|
rescue ::GRPC::BadStatus => e
|
2184
2199
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2266,7 +2281,6 @@ module Google
|
|
2266
2281
|
|
2267
2282
|
@document_processor_service_stub.call_rpc :get_evaluation, request, options: options do |response, operation|
|
2268
2283
|
yield response, operation if block_given?
|
2269
|
-
return response
|
2270
2284
|
end
|
2271
2285
|
rescue ::GRPC::BadStatus => e
|
2272
2286
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2367,7 +2381,7 @@ module Google
|
|
2367
2381
|
@document_processor_service_stub.call_rpc :list_evaluations, request, options: options do |response, operation|
|
2368
2382
|
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_evaluations, request, response, operation, options
|
2369
2383
|
yield response, operation if block_given?
|
2370
|
-
|
2384
|
+
throw :response, response
|
2371
2385
|
end
|
2372
2386
|
rescue ::GRPC::BadStatus => e
|
2373
2387
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2456,6 +2470,11 @@ module Google
|
|
2456
2470
|
# default endpoint URL. The default value of nil uses the environment
|
2457
2471
|
# universe (usually the default "googleapis.com" universe).
|
2458
2472
|
# @return [::String,nil]
|
2473
|
+
# @!attribute [rw] logger
|
2474
|
+
# A custom logger to use for request/response debug logging, or the value
|
2475
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
2476
|
+
# explicitly disable logging.
|
2477
|
+
# @return [::Logger,:default,nil]
|
2459
2478
|
#
|
2460
2479
|
class Configuration
|
2461
2480
|
extend ::Gapic::Config
|
@@ -2480,6 +2499,7 @@ module Google
|
|
2480
2499
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
2481
2500
|
config_attr :quota_project, nil, ::String, nil
|
2482
2501
|
config_attr :universe_domain, nil, ::String, nil
|
2502
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
2483
2503
|
|
2484
2504
|
# @private
|
2485
2505
|
def initialize parent_config = nil
|
@@ -124,14 +124,6 @@ module Google
|
|
124
124
|
# Lists operations that match the specified filter in the request. If the
|
125
125
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
126
126
|
#
|
127
|
-
# NOTE: the `name` binding allows API services to override the binding
|
128
|
-
# to use different resource name schemes, such as `users/*/operations`. To
|
129
|
-
# override the binding, API services can add a binding such as
|
130
|
-
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
131
|
-
# For backwards compatibility, the default name includes the operations
|
132
|
-
# collection id, however overriding users must ensure the name binding
|
133
|
-
# is the parent resource, without the operations collection id.
|
134
|
-
#
|
135
127
|
# @overload list_operations(request, options = nil)
|
136
128
|
# Pass arguments to `list_operations` via a request object, either of type
|
137
129
|
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
@@ -221,7 +213,7 @@ module Google
|
|
221
213
|
wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
|
222
214
|
response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
|
223
215
|
yield response, operation if block_given?
|
224
|
-
|
216
|
+
throw :response, response
|
225
217
|
end
|
226
218
|
rescue ::GRPC::BadStatus => e
|
227
219
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -317,7 +309,7 @@ module Google
|
|
317
309
|
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
318
310
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
319
311
|
yield response, operation if block_given?
|
320
|
-
|
312
|
+
throw :response, response
|
321
313
|
end
|
322
314
|
rescue ::GRPC::BadStatus => e
|
323
315
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -406,7 +398,6 @@ module Google
|
|
406
398
|
|
407
399
|
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
408
400
|
yield response, operation if block_given?
|
409
|
-
return response
|
410
401
|
end
|
411
402
|
rescue ::GRPC::BadStatus => e
|
412
403
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -421,8 +412,9 @@ module Google
|
|
421
412
|
# other methods to check whether the cancellation succeeded or whether the
|
422
413
|
# operation completed despite cancellation. On successful cancellation,
|
423
414
|
# the operation is not deleted; instead, it becomes an operation with
|
424
|
-
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
425
|
-
# corresponding to
|
415
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
416
|
+
# {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
|
417
|
+
# `Code.CANCELLED`.
|
426
418
|
#
|
427
419
|
# @overload cancel_operation(request, options = nil)
|
428
420
|
# Pass arguments to `cancel_operation` via a request object, either of type
|
@@ -501,7 +493,6 @@ module Google
|
|
501
493
|
|
502
494
|
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
503
495
|
yield response, operation if block_given?
|
504
|
-
return response
|
505
496
|
end
|
506
497
|
rescue ::GRPC::BadStatus => e
|
507
498
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -599,7 +590,7 @@ module Google
|
|
599
590
|
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
600
591
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
601
592
|
yield response, operation if block_given?
|
602
|
-
|
593
|
+
throw :response, response
|
603
594
|
end
|
604
595
|
rescue ::GRPC::BadStatus => e
|
605
596
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -688,6 +679,11 @@ module Google
|
|
688
679
|
# default endpoint URL. The default value of nil uses the environment
|
689
680
|
# universe (usually the default "googleapis.com" universe).
|
690
681
|
# @return [::String,nil]
|
682
|
+
# @!attribute [rw] logger
|
683
|
+
# A custom logger to use for request/response debug logging, or the value
|
684
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
685
|
+
# explicitly disable logging.
|
686
|
+
# @return [::Logger,:default,nil]
|
691
687
|
#
|
692
688
|
class Configuration
|
693
689
|
extend ::Gapic::Config
|
@@ -712,6 +708,7 @@ module Google
|
|
712
708
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
713
709
|
config_attr :quota_project, nil, ::String, nil
|
714
710
|
config_attr :universe_domain, nil, ::String, nil
|
711
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
715
712
|
|
716
713
|
# @private
|
717
714
|
def initialize parent_config = nil
|
@@ -176,15 +176,27 @@ module Google
|
|
176
176
|
endpoint: @config.endpoint,
|
177
177
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
178
178
|
universe_domain: @config.universe_domain,
|
179
|
-
credentials: credentials
|
179
|
+
credentials: credentials,
|
180
|
+
logger: @config.logger
|
180
181
|
)
|
181
182
|
|
183
|
+
@document_processor_service_stub.logger(stub: true)&.info do |entry|
|
184
|
+
entry.set_system_name
|
185
|
+
entry.set_service
|
186
|
+
entry.message = "Created client for #{entry.service}"
|
187
|
+
entry.set_credentials_fields credentials
|
188
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
189
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
190
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
191
|
+
end
|
192
|
+
|
182
193
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
183
194
|
config.credentials = credentials
|
184
195
|
config.quota_project = @quota_project_id
|
185
196
|
config.endpoint = @document_processor_service_stub.endpoint
|
186
197
|
config.universe_domain = @document_processor_service_stub.universe_domain
|
187
198
|
config.bindings_override = @config.bindings_override
|
199
|
+
config.logger = @document_processor_service_stub.logger if config.respond_to? :logger=
|
188
200
|
end
|
189
201
|
end
|
190
202
|
|
@@ -202,6 +214,15 @@ module Google
|
|
202
214
|
#
|
203
215
|
attr_reader :location_client
|
204
216
|
|
217
|
+
##
|
218
|
+
# The logger used for request/response debug logging.
|
219
|
+
#
|
220
|
+
# @return [Logger]
|
221
|
+
#
|
222
|
+
def logger
|
223
|
+
@document_processor_service_stub.logger
|
224
|
+
end
|
225
|
+
|
205
226
|
# Service calls
|
206
227
|
|
207
228
|
##
|
@@ -311,7 +332,6 @@ module Google
|
|
311
332
|
|
312
333
|
@document_processor_service_stub.process_document request, options do |result, operation|
|
313
334
|
yield result, operation if block_given?
|
314
|
-
return result
|
315
335
|
end
|
316
336
|
rescue ::Gapic::Rest::Error => e
|
317
337
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -424,7 +444,7 @@ module Google
|
|
424
444
|
@document_processor_service_stub.batch_process_documents request, options do |result, operation|
|
425
445
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
426
446
|
yield result, operation if block_given?
|
427
|
-
|
447
|
+
throw :response, result
|
428
448
|
end
|
429
449
|
rescue ::Gapic::Rest::Error => e
|
430
450
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -506,7 +526,6 @@ module Google
|
|
506
526
|
|
507
527
|
@document_processor_service_stub.fetch_processor_types request, options do |result, operation|
|
508
528
|
yield result, operation if block_given?
|
509
|
-
return result
|
510
529
|
end
|
511
530
|
rescue ::Gapic::Rest::Error => e
|
512
531
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -597,7 +616,7 @@ module Google
|
|
597
616
|
@document_processor_service_stub.list_processor_types request, options do |result, operation|
|
598
617
|
result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_processor_types, "processor_types", request, result, options
|
599
618
|
yield result, operation if block_given?
|
600
|
-
|
619
|
+
throw :response, result
|
601
620
|
end
|
602
621
|
rescue ::Gapic::Rest::Error => e
|
603
622
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -676,7 +695,6 @@ module Google
|
|
676
695
|
|
677
696
|
@document_processor_service_stub.get_processor_type request, options do |result, operation|
|
678
697
|
yield result, operation if block_given?
|
679
|
-
return result
|
680
698
|
end
|
681
699
|
rescue ::Gapic::Rest::Error => e
|
682
700
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -768,7 +786,7 @@ module Google
|
|
768
786
|
@document_processor_service_stub.list_processors request, options do |result, operation|
|
769
787
|
result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_processors, "processors", request, result, options
|
770
788
|
yield result, operation if block_given?
|
771
|
-
|
789
|
+
throw :response, result
|
772
790
|
end
|
773
791
|
rescue ::Gapic::Rest::Error => e
|
774
792
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -847,7 +865,6 @@ module Google
|
|
847
865
|
|
848
866
|
@document_processor_service_stub.get_processor request, options do |result, operation|
|
849
867
|
yield result, operation if block_given?
|
850
|
-
return result
|
851
868
|
end
|
852
869
|
rescue ::Gapic::Rest::Error => e
|
853
870
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -953,7 +970,7 @@ module Google
|
|
953
970
|
@document_processor_service_stub.train_processor_version request, options do |result, operation|
|
954
971
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
955
972
|
yield result, operation if block_given?
|
956
|
-
|
973
|
+
throw :response, result
|
957
974
|
end
|
958
975
|
rescue ::Gapic::Rest::Error => e
|
959
976
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1032,7 +1049,6 @@ module Google
|
|
1032
1049
|
|
1033
1050
|
@document_processor_service_stub.get_processor_version request, options do |result, operation|
|
1034
1051
|
yield result, operation if block_given?
|
1035
|
-
return result
|
1036
1052
|
end
|
1037
1053
|
rescue ::Gapic::Rest::Error => e
|
1038
1054
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1125,7 +1141,7 @@ module Google
|
|
1125
1141
|
@document_processor_service_stub.list_processor_versions request, options do |result, operation|
|
1126
1142
|
result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_processor_versions, "processor_versions", request, result, options
|
1127
1143
|
yield result, operation if block_given?
|
1128
|
-
|
1144
|
+
throw :response, result
|
1129
1145
|
end
|
1130
1146
|
rescue ::Gapic::Rest::Error => e
|
1131
1147
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1213,7 +1229,7 @@ module Google
|
|
1213
1229
|
@document_processor_service_stub.delete_processor_version request, options do |result, operation|
|
1214
1230
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1215
1231
|
yield result, operation if block_given?
|
1216
|
-
|
1232
|
+
throw :response, result
|
1217
1233
|
end
|
1218
1234
|
rescue ::Gapic::Rest::Error => e
|
1219
1235
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1300,7 +1316,7 @@ module Google
|
|
1300
1316
|
@document_processor_service_stub.deploy_processor_version request, options do |result, operation|
|
1301
1317
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1302
1318
|
yield result, operation if block_given?
|
1303
|
-
|
1319
|
+
throw :response, result
|
1304
1320
|
end
|
1305
1321
|
rescue ::Gapic::Rest::Error => e
|
1306
1322
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1387,7 +1403,7 @@ module Google
|
|
1387
1403
|
@document_processor_service_stub.undeploy_processor_version request, options do |result, operation|
|
1388
1404
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1389
1405
|
yield result, operation if block_given?
|
1390
|
-
|
1406
|
+
throw :response, result
|
1391
1407
|
end
|
1392
1408
|
rescue ::Gapic::Rest::Error => e
|
1393
1409
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1480,7 +1496,6 @@ module Google
|
|
1480
1496
|
|
1481
1497
|
@document_processor_service_stub.create_processor request, options do |result, operation|
|
1482
1498
|
yield result, operation if block_given?
|
1483
|
-
return result
|
1484
1499
|
end
|
1485
1500
|
rescue ::Gapic::Rest::Error => e
|
1486
1501
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1568,7 +1583,7 @@ module Google
|
|
1568
1583
|
@document_processor_service_stub.delete_processor request, options do |result, operation|
|
1569
1584
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1570
1585
|
yield result, operation if block_given?
|
1571
|
-
|
1586
|
+
throw :response, result
|
1572
1587
|
end
|
1573
1588
|
rescue ::Gapic::Rest::Error => e
|
1574
1589
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1655,7 +1670,7 @@ module Google
|
|
1655
1670
|
@document_processor_service_stub.enable_processor request, options do |result, operation|
|
1656
1671
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1657
1672
|
yield result, operation if block_given?
|
1658
|
-
|
1673
|
+
throw :response, result
|
1659
1674
|
end
|
1660
1675
|
rescue ::Gapic::Rest::Error => e
|
1661
1676
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1742,7 +1757,7 @@ module Google
|
|
1742
1757
|
@document_processor_service_stub.disable_processor request, options do |result, operation|
|
1743
1758
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1744
1759
|
yield result, operation if block_given?
|
1745
|
-
|
1760
|
+
throw :response, result
|
1746
1761
|
end
|
1747
1762
|
rescue ::Gapic::Rest::Error => e
|
1748
1763
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1840,7 +1855,7 @@ module Google
|
|
1840
1855
|
@document_processor_service_stub.set_default_processor_version request, options do |result, operation|
|
1841
1856
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1842
1857
|
yield result, operation if block_given?
|
1843
|
-
|
1858
|
+
throw :response, result
|
1844
1859
|
end
|
1845
1860
|
rescue ::Gapic::Rest::Error => e
|
1846
1861
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1938,7 +1953,7 @@ module Google
|
|
1938
1953
|
@document_processor_service_stub.review_document request, options do |result, operation|
|
1939
1954
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1940
1955
|
yield result, operation if block_given?
|
1941
|
-
|
1956
|
+
throw :response, result
|
1942
1957
|
end
|
1943
1958
|
rescue ::Gapic::Rest::Error => e
|
1944
1959
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2032,7 +2047,7 @@ module Google
|
|
2032
2047
|
@document_processor_service_stub.evaluate_processor_version request, options do |result, operation|
|
2033
2048
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
2034
2049
|
yield result, operation if block_given?
|
2035
|
-
|
2050
|
+
throw :response, result
|
2036
2051
|
end
|
2037
2052
|
rescue ::Gapic::Rest::Error => e
|
2038
2053
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2113,7 +2128,6 @@ module Google
|
|
2113
2128
|
|
2114
2129
|
@document_processor_service_stub.get_evaluation request, options do |result, operation|
|
2115
2130
|
yield result, operation if block_given?
|
2116
|
-
return result
|
2117
2131
|
end
|
2118
2132
|
rescue ::Gapic::Rest::Error => e
|
2119
2133
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2207,7 +2221,7 @@ module Google
|
|
2207
2221
|
@document_processor_service_stub.list_evaluations request, options do |result, operation|
|
2208
2222
|
result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_evaluations, "evaluations", request, result, options
|
2209
2223
|
yield result, operation if block_given?
|
2210
|
-
|
2224
|
+
throw :response, result
|
2211
2225
|
end
|
2212
2226
|
rescue ::Gapic::Rest::Error => e
|
2213
2227
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2287,6 +2301,11 @@ module Google
|
|
2287
2301
|
# default endpoint URL. The default value of nil uses the environment
|
2288
2302
|
# universe (usually the default "googleapis.com" universe).
|
2289
2303
|
# @return [::String,nil]
|
2304
|
+
# @!attribute [rw] logger
|
2305
|
+
# A custom logger to use for request/response debug logging, or the value
|
2306
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
2307
|
+
# explicitly disable logging.
|
2308
|
+
# @return [::Logger,:default,nil]
|
2290
2309
|
#
|
2291
2310
|
class Configuration
|
2292
2311
|
extend ::Gapic::Config
|
@@ -2315,6 +2334,7 @@ module Google
|
|
2315
2334
|
# by the host service.
|
2316
2335
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
2317
2336
|
config_attr :bindings_override, {}, ::Hash, nil
|
2337
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
2318
2338
|
|
2319
2339
|
# @private
|
2320
2340
|
def initialize parent_config = nil
|