google-cloud-notebooks-v1 0.9.0 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c28b151511aacc9d9b3538012af1f1069513f66fa353d5e99c4f08525c00934
4
- data.tar.gz: 39fe89591d27cce2b7605758e408a3534c2339f8905250da730c64f8d6debb17
3
+ metadata.gz: 947a3e792468868bcac7bc6184e06a1649959a1ecd82ea010295e928ee7122c5
4
+ data.tar.gz: 5add96fb707c1443850c86082896f8c0bca9653f285aac6a50c37fe59a45e68f
5
5
  SHA512:
6
- metadata.gz: 2379088af39aa42c2d5234567d6c56551a819e08c5f72c6778fcee969a335ffabc31b0fb6f00002f5b85a67c2a3982e745182c112031c6aea994421d57591a78
7
- data.tar.gz: 66f55d109d8bf4c5d8df14a64dce08ca39d9477ec3c0926a3d0da2004aee046296220b723bb9e41290fb916eebbaf734aad4e0a808588e4d1a4e757adadf6eed
6
+ metadata.gz: 3653e88c9870c00d5587e5b7884cff615abbae175ea0e119d02d293be56bb1f9d1b8a749c44fd9268ce24e1f735b4ee1df480e5ff6bb1bd2d84c2475dc115040
7
+ data.tar.gz: 9278ebfba33f0286ba7b52c7447bb38c9ac42b312eadfc7890a5d956794fba75012ded58a7e9e5d5bc3e98c02fa91c55f36981946fed7fd51a7e9a3bb1a52495
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/ai-platform-notebooks)
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/notebooks/v1"
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::Notebooks::V1::ManagedNotebookService::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).
@@ -32,6 +32,9 @@ module Google
32
32
  # API v1 service for Managed Notebooks.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
35
38
  # @private
36
39
  DEFAULT_ENDPOINT_TEMPLATE = "notebooks.$UNIVERSE_DOMAIN$"
37
40
 
@@ -188,14 +191,26 @@ module Google
188
191
  universe_domain: @config.universe_domain,
189
192
  channel_args: @config.channel_args,
190
193
  interceptors: @config.interceptors,
191
- channel_pool_config: @config.channel_pool
194
+ channel_pool_config: @config.channel_pool,
195
+ logger: @config.logger
192
196
  )
193
197
 
198
+ @managed_notebook_service_stub.stub_logger&.info do |entry|
199
+ entry.set_system_name
200
+ entry.set_service
201
+ entry.message = "Created client for #{entry.service}"
202
+ entry.set_credentials_fields credentials
203
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
204
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
205
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
206
+ end
207
+
194
208
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
195
209
  config.credentials = credentials
196
210
  config.quota_project = @quota_project_id
197
211
  config.endpoint = @managed_notebook_service_stub.endpoint
198
212
  config.universe_domain = @managed_notebook_service_stub.universe_domain
213
+ config.logger = @managed_notebook_service_stub.logger if config.respond_to? :logger=
199
214
  end
200
215
 
201
216
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -203,6 +218,7 @@ module Google
203
218
  config.quota_project = @quota_project_id
204
219
  config.endpoint = @managed_notebook_service_stub.endpoint
205
220
  config.universe_domain = @managed_notebook_service_stub.universe_domain
221
+ config.logger = @managed_notebook_service_stub.logger if config.respond_to? :logger=
206
222
  end
207
223
  end
208
224
 
@@ -227,6 +243,15 @@ module Google
227
243
  #
228
244
  attr_reader :iam_policy_client
229
245
 
246
+ ##
247
+ # The logger used for request/response debug logging.
248
+ #
249
+ # @return [Logger]
250
+ #
251
+ def logger
252
+ @managed_notebook_service_stub.logger
253
+ end
254
+
230
255
  # Service calls
231
256
 
232
257
  ##
@@ -294,10 +319,11 @@ module Google
294
319
  # Customize the options with defaults
295
320
  metadata = @config.rpcs.list_runtimes.metadata.to_h
296
321
 
297
- # Set x-goog-api-client and x-goog-user-project headers
322
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
298
323
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
299
324
  lib_name: @config.lib_name, lib_version: @config.lib_version,
300
325
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
326
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
301
327
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
302
328
 
303
329
  header_params = {}
