google-cloud-os_config-v1alpha 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,9 @@ module Google
35
35
  # manage package installations and patch jobs for Compute Engine VM instances.
36
36
  #
37
37
  class Client
38
+ # @private
39
+ API_VERSION = ""
40
+
38
41
  # @private
39
42
  DEFAULT_ENDPOINT_TEMPLATE = "osconfig.$UNIVERSE_DOMAIN$"
40
43
 
@@ -162,8 +165,19 @@ module Google
162
165
  endpoint: @config.endpoint,
163
166
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
164
167
  universe_domain: @config.universe_domain,
165
- credentials: credentials
168
+ credentials: credentials,
169
+ logger: @config.logger
166
170
  )
171
+
172
+ @os_config_zonal_service_stub.logger(stub: true)&.info do |entry|
173
+ entry.set_system_name
174
+ entry.set_service
175
+ entry.message = "Created client for #{entry.service}"
176
+ entry.set_credentials_fields credentials
177
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
178
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
179
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
180
+ end
167
181
  end
168
182
 
169
183
  ##
@@ -173,6 +187,15 @@ module Google
173
187
  #
174
188
  attr_reader :operations_client
175
189
 
190
+ ##
191
+ # The logger used for request/response debug logging.
192
+ #
193
+ # @return [Logger]
194
+ #
195
+ def logger
196
+ @os_config_zonal_service_stub.logger
197
+ end
198
+
176
199
  # Service calls
177
200
 
178
201
  ##
@@ -256,12 +279,13 @@ module Google
256
279
  # Customize the options with defaults
257
280
  call_metadata = @config.rpcs.create_os_policy_assignment.metadata.to_h
258
281
 
259
- # Set x-goog-api-client and x-goog-user-project headers
282
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
260
283
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
261
284
  lib_name: @config.lib_name, lib_version: @config.lib_version,
262
285
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
263
286
  transports_version_send: [:rest]
264
287
 
288
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
265
289
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
266
290
 
267
291
  options.apply_defaults timeout: @config.rpcs.create_os_policy_assignment.timeout,
@@ -275,7 +299,7 @@ module Google
275
299
  @os_config_zonal_service_stub.create_os_policy_assignment request, options do |result, operation|
276
300
  result = ::Gapic::Operation.new result, @operations_client, options: options
277
301
  yield result, operation if block_given?
278
- return result
302
+ throw :response, result
279
303
  end
280
304
  rescue ::Gapic::Rest::Error => e
281
305
  raise ::Google::Cloud::Error.from_error(e)
@@ -352,12 +376,13 @@ module Google
352
376
  # Customize the options with defaults
353
377
  call_metadata = @config.rpcs.update_os_policy_assignment.metadata.to_h
354
378
 
355
- # Set x-goog-api-client and x-goog-user-project headers
379
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
356
380
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
357
381
  lib_name: @config.lib_name, lib_version: @config.lib_version,
358
382
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
359
383
  transports_version_send: [:rest]
360
384
 
385
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
361
386
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
362
387
 
363
388
  options.apply_defaults timeout: @config.rpcs.update_os_policy_assignment.timeout,
@@ -371,7 +396,7 @@ module Google
371
396
  @os_config_zonal_service_stub.update_os_policy_assignment request, options do |result, operation|
372
397
  result = ::Gapic::Operation.new result, @operations_client, options: options
373
398
  yield result, operation if block_given?
374
- return result
399
+ throw :response, result
375
400
  end
376
401
  rescue ::Gapic::Rest::Error => e
377
402
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,12 +463,13 @@ module Google
438
463
  # Customize the options with defaults
439
464
  call_metadata = @config.rpcs.get_os_policy_assignment.metadata.to_h
440
465
 
441
- # Set x-goog-api-client and x-goog-user-project headers
466
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
442
467
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
443
468
  lib_name: @config.lib_name, lib_version: @config.lib_version,
444
469
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
445
470
  transports_version_send: [:rest]
446
471
 
472
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
447
473
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
448
474
 
449
475
  options.apply_defaults timeout: @config.rpcs.get_os_policy_assignment.timeout,
@@ -456,7 +482,6 @@ module Google
456
482
 
457
483
  @os_config_zonal_service_stub.get_os_policy_assignment request, options do |result, operation|
458
484
  yield result, operation if block_given?
459
- return result
460
485
  end
