google-cloud-os_config-v1alpha 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32f126492f1fd7c8fa0e2ce4039205a9f9e0f925f3b5dd5148f7d0ae652699d7
4
- data.tar.gz: c1badbd908d6c8deaeb2f5cf1db633a80ee81df99642dd27d4d8599a4b3c5a48
3
+ metadata.gz: 9ce6e30c0278c136cb59dddfd870a0368a62cee26d60829dc7fccedbadb60340
4
+ data.tar.gz: afa500ba5bf10abc949af584d03ee0684b763129618bcc517367ef6243b4b5d0
5
5
  SHA512:
6
- metadata.gz: db474cbf24a9286c05ade2c526ed0379f8842517848d7ae4b14fdc168bfa730ea1cdb7b7633c1d590798f60faf28fc4a328f37d96c6466e319836c7b2aa52810
7
- data.tar.gz: 3230982717be02c975b51c2283ab60d0edcace99ac7c531b8cb227615c10e08ba9c2a6f8cd01260c40194a660cacdcd2728af5fdb1d72b53b0e9f46e0653115e
6
+ metadata.gz: 950670823be1414082b5d190d427871f1bce9333706c798e7e84b541669fc088324fa4aaa2369a7561619853ab776dc6514af18568add83aa4aed721cff2d56f
7
+ data.tar.gz: aee355f7d7f8b8946a8f1aed10ba4ebb83a1b6156863f6293f2936f79b5c8058ae45592d22219743160fed099556dba3878e5ea66ca18e1fc9140b72ff1984fe
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/compute/docs/manage-os)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/os_config/v1alpha"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -33,6 +33,9 @@ module Google
33
33
  # manage package installations and patch jobs for Compute Engine VM instances.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
36
39
  # @private
37
40
  DEFAULT_ENDPOINT_TEMPLATE = "osconfig.$UNIVERSE_DOMAIN$"
38
41
 
@@ -169,8 +172,19 @@ module Google
169
172
  universe_domain: @config.universe_domain,
170
173
  channel_args: @config.channel_args,
171
174
  interceptors: @config.interceptors,
172
- channel_pool_config: @config.channel_pool
175
+ channel_pool_config: @config.channel_pool,
176
+ logger: @config.logger
173
177
  )
178
+
179
+ @os_config_zonal_service_stub.stub_logger&.info do |entry|
180
+ entry.set_system_name
181
+ entry.set_service
182
+ entry.message = "Created client for #{entry.service}"
183
+ entry.set_credentials_fields credentials
184
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
185
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
186
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
187
+ end
174
188
  end
175
189
 
176
190
  ##
@@ -180,6 +194,15 @@ module Google
180
194
  #
181
195
  attr_reader :operations_client
182
196
 
197
+ ##
198
+ # The logger used for request/response debug logging.
199
+ #
200
+ # @return [Logger]
201
+ #
202
+ def logger
203
+ @os_config_zonal_service_stub.logger
204
+ end
205
+
183
206
  # Service calls
184
207
 
185
208
  ##
@@ -264,10 +287,11 @@ module Google
264
287
  # Customize the options with defaults
265
288
  metadata = @config.rpcs.create_os_policy_assignment.metadata.to_h
266
289
 
267
- # Set x-goog-api-client and x-goog-user-project headers
290
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
268
291
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
269
292
  lib_name: @config.lib_name, lib_version: @config.lib_version,
270
293
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
294
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
271
295
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
272
296
 
273
297
  header_params = {}
@@ -289,7 +313,7 @@ module Google
289
313
  @os_config_zonal_service_stub.call_rpc :create_os_policy_assignment, request, options: options do |response, operation|
290
314
  response = ::Gapic::Operation.new response, @operations_client, options: options
291
315
  yield response, operation if block_given?
292
- return response
316
+ throw :response, response
293
317
  end
294
318
  rescue ::GRPC::BadStatus => e
295
319
  raise ::Google::Cloud::Error.from_error(e)
@@ -367,10 +391,11 @@ module Google
367
391
  # Customize the options with defaults
368
392
  metadata = @config.rpcs.update_os_policy_assignment.metadata.to_h
369
393
 
370
- # Set x-goog-api-client and x-goog-user-project headers
394
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
371
395
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
372
396
  lib_name: @config.lib_name, lib_version: @config.lib_version,
