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.
@@ -34,6 +34,9 @@ module Google
34
34
  # API v1 service for Managed Notebooks.
35
35
  #
36
36
  class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
37
40
  # @private
38
41
  DEFAULT_ENDPOINT_TEMPLATE = "notebooks.$UNIVERSE_DOMAIN$"
39
42
 
@@ -181,15 +184,27 @@ module Google
181
184
  endpoint: @config.endpoint,
182
185
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
183
186
  universe_domain: @config.universe_domain,
184
- credentials: credentials
187
+ credentials: credentials,
188
+ logger: @config.logger
185
189
  )
186
190
 
191
+ @managed_notebook_service_stub.logger(stub: true)&.info do |entry|
192
+ entry.set_system_name
193
+ entry.set_service
194
+ entry.message = "Created client for #{entry.service}"
195
+ entry.set_credentials_fields credentials
196
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
197
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
198
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
199
+ end
200
+
187
201
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
188
202
  config.credentials = credentials
189
203
  config.quota_project = @quota_project_id
190
204
  config.endpoint = @managed_notebook_service_stub.endpoint
191
205
  config.universe_domain = @managed_notebook_service_stub.universe_domain
192
206
  config.bindings_override = @config.bindings_override
207
+ config.logger = @managed_notebook_service_stub.logger if config.respond_to? :logger=
193
208
  end
194
209
 
195
210
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -198,6 +213,7 @@ module Google
198
213
  config.endpoint = @managed_notebook_service_stub.endpoint
199
214
  config.universe_domain = @managed_notebook_service_stub.universe_domain
200
215
  config.bindings_override = @config.bindings_override
216
+ config.logger = @managed_notebook_service_stub.logger if config.respond_to? :logger=
201
217
  end
202
218
  end
203
219
 
@@ -222,6 +238,15 @@ module Google
222
238
  #
223
239
  attr_reader :iam_policy_client
224
240
 
241
+ ##
242
+ # The logger used for request/response debug logging.
243
+ #
244
+ # @return [Logger]
245
+ #
246
+ def logger
247
+ @managed_notebook_service_stub.logger
248
+ end
249
+
225
250
  # Service calls
226
251
 
227
252
  ##
@@ -288,12 +313,13 @@ module Google
288
313
  # Customize the options with defaults
289
314
  call_metadata = @config.rpcs.list_runtimes.metadata.to_h
290
315
 
291
- # Set x-goog-api-client and x-goog-user-project headers
316
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
292
317
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
293
318
  lib_name: @config.lib_name, lib_version: @config.lib_version,
294
319
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
295
320
  transports_version_send: [:rest]
296
321
 
322
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
297
323
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
298
324
 
299
325
  options.apply_defaults timeout: @config.rpcs.list_runtimes.timeout,
@@ -306,7 +332,6 @@ module Google
306
332
 
307
333
  @managed_notebook_service_stub.list_runtimes request, options do |result, operation|
308
334
  yield result, operation if block_given?
309
- return result
310
335
  end
311
336
  rescue ::Gapic::Rest::Error => e
312
337
  raise ::Google::Cloud::Error.from_error(e)
@@ -368,12 +393,13 @@ module Google
368
393
  # Customize the options with defaults
369
394
  call_metadata = @config.rpcs.get_runtime.metadata.to_h
370
395
 
371
- # Set x-goog-api-client and x-goog-user-project headers
396
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
372
397
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
373
398
  lib_name: @config.lib_name, lib_version: @config.lib_version,
374
399
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
375
400
  transports_version_send: [:rest]
376
401
 
402
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
377
403
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
378
404
 
379
405
  options.apply_defaults timeout: @config.rpcs.get_runtime.timeout,
@@ -386,7 +412,6 @@ module Google
386
412
 
387
413
  @managed_notebook_service_stub.get_runtime request, options do |result, operation|
388
414
  yield result, operation if block_given?
389
- return result
390
415
  end
391
416
  rescue ::Gapic::Rest::Error => e
392
417
  raise ::Google::Cloud::Error.from_error(e)
@@ -460,12 +485,13 @@ module Google
460
485
  # Customize the options with defaults
461
486
  call_metadata = @config.rpcs.create_runtime.metadata.to_h
462
487
 
463
- # Set x-goog-api-client and x-goog-user-project headers
488
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
464
489
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
465
490
  lib_name: @config.lib_name, lib_version: @config.lib_version,
466
491
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
467
492
  transports_version_send: [:rest]
468
493
 
494
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
469
495
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
470
496
 
471
497
  options.apply_defaults timeout: @config.rpcs.create_runtime.timeout,
