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.
@@ -32,6 +32,9 @@ module Google
32
32
  # API v1 service for Cloud AI Platform 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
 
@@ -232,14 +235,26 @@ module Google
232
235
  universe_domain: @config.universe_domain,
233
236
  channel_args: @config.channel_args,
234
237
  interceptors: @config.interceptors,
235
- channel_pool_config: @config.channel_pool
238
+ channel_pool_config: @config.channel_pool,
239
+ logger: @config.logger
236
240
  )
237
241
 
242
+ @notebook_service_stub.stub_logger&.info do |entry|
243
+ entry.set_system_name
244
+ entry.set_service
245
+ entry.message = "Created client for #{entry.service}"
246
+ entry.set_credentials_fields credentials
247
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
248
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
249
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
250
+ end
251
+
238
252
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
239
253
  config.credentials = credentials
240
254
  config.quota_project = @quota_project_id
241
255
  config.endpoint = @notebook_service_stub.endpoint
242
256
  config.universe_domain = @notebook_service_stub.universe_domain
257
+ config.logger = @notebook_service_stub.logger if config.respond_to? :logger=
243
258
  end
244
259
 
245
260
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -247,6 +262,7 @@ module Google
247
262
  config.quota_project = @quota_project_id
248
263
  config.endpoint = @notebook_service_stub.endpoint
249
264
  config.universe_domain = @notebook_service_stub.universe_domain
265
+ config.logger = @notebook_service_stub.logger if config.respond_to? :logger=
250
266
  end
251
267
  end
252
268
 
@@ -271,6 +287,15 @@ module Google
271
287
  #
272
288
  attr_reader :iam_policy_client
273
289
 
290
+ ##
291
+ # The logger used for request/response debug logging.
292
+ #
293
+ # @return [Logger]
294
+ #
295
+ def logger
296
+ @notebook_service_stub.logger
297
+ end
298
+
274
299
  # Service calls
275
300
 
276
301
  ##
@@ -338,10 +363,11 @@ module Google
338
363
  # Customize the options with defaults
339
364
  metadata = @config.rpcs.list_instances.metadata.to_h
340
365
 
341
- # Set x-goog-api-client and x-goog-user-project headers
366
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
342
367
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
343
368
  lib_name: @config.lib_name, lib_version: @config.lib_version,
344
369
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
370
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
345
371
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
346
372
 
347
373
  header_params = {}
@@ -363,7 +389,7 @@ module Google
363
389
  @notebook_service_stub.call_rpc :list_instances, request, options: options do |response, operation|
364
390
  response = ::Gapic::PagedEnumerable.new @notebook_service_stub, :list_instances, request, response, operation, options
365
391
  yield response, operation if block_given?
366
- return response
392
+ throw :response, response
367
393
  end
368
394
  rescue ::GRPC::BadStatus => e
369
395
  raise ::Google::Cloud::Error.from_error(e)
@@ -425,10 +451,11 @@ module Google
425
451
  # Customize the options with defaults
426
452
  metadata = @config.rpcs.get_instance.metadata.to_h
427
453
 
428
- # Set x-goog-api-client and x-goog-user-project headers
454
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
429
455
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
430
456
  lib_name: @config.lib_name, lib_version: @config.lib_version,
431
457
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
458
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
432
459
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
433
460
 
434
461
  header_params = {}
@@ -449,7 +476,6 @@ module Google
449
476
 
450
477
  @notebook_service_stub.call_rpc :get_instance, request, options: options do |response, operation|
451
478
  yield response, operation if block_given?
452
- return response
453
479
  end
454
480
  rescue ::GRPC::BadStatus => e
455
481
  raise ::Google::Cloud::Error.from_error(e)
@@ -522,10 +548,11 @@ module Google
522
548
  # Customize the options with defaults
523
549
  metadata = @config.rpcs.create_instance.metadata.to_h
524
550
 
525
- # Set x-goog-api-client and x-goog-user-project headers
551
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
526
552
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
527
553
  lib_name: @config.lib_name, lib_version: @config.lib_version,
528
554
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
555
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
529
556
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
530
557
 
531
558
  header_params = {}
@@ -547,7 +574,7 @@ module Google
547
574
  @notebook_service_stub.call_rpc :create_instance, request, options: options do |response, operation|