461
486
  rescue ::Gapic::Rest::Error => e
462
487
  raise ::Google::Cloud::Error.from_error(e)
@@ -528,12 +553,13 @@ module Google
528
553
  # Customize the options with defaults
529
554
  call_metadata = @config.rpcs.list_os_policy_assignments.metadata.to_h
530
555
 
531
- # Set x-goog-api-client and x-goog-user-project headers
556
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
532
557
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
533
558
  lib_name: @config.lib_name, lib_version: @config.lib_version,
534
559
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
535
560
  transports_version_send: [:rest]
536
561
 
562
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
537
563
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
538
564
 
539
565
  options.apply_defaults timeout: @config.rpcs.list_os_policy_assignments.timeout,
@@ -547,7 +573,7 @@ module Google
547
573
  @os_config_zonal_service_stub.list_os_policy_assignments request, options do |result, operation|
548
574
  result = ::Gapic::Rest::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignments, "os_policy_assignments", request, result, options
549
575
  yield result, operation if block_given?
550
- return result
576
+ throw :response, result
551
577
  end
552
578
  rescue ::Gapic::Rest::Error => e
553
579
  raise ::Google::Cloud::Error.from_error(e)
@@ -617,12 +643,13 @@ module Google
617
643
  # Customize the options with defaults
618
644
  call_metadata = @config.rpcs.list_os_policy_assignment_revisions.metadata.to_h
619
645
 
620
- # Set x-goog-api-client and x-goog-user-project headers
646
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
621
647
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
622
648
  lib_name: @config.lib_name, lib_version: @config.lib_version,
623
649
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
624
650
  transports_version_send: [:rest]
625
651
 
652
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
626
653
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
627
654
 
628
655
  options.apply_defaults timeout: @config.rpcs.list_os_policy_assignment_revisions.timeout,
@@ -636,7 +663,7 @@ module Google
636
663
  @os_config_zonal_service_stub.list_os_policy_assignment_revisions request, options do |result, operation|
637
664
  result = ::Gapic::Rest::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignment_revisions, "os_policy_assignments", request, result, options
638
665
  yield result, operation if block_given?
639
- return result
666
+ throw :response, result
640
667
  end
641
668
  rescue ::Gapic::Rest::Error => e
642
669
  raise ::Google::Cloud::Error.from_error(e)
@@ -714,12 +741,13 @@ module Google
714
741
  # Customize the options with defaults
715
742
  call_metadata = @config.rpcs.delete_os_policy_assignment.metadata.to_h
716
743
 
717
- # Set x-goog-api-client and x-goog-user-project headers
744
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
718
745
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
719
746
  lib_name: @config.lib_name, lib_version: @config.lib_version,
720
747
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
721
748
  transports_version_send: [:rest]
722
749
 
750
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
723
751
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
724
752
 
725
753
  options.apply_defaults timeout: @config.rpcs.delete_os_policy_assignment.timeout,
@@ -733,7 +761,7 @@ module Google
733
761
  @os_config_zonal_service_stub.delete_os_policy_assignment request, options do |result, operation|
734
762
  result = ::Gapic::Operation.new result, @operations_client, options: options
735
763
  yield result, operation if block_given?
736
- return result
764
+ throw :response, result
737
765
  end
738
766
  rescue ::Gapic::Rest::Error => e
739
767
  raise ::Google::Cloud::Error.from_error(e)
@@ -802,12 +830,13 @@ module Google
802
830
  # Customize the options with defaults
803
831
  call_metadata = @config.rpcs.get_instance_os_policies_compliance.metadata.to_h
804
832
 
805
- # Set x-goog-api-client and x-goog-user-project headers
833
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
806
834
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
807
835
  lib_name: @config.lib_name, lib_version: @config.lib_version,
808
836
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
809
837
  transports_version_send: [:rest]
810
838
 
839
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
811
840
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
812
841
 
813
842
  options.apply_defaults timeout: @config.rpcs.get_instance_os_policies_compliance.timeout,
@@ -820,7 +849,6 @@ module Google
820
849
 
821
850
  @os_config_zonal_service_stub.get_instance_os_policies_compliance request, options do |result, operation|
822
851
  yield result, operation if block_given?
823
- return result
824
852
  end
825
853
  rescue ::Gapic::Rest::Error => e
826
854
  raise ::Google::Cloud::Error.from_error(e)