@@ -479,7 +505,7 @@ module Google
479
505
  @managed_notebook_service_stub.create_runtime request, options do |result, operation|
480
506
  result = ::Gapic::Operation.new result, @operations_client, options: options
481
507
  yield result, operation if block_given?
482
- return result
508
+ throw :response, result
483
509
  end
484
510
  rescue ::Gapic::Rest::Error => e
485
511
  raise ::Google::Cloud::Error.from_error(e)
@@ -572,12 +598,13 @@ module Google
572
598
  # Customize the options with defaults
573
599
  call_metadata = @config.rpcs.update_runtime.metadata.to_h
574
600
 
575
- # Set x-goog-api-client and x-goog-user-project headers
601
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
576
602
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
577
603
  lib_name: @config.lib_name, lib_version: @config.lib_version,
578
604
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
579
605
  transports_version_send: [:rest]
580
606
 
607
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
581
608
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
582
609
 
583
610
  options.apply_defaults timeout: @config.rpcs.update_runtime.timeout,
@@ -591,7 +618,7 @@ module Google
591
618
  @managed_notebook_service_stub.update_runtime request, options do |result, operation|
592
619
  result = ::Gapic::Operation.new result, @operations_client, options: options
593
620
  yield result, operation if block_given?
594
- return result
621
+ throw :response, result
595
622
  end
596
623
  rescue ::Gapic::Rest::Error => e
597
624
  raise ::Google::Cloud::Error.from_error(e)
@@ -661,12 +688,13 @@ module Google
661
688
  # Customize the options with defaults
662
689
  call_metadata = @config.rpcs.delete_runtime.metadata.to_h
663
690
 
664
- # Set x-goog-api-client and x-goog-user-project headers
691
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
665
692
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
666
693
  lib_name: @config.lib_name, lib_version: @config.lib_version,
667
694
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
668
695
  transports_version_send: [:rest]
669
696
 
697
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
670
698
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
671
699
 
672
700
  options.apply_defaults timeout: @config.rpcs.delete_runtime.timeout,
@@ -680,7 +708,7 @@ module Google
680
708
  @managed_notebook_service_stub.delete_runtime request, options do |result, operation|
681
709
  result = ::Gapic::Operation.new result, @operations_client, options: options
682
710
  yield result, operation if block_given?
683
- return result
711
+ throw :response, result
684
712
  end
685
713
  rescue ::Gapic::Rest::Error => e
686
714
  raise ::Google::Cloud::Error.from_error(e)
@@ -754,12 +782,13 @@ module Google
754
782
  # Customize the options with defaults
755
783
  call_metadata = @config.rpcs.start_runtime.metadata.to_h
756
784
 
757
- # Set x-goog-api-client and x-goog-user-project headers
785
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
758
786
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
759
787
  lib_name: @config.lib_name, lib_version: @config.lib_version,
760
788
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
761
789
  transports_version_send: [:rest]
762
790
 
791
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
763
792
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
764
793
 
765
794
  options.apply_defaults timeout: @config.rpcs.start_runtime.timeout,
@@ -773,7 +802,7 @@ module Google
773
802
  @managed_notebook_service_stub.start_runtime request, options do |result, operation|
774
803
  result = ::Gapic::Operation.new result, @operations_client, options: options
775
804
  yield result, operation if block_given?
776
- return result
805
+ throw :response, result
777
806
  end
778
807
  rescue ::Gapic::Rest::Error => e
779
808
  raise ::Google::Cloud::Error.from_error(e)
@@ -847,12 +876,13 @@ module Google
847
876
  # Customize the options with defaults
848
877
  call_metadata = @config.rpcs.stop_runtime.metadata.to_h
849
878
 
850
- # Set x-goog-api-client and x-goog-user-project headers
879
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
851
880
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
852
881
  lib_name: @config.lib_name, lib_version: @config.lib_version,
853
882
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
854
883
  transports_version_send: [:rest]
855
884
 
885
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
856
886
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
857
887
 
858
888
  options.apply_defaults timeout: @config.rpcs.stop_runtime.timeout,
@@ -866,7 +896,7 @@ module Google
866
896
  @managed_notebook_service_stub.stop_runtime request, options do |result, operation|
867
897
  result = ::Gapic::Operation.new result, @operations_client, options: options
868
898
  yield result, operation if block_given?
869
- return result
899
+ throw :response, result
870
900
  end
871
901
  rescue ::Gapic::Rest::Error => e
872
902
  raise ::Google::Cloud::Error.from_error(e)
@@ -940,12 +970,13 @@ module Google
940
970
  # Customize the options with defaults