373
397
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
398
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
374
399
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
375
400
 
376
401
  header_params = {}
@@ -392,7 +417,7 @@ module Google
392
417
  @os_config_zonal_service_stub.call_rpc :update_os_policy_assignment, request, options: options do |response, operation|
393
418
  response = ::Gapic::Operation.new response, @operations_client, options: options
394
419
  yield response, operation if block_given?
395
- return response
420
+ throw :response, response
396
421
  end
397
422
  rescue ::GRPC::BadStatus => e
398
423
  raise ::Google::Cloud::Error.from_error(e)
@@ -460,10 +485,11 @@ module Google
460
485
  # Customize the options with defaults
461
486
  metadata = @config.rpcs.get_os_policy_assignment.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
  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::OsConfig::V1alpha::VERSION
492
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
467
493
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
468
494
 
469
495
  header_params = {}
@@ -484,7 +510,6 @@ module Google
484
510
 
485
511
  @os_config_zonal_service_stub.call_rpc :get_os_policy_assignment, request, options: options do |response, operation|
486
512
  yield response, operation if block_given?
487
- return response
488
513
  end
489
514
  rescue ::GRPC::BadStatus => e
490
515
  raise ::Google::Cloud::Error.from_error(e)
@@ -557,10 +582,11 @@ module Google
557
582
  # Customize the options with defaults
558
583
  metadata = @config.rpcs.list_os_policy_assignments.metadata.to_h
559
584
 
560
- # Set x-goog-api-client and x-goog-user-project headers
585
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
561
586
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
562
587
  lib_name: @config.lib_name, lib_version: @config.lib_version,
563
588
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
589
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
564
590
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
565
591
 
566
592
  header_params = {}
@@ -582,7 +608,7 @@ module Google
582
608
  @os_config_zonal_service_stub.call_rpc :list_os_policy_assignments, request, options: options do |response, operation|
583
609
  response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignments, request, response, operation, options
584
610
  yield response, operation if block_given?
585
- return response
611
+ throw :response, response
586
612
  end
587
613
  rescue ::GRPC::BadStatus => e
588
614
  raise ::Google::Cloud::Error.from_error(e)
@@ -653,10 +679,11 @@ module Google
653
679
  # Customize the options with defaults
654
680
  metadata = @config.rpcs.list_os_policy_assignment_revisions.metadata.to_h
655
681
 
656
- # Set x-goog-api-client and x-goog-user-project headers
682
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
657
683
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
658
684
  lib_name: @config.lib_name, lib_version: @config.lib_version,
659
685
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
686
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
660
687
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
661
688
 
662
689
  header_params = {}
@@ -678,7 +705,7 @@ module Google
678
705
  @os_config_zonal_service_stub.call_rpc :list_os_policy_assignment_revisions, request, options: options do |response, operation|
679
706
  response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignment_revisions, request, response, operation, options
680
707
  yield response, operation if block_given?
681
- return response
708
+ throw :response, response
682
709
  end
683
710
  rescue ::GRPC::BadStatus => e
684
711
  raise ::Google::Cloud::Error.from_error(e)
@@ -757,10 +784,11 @@ module Google
757
784
  # Customize the options with defaults
758
785
  metadata = @config.rpcs.delete_os_policy_assignment.metadata.to_h
759
786
 
760
- # Set x-goog-api-client and x-goog-user-project headers
787
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
761
788
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
762
789
  lib_name: @config.lib_name, lib_version: @config.lib_version,
763
790
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
791
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
764
792
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
765
793
 
766
794
  header_params = {}
@@ -782,7 +810,7 @@ module Google
782
810
  @os_config_zonal_service_stub.call_rpc :delete_os_policy_assignment, request, options: options do |response, operation|
783
811
  response = ::Gapic::Operation.new response, @operations_client, options: options
784
812
  yield response, operation if block_given?
785
- return response
813
+ throw :response, response
786
814
  end
787
815
  rescue ::GRPC::BadStatus => e
788
816
  raise ::Google::Cloud::Error.from_error(e)
@@ -854,10 +882,11 @@ module Google
854
882
  # Customize the options with defaults
855
883
  metadata = @config.rpcs.get_instance_os_policies_compliance.metadata.to_h
856
884
 