@@ -899,12 +927,13 @@ module Google
899
927
  # Customize the options with defaults
900
928
  call_metadata = @config.rpcs.list_instance_os_policies_compliances.metadata.to_h
901
929
 
902
- # Set x-goog-api-client and x-goog-user-project headers
930
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
903
931
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
904
932
  lib_name: @config.lib_name, lib_version: @config.lib_version,
905
933
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
906
934
  transports_version_send: [:rest]
907
935
 
936
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
908
937
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
909
938
 
910
939
  options.apply_defaults timeout: @config.rpcs.list_instance_os_policies_compliances.timeout,
@@ -918,7 +947,7 @@ module Google
918
947
  @os_config_zonal_service_stub.list_instance_os_policies_compliances request, options do |result, operation|
919
948
  result = ::Gapic::Rest::PagedEnumerable.new @os_config_zonal_service_stub, :list_instance_os_policies_compliances, "instance_os_policies_compliances", request, result, options
920
949
  yield result, operation if block_given?
921
- return result
950
+ throw :response, result
922
951
  end
923
952
  rescue ::Gapic::Rest::Error => e
924
953
  raise ::Google::Cloud::Error.from_error(e)
@@ -987,12 +1016,13 @@ module Google
987
1016
  # Customize the options with defaults
988
1017
  call_metadata = @config.rpcs.get_os_policy_assignment_report.metadata.to_h
989
1018
 
990
- # Set x-goog-api-client and x-goog-user-project headers
1019
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
991
1020
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
992
1021
  lib_name: @config.lib_name, lib_version: @config.lib_version,
993
1022
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
994
1023
  transports_version_send: [:rest]
995
1024
 
1025
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
996
1026
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
997
1027
 
998
1028
  options.apply_defaults timeout: @config.rpcs.get_os_policy_assignment_report.timeout,
@@ -1005,7 +1035,6 @@ module Google
1005
1035
 
1006
1036
  @os_config_zonal_service_stub.get_os_policy_assignment_report request, options do |result, operation|
1007
1037
  yield result, operation if block_given?
1008
- return result
1009
1038
  end
1010
1039
  rescue ::Gapic::Rest::Error => e
1011
1040
  raise ::Google::Cloud::Error.from_error(e)
@@ -1099,12 +1128,13 @@ module Google
1099
1128
  # Customize the options with defaults
1100
1129
  call_metadata = @config.rpcs.list_os_policy_assignment_reports.metadata.to_h
1101
1130
 
1102
- # Set x-goog-api-client and x-goog-user-project headers
1131
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1103
1132
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1104
1133
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1105
1134
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
1106
1135
  transports_version_send: [:rest]
1107
1136
 
1137
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1108
1138
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1109
1139
 
1110
1140
  options.apply_defaults timeout: @config.rpcs.list_os_policy_assignment_reports.timeout,
@@ -1118,7 +1148,7 @@ module Google
1118
1148
  @os_config_zonal_service_stub.list_os_policy_assignment_reports request, options do |result, operation|
1119
1149
  result = ::Gapic::Rest::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignment_reports, "os_policy_assignment_reports", request, result, options
1120
1150
  yield result, operation if block_given?
1121
- return result
1151
+ throw :response, result
1122
1152
  end
1123
1153
  rescue ::Gapic::Rest::Error => e
1124
1154
  raise ::Google::Cloud::Error.from_error(e)
@@ -1189,12 +1219,13 @@ module Google
1189
1219
  # Customize the options with defaults
1190
1220
  call_metadata = @config.rpcs.get_inventory.metadata.to_h
1191
1221
 
1192
- # Set x-goog-api-client and x-goog-user-project headers
1222
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1193
1223
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1194
1224
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1195
1225
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
1196
1226
  transports_version_send: [:rest]
1197
1227
 
1228
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1198
1229
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1199
1230
 
1200
1231
  options.apply_defaults timeout: @config.rpcs.get_inventory.timeout,
@@ -1207,7 +1238,6 @@ module Google
1207
1238
 
1208
1239
  @os_config_zonal_service_stub.get_inventory request, options do |result, operation|
1209
1240
  yield result, operation if block_given?
1210
- return result
1211
1241
  end
1212
1242
  rescue ::Gapic::Rest::Error => e
1213
1243
  raise ::Google::Cloud::Error.from_error(e)
@@ -1287,12 +1317,13 @@ module Google
1287
1317
  # Customize the options with defaults