941
971
  call_metadata = @config.rpcs.switch_runtime.metadata.to_h
942
972
 
943
- # Set x-goog-api-client and x-goog-user-project headers
973
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
944
974
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
945
975
  lib_name: @config.lib_name, lib_version: @config.lib_version,
946
976
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
947
977
  transports_version_send: [:rest]
948
978
 
979
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
949
980
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
950
981
 
951
982
  options.apply_defaults timeout: @config.rpcs.switch_runtime.timeout,
@@ -959,7 +990,7 @@ module Google
959
990
  @managed_notebook_service_stub.switch_runtime request, options do |result, operation|
960
991
  result = ::Gapic::Operation.new result, @operations_client, options: options
961
992
  yield result, operation if block_given?
962
- return result
993
+ throw :response, result
963
994
  end
964
995
  rescue ::Gapic::Rest::Error => e
965
996
  raise ::Google::Cloud::Error.from_error(e)
@@ -1029,12 +1060,13 @@ module Google
1029
1060
  # Customize the options with defaults
1030
1061
  call_metadata = @config.rpcs.reset_runtime.metadata.to_h
1031
1062
 
1032
- # Set x-goog-api-client and x-goog-user-project headers
1063
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1033
1064
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1034
1065
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1035
1066
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
1036
1067
  transports_version_send: [:rest]
1037
1068
 
1069
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1038
1070
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1039
1071
 
1040
1072
  options.apply_defaults timeout: @config.rpcs.reset_runtime.timeout,
@@ -1048,7 +1080,7 @@ module Google
1048
1080
  @managed_notebook_service_stub.reset_runtime request, options do |result, operation|
1049
1081
  result = ::Gapic::Operation.new result, @operations_client, options: options
1050
1082
  yield result, operation if block_given?
1051
- return result
1083
+ throw :response, result
1052
1084
  end
1053
1085
  rescue ::Gapic::Rest::Error => e
1054
1086
  raise ::Google::Cloud::Error.from_error(e)
@@ -1118,12 +1150,13 @@ module Google
1118
1150
  # Customize the options with defaults
1119
1151
  call_metadata = @config.rpcs.upgrade_runtime.metadata.to_h
1120
1152
 
1121
- # Set x-goog-api-client and x-goog-user-project headers
1153
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1122
1154
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1123
1155
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1124
1156
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
1125
1157
  transports_version_send: [:rest]
1126
1158
 
1159
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1127
1160
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1128
1161
 
1129
1162
  options.apply_defaults timeout: @config.rpcs.upgrade_runtime.timeout,
@@ -1137,7 +1170,7 @@ module Google
1137
1170
  @managed_notebook_service_stub.upgrade_runtime request, options do |result, operation|
1138
1171
  result = ::Gapic::Operation.new result, @operations_client, options: options
1139
1172
  yield result, operation if block_given?
1140
- return result
1173
+ throw :response, result
1141
1174
  end
1142
1175
  rescue ::Gapic::Rest::Error => e
1143
1176
  raise ::Google::Cloud::Error.from_error(e)
@@ -1210,12 +1243,13 @@ module Google
1210
1243
  # Customize the options with defaults
1211
1244
  call_metadata = @config.rpcs.report_runtime_event.metadata.to_h
1212
1245
 
1213
- # Set x-goog-api-client and x-goog-user-project headers
1246
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1214
1247
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1215
1248
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1216
1249
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
1217
1250
  transports_version_send: [:rest]
1218
1251
 
1252
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1219
1253
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1220
1254
 
1221
1255
  options.apply_defaults timeout: @config.rpcs.report_runtime_event.timeout,
@@ -1229,7 +1263,7 @@ module Google
1229
1263
  @managed_notebook_service_stub.report_runtime_event request, options do |result, operation|
1230
1264
  result = ::Gapic::Operation.new result, @operations_client, options: options
1231
1265
  yield result, operation if block_given?
1232
- return result
1266
+ throw :response, result
1233
1267
  end
1234
1268
  rescue ::Gapic::Rest::Error => e
1235
1269
  raise ::Google::Cloud::Error.from_error(e)
@@ -1294,12 +1328,13 @@ module Google
1294
1328
  # Customize the options with defaults
1295
1329
  call_metadata = @config.rpcs.refresh_runtime_token_internal.metadata.to_h
1296
1330
 
1297
- # Set x-goog-api-client and x-goog-user-project headers
1331
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1298
1332
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1299
1333
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1300
1334
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
1301
1335
  transports_version_send: [:rest]
1302
1336
 
1337
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1303
1338
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1304
1339
 