857
- # Set x-goog-api-client and x-goog-user-project headers
885
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
858
886
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
859
887
  lib_name: @config.lib_name, lib_version: @config.lib_version,
860
888
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
889
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
861
890
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
862
891
 
863
892
  header_params = {}
@@ -878,7 +907,6 @@ module Google
878
907
 
879
908
  @os_config_zonal_service_stub.call_rpc :get_instance_os_policies_compliance, request, options: options do |response, operation|
880
909
  yield response, operation if block_given?
881
- return response
882
910
  end
883
911
  rescue ::GRPC::BadStatus => e
884
912
  raise ::Google::Cloud::Error.from_error(e)
@@ -960,10 +988,11 @@ module Google
960
988
  # Customize the options with defaults
961
989
  metadata = @config.rpcs.list_instance_os_policies_compliances.metadata.to_h
962
990
 
963
- # Set x-goog-api-client and x-goog-user-project headers
991
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
964
992
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
965
993
  lib_name: @config.lib_name, lib_version: @config.lib_version,
966
994
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
995
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
967
996
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
968
997
 
969
998
  header_params = {}
@@ -985,7 +1014,7 @@ module Google
985
1014
  @os_config_zonal_service_stub.call_rpc :list_instance_os_policies_compliances, request, options: options do |response, operation|
986
1015
  response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_instance_os_policies_compliances, request, response, operation, options
987
1016
  yield response, operation if block_given?
988
- return response
1017
+ throw :response, response
989
1018
  end
990
1019
  rescue ::GRPC::BadStatus => e
991
1020
  raise ::Google::Cloud::Error.from_error(e)
@@ -1055,10 +1084,11 @@ module Google
1055
1084
  # Customize the options with defaults
1056
1085
  metadata = @config.rpcs.get_os_policy_assignment_report.metadata.to_h
1057
1086
 
1058
- # Set x-goog-api-client and x-goog-user-project headers
1087
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1059
1088
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1060
1089
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1061
1090
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1091
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1062
1092
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1063
1093
 
1064
1094
  header_params = {}
@@ -1079,7 +1109,6 @@ module Google
1079
1109
 
1080
1110
  @os_config_zonal_service_stub.call_rpc :get_os_policy_assignment_report, request, options: options do |response, operation|
1081
1111
  yield response, operation if block_given?
1082
- return response
1083
1112
  end
1084
1113
  rescue ::GRPC::BadStatus => e
1085
1114
  raise ::Google::Cloud::Error.from_error(e)
@@ -1174,10 +1203,11 @@ module Google
1174
1203
  # Customize the options with defaults
1175
1204
  metadata = @config.rpcs.list_os_policy_assignment_reports.metadata.to_h
1176
1205
 
1177
- # Set x-goog-api-client and x-goog-user-project headers
1206
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1178
1207
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1179
1208
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1180
1209
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1210
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1181
1211
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1182
1212
 
1183
1213
  header_params = {}
@@ -1199,7 +1229,7 @@ module Google
1199
1229
  @os_config_zonal_service_stub.call_rpc :list_os_policy_assignment_reports, request, options: options do |response, operation|
1200
1230
  response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignment_reports, request, response, operation, options
1201
1231
  yield response, operation if block_given?
1202
- return response
1232
+ throw :response, response
1203
1233
  end
1204
1234
  rescue ::GRPC::BadStatus => e
1205
1235
  raise ::Google::Cloud::Error.from_error(e)
@@ -1271,10 +1301,11 @@ module Google
1271
1301
  # Customize the options with defaults
1272
1302
  metadata = @config.rpcs.get_inventory.metadata.to_h
1273
1303
 
1274
- # Set x-goog-api-client and x-goog-user-project headers
1304
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1275
1305
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1276
1306
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1277
1307
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1308
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1278
1309
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1279
1310
 
1280
1311
  header_params = {}
@@ -1295,7 +1326,6 @@ module Google
1295
1326
 
1296
1327
  @os_config_zonal_service_stub.call_rpc :get_inventory, request, options: options do |response, operation|
1297
1328
  yield response, operation if block_given?
1298
- return response
1299
1329
  end
1300
1330
  rescue ::GRPC::BadStatus => e
1301
1331
  raise ::Google::Cloud::Error.from_error(e)