1288
1318
  call_metadata = @config.rpcs.list_inventories.metadata.to_h
1289
1319
 
1290
- # Set x-goog-api-client and x-goog-user-project headers
1320
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1291
1321
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1292
1322
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1293
1323
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
1294
1324
  transports_version_send: [:rest]
1295
1325
 
1326
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1296
1327
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1297
1328
 
1298
1329
  options.apply_defaults timeout: @config.rpcs.list_inventories.timeout,
@@ -1306,7 +1337,7 @@ module Google
1306
1337
  @os_config_zonal_service_stub.list_inventories request, options do |result, operation|
1307
1338
  result = ::Gapic::Rest::PagedEnumerable.new @os_config_zonal_service_stub, :list_inventories, "inventories", request, result, options
1308
1339
  yield result, operation if block_given?
1309
- return result
1340
+ throw :response, result
1310
1341
  end
1311
1342
  rescue ::Gapic::Rest::Error => e
1312
1343
  raise ::Google::Cloud::Error.from_error(e)
@@ -1374,12 +1405,13 @@ module Google
1374
1405
  # Customize the options with defaults
1375
1406
  call_metadata = @config.rpcs.get_vulnerability_report.metadata.to_h
1376
1407
 
1377
- # Set x-goog-api-client and x-goog-user-project headers
1408
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1378
1409
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1379
1410
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1380
1411
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
1381
1412
  transports_version_send: [:rest]
1382
1413
 
1414
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1383
1415
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1384
1416
 
1385
1417
  options.apply_defaults timeout: @config.rpcs.get_vulnerability_report.timeout,
@@ -1392,7 +1424,6 @@ module Google
1392
1424
 
1393
1425
  @os_config_zonal_service_stub.get_vulnerability_report request, options do |result, operation|
1394
1426
  yield result, operation if block_given?
1395
- return result
1396
1427
  end
1397
1428
  rescue ::Gapic::Rest::Error => e
1398
1429
  raise ::Google::Cloud::Error.from_error(e)
@@ -1469,12 +1500,13 @@ module Google
1469
1500
  # Customize the options with defaults
1470
1501
  call_metadata = @config.rpcs.list_vulnerability_reports.metadata.to_h
1471
1502
 
1472
- # Set x-goog-api-client and x-goog-user-project headers
1503
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1473
1504
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1474
1505
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1475
1506
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION,
1476
1507
  transports_version_send: [:rest]
1477
1508
 
1509
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1478
1510
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1479
1511
 
1480
1512
  options.apply_defaults timeout: @config.rpcs.list_vulnerability_reports.timeout,
@@ -1488,7 +1520,7 @@ module Google
1488
1520
  @os_config_zonal_service_stub.list_vulnerability_reports request, options do |result, operation|
1489
1521
  result = ::Gapic::Rest::PagedEnumerable.new @os_config_zonal_service_stub, :list_vulnerability_reports, "vulnerability_reports", request, result, options
1490
1522
  yield result, operation if block_given?
1491
- return result
1523
+ throw :response, result
1492
1524
  end
1493
1525
  rescue ::Gapic::Rest::Error => e
1494
1526
  raise ::Google::Cloud::Error.from_error(e)
@@ -1568,6 +1600,11 @@ module Google
1568
1600
  # default endpoint URL. The default value of nil uses the environment
1569
1601
  # universe (usually the default "googleapis.com" universe).
1570
1602
  # @return [::String,nil]
1603
+ # @!attribute [rw] logger
1604
+ # A custom logger to use for request/response debug logging, or the value
1605
+ # `:default` (the default) to construct a default logger, or `nil` to
1606
+ # explicitly disable logging.
1607
+ # @return [::Logger,:default,nil]
1571
1608
  #
1572
1609
  class Configuration
1573
1610
  extend ::Gapic::Config
@@ -1589,6 +1626,7 @@ module Google
1589
1626
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1590
1627
  config_attr :quota_project, nil, ::String, nil
1591
1628
  config_attr :universe_domain, nil, ::String, nil
1629
+ config_attr :logger, :default, ::Logger, nil, :default
1592
1630
 
1593
1631
  # @private
1594
1632
  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 = "osconfig.$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::OsConfig::V1alpha::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::OsConfig::V1alpha::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::OsConfig::V1alpha::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::OsConfig::V1alpha::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
  ##