google-cloud-automl-v1beta1 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1fcf3c9bd2553e6d59b69f8a1b237bd2f9b7c69bbbfa5d34339a49d300420a1
4
- data.tar.gz: fcdb4b58be3d090d2c17c2d4f0ae345e6ec75b007cd423049d9813c519a6c03a
3
+ metadata.gz: f2d49f8670a69eb9aeb207c838d57b1c2de21e55980f0a4755404824ef9976e5
4
+ data.tar.gz: a34775ff7db0af650c61b921e36f8c1e50401f4876e3d7a6262e5852dcffc865
5
5
  SHA512:
6
- metadata.gz: a1cea43c8d15010f5e2979c1178bd5df813a4d08a47e1c50f6ab2a56e7ba346b095425e50b1e6acdf3c9bf8b958b76c535fc894d06719fad169e63bb1f7d32ed
7
- data.tar.gz: e2a1cdf90a97fd2cba23f5d436262aefaed8d97846ff02cbd435f5173860ee7fb7a7482a678c6664e7faa277ac3e63ed6b04efea6dae7cd3206a57bc5d36e73b
6
+ metadata.gz: 7e4cfacfbdf5891a29ddc1442374a06608b237a4aeb6ec12963bbe56a83c82f4d6656e308fcc4d8724f8b3743d2ccf545ca329e1e1dc84dc86a0bb1c0b7b5571
7
+ data.tar.gz: 0c2144b9a7eacab1ad88ce27d193de6a1cf6bacf68ba3430302f4c391973ed7c2a5fa65a3030aa622dd45aad2e60bdfb2956713fdbe7b138cc4b0460113f4cf8
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/automl)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
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/automl/v1beta1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
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::AutoML::V1beta1::PredictionService::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).
@@ -261,8 +261,19 @@ module Google
261
261
  universe_domain: @config.universe_domain,
262
262
  channel_args: @config.channel_args,
263
263
  interceptors: @config.interceptors,
264
- channel_pool_config: @config.channel_pool
264
+ channel_pool_config: @config.channel_pool,
265
+ logger: @config.logger
265
266
  )
267
+
268
+ @auto_ml_stub.stub_logger&.info do |entry|
269
+ entry.set_system_name
270
+ entry.set_service
271
+ entry.message = "Created client for #{entry.service}"
272
+ entry.set_credentials_fields credentials
273
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
274
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
275
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
276
+ end
266
277
  end
267
278
 
268
279
  ##
@@ -272,6 +283,15 @@ module Google
272
283
  #
273
284
  attr_reader :operations_client
274
285
 
286
+ ##
287
+ # The logger used for request/response debug logging.
288
+ #
289
+ # @return [Logger]
290
+ #
291
+ def logger
292
+ @auto_ml_stub.logger
293
+ end
294
+
275
295
  # Service calls
276
296
 
277
297
  ##
@@ -356,7 +376,6 @@ module Google
356
376
 
357
377
  @auto_ml_stub.call_rpc :create_dataset, request, options: options do |response, operation|
358
378
  yield response, operation if block_given?
359
- return response
360
379
  end
361
380
  rescue ::GRPC::BadStatus => e
362
381
  raise ::Google::Cloud::Error.from_error(e)
@@ -442,7 +461,6 @@ module Google
442
461
 
443
462
  @auto_ml_stub.call_rpc :get_dataset, request, options: options do |response, operation|
444
463
  yield response, operation if block_given?
445
- return response
446
464
  end
447
465
  rescue ::GRPC::BadStatus => e
448
466
  raise ::Google::Cloud::Error.from_error(e)
@@ -550,7 +568,7 @@ module Google
550
568
  @auto_ml_stub.call_rpc :list_datasets, request, options: options do |response, operation|
551
569
  response = ::Gapic::PagedEnumerable.new @auto_ml_stub, :list_datasets, request, response, operation, options
552
570
  yield response, operation if block_given?
553
- return response
571
+ throw :response, response
554
572
  end
555
573
  rescue ::GRPC::BadStatus => e