548
575
  response = ::Gapic::Operation.new response, @operations_client, options: options
549
576
  yield response, operation if block_given?
550
- return response
577
+ throw :response, response
551
578
  end
552
579
  rescue ::GRPC::BadStatus => e
553
580
  raise ::Google::Cloud::Error.from_error(e)
@@ -624,10 +651,11 @@ module Google
624
651
  # Customize the options with defaults
625
652
  metadata = @config.rpcs.register_instance.metadata.to_h
626
653
 
627
- # Set x-goog-api-client and x-goog-user-project headers
654
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
628
655
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
629
656
  lib_name: @config.lib_name, lib_version: @config.lib_version,
630
657
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
658
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
631
659
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
632
660
 
633
661
  header_params = {}
@@ -649,7 +677,7 @@ module Google
649
677
  @notebook_service_stub.call_rpc :register_instance, request, options: options do |response, operation|
650
678
  response = ::Gapic::Operation.new response, @operations_client, options: options
651
679
  yield response, operation if block_given?
652
- return response
680
+ throw :response, response
653
681
  end
654
682
  rescue ::GRPC::BadStatus => e
655
683
  raise ::Google::Cloud::Error.from_error(e)
@@ -725,10 +753,11 @@ module Google
725
753
  # Customize the options with defaults
726
754
  metadata = @config.rpcs.set_instance_accelerator.metadata.to_h
727
755
 
728
- # Set x-goog-api-client and x-goog-user-project headers
756
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
729
757
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
730
758
  lib_name: @config.lib_name, lib_version: @config.lib_version,
731
759
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
760
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
732
761
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
733
762
 
734
763
  header_params = {}
@@ -750,7 +779,7 @@ module Google
750
779
  @notebook_service_stub.call_rpc :set_instance_accelerator, request, options: options do |response, operation|
751
780
  response = ::Gapic::Operation.new response, @operations_client, options: options
752
781
  yield response, operation if block_given?
753
- return response
782
+ throw :response, response
754
783
  end
755
784
  rescue ::GRPC::BadStatus => e
756
785
  raise ::Google::Cloud::Error.from_error(e)
@@ -822,10 +851,11 @@ module Google
822
851
  # Customize the options with defaults
823
852
  metadata = @config.rpcs.set_instance_machine_type.metadata.to_h
824
853
 
825
- # Set x-goog-api-client and x-goog-user-project headers
854
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
826
855
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
827
856
  lib_name: @config.lib_name, lib_version: @config.lib_version,
828
857
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
858
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
829
859
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
830
860
 
831
861
  header_params = {}
@@ -847,7 +877,7 @@ module Google
847
877
  @notebook_service_stub.call_rpc :set_instance_machine_type, request, options: options do |response, operation|
848
878
  response = ::Gapic::Operation.new response, @operations_client, options: options
849
879
  yield response, operation if block_given?
850
- return response
880
+ throw :response, response
851
881
  end
852
882
  rescue ::GRPC::BadStatus => e
853
883
  raise ::Google::Cloud::Error.from_error(e)
@@ -918,10 +948,11 @@ module Google
918
948
  # Customize the options with defaults
919
949
  metadata = @config.rpcs.update_instance_config.metadata.to_h
920
950
 
921
- # Set x-goog-api-client and x-goog-user-project headers
951
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
922
952
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
923
953
  lib_name: @config.lib_name, lib_version: @config.lib_version,
924
954
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
955
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
925
956
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
926
957
 
927
958
  header_params = {}
@@ -943,7 +974,7 @@ module Google
943
974
  @notebook_service_stub.call_rpc :update_instance_config, request, options: options do |response, operation|
944
975
  response = ::Gapic::Operation.new response, @operations_client, options: options
945
976
  yield response, operation if block_given?
946
- return response
977
+ throw :response, response
947
978
  end
948
979
  rescue ::GRPC::BadStatus => e
949
980
  raise ::Google::Cloud::Error.from_error(e)
@@ -1014,10 +1045,11 @@ module Google
1014
1045
  # Customize the options with defaults
1015
1046
  metadata = @config.rpcs.update_shielded_instance_config.metadata.to_h
1016
1047
 
1017
- # Set x-goog-api-client and x-goog-user-project headers
1048
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1018
1049
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1019
1050
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1020
1051
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1052
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1021
1053
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1022
1054
 