@@ -319,7 +345,7 @@ module Google
319
345
  @managed_notebook_service_stub.call_rpc :list_runtimes, request, options: options do |response, operation|
320
346
  response = ::Gapic::PagedEnumerable.new @managed_notebook_service_stub, :list_runtimes, request, response, operation, options
321
347
  yield response, operation if block_given?
322
- return response
348
+ throw :response, response
323
349
  end
324
350
  rescue ::GRPC::BadStatus => e
325
351
  raise ::Google::Cloud::Error.from_error(e)
@@ -382,10 +408,11 @@ module Google
382
408
  # Customize the options with defaults
383
409
  metadata = @config.rpcs.get_runtime.metadata.to_h
384
410
 
385
- # Set x-goog-api-client and x-goog-user-project headers
411
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
386
412
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
387
413
  lib_name: @config.lib_name, lib_version: @config.lib_version,
388
414
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
415
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
389
416
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
390
417
 
391
418
  header_params = {}
@@ -406,7 +433,6 @@ module Google
406
433
 
407
434
  @managed_notebook_service_stub.call_rpc :get_runtime, request, options: options do |response, operation|
408
435
  yield response, operation if block_given?
409
- return response
410
436
  end
411
437
  rescue ::GRPC::BadStatus => e
412
438
  raise ::Google::Cloud::Error.from_error(e)
@@ -481,10 +507,11 @@ module Google
481
507
  # Customize the options with defaults
482
508
  metadata = @config.rpcs.create_runtime.metadata.to_h
483
509
 
484
- # Set x-goog-api-client and x-goog-user-project headers
510
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
485
511
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
486
512
  lib_name: @config.lib_name, lib_version: @config.lib_version,
487
513
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
514
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
488
515
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
489
516
 
490
517
  header_params = {}
@@ -506,7 +533,7 @@ module Google
506
533
  @managed_notebook_service_stub.call_rpc :create_runtime, request, options: options do |response, operation|
507
534
  response = ::Gapic::Operation.new response, @operations_client, options: options
508
535
  yield response, operation if block_given?
509
- return response
536
+ throw :response, response
510
537
  end
511
538
  rescue ::GRPC::BadStatus => e
512
539
  raise ::Google::Cloud::Error.from_error(e)
@@ -600,10 +627,11 @@ module Google
600
627
  # Customize the options with defaults
601
628
  metadata = @config.rpcs.update_runtime.metadata.to_h
602
629
 
603
- # Set x-goog-api-client and x-goog-user-project headers
630
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
604
631
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
605
632
  lib_name: @config.lib_name, lib_version: @config.lib_version,
606
633
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
634
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
607
635
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
608
636
 
609
637
  header_params = {}
@@ -625,7 +653,7 @@ module Google
625
653
  @managed_notebook_service_stub.call_rpc :update_runtime, request, options: options do |response, operation|
626
654
  response = ::Gapic::Operation.new response, @operations_client, options: options
627
655
  yield response, operation if block_given?
628
- return response
656
+ throw :response, response
629
657
  end
630
658
  rescue ::GRPC::BadStatus => e
631
659
  raise ::Google::Cloud::Error.from_error(e)
@@ -696,10 +724,11 @@ module Google
696
724
  # Customize the options with defaults
697
725
  metadata = @config.rpcs.delete_runtime.metadata.to_h
698
726
 
699
- # Set x-goog-api-client and x-goog-user-project headers
727
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
700
728
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
701
729
  lib_name: @config.lib_name, lib_version: @config.lib_version,
702
730
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
731
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
703
732
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
704
733
 
705
734
  header_params = {}
@@ -721,7 +750,7 @@ module Google
721
750
  @managed_notebook_service_stub.call_rpc :delete_runtime, request, options: options do |response, operation|
722
751
  response = ::Gapic::Operation.new response, @operations_client, options: options
723
752
  yield response, operation if block_given?
724
- return response
753
+ throw :response, response
725
754
  end
726
755
  rescue ::GRPC::BadStatus => e
727
756
  raise ::Google::Cloud::Error.from_error(e)
@@ -796,10 +825,11 @@ module Google
796
825
  # Customize the options with defaults
797
826
  metadata = @config.rpcs.start_runtime.metadata.to_h
798
827
 
799
- # Set x-goog-api-client and x-goog-user-project headers
828
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
800
829
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
801
830
  lib_name: @config.lib_name, lib_version: @config.lib_version,