1305
1340
  options.apply_defaults timeout: @config.rpcs.refresh_runtime_token_internal.timeout,
@@ -1312,7 +1347,6 @@ module Google
1312
1347
 
1313
1348
  @managed_notebook_service_stub.refresh_runtime_token_internal request, options do |result, operation|
1314
1349
  yield result, operation if block_given?
1315
- return result
1316
1350
  end
1317
1351
  rescue ::Gapic::Rest::Error => e
1318
1352
  raise ::Google::Cloud::Error.from_error(e)
@@ -1382,12 +1416,13 @@ module Google
1382
1416
  # Customize the options with defaults
1383
1417
  call_metadata = @config.rpcs.diagnose_runtime.metadata.to_h
1384
1418
 
1385
- # Set x-goog-api-client and x-goog-user-project headers
1419
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1386
1420
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1387
1421
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1388
1422
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
1389
1423
  transports_version_send: [:rest]
1390
1424
 
1425
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1391
1426
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1392
1427
 
1393
1428
  options.apply_defaults timeout: @config.rpcs.diagnose_runtime.timeout,
@@ -1401,7 +1436,7 @@ module Google
1401
1436
  @managed_notebook_service_stub.diagnose_runtime request, options do |result, operation|
1402
1437
  result = ::Gapic::Operation.new result, @operations_client, options: options
1403
1438
  yield result, operation if block_given?
1404
- return result
1439
+ throw :response, result
1405
1440
  end
1406
1441
  rescue ::Gapic::Rest::Error => e
1407
1442
  raise ::Google::Cloud::Error.from_error(e)
@@ -1481,6 +1516,11 @@ module Google
1481
1516
  # default endpoint URL. The default value of nil uses the environment
1482
1517
  # universe (usually the default "googleapis.com" universe).
1483
1518
  # @return [::String,nil]
1519
+ # @!attribute [rw] logger
1520
+ # A custom logger to use for request/response debug logging, or the value
1521
+ # `:default` (the default) to construct a default logger, or `nil` to
1522
+ # explicitly disable logging.
1523
+ # @return [::Logger,:default,nil]
1484
1524
  #
1485
1525
  class Configuration
1486
1526
  extend ::Gapic::Config
@@ -1509,6 +1549,7 @@ module Google
1509
1549
  # by the host service.
1510
1550
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1511
1551
  config_attr :bindings_override, {}, ::Hash, nil
1552
+ config_attr :logger, :default, ::Logger, nil, :default
1512
1553
 
1513
1554
  # @private
1514
1555
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module Rest
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
 
@@ -112,14 +115,6 @@ module Google
112
115
  # Lists operations that match the specified filter in the request. If the
113
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
114
117
  #
115
- # NOTE: the `name` binding allows API services to override the binding
116
- # to use different resource name schemes, such as `users/*/operations`. To
117
- # override the binding, API services can add a binding such as
118
- # `"/v1/{name=users/*}/operations"` to their service configuration.
119
- # For backwards compatibility, the default name includes the operations
120
- # collection id, however overriding users must ensure the name binding
121
- # is the parent resource, without the operations collection id.
122
- #
123
118
  # @overload list_operations(request, options = nil)
124
119
  # Pass arguments to `list_operations` via a request object, either of type
125
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -181,12 +176,13 @@ module Google
181
176
  # Customize the options with defaults
182
177
  call_metadata = @config.rpcs.list_operations.metadata.to_h
183
178
 
184
- # Set x-goog-api-client and x-goog-user-project headers
179
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
185
180
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
186
181
  lib_name: @config.lib_name, lib_version: @config.lib_version,
187
182
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
188
183
  transports_version_send: [:rest]
189
184
 
185
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
190
186
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
191
187
 
192
188
  options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
@@ -200,7 +196,7 @@ module Google
200
196
  @operations_stub.list_operations request, options do |result, operation|
201
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
202
198
  yield result, operation if block_given?
203
- return result
199
+ throw :response, result
204
200
  end
205
201
  rescue ::Gapic::Rest::Error => e
206
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -269,12 +265,13 @@ module Google
269
265
  # Customize the options with defaults
270
266
  call_metadata = @config.rpcs.get_operation.metadata.to_h
271
267
 
272
- # Set x-goog-api-client and x-goog-user-project headers
268
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
273
269
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
274
270
  lib_name: @config.lib_name, lib_version: @config.lib_version,
275
271
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
276
272
  transports_version_send: [:rest]
277
273
 
274
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
278
275
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
279
276
 
280
277
  options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
@@ -288,7 +285,7 @@ module Google
288
285
  @operations_stub.get_operation request, options do |result, operation|