1023
1055
  header_params = {}
@@ -1039,7 +1071,7 @@ module Google
1039
1071
  @notebook_service_stub.call_rpc :update_shielded_instance_config, request, options: options do |response, operation|
1040
1072
  response = ::Gapic::Operation.new response, @operations_client, options: options
1041
1073
  yield response, operation if block_given?
1042
- return response
1074
+ throw :response, response
1043
1075
  end
1044
1076
  rescue ::GRPC::BadStatus => e
1045
1077
  raise ::Google::Cloud::Error.from_error(e)
@@ -1111,10 +1143,11 @@ module Google
1111
1143
  # Customize the options with defaults
1112
1144
  metadata = @config.rpcs.set_instance_labels.metadata.to_h
1113
1145
 
1114
- # Set x-goog-api-client and x-goog-user-project headers
1146
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1115
1147
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1116
1148
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1117
1149
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1150
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1118
1151
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1119
1152
 
1120
1153
  header_params = {}
@@ -1136,7 +1169,7 @@ module Google
1136
1169
  @notebook_service_stub.call_rpc :set_instance_labels, request, options: options do |response, operation|
1137
1170
  response = ::Gapic::Operation.new response, @operations_client, options: options
1138
1171
  yield response, operation if block_given?
1139
- return response
1172
+ throw :response, response
1140
1173
  end
1141
1174
  rescue ::GRPC::BadStatus => e
1142
1175
  raise ::Google::Cloud::Error.from_error(e)
@@ -1200,10 +1233,11 @@ module Google
1200
1233
  # Customize the options with defaults
1201
1234
  metadata = @config.rpcs.update_instance_metadata_items.metadata.to_h
1202
1235
 
1203
- # Set x-goog-api-client and x-goog-user-project headers
1236
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1204
1237
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1205
1238
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1206
1239
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1240
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1207
1241
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1208
1242
 
1209
1243
  header_params = {}
@@ -1224,7 +1258,6 @@ module Google
1224
1258
 
1225
1259
  @notebook_service_stub.call_rpc :update_instance_metadata_items, request, options: options do |response, operation|
1226
1260
  yield response, operation if block_given?
1227
- return response
1228
1261
  end
1229
1262
  rescue ::GRPC::BadStatus => e
1230
1263
  raise ::Google::Cloud::Error.from_error(e)
@@ -1293,10 +1326,11 @@ module Google
1293
1326
  # Customize the options with defaults
1294
1327
  metadata = @config.rpcs.delete_instance.metadata.to_h
1295
1328
 
1296
- # Set x-goog-api-client and x-goog-user-project headers
1329
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1297
1330
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1298
1331
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1299
1332
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1333
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1300
1334
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1301
1335
 
1302
1336
  header_params = {}
@@ -1318,7 +1352,7 @@ module Google
1318
1352
  @notebook_service_stub.call_rpc :delete_instance, request, options: options do |response, operation|
1319
1353
  response = ::Gapic::Operation.new response, @operations_client, options: options
1320
1354
  yield response, operation if block_given?
1321
- return response
1355
+ throw :response, response
1322
1356
  end
1323
1357
  rescue ::GRPC::BadStatus => e
1324
1358
  raise ::Google::Cloud::Error.from_error(e)
@@ -1387,10 +1421,11 @@ module Google
1387
1421
  # Customize the options with defaults
1388
1422
  metadata = @config.rpcs.start_instance.metadata.to_h
1389
1423
 
1390
- # Set x-goog-api-client and x-goog-user-project headers
1424
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1391
1425
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1392
1426
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1393
1427
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1428
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1394
1429
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1395
1430
 
1396
1431
  header_params = {}
@@ -1412,7 +1447,7 @@ module Google
1412
1447
  @notebook_service_stub.call_rpc :start_instance, request, options: options do |response, operation|
1413
1448
  response = ::Gapic::Operation.new response, @operations_client, options: options
1414
1449
  yield response, operation if block_given?
1415
- return response
1450
+ throw :response, response
1416
1451
  end
1417
1452
  rescue ::GRPC::BadStatus => e
1418
1453
  raise ::Google::Cloud::Error.from_error(e)