802
831
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
832
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
803
833
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
804
834
 
805
835
  header_params = {}
@@ -821,7 +851,7 @@ module Google
821
851
  @managed_notebook_service_stub.call_rpc :start_runtime, request, options: options do |response, operation|
822
852
  response = ::Gapic::Operation.new response, @operations_client, options: options
823
853
  yield response, operation if block_given?
824
- return response
854
+ throw :response, response
825
855
  end
826
856
  rescue ::GRPC::BadStatus => e
827
857
  raise ::Google::Cloud::Error.from_error(e)
@@ -896,10 +926,11 @@ module Google
896
926
  # Customize the options with defaults
897
927
  metadata = @config.rpcs.stop_runtime.metadata.to_h
898
928
 
899
- # Set x-goog-api-client and x-goog-user-project headers
929
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
900
930
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
901
931
  lib_name: @config.lib_name, lib_version: @config.lib_version,
902
932
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
933
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
903
934
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
904
935
 
905
936
  header_params = {}
@@ -921,7 +952,7 @@ module Google
921
952
  @managed_notebook_service_stub.call_rpc :stop_runtime, request, options: options do |response, operation|
922
953
  response = ::Gapic::Operation.new response, @operations_client, options: options
923
954
  yield response, operation if block_given?
924
- return response
955
+ throw :response, response
925
956
  end
926
957
  rescue ::GRPC::BadStatus => e
927
958
  raise ::Google::Cloud::Error.from_error(e)
@@ -996,10 +1027,11 @@ module Google
996
1027
  # Customize the options with defaults
997
1028
  metadata = @config.rpcs.switch_runtime.metadata.to_h
998
1029
 
999
- # Set x-goog-api-client and x-goog-user-project headers
1030
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1000
1031
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1001
1032
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1002
1033
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1034
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1003
1035
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1004
1036
 
1005
1037
  header_params = {}
@@ -1021,7 +1053,7 @@ module Google
1021
1053
  @managed_notebook_service_stub.call_rpc :switch_runtime, request, options: options do |response, operation|
1022
1054
  response = ::Gapic::Operation.new response, @operations_client, options: options
1023
1055
  yield response, operation if block_given?
1024
- return response
1056
+ throw :response, response
1025
1057
  end
1026
1058
  rescue ::GRPC::BadStatus => e
1027
1059
  raise ::Google::Cloud::Error.from_error(e)
@@ -1092,10 +1124,11 @@ module Google
1092
1124
  # Customize the options with defaults
1093
1125
  metadata = @config.rpcs.reset_runtime.metadata.to_h
1094
1126
 
1095
- # Set x-goog-api-client and x-goog-user-project headers
1127
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1096
1128
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1097
1129
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1098
1130
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1131
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1099
1132
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1100
1133
 
1101
1134
  header_params = {}
@@ -1117,7 +1150,7 @@ module Google
1117
1150
  @managed_notebook_service_stub.call_rpc :reset_runtime, request, options: options do |response, operation|
1118
1151
  response = ::Gapic::Operation.new response, @operations_client, options: options
1119
1152
  yield response, operation if block_given?
1120
- return response
1153
+ throw :response, response
1121
1154
  end
1122
1155
  rescue ::GRPC::BadStatus => e
1123
1156
  raise ::Google::Cloud::Error.from_error(e)
@@ -1188,10 +1221,11 @@ module Google
1188
1221
  # Customize the options with defaults
1189
1222
  metadata = @config.rpcs.upgrade_runtime.metadata.to_h
1190
1223
 
1191
- # Set x-goog-api-client and x-goog-user-project headers
1224
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1192
1225
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1193
1226
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1194
1227
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1228
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1195
1229
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1196
1230
 
1197
1231
  header_params = {}
@@ -1213,7 +1247,7 @@ module Google
1213
1247
  @managed_notebook_service_stub.call_rpc :upgrade_runtime, request, options: options do |response, operation|
1214
1248
  response = ::Gapic::Operation.new response, @operations_client, options: options
1215
1249
  yield response, operation if block_given?
1216
- return response
1250
+ throw :response, response
1217
1251
  end
1218
1252
  rescue ::GRPC::BadStatus => e
1219
1253
  raise ::Google::Cloud::Error.from_error(e)
@@ -1287,10 +1321,11 @@ module Google
1287
1321
  # Customize the options with defaults