289
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
290
287
  yield result, operation if block_given?
291
- return result
288
+ throw :response, result
292
289
  end
293
290
  rescue ::Gapic::Rest::Error => e
294
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -351,12 +348,13 @@ module Google
351
348
  # Customize the options with defaults
352
349
  call_metadata = @config.rpcs.delete_operation.metadata.to_h
353
350
 
354
- # Set x-goog-api-client and x-goog-user-project headers
351
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
355
352
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
356
353
  lib_name: @config.lib_name, lib_version: @config.lib_version,
357
354
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
358
355
  transports_version_send: [:rest]
359
356
 
357
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
360
358
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
361
359
 
362
360
  options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
@@ -369,7 +367,6 @@ module Google
369
367
 
370
368
  @operations_stub.delete_operation request, options do |result, operation|
371
369
  yield result, operation if block_given?
372
- return result
373
370
  end
374
371
  rescue ::Gapic::Rest::Error => e
375
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -384,8 +381,9 @@ module Google
384
381
  # other methods to check whether the cancellation succeeded or whether the
385
382
  # operation completed despite cancellation. On successful cancellation,
386
383
  # the operation is not deleted; instead, it becomes an operation with
387
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
388
- # corresponding to `Code.CANCELLED`.
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
389
387
  #
390
388
  # @overload cancel_operation(request, options = nil)
391
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -438,12 +436,13 @@ module Google
438
436
  # Customize the options with defaults
439
437
  call_metadata = @config.rpcs.cancel_operation.metadata.to_h
440
438
 
441
- # Set x-goog-api-client and x-goog-user-project headers
439
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
442
440
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
443
441
  lib_name: @config.lib_name, lib_version: @config.lib_version,
444
442
  gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
445
443
  transports_version_send: [:rest]
446
444
 
445
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
447
446
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
448
447
 
449
448
  options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
@@ -456,7 +455,6 @@ module Google
456
455
 
457
456
  @operations_stub.cancel_operation request, options do |result, operation|
458
457
  yield result, operation if block_given?
459
- return result
460
458
  end
461
459
  rescue ::Gapic::Rest::Error => e
462
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -536,6 +534,11 @@ module Google
536
534
  # default endpoint URL. The default value of nil uses the environment
537
535
  # universe (usually the default "googleapis.com" universe).
538
536
  # @return [::String,nil]
537
+ # @!attribute [rw] logger
538
+ # A custom logger to use for request/response debug logging, or the value
539
+ # `:default` (the default) to construct a default logger, or `nil` to
540
+ # explicitly disable logging.
541
+ # @return [::Logger,:default,nil]
539
542
  #
540
543
  class Configuration
541
544
  extend ::Gapic::Config
@@ -557,6 +560,7 @@ module Google
557
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
561
  config_attr :quota_project, nil, ::String, nil
559
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
560
564
 
561
565
  # @private
562
566
  def initialize parent_config = nil
@@ -676,16 +680,18 @@ module Google
676
680
 
677
681
  response = @client_stub.make_http_request(
678
682
  verb,
679
- uri: uri,
680
- body: body || "",
681
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
682
687
  options: options
683
688
  )
684
689
  operation = ::Gapic::Rest::TransportOperation.new response
685
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
686
-
687
- yield result, operation if block_given?
688
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
689
695
  end
690
696
 
691
697
  ##
@@ -714,16 +720,18 @@ module Google
714
720
 
715
721
  response = @client_stub.make_http_request(
716
722
  verb,
717
- uri: uri,
718
- body: body || "",
719
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
720
727
  options: options
721
728
  )
722
729
  operation = ::Gapic::Rest::TransportOperation.new response
723
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
724
-
725
- yield result, operation if block_given?
726
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
727
735
  end
728
736
 
729
737
  ##
@@ -752,16 +760,18 @@ module Google
752
760
 
753
761
  response = @client_stub.make_http_request(
754
762
  verb,
755
- uri: uri,
756
- body: body || "",
757
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
758
767
  options: options
759
768
  )
760
769
  operation = ::Gapic::Rest::TransportOperation.new response
761
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
762
-
763
- yield result, operation if block_given?
764
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
765
775
  end
766
776
 
767
777
  ##
@@ -790,16 +800,18 @@ module Google
790
800
 
791
801
  response = @client_stub.make_http_request(
792
802
  verb,
793
- uri: uri,
794
- body: body || "",
795
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
796
807
  options: options
797
808
  )
798
809
  operation = ::Gapic::Rest::TransportOperation.new response
799
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
800
-
801
- yield result, operation if block_given?
802
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
803
815
  end
804
816
 
805
817
  ##