@@ -1481,10 +1516,11 @@ module Google
1481
1516
  # Customize the options with defaults
1482
1517
  metadata = @config.rpcs.stop_instance.metadata.to_h
1483
1518
 
1484
- # Set x-goog-api-client and x-goog-user-project headers
1519
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1485
1520
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1486
1521
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1487
1522
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1523
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1488
1524
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1489
1525
 
1490
1526
  header_params = {}
@@ -1506,7 +1542,7 @@ module Google
1506
1542
  @notebook_service_stub.call_rpc :stop_instance, request, options: options do |response, operation|
1507
1543
  response = ::Gapic::Operation.new response, @operations_client, options: options
1508
1544
  yield response, operation if block_given?
1509
- return response
1545
+ throw :response, response
1510
1546
  end
1511
1547
  rescue ::GRPC::BadStatus => e
1512
1548
  raise ::Google::Cloud::Error.from_error(e)
@@ -1575,10 +1611,11 @@ module Google
1575
1611
  # Customize the options with defaults
1576
1612
  metadata = @config.rpcs.reset_instance.metadata.to_h
1577
1613
 
1578
- # Set x-goog-api-client and x-goog-user-project headers
1614
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1579
1615
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1580
1616
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1581
1617
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1618
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1582
1619
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1583
1620
 
1584
1621
  header_params = {}
@@ -1600,7 +1637,7 @@ module Google
1600
1637
  @notebook_service_stub.call_rpc :reset_instance, request, options: options do |response, operation|
1601
1638
  response = ::Gapic::Operation.new response, @operations_client, options: options
1602
1639
  yield response, operation if block_given?
1603
- return response
1640
+ throw :response, response
1604
1641
  end
1605
1642
  rescue ::GRPC::BadStatus => e
1606
1643
  raise ::Google::Cloud::Error.from_error(e)
@@ -1678,10 +1715,11 @@ module Google
1678
1715
  # Customize the options with defaults
1679
1716
  metadata = @config.rpcs.report_instance_info.metadata.to_h
1680
1717
 
1681
- # Set x-goog-api-client and x-goog-user-project headers
1718
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1682
1719
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1683
1720
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1684
1721
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1722
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1685
1723
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1686
1724
 
1687
1725
  header_params = {}
@@ -1703,7 +1741,7 @@ module Google
1703
1741
  @notebook_service_stub.call_rpc :report_instance_info, request, options: options do |response, operation|
1704
1742
  response = ::Gapic::Operation.new response, @operations_client, options: options
1705
1743
  yield response, operation if block_given?
1706
- return response
1744
+ throw :response, response
1707
1745
  end
1708
1746
  rescue ::GRPC::BadStatus => e
1709
1747
  raise ::Google::Cloud::Error.from_error(e)
@@ -1768,10 +1806,11 @@ module Google
1768
1806
  # Customize the options with defaults
1769
1807
  metadata = @config.rpcs.is_instance_upgradeable.metadata.to_h
1770
1808
 
1771
- # Set x-goog-api-client and x-goog-user-project headers
1809
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1772
1810
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1773
1811
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1774
1812
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1813
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1775
1814
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1776
1815
 
1777
1816
  header_params = {}
@@ -1792,7 +1831,6 @@ module Google
1792
1831
 
1793
1832
  @notebook_service_stub.call_rpc :is_instance_upgradeable, request, options: options do |response, operation|
1794
1833
  yield response, operation if block_given?
1795
- return response
1796
1834
  end
1797
1835
  rescue ::GRPC::BadStatus => e
1798
1836
  raise ::Google::Cloud::Error.from_error(e)
@@ -1854,10 +1892,11 @@ module Google
1854
1892
  # Customize the options with defaults
1855
1893
  metadata = @config.rpcs.get_instance_health.metadata.to_h
1856
1894
 
1857
- # Set x-goog-api-client and x-goog-user-project headers
1895
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1858
1896
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1859
1897
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1860
1898
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1899
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1861
1900
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1862
1901
 
1863
1902
  header_params = {}
@@ -1878,7 +1917,6 @@ module Google
1878
1917
 
1879
1918
  @notebook_service_stub.call_rpc :get_instance_health, request, options: options do |response, operation|
1880
1919
  yield response, operation if block_given?
1881
- return response
1882
1920
  end