1288
1322
  metadata = @config.rpcs.report_runtime_event.metadata.to_h
1289
1323
 
1290
- # Set x-goog-api-client and x-goog-user-project headers
1324
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1291
1325
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1292
1326
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1293
1327
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1328
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1294
1329
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1295
1330
 
1296
1331
  header_params = {}
@@ -1312,7 +1347,7 @@ module Google
1312
1347
  @managed_notebook_service_stub.call_rpc :report_runtime_event, request, options: options do |response, operation|
1313
1348
  response = ::Gapic::Operation.new response, @operations_client, options: options
1314
1349
  yield response, operation if block_given?
1315
- return response
1350
+ throw :response, response
1316
1351
  end
1317
1352
  rescue ::GRPC::BadStatus => e
1318
1353
  raise ::Google::Cloud::Error.from_error(e)
@@ -1378,10 +1413,11 @@ module Google
1378
1413
  # Customize the options with defaults
1379
1414
  metadata = @config.rpcs.refresh_runtime_token_internal.metadata.to_h
1380
1415
 
1381
- # Set x-goog-api-client and x-goog-user-project headers
1416
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1382
1417
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1383
1418
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1384
1419
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1420
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1385
1421
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1386
1422
 
1387
1423
  header_params = {}
@@ -1402,7 +1438,6 @@ module Google
1402
1438
 
1403
1439
  @managed_notebook_service_stub.call_rpc :refresh_runtime_token_internal, request, options: options do |response, operation|
1404
1440
  yield response, operation if block_given?
1405
- return response
1406
1441
  end
1407
1442
  rescue ::GRPC::BadStatus => e
1408
1443
  raise ::Google::Cloud::Error.from_error(e)
@@ -1473,10 +1508,11 @@ module Google
1473
1508
  # Customize the options with defaults
1474
1509
  metadata = @config.rpcs.diagnose_runtime.metadata.to_h
1475
1510
 
1476
- # Set x-goog-api-client and x-goog-user-project headers
1511
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1477
1512
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1478
1513
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1479
1514
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1515
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1480
1516
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1481
1517
 
1482
1518
  header_params = {}
@@ -1498,7 +1534,7 @@ module Google
1498
1534
  @managed_notebook_service_stub.call_rpc :diagnose_runtime, request, options: options do |response, operation|
1499
1535
  response = ::Gapic::Operation.new response, @operations_client, options: options
1500
1536
  yield response, operation if block_given?
1501
- return response
1537
+ throw :response, response
1502
1538
  end
1503
1539
  rescue ::GRPC::BadStatus => e
1504
1540
  raise ::Google::Cloud::Error.from_error(e)
@@ -1587,6 +1623,11 @@ module Google
1587
1623
  # default endpoint URL. The default value of nil uses the environment
1588
1624
  # universe (usually the default "googleapis.com" universe).
1589
1625
  # @return [::String,nil]
1626
+ # @!attribute [rw] logger
1627
+ # A custom logger to use for request/response debug logging, or the value
1628
+ # `:default` (the default) to construct a default logger, or `nil` to
1629
+ # explicitly disable logging.
1630
+ # @return [::Logger,:default,nil]
1590
1631
  #
1591
1632
  class Configuration
1592
1633
  extend ::Gapic::Config
@@ -1611,6 +1652,7 @@ module Google
1611
1652
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1612
1653
  config_attr :quota_project, nil, ::String, nil
1613
1654
  config_attr :universe_domain, nil, ::String, nil
1655
+ config_attr :logger, :default, ::Logger, nil, :default
1614
1656
 
1615
1657
  # @private
1616
1658
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module ManagedNotebookService
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ API_VERSION = ""
31
+
29
32
  # @private
30
33
  DEFAULT_ENDPOINT_TEMPLATE = "notebooks.$UNIVERSE_DOMAIN$"
31
34
 
@@ -121,14 +124,6 @@ module Google
121
124
  # Lists operations that match the specified filter in the request. If the
122
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
123
126
  #
124
- # NOTE: the `name` binding allows API services to override the binding
125
- # to use different resource name schemes, such as `users/*/operations`. To
126
- # override the binding, API services can add a binding such as
127
- # `"/v1/{name=users/*}/operations"` to their service configuration.
128
- # For backwards compatibility, the default name includes the operations
129
- # collection id, however overriding users must ensure the name binding
130
- # is the parent resource, without the operations collection id.
131
- #
132
127
  # @overload list_operations(request, options = nil)