@@ -1376,10 +1406,11 @@ module Google
1376
1406
  # Customize the options with defaults
1377
1407
  metadata = @config.rpcs.list_inventories.metadata.to_h
1378
1408
 
1379
- # Set x-goog-api-client and x-goog-user-project headers
1409
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1380
1410
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1381
1411
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1382
1412
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1413
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1383
1414
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1384
1415
 
1385
1416
  header_params = {}
@@ -1401,7 +1432,7 @@ module Google
1401
1432
  @os_config_zonal_service_stub.call_rpc :list_inventories, request, options: options do |response, operation|
1402
1433
  response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_inventories, request, response, operation, options
1403
1434
  yield response, operation if block_given?
1404
- return response
1435
+ throw :response, response
1405
1436
  end
1406
1437
  rescue ::GRPC::BadStatus => e
1407
1438
  raise ::Google::Cloud::Error.from_error(e)
@@ -1470,10 +1501,11 @@ module Google
1470
1501
  # Customize the options with defaults
1471
1502
  metadata = @config.rpcs.get_vulnerability_report.metadata.to_h
1472
1503
 
1473
- # Set x-goog-api-client and x-goog-user-project headers
1504
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1474
1505
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1475
1506
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1476
1507
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1508
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1477
1509
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1478
1510
 
1479
1511
  header_params = {}
@@ -1494,7 +1526,6 @@ module Google
1494
1526
 
1495
1527
  @os_config_zonal_service_stub.call_rpc :get_vulnerability_report, request, options: options do |response, operation|
1496
1528
  yield response, operation if block_given?
1497
- return response
1498
1529
  end
1499
1530
  rescue ::GRPC::BadStatus => e
1500
1531
  raise ::Google::Cloud::Error.from_error(e)
@@ -1572,10 +1603,11 @@ module Google
1572
1603
  # Customize the options with defaults
1573
1604
  metadata = @config.rpcs.list_vulnerability_reports.metadata.to_h
1574
1605
 
1575
- # Set x-goog-api-client and x-goog-user-project headers
1606
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1576
1607
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1577
1608
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1578
1609
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1610
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1579
1611
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1580
1612
 
1581
1613
  header_params = {}
@@ -1597,7 +1629,7 @@ module Google
1597
1629
  @os_config_zonal_service_stub.call_rpc :list_vulnerability_reports, request, options: options do |response, operation|
1598
1630
  response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_vulnerability_reports, request, response, operation, options
1599
1631
  yield response, operation if block_given?
1600
- return response
1632
+ throw :response, response
1601
1633
  end
1602
1634
  rescue ::GRPC::BadStatus => e
1603
1635
  raise ::Google::Cloud::Error.from_error(e)
@@ -1686,6 +1718,11 @@ module Google
1686
1718
  # default endpoint URL. The default value of nil uses the environment
1687
1719
  # universe (usually the default "googleapis.com" universe).
1688
1720
  # @return [::String,nil]
1721
+ # @!attribute [rw] logger
1722
+ # A custom logger to use for request/response debug logging, or the value
1723
+ # `:default` (the default) to construct a default logger, or `nil` to
1724
+ # explicitly disable logging.
1725
+ # @return [::Logger,:default,nil]
1689
1726
  #
1690
1727
  class Configuration
1691
1728
  extend ::Gapic::Config
@@ -1710,6 +1747,7 @@ module Google
1710
1747
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1711
1748
  config_attr :quota_project, nil, ::String, nil
1712
1749
  config_attr :universe_domain, nil, ::String, nil
1750
+ config_attr :logger, :default, ::Logger, nil, :default
1713
1751
 
1714
1752
  # @private
1715
1753
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module OsConfigZonalService
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
 
@@ -121,14 +124,6 @@ module Google
121
124
  # Lists operations that match the specified filter in the request. If the
122
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
123
126
  #
124
- # NOTE: the `name` binding allows API services to override the binding
125
- # to use different resource name schemes, such as `users/*/operations`. To
126
- # override the binding, API services can add a binding such as
127
- # `"/v1/{name=users/*}/operations"` to their service configuration.
128
- # For backwards compatibility, the default name includes the operations
129
- # collection id, however overriding users must ensure the name binding
130
- # is the parent resource, without the operations collection id.
131
- #
132
127
  # @overload list_operations(request, options = nil)