1883
1921
  rescue ::GRPC::BadStatus => e
1884
1922
  raise ::Google::Cloud::Error.from_error(e)
@@ -1950,10 +1988,11 @@ module Google
1950
1988
  # Customize the options with defaults
1951
1989
  metadata = @config.rpcs.upgrade_instance.metadata.to_h
1952
1990
 
1953
- # Set x-goog-api-client and x-goog-user-project headers
1991
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1954
1992
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1955
1993
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1956
1994
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
1995
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1957
1996
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1958
1997
 
1959
1998
  header_params = {}
@@ -1975,7 +2014,7 @@ module Google
1975
2014
  @notebook_service_stub.call_rpc :upgrade_instance, request, options: options do |response, operation|
1976
2015
  response = ::Gapic::Operation.new response, @operations_client, options: options
1977
2016
  yield response, operation if block_given?
1978
- return response
2017
+ throw :response, response
1979
2018
  end
1980
2019
  rescue ::GRPC::BadStatus => e
1981
2020
  raise ::Google::Cloud::Error.from_error(e)
@@ -2047,10 +2086,11 @@ module Google
2047
2086
  # Customize the options with defaults
2048
2087
  metadata = @config.rpcs.rollback_instance.metadata.to_h
2049
2088
 
2050
- # Set x-goog-api-client and x-goog-user-project headers
2089
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2051
2090
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2052
2091
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2053
2092
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2093
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2054
2094
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2055
2095
 
2056
2096
  header_params = {}
@@ -2072,7 +2112,7 @@ module Google
2072
2112
  @notebook_service_stub.call_rpc :rollback_instance, request, options: options do |response, operation|
2073
2113
  response = ::Gapic::Operation.new response, @operations_client, options: options
2074
2114
  yield response, operation if block_given?
2075
- return response
2115
+ throw :response, response
2076
2116
  end
2077
2117
  rescue ::GRPC::BadStatus => e
2078
2118
  raise ::Google::Cloud::Error.from_error(e)
@@ -2143,10 +2183,11 @@ module Google
2143
2183
  # Customize the options with defaults
2144
2184
  metadata = @config.rpcs.diagnose_instance.metadata.to_h
2145
2185
 
2146
- # Set x-goog-api-client and x-goog-user-project headers
2186
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2147
2187
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2148
2188
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2149
2189
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2190
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2150
2191
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2151
2192
 
2152
2193
  header_params = {}
@@ -2168,7 +2209,7 @@ module Google
2168
2209
  @notebook_service_stub.call_rpc :diagnose_instance, request, options: options do |response, operation|
2169
2210
  response = ::Gapic::Operation.new response, @operations_client, options: options
2170
2211
  yield response, operation if block_given?
2171
- return response
2212
+ throw :response, response
2172
2213
  end
2173
2214
  rescue ::GRPC::BadStatus => e
2174
2215
  raise ::Google::Cloud::Error.from_error(e)
@@ -2244,10 +2285,11 @@ module Google
2244
2285
  # Customize the options with defaults
2245
2286
  metadata = @config.rpcs.upgrade_instance_internal.metadata.to_h
2246
2287
 
2247
- # Set x-goog-api-client and x-goog-user-project headers
2288
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2248
2289
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2249
2290
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2250
2291
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2292
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2251
2293
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2252
2294
 
2253
2295
  header_params = {}
@@ -2269,7 +2311,7 @@ module Google
2269
2311
  @notebook_service_stub.call_rpc :upgrade_instance_internal, request, options: options do |response, operation|
2270
2312
  response = ::Gapic::Operation.new response, @operations_client, options: options
2271
2313
  yield response, operation if block_given?
2272
- return response
2314
+ throw :response, response
2273
2315
  end
2274
2316
  rescue ::GRPC::BadStatus => e
2275
2317
  raise ::Google::Cloud::Error.from_error(e)
@@ -2339,10 +2381,11 @@ module Google
2339
2381
  # Customize the options with defaults
2340
2382
  metadata = @config.rpcs.list_environments.metadata.to_h
2341
2383
 
2342
- # Set x-goog-api-client and x-goog-user-project headers
2384
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2343
2385
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2344
2386
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2345
2387
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2388
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2346
2389
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2347
2390
 
2348
2391
  header_params = {}