133
128
  # Pass arguments to `list_operations` via a request object, either of type
134
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -191,10 +186,11 @@ module Google
191
186
  # Customize the options with defaults
192
187
  metadata = @config.rpcs.list_operations.metadata.to_h
193
188
 
194
- # Set x-goog-api-client and x-goog-user-project headers
189
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
195
190
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
196
191
  lib_name: @config.lib_name, lib_version: @config.lib_version,
197
192
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
193
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
198
194
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
199
195
 
200
196
  header_params = {}
@@ -217,7 +213,7 @@ module Google
217
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
218
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
219
215
  yield response, operation if block_given?
220
- return response
216
+ throw :response, response
221
217
  end
222
218
  rescue ::GRPC::BadStatus => e
223
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -287,10 +283,11 @@ module Google
287
283
  # Customize the options with defaults
288
284
  metadata = @config.rpcs.get_operation.metadata.to_h
289
285
 
290
- # Set x-goog-api-client and x-goog-user-project headers
286
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
291
287
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
292
288
  lib_name: @config.lib_name, lib_version: @config.lib_version,
293
289
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
290
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
294
291
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
295
292
 
296
293
  header_params = {}
@@ -312,7 +309,7 @@ module Google
312
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
313
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
314
311
  yield response, operation if block_given?
315
- return response
312
+ throw :response, response
316
313
  end
317
314
  rescue ::GRPC::BadStatus => e
318
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -376,10 +373,11 @@ module Google
376
373
  # Customize the options with defaults
377
374
  metadata = @config.rpcs.delete_operation.metadata.to_h
378
375
 
379
- # Set x-goog-api-client and x-goog-user-project headers
376
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
380
377
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
381
378
  lib_name: @config.lib_name, lib_version: @config.lib_version,
382
379
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
380
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
383
381
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
384
382
 
385
383
  header_params = {}
@@ -400,7 +398,6 @@ module Google
400
398
 
401
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
402
400
  yield response, operation if block_given?
403
- return response
404
401
  end
405
402
  rescue ::GRPC::BadStatus => e
406
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -415,8 +412,9 @@ module Google
415
412
  # other methods to check whether the cancellation succeeded or whether the
416
413
  # operation completed despite cancellation. On successful cancellation,
417
414
  # the operation is not deleted; instead, it becomes an operation with
418
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
419
- # 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`.
420
418
  #
421
419
  # @overload cancel_operation(request, options = nil)
422
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -470,10 +468,11 @@ module Google
470
468
  # Customize the options with defaults
471
469
  metadata = @config.rpcs.cancel_operation.metadata.to_h
472
470
 
473
- # Set x-goog-api-client and x-goog-user-project headers
471
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
474
472
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
475
473
  lib_name: @config.lib_name, lib_version: @config.lib_version,
476
474
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
475
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
477
476
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
478
477
 
479
478
  header_params = {}
@@ -494,7 +493,6 @@ module Google
494
493
 
495
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
496
495
  yield response, operation if block_given?
497
- return response
498
496
  end
499
497
  rescue ::GRPC::BadStatus => e
500
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -574,10 +572,11 @@ module Google
574
572
  # Customize the options with defaults
575
573
  metadata = @config.rpcs.wait_operation.metadata.to_h
576
574
 
577
- # Set x-goog-api-client and x-goog-user-project headers
575
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
578
576
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
579
577
  lib_name: @config.lib_name, lib_version: @config.lib_version,
580
578
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
579
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
581
580
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
582
581
 
583
582
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
@@ -591,7 +590,7 @@ module Google
591
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
592
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
593
592
  yield response, operation if block_given?
594
- return response
593
+ throw :response, response
595
594
  end
596
595
  rescue ::GRPC::BadStatus => e
597
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -680,6 +679,11 @@ module Google
680
679
  # default endpoint URL. The default value of nil uses the environment
681
680
  # universe (usually the default "googleapis.com" universe).
682
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]
683
687
  #
684
688
  class Configuration
685
689
  extend ::Gapic::Config
@@ -704,6 +708,7 @@ module Google
704
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
705
709
  config_attr :quota_project, nil, ::String, nil
706
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
707
712
 
708
713
  # @private
709
714
  def initialize parent_config = nil