133
128
  # Pass arguments to `list_operations` via a request object, either of type
134
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -191,10 +186,11 @@ module Google
191
186
  # Customize the options with defaults
192
187
  metadata = @config.rpcs.list_operations.metadata.to_h
193
188
 
194
- # Set x-goog-api-client and x-goog-user-project headers
189
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
195
190
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
196
191
  lib_name: @config.lib_name, lib_version: @config.lib_version,
197
192
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
193
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
198
194
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
199
195
 
200
196
  header_params = {}
@@ -217,7 +213,7 @@ module Google
217
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
218
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
219
215
  yield response, operation if block_given?
220
- return response
216
+ throw :response, response
221
217
  end
222
218
  rescue ::GRPC::BadStatus => e
223
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -287,10 +283,11 @@ module Google
287
283
  # Customize the options with defaults
288
284
  metadata = @config.rpcs.get_operation.metadata.to_h
289
285
 
290
- # Set x-goog-api-client and x-goog-user-project headers
286
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
291
287
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
292
288
  lib_name: @config.lib_name, lib_version: @config.lib_version,
293
289
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
290
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
294
291
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
295
292
 
296
293
  header_params = {}
@@ -312,7 +309,7 @@ module Google
312
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
313
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
314
311
  yield response, operation if block_given?
315
- return response
312
+ throw :response, response
316
313
  end
317
314
  rescue ::GRPC::BadStatus => e
318
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -376,10 +373,11 @@ module Google
376
373
  # Customize the options with defaults
377
374
  metadata = @config.rpcs.delete_operation.metadata.to_h
378
375
 
379
- # Set x-goog-api-client and x-goog-user-project headers
376
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
380
377
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
381
378
  lib_name: @config.lib_name, lib_version: @config.lib_version,
382
379
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
380
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
383
381
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
384
382
 
385
383
  header_params = {}
@@ -400,7 +398,6 @@ module Google
400
398
 
401
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
402
400
  yield response, operation if block_given?
403
- return response
404
401
  end
405
402
  rescue ::GRPC::BadStatus => e
406
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -415,8 +412,9 @@ module Google
415
412
  # other methods to check whether the cancellation succeeded or whether the
416
413
  # operation completed despite cancellation. On successful cancellation,
417
414
  # the operation is not deleted; instead, it becomes an operation with
418
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
419
- # corresponding to `Code.CANCELLED`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
420
418
  #
421
419
  # @overload cancel_operation(request, options = nil)
422
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -470,10 +468,11 @@ module Google
470
468
  # Customize the options with defaults
471
469
  metadata = @config.rpcs.cancel_operation.metadata.to_h
472
470
 
473
- # Set x-goog-api-client and x-goog-user-project headers
471
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
474
472
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
475
473
  lib_name: @config.lib_name, lib_version: @config.lib_version,
476
474
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
475
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
477
476
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
478
477
 
479
478
  header_params = {}
@@ -494,7 +493,6 @@ module Google
494
493
 
495
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
496
495
  yield response, operation if block_given?
497
- return response
498
496
  end
499
497
  rescue ::GRPC::BadStatus => e
500
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -574,10 +572,11 @@ module Google
574
572
  # Customize the options with defaults
575
573
  metadata = @config.rpcs.wait_operation.metadata.to_h
576
574
 
577
- # Set x-goog-api-client and x-goog-user-project headers
575
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
578
576
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
579
577
  lib_name: @config.lib_name, lib_version: @config.lib_version,
580
578
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
579
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
581
580
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
582
581
 
583
582
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
@@ -591,7 +590,7 @@ module Google
591
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
592
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
593
592
  yield response, operation if block_given?
594
- return response
593
+ throw :response, response
595
594
  end
596
595
  rescue ::GRPC::BadStatus => e
597
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -680,6 +679,11 @@ module Google
680
679
  # default endpoint URL. The default value of nil uses the environment
681
680
  # universe (usually the default "googleapis.com" universe).
682
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
683
687
  #
684
688
  class Configuration
685
689
  extend ::Gapic::Config
@@ -704,6 +708,7 @@ module Google
704
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
705
709
  config_attr :quota_project, nil, ::String, nil
706
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
707
712
 
708
713
  # @private
709
714
  def initialize parent_config = nil