@@ -2364,7 +2407,7 @@ module Google
2364
2407
  @notebook_service_stub.call_rpc :list_environments, request, options: options do |response, operation|
2365
2408
  response = ::Gapic::PagedEnumerable.new @notebook_service_stub, :list_environments, request, response, operation, options
2366
2409
  yield response, operation if block_given?
2367
- return response
2410
+ throw :response, response
2368
2411
  end
2369
2412
  rescue ::GRPC::BadStatus => e
2370
2413
  raise ::Google::Cloud::Error.from_error(e)
@@ -2426,10 +2469,11 @@ module Google
2426
2469
  # Customize the options with defaults
2427
2470
  metadata = @config.rpcs.get_environment.metadata.to_h
2428
2471
 
2429
- # Set x-goog-api-client and x-goog-user-project headers
2472
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2430
2473
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2431
2474
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2432
2475
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2476
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2433
2477
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2434
2478
 
2435
2479
  header_params = {}
@@ -2450,7 +2494,6 @@ module Google
2450
2494
 
2451
2495
  @notebook_service_stub.call_rpc :get_environment, request, options: options do |response, operation|
2452
2496
  yield response, operation if block_given?
2453
- return response
2454
2497
  end
2455
2498
  rescue ::GRPC::BadStatus => e
2456
2499
  raise ::Google::Cloud::Error.from_error(e)
@@ -2525,10 +2568,11 @@ module Google
2525
2568
  # Customize the options with defaults
2526
2569
  metadata = @config.rpcs.create_environment.metadata.to_h
2527
2570
 
2528
- # Set x-goog-api-client and x-goog-user-project headers
2571
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2529
2572
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2530
2573
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2531
2574
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2575
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2532
2576
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2533
2577
 
2534
2578
  header_params = {}
@@ -2550,7 +2594,7 @@ module Google
2550
2594
  @notebook_service_stub.call_rpc :create_environment, request, options: options do |response, operation|
2551
2595
  response = ::Gapic::Operation.new response, @operations_client, options: options
2552
2596
  yield response, operation if block_given?
2553
- return response
2597
+ throw :response, response
2554
2598
  end
2555
2599
  rescue ::GRPC::BadStatus => e
2556
2600
  raise ::Google::Cloud::Error.from_error(e)
@@ -2619,10 +2663,11 @@ module Google
2619
2663
  # Customize the options with defaults
2620
2664
  metadata = @config.rpcs.delete_environment.metadata.to_h
2621
2665
 
2622
- # Set x-goog-api-client and x-goog-user-project headers
2666
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2623
2667
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2624
2668
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2625
2669
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2670
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2626
2671
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2627
2672
 
2628
2673
  header_params = {}
@@ -2644,7 +2689,7 @@ module Google
2644
2689
  @notebook_service_stub.call_rpc :delete_environment, request, options: options do |response, operation|
2645
2690
  response = ::Gapic::Operation.new response, @operations_client, options: options
2646
2691
  yield response, operation if block_given?
2647
- return response
2692
+ throw :response, response
2648
2693
  end
2649
2694
  rescue ::GRPC::BadStatus => e
2650
2695
  raise ::Google::Cloud::Error.from_error(e)
@@ -2719,10 +2764,11 @@ module Google
2719
2764
  # Customize the options with defaults
2720
2765
  metadata = @config.rpcs.list_schedules.metadata.to_h
2721
2766
 
2722
- # Set x-goog-api-client and x-goog-user-project headers
2767
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2723
2768
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2724
2769
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2725
2770
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2771
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2726
2772
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2727
2773
 
2728
2774
  header_params = {}
@@ -2744,7 +2790,7 @@ module Google
2744
2790
  @notebook_service_stub.call_rpc :list_schedules, request, options: options do |response, operation|
2745
2791
  response = ::Gapic::PagedEnumerable.new @notebook_service_stub, :list_schedules, request, response, operation, options
2746
2792
  yield response, operation if block_given?
2747
- return response
2793
+ throw :response, response
2748
2794
  end
2749
2795
  rescue ::GRPC::BadStatus => e
2750
2796
  raise ::Google::Cloud::Error.from_error(e)
@@ -2806,10 +2852,11 @@ module Google
2806
2852
  # Customize the options with defaults