556
574
  raise ::Google::Cloud::Error.from_error(e)
@@ -638,7 +656,6 @@ module Google
638
656
 
639
657
  @auto_ml_stub.call_rpc :update_dataset, request, options: options do |response, operation|
640
658
  yield response, operation if block_given?
641
- return response
642
659
  end
643
660
  rescue ::GRPC::BadStatus => e
644
661
  raise ::Google::Cloud::Error.from_error(e)
@@ -736,7 +753,7 @@ module Google
736
753
  @auto_ml_stub.call_rpc :delete_dataset, request, options: options do |response, operation|
737
754
  response = ::Gapic::Operation.new response, @operations_client, options: options
738
755
  yield response, operation if block_given?
739
- return response
756
+ throw :response, response
740
757
  end
741
758
  rescue ::GRPC::BadStatus => e
742
759
  raise ::Google::Cloud::Error.from_error(e)
@@ -842,7 +859,7 @@ module Google
842
859
  @auto_ml_stub.call_rpc :import_data, request, options: options do |response, operation|
843
860
  response = ::Gapic::Operation.new response, @operations_client, options: options
844
861
  yield response, operation if block_given?
845
- return response
862
+ throw :response, response
846
863
  end
847
864
  rescue ::GRPC::BadStatus => e
848
865
  raise ::Google::Cloud::Error.from_error(e)
@@ -940,7 +957,7 @@ module Google
940
957
  @auto_ml_stub.call_rpc :export_data, request, options: options do |response, operation|
941
958
  response = ::Gapic::Operation.new response, @operations_client, options: options
942
959
  yield response, operation if block_given?
943
- return response
960
+ throw :response, response
944
961
  end
945
962
  rescue ::GRPC::BadStatus => e
946
963
  raise ::Google::Cloud::Error.from_error(e)
@@ -1026,7 +1043,6 @@ module Google
1026
1043
 
1027
1044
  @auto_ml_stub.call_rpc :get_annotation_spec, request, options: options do |response, operation|
1028
1045
  yield response, operation if block_given?
1029
- return response
1030
1046
  end
1031
1047
  rescue ::GRPC::BadStatus => e
1032
1048
  raise ::Google::Cloud::Error.from_error(e)
@@ -1114,7 +1130,6 @@ module Google
1114
1130
 
1115
1131
  @auto_ml_stub.call_rpc :get_table_spec, request, options: options do |response, operation|
1116
1132
  yield response, operation if block_given?
1117
- return response
1118
1133
  end
1119
1134
  rescue ::GRPC::BadStatus => e
1120
1135
  raise ::Google::Cloud::Error.from_error(e)
@@ -1217,7 +1232,7 @@ module Google
1217
1232
  @auto_ml_stub.call_rpc :list_table_specs, request, options: options do |response, operation|
1218
1233
  response = ::Gapic::PagedEnumerable.new @auto_ml_stub, :list_table_specs, request, response, operation, options
1219
1234
  yield response, operation if block_given?
1220
- return response
1235
+ throw :response, response
1221
1236
  end
1222
1237
  rescue ::GRPC::BadStatus => e
1223
1238
  raise ::Google::Cloud::Error.from_error(e)
@@ -1305,7 +1320,6 @@ module Google
1305
1320
 
1306
1321
  @auto_ml_stub.call_rpc :update_table_spec, request, options: options do |response, operation|
1307
1322
  yield response, operation if block_given?
1308
- return response
1309
1323
  end
1310
1324
  rescue ::GRPC::BadStatus => e
1311
1325
  raise ::Google::Cloud::Error.from_error(e)
@@ -1393,7 +1407,6 @@ module Google
1393
1407
 
1394
1408
  @auto_ml_stub.call_rpc :get_column_spec, request, options: options do |response, operation|
1395
1409
  yield response, operation if block_given?
1396
- return response
1397
1410
  end
1398
1411
  rescue ::GRPC::BadStatus => e
1399
1412
  raise ::Google::Cloud::Error.from_error(e)
@@ -1496,7 +1509,7 @@ module Google
1496
1509
  @auto_ml_stub.call_rpc :list_column_specs, request, options: options do |response, operation|