2807
2853
  metadata = @config.rpcs.get_schedule.metadata.to_h
2808
2854
 
2809
- # Set x-goog-api-client and x-goog-user-project headers
2855
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2810
2856
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2811
2857
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2812
2858
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2859
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2813
2860
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2814
2861
 
2815
2862
  header_params = {}
@@ -2830,7 +2877,6 @@ module Google
2830
2877
 
2831
2878
  @notebook_service_stub.call_rpc :get_schedule, request, options: options do |response, operation|
2832
2879
  yield response, operation if block_given?
2833
- return response
2834
2880
  end
2835
2881
  rescue ::GRPC::BadStatus => e
2836
2882
  raise ::Google::Cloud::Error.from_error(e)
@@ -2899,10 +2945,11 @@ module Google
2899
2945
  # Customize the options with defaults
2900
2946
  metadata = @config.rpcs.delete_schedule.metadata.to_h
2901
2947
 
2902
- # Set x-goog-api-client and x-goog-user-project headers
2948
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2903
2949
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2904
2950
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2905
2951
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
2952
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2906
2953
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2907
2954
 
2908
2955
  header_params = {}
@@ -2924,7 +2971,7 @@ module Google
2924
2971
  @notebook_service_stub.call_rpc :delete_schedule, request, options: options do |response, operation|
2925
2972
  response = ::Gapic::Operation.new response, @operations_client, options: options
2926
2973
  yield response, operation if block_given?
2927
- return response
2974
+ throw :response, response
2928
2975
  end
2929
2976
  rescue ::GRPC::BadStatus => e
2930
2977
  raise ::Google::Cloud::Error.from_error(e)
@@ -2997,10 +3044,11 @@ module Google
2997
3044
  # Customize the options with defaults
2998
3045
  metadata = @config.rpcs.create_schedule.metadata.to_h
2999
3046
 
3000
- # Set x-goog-api-client and x-goog-user-project headers
3047
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3001
3048
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3002
3049
  lib_name: @config.lib_name, lib_version: @config.lib_version,
3003
3050
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
3051
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3004
3052
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3005
3053
 
3006
3054
  header_params = {}
@@ -3022,7 +3070,7 @@ module Google
3022
3070
  @notebook_service_stub.call_rpc :create_schedule, request, options: options do |response, operation|
3023
3071
  response = ::Gapic::Operation.new response, @operations_client, options: options
3024
3072
  yield response, operation if block_given?
3025
- return response
3073
+ throw :response, response
3026
3074
  end
3027
3075
  rescue ::GRPC::BadStatus => e
3028
3076
  raise ::Google::Cloud::Error.from_error(e)
@@ -3091,10 +3139,11 @@ module Google
3091
3139
  # Customize the options with defaults
3092
3140
  metadata = @config.rpcs.trigger_schedule.metadata.to_h
3093
3141
 
3094
- # Set x-goog-api-client and x-goog-user-project headers
3142
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3095
3143
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3096
3144
  lib_name: @config.lib_name, lib_version: @config.lib_version,
3097
3145
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
3146
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3098
3147
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3099
3148
 
3100
3149
  header_params = {}
@@ -3116,7 +3165,7 @@ module Google
3116
3165
  @notebook_service_stub.call_rpc :trigger_schedule, request, options: options do |response, operation|
3117
3166
  response = ::Gapic::Operation.new response, @operations_client, options: options
3118
3167
  yield response, operation if block_given?
3119
- return response
3168
+ throw :response, response
3120
3169
  end
3121
3170
  rescue ::GRPC::BadStatus => e
3122
3171
  raise ::Google::Cloud::Error.from_error(e)
@@ -3193,10 +3242,11 @@ module Google
3193
3242
  # Customize the options with defaults
3194
3243
  metadata = @config.rpcs.list_executions.metadata.to_h
3195
3244
 
3196
- # Set x-goog-api-client and x-goog-user-project headers
3245
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3197
3246
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3198
3247
  lib_name: @config.lib_name, lib_version: @config.lib_version,
3199
3248
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
3249
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3200
3250
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3201
3251
 
3202
3252
  header_params = {}
@@ -3218,7 +3268,7 @@ module Google
3218
3268
  @notebook_service_stub.call_rpc :list_executions, request, options: options do |response, operation|