1497
1510
  response = ::Gapic::PagedEnumerable.new @auto_ml_stub, :list_column_specs, request, response, operation, options
1498
1511
  yield response, operation if block_given?
1499
- return response
1512
+ throw :response, response
1500
1513
  end
1501
1514
  rescue ::GRPC::BadStatus => e
1502
1515
  raise ::Google::Cloud::Error.from_error(e)
@@ -1584,7 +1597,6 @@ module Google
1584
1597
 
1585
1598
  @auto_ml_stub.call_rpc :update_column_spec, request, options: options do |response, operation|
1586
1599
  yield response, operation if block_given?
1587
- return response
1588
1600
  end
1589
1601
  rescue ::GRPC::BadStatus => e
1590
1602
  raise ::Google::Cloud::Error.from_error(e)
@@ -1684,7 +1696,7 @@ module Google
1684
1696
  @auto_ml_stub.call_rpc :create_model, request, options: options do |response, operation|
1685
1697
  response = ::Gapic::Operation.new response, @operations_client, options: options
1686
1698
  yield response, operation if block_given?
1687
- return response
1699
+ throw :response, response
1688
1700
  end
1689
1701
  rescue ::GRPC::BadStatus => e
1690
1702
  raise ::Google::Cloud::Error.from_error(e)
@@ -1770,7 +1782,6 @@ module Google
1770
1782
 
1771
1783
  @auto_ml_stub.call_rpc :get_model, request, options: options do |response, operation|
1772
1784
  yield response, operation if block_given?
1773
- return response
1774
1785
  end
1775
1786
  rescue ::GRPC::BadStatus => e
1776
1787
  raise ::Google::Cloud::Error.from_error(e)
@@ -1878,7 +1889,7 @@ module Google
1878
1889
  @auto_ml_stub.call_rpc :list_models, request, options: options do |response, operation|
1879
1890
  response = ::Gapic::PagedEnumerable.new @auto_ml_stub, :list_models, request, response, operation, options
1880
1891
  yield response, operation if block_given?
1881
- return response
1892
+ throw :response, response
1882
1893
  end
1883
1894
  rescue ::GRPC::BadStatus => e
1884
1895
  raise ::Google::Cloud::Error.from_error(e)
@@ -1976,7 +1987,7 @@ module Google
1976
1987
  @auto_ml_stub.call_rpc :delete_model, request, options: options do |response, operation|
1977
1988
  response = ::Gapic::Operation.new response, @operations_client, options: options
1978
1989
  yield response, operation if block_given?
1979
- return response
1990
+ throw :response, response
1980
1991
  end
1981
1992
  rescue ::GRPC::BadStatus => e
1982
1993
  raise ::Google::Cloud::Error.from_error(e)
@@ -2085,7 +2096,7 @@ module Google
2085
2096
  @auto_ml_stub.call_rpc :deploy_model, request, options: options do |response, operation|
2086
2097
  response = ::Gapic::Operation.new response, @operations_client, options: options
2087
2098
  yield response, operation if block_given?
2088
- return response
2099
+ throw :response, response
2089
2100
  end
2090
2101
  rescue ::GRPC::BadStatus => e
2091
2102
  raise ::Google::Cloud::Error.from_error(e)
@@ -2185,7 +2196,7 @@ module Google
2185
2196
  @auto_ml_stub.call_rpc :undeploy_model, request, options: options do |response, operation|
2186
2197
  response = ::Gapic::Operation.new response, @operations_client, options: options
2187
2198
  yield response, operation if block_given?
2188
- return response
2199
+ throw :response, response
2189
2200
  end
2190
2201
  rescue ::GRPC::BadStatus => e
2191
2202
  raise ::Google::Cloud::Error.from_error(e)
@@ -2288,7 +2299,7 @@ module Google
2288
2299
  @auto_ml_stub.call_rpc :export_model, request, options: options do |response, operation|
2289
2300
  response = ::Gapic::Operation.new response, @operations_client, options: options
2290
2301
  yield response, operation if block_given?