3219
3269
  response = ::Gapic::PagedEnumerable.new @notebook_service_stub, :list_executions, request, response, operation, options
3220
3270
  yield response, operation if block_given?
3221
- return response
3271
+ throw :response, response
3222
3272
  end
3223
3273
  rescue ::GRPC::BadStatus => e
3224
3274
  raise ::Google::Cloud::Error.from_error(e)
@@ -3280,10 +3330,11 @@ module Google
3280
3330
  # Customize the options with defaults
3281
3331
  metadata = @config.rpcs.get_execution.metadata.to_h
3282
3332
 
3283
- # Set x-goog-api-client and x-goog-user-project headers
3333
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3284
3334
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3285
3335
  lib_name: @config.lib_name, lib_version: @config.lib_version,
3286
3336
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
3337
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3287
3338
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3288
3339
 
3289
3340
  header_params = {}
@@ -3304,7 +3355,6 @@ module Google
3304
3355
 
3305
3356
  @notebook_service_stub.call_rpc :get_execution, request, options: options do |response, operation|
3306
3357
  yield response, operation if block_given?
3307
- return response
3308
3358
  end
3309
3359
  rescue ::GRPC::BadStatus => e
3310
3360
  raise ::Google::Cloud::Error.from_error(e)
@@ -3373,10 +3423,11 @@ module Google
3373
3423
  # Customize the options with defaults
3374
3424
  metadata = @config.rpcs.delete_execution.metadata.to_h
3375
3425
 
3376
- # Set x-goog-api-client and x-goog-user-project headers
3426
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3377
3427
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3378
3428
  lib_name: @config.lib_name, lib_version: @config.lib_version,
3379
3429
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
3430
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3380
3431
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3381
3432
 
3382
3433
  header_params = {}
@@ -3398,7 +3449,7 @@ module Google
3398
3449
  @notebook_service_stub.call_rpc :delete_execution, request, options: options do |response, operation|
3399
3450
  response = ::Gapic::Operation.new response, @operations_client, options: options
3400
3451
  yield response, operation if block_given?
3401
- return response
3452
+ throw :response, response
3402
3453
  end
3403
3454
  rescue ::GRPC::BadStatus => e
3404
3455
  raise ::Google::Cloud::Error.from_error(e)
@@ -3471,10 +3522,11 @@ module Google
3471
3522
  # Customize the options with defaults
3472
3523
  metadata = @config.rpcs.create_execution.metadata.to_h
3473
3524
 
3474
- # Set x-goog-api-client and x-goog-user-project headers
3525
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3475
3526
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3476
3527
  lib_name: @config.lib_name, lib_version: @config.lib_version,
3477
3528
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION
3529
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3478
3530
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3479
3531
 
3480
3532
  header_params = {}
@@ -3496,7 +3548,7 @@ module Google
3496
3548
  @notebook_service_stub.call_rpc :create_execution, request, options: options do |response, operation|
3497
3549
  response = ::Gapic::Operation.new response, @operations_client, options: options
3498
3550
  yield response, operation if block_given?
3499
- return response
3551
+ throw :response, response
3500
3552
  end
3501
3553
  rescue ::GRPC::BadStatus => e
3502
3554
  raise ::Google::Cloud::Error.from_error(e)
@@ -3585,6 +3637,11 @@ module Google
3585
3637
  # default endpoint URL. The default value of nil uses the environment
3586
3638
  # universe (usually the default "googleapis.com" universe).
3587
3639
  # @return [::String,nil]
3640
+ # @!attribute [rw] logger
3641
+ # A custom logger to use for request/response debug logging, or the value
3642
+ # `:default` (the default) to construct a default logger, or `nil` to
3643
+ # explicitly disable logging.
3644
+ # @return [::Logger,:default,nil]
3588
3645
  #
3589
3646
  class Configuration
3590
3647
  extend ::Gapic::Config
@@ -3609,6 +3666,7 @@ module Google
3609
3666
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3610
3667
  config_attr :quota_project, nil, ::String, nil
3611
3668
  config_attr :universe_domain, nil, ::String, nil
3669
+ config_attr :logger, :default, ::Logger, nil, :default
3612
3670
 
3613
3671
  # @private
3614
3672
  def initialize parent_config = nil