2291
- return response
2302
+ throw :response, response
2292
2303
  end
2293
2304
  rescue ::GRPC::BadStatus => e
2294
2305
  raise ::Google::Cloud::Error.from_error(e)
@@ -2398,7 +2409,7 @@ module Google
2398
2409
  @auto_ml_stub.call_rpc :export_evaluated_examples, request, options: options do |response, operation|
2399
2410
  response = ::Gapic::Operation.new response, @operations_client, options: options
2400
2411
  yield response, operation if block_given?
2401
- return response
2412
+ throw :response, response
2402
2413
  end
2403
2414
  rescue ::GRPC::BadStatus => e
2404
2415
  raise ::Google::Cloud::Error.from_error(e)
@@ -2484,7 +2495,6 @@ module Google
2484
2495
 
2485
2496
  @auto_ml_stub.call_rpc :get_model_evaluation, request, options: options do |response, operation|
2486
2497
  yield response, operation if block_given?
2487
- return response
2488
2498
  end
2489
2499
  rescue ::GRPC::BadStatus => e
2490
2500
  raise ::Google::Cloud::Error.from_error(e)
@@ -2596,7 +2606,7 @@ module Google
2596
2606
  @auto_ml_stub.call_rpc :list_model_evaluations, request, options: options do |response, operation|
2597
2607
  response = ::Gapic::PagedEnumerable.new @auto_ml_stub, :list_model_evaluations, request, response, operation, options
2598
2608
  yield response, operation if block_given?
2599
- return response
2609
+ throw :response, response
2600
2610
  end
2601
2611
  rescue ::GRPC::BadStatus => e
2602
2612
  raise ::Google::Cloud::Error.from_error(e)
@@ -2685,6 +2695,11 @@ module Google
2685
2695
  # default endpoint URL. The default value of nil uses the environment
2686
2696
  # universe (usually the default "googleapis.com" universe).
2687
2697
  # @return [::String,nil]
2698
+ # @!attribute [rw] logger
2699
+ # A custom logger to use for request/response debug logging, or the value
2700
+ # `:default` (the default) to construct a default logger, or `nil` to
2701
+ # explicitly disable logging.
2702
+ # @return [::Logger,:default,nil]
2688
2703
  #
2689
2704
  class Configuration
2690
2705
  extend ::Gapic::Config
@@ -2709,6 +2724,7 @@ module Google
2709
2724
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2710
2725
  config_attr :quota_project, nil, ::String, nil
2711
2726
  config_attr :universe_domain, nil, ::String, nil
2727
+ config_attr :logger, :default, ::Logger, nil, :default
2712
2728
 
2713
2729
  # @private
2714
2730
  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
- return response
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
- return response
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 {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # corresponding to `Code.CANCELLED`.
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)
@@ -607,7 +598,7 @@ module Google
607
598
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
608
599
  response = ::Gapic::Operation.new response, @operations_client, options: options
609
600
  yield response, operation if block_given?
610
- return response
601
+ throw :response, response
611
602
  end
612
603
  rescue ::GRPC::BadStatus => e
613
604
  raise ::Google::Cloud::Error.from_error(e)
@@ -696,6 +687,11 @@ module Google
696
687
  # default endpoint URL. The default value of nil uses the environment
697
688
  # universe (usually the default "googleapis.com" universe).
698
689
  # @return [::String,nil]
690
+ # @!attribute [rw] logger
691
+ # A custom logger to use for request/response debug logging, or the value
692
+ # `:default` (the default) to construct a default logger, or `nil` to
693
+ # explicitly disable logging.
694
+ # @return [::Logger,:default,nil]
699
695
  #
700
696
  class Configuration
701
697
  extend ::Gapic::Config
@@ -720,6 +716,7 @@ module Google
720
716
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
721
717
  config_attr :quota_project, nil, ::String, nil
722
718
  config_attr :universe_domain, nil, ::String, nil
719
+ config_attr :logger, :default, ::Logger, nil, :default
723
720
 
724
721
  # @private
725
722
  def initialize parent_config = nil