google-cloud-security_center-v1p1beta1 0.14.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b90c422f1b6fd2c572793c12d9918c8e207565d5ccd011109e03782a03824bb
4
- data.tar.gz: 7992f03d071a7d3ae8d405331fe74aeb8311d0f0109c0e818cfe5c8f84b498bf
3
+ metadata.gz: 686ec6f61d9d05118bde5799e1f65431cd41ec9eccf55de81c8714be289d812d
4
+ data.tar.gz: ac670cdf01f353e29a51c7b50ac0f0d08ada46388a87170d1b1e808f9c6d9e60
5
5
  SHA512:
6
- metadata.gz: ccd6f862954483290b59d779c4cc53bcb29464dad0ed3eb264b71aa314e136db022283797d203a1a2e8b9bde6c58859c8e6d15073f358186e290806879a6741b
7
- data.tar.gz: 2d0384dd82e2010e85b866a7b52569c2697dac0a888f6a80011276ce6fd160fc95f450b635414e3d6e9f8e0bad19d4eaa4eaee8b8fe44c0565648268153a12b5
6
+ metadata.gz: c4b5677565eea753c1489e91452029d2731e3b91fb5434b19d8c1a17cc0f788f73f950e0141a789a49ebfd8bd626ab0349fbce57940558c5cf926e4df5b89b4a
7
+ data.tar.gz: 77c47703a8decdca2b7e4a7fed584061db4b00a83d085f2c04401ce26d82b4d8ed60f5e9fbb18afe4c83680613299feb3510f4787d26c3358e1f4b190273717a
data/README.md CHANGED
@@ -42,40 +42,50 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/security-command-center)
43
43
  for general usage information.
44
44
 
45
- ## Enabling Logging
46
-
47
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
48
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
49
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
50
- 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)
51
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
52
-
53
- Configuring a Ruby stdlib logger:
45
+ ## Debug Logging
46
+
47
+ This library comes with opt-in Debug Logging that can help you troubleshoot
48
+ your application's integration with the API. When logging is activated, key
49
+ events such as requests and responses, along with data payloads and metadata
50
+ such as headers and client configuration, are logged to the standard error
51
+ stream.
52
+
53
+ **WARNING:** Client Library Debug Logging includes your data payloads in
54
+ plaintext, which could include sensitive data such as PII for yourself or your
55
+ customers, private keys, or other security data that could be compromising if
56
+ leaked. Always practice good data hygiene with your application logs, and follow
57
+ the principle of least access. Google also recommends that Client Library Debug
58
+ Logging be enabled only temporarily during active debugging, and not used
59
+ permanently in production.
60
+
61
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
62
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
63
+ list of client library gem names. This will select the default logging behavior,
64
+ which writes logs to the standard error stream. On a local workstation, this may
65
+ result in logs appearing on the console. When running on a Google Cloud hosting
66
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
67
+ results in logs appearing alongside your application logs in the
68
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
69
+
70
+ You can customize logging by modifying the `logger` configuration when
71
+ constructing a client object. For example:
54
72
 
55
73
  ```ruby
74
+ require "google/cloud/security_center/v1p1beta1"
56
75
  require "logger"
57
76
 
58
- module MyLogger
59
- LOGGER = Logger.new $stderr, level: Logger::WARN
60
- def logger
61
- LOGGER
62
- end
63
- end
64
-
65
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
66
- module GRPC
67
- extend MyLogger
77
+ client = ::Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client.new do |config|
78
+ config.logger = Logger.new "my-app.log"
68
79
  end
69
80
  ```
70
81
 
71
-
72
82
  ## Google Cloud Samples
73
83
 
74
84
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
75
85
 
76
86
  ## Supported Ruby Versions
77
87
 
78
- This library is supported on Ruby 2.7+.
88
+ This library is supported on Ruby 3.0+.
79
89
 
80
90
  Google provides official support for Ruby versions that are actively supported
81
91
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -243,8 +243,19 @@ module Google
243
243
  universe_domain: @config.universe_domain,
244
244
  channel_args: @config.channel_args,
245
245
  interceptors: @config.interceptors,
246
- channel_pool_config: @config.channel_pool
246
+ channel_pool_config: @config.channel_pool,
247
+ logger: @config.logger
247
248
  )
249
+
250
+ @security_center_stub.stub_logger&.info do |entry|
251
+ entry.set_system_name
252
+ entry.set_service
253
+ entry.message = "Created client for #{entry.service}"
254
+ entry.set_credentials_fields credentials
255
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
256
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
257
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
258
+ end
248
259
  end
249
260
 
250
261
  ##
@@ -254,6 +265,15 @@ module Google
254
265
  #
255
266
  attr_reader :operations_client
256
267
 
268
+ ##
269
+ # The logger used for request/response debug logging.
270
+ #
271
+ # @return [Logger]
272
+ #
273
+ def logger
274
+ @security_center_stub.logger
275
+ end
276
+
257
277
  # Service calls
258
278
 
259
279
  ##
@@ -340,7 +360,6 @@ module Google
340
360
 
341
361
  @security_center_stub.call_rpc :create_source, request, options: options do |response, operation|
342
362
  yield response, operation if block_given?
343
- return response
344
363
  end
345
364
  rescue ::GRPC::BadStatus => e
346
365
  raise ::Google::Cloud::Error.from_error(e)
@@ -433,7 +452,6 @@ module Google
433
452
 
434
453
  @security_center_stub.call_rpc :create_finding, request, options: options do |response, operation|
435
454
  yield response, operation if block_given?
436
- return response
437
455
  end
438
456
  rescue ::GRPC::BadStatus => e
439
457
  raise ::Google::Cloud::Error.from_error(e)
@@ -527,7 +545,6 @@ module Google
527
545
 
528
546
  @security_center_stub.call_rpc :create_notification_config, request, options: options do |response, operation|
529
547
  yield response, operation if block_given?
530
- return response
531
548
  end
532
549
  rescue ::GRPC::BadStatus => e
533
550
  raise ::Google::Cloud::Error.from_error(e)
@@ -614,7 +631,6 @@ module Google
614
631
 
615
632
  @security_center_stub.call_rpc :delete_notification_config, request, options: options do |response, operation|
616
633
  yield response, operation if block_given?
617
- return response
618
634
  end
619
635
  rescue ::GRPC::BadStatus => e
620
636
  raise ::Google::Cloud::Error.from_error(e)
@@ -704,7 +720,6 @@ module Google
704
720
 
705
721
  @security_center_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
706
722
  yield response, operation if block_given?
707
- return response
708
723
  end
709
724
  rescue ::GRPC::BadStatus => e
710
725
  raise ::Google::Cloud::Error.from_error(e)
@@ -791,7 +806,6 @@ module Google
791
806
 
792
807
  @security_center_stub.call_rpc :get_notification_config, request, options: options do |response, operation|
793
808
  yield response, operation if block_given?
794
- return response
795
809
  end
796
810
  rescue ::GRPC::BadStatus => e
797
811
  raise ::Google::Cloud::Error.from_error(e)
@@ -878,7 +892,6 @@ module Google
878
892
 
879
893
  @security_center_stub.call_rpc :get_organization_settings, request, options: options do |response, operation|
880
894
  yield response, operation if block_given?
881
- return response
882
895
  end
883
896
  rescue ::GRPC::BadStatus => e
884
897
  raise ::Google::Cloud::Error.from_error(e)
@@ -965,7 +978,6 @@ module Google
965
978
 
966
979
  @security_center_stub.call_rpc :get_source, request, options: options do |response, operation|
967
980
  yield response, operation if block_given?
968
- return response
969
981
  end
970
982
  rescue ::GRPC::BadStatus => e
971
983
  raise ::Google::Cloud::Error.from_error(e)
@@ -1181,7 +1193,7 @@ module Google
1181
1193
  @security_center_stub.call_rpc :group_assets, request, options: options do |response, operation|
1182
1194
  response = ::Gapic::PagedEnumerable.new @security_center_stub, :group_assets, request, response, operation, options
1183
1195
  yield response, operation if block_given?
1184
- return response
1196
+ throw :response, response
1185
1197
  end
1186
1198
  rescue ::GRPC::BadStatus => e
1187
1199
  raise ::Google::Cloud::Error.from_error(e)
@@ -1396,7 +1408,7 @@ module Google
1396
1408
  @security_center_stub.call_rpc :group_findings, request, options: options do |response, operation|
1397
1409
  response = ::Gapic::PagedEnumerable.new @security_center_stub, :group_findings, request, response, operation, options
1398
1410
  yield response, operation if block_given?
1399
- return response
1411
+ throw :response, response
1400
1412
  end
1401
1413
  rescue ::GRPC::BadStatus => e
1402
1414
  raise ::Google::Cloud::Error.from_error(e)
@@ -1615,7 +1627,7 @@ module Google
1615
1627
  @security_center_stub.call_rpc :list_assets, request, options: options do |response, operation|
1616
1628
  response = ::Gapic::PagedEnumerable.new @security_center_stub, :list_assets, request, response, operation, options
1617
1629
  yield response, operation if block_given?
1618
- return response
1630
+ throw :response, response
1619
1631
  end
1620
1632
  rescue ::GRPC::BadStatus => e
1621
1633
  raise ::Google::Cloud::Error.from_error(e)
@@ -1831,7 +1843,7 @@ module Google
1831
1843
  @security_center_stub.call_rpc :list_findings, request, options: options do |response, operation|
1832
1844
  response = ::Gapic::PagedEnumerable.new @security_center_stub, :list_findings, request, response, operation, options
1833
1845
  yield response, operation if block_given?
1834
- return response
1846
+ throw :response, response
1835
1847
  end
1836
1848
  rescue ::GRPC::BadStatus => e
1837
1849
  raise ::Google::Cloud::Error.from_error(e)
@@ -1930,7 +1942,7 @@ module Google
1930
1942
  @security_center_stub.call_rpc :list_notification_configs, request, options: options do |response, operation|
1931
1943
  response = ::Gapic::PagedEnumerable.new @security_center_stub, :list_notification_configs, request, response, operation, options
1932
1944
  yield response, operation if block_given?
1933
- return response
1945
+ throw :response, response
1934
1946
  end
1935
1947
  rescue ::GRPC::BadStatus => e
1936
1948
  raise ::Google::Cloud::Error.from_error(e)
@@ -2030,7 +2042,7 @@ module Google
2030
2042
  @security_center_stub.call_rpc :list_sources, request, options: options do |response, operation|
2031
2043
  response = ::Gapic::PagedEnumerable.new @security_center_stub, :list_sources, request, response, operation, options
2032
2044
  yield response, operation if block_given?
2033
- return response
2045
+ throw :response, response
2034
2046
  end
2035
2047
  rescue ::GRPC::BadStatus => e
2036
2048
  raise ::Google::Cloud::Error.from_error(e)
@@ -2130,7 +2142,7 @@ module Google
2130
2142
  @security_center_stub.call_rpc :run_asset_discovery, request, options: options do |response, operation|
2131
2143
  response = ::Gapic::Operation.new response, @operations_client, options: options
2132
2144
  yield response, operation if block_given?
2133
- return response
2145
+ throw :response, response
2134
2146
  end
2135
2147
  rescue ::GRPC::BadStatus => e
2136
2148
  raise ::Google::Cloud::Error.from_error(e)
@@ -2223,7 +2235,6 @@ module Google
2223
2235
 
2224
2236
  @security_center_stub.call_rpc :set_finding_state, request, options: options do |response, operation|
2225
2237
  yield response, operation if block_given?
2226
- return response
2227
2238
  end
2228
2239
  rescue ::GRPC::BadStatus => e
2229
2240
  raise ::Google::Cloud::Error.from_error(e)
@@ -2321,7 +2332,6 @@ module Google
2321
2332
 
2322
2333
  @security_center_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
2323
2334
  yield response, operation if block_given?
2324
- return response
2325
2335
  end
2326
2336
  rescue ::GRPC::BadStatus => e
2327
2337
  raise ::Google::Cloud::Error.from_error(e)
@@ -2413,7 +2423,6 @@ module Google
2413
2423
 
2414
2424
  @security_center_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
2415
2425
  yield response, operation if block_given?
2416
- return response
2417
2426
  end
2418
2427
  rescue ::GRPC::BadStatus => e
2419
2428
  raise ::Google::Cloud::Error.from_error(e)
@@ -2513,7 +2522,6 @@ module Google
2513
2522
 
2514
2523
  @security_center_stub.call_rpc :update_finding, request, options: options do |response, operation|
2515
2524
  yield response, operation if block_given?
2516
- return response
2517
2525
  end
2518
2526
  rescue ::GRPC::BadStatus => e
2519
2527
  raise ::Google::Cloud::Error.from_error(e)
@@ -2604,7 +2612,6 @@ module Google
2604
2612
 
2605
2613
  @security_center_stub.call_rpc :update_notification_config, request, options: options do |response, operation|
2606
2614
  yield response, operation if block_given?
2607
- return response
2608
2615
  end
2609
2616
  rescue ::GRPC::BadStatus => e
2610
2617
  raise ::Google::Cloud::Error.from_error(e)
@@ -2694,7 +2701,6 @@ module Google
2694
2701
 
2695
2702
  @security_center_stub.call_rpc :update_organization_settings, request, options: options do |response, operation|
2696
2703
  yield response, operation if block_given?
2697
- return response
2698
2704
  end
2699
2705
  rescue ::GRPC::BadStatus => e
2700
2706
  raise ::Google::Cloud::Error.from_error(e)
@@ -2784,7 +2790,6 @@ module Google
2784
2790
 
2785
2791
  @security_center_stub.call_rpc :update_source, request, options: options do |response, operation|
2786
2792
  yield response, operation if block_given?
2787
- return response
2788
2793
  end
2789
2794
  rescue ::GRPC::BadStatus => e
2790
2795
  raise ::Google::Cloud::Error.from_error(e)
@@ -2880,7 +2885,6 @@ module Google
2880
2885
 
2881
2886
  @security_center_stub.call_rpc :update_security_marks, request, options: options do |response, operation|
2882
2887
  yield response, operation if block_given?
2883
- return response
2884
2888
  end
2885
2889
  rescue ::GRPC::BadStatus => e
2886
2890
  raise ::Google::Cloud::Error.from_error(e)
@@ -2930,6 +2934,13 @@ module Google
2930
2934
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2931
2935
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2932
2936
  # * (`nil`) indicating no credentials
2937
+ #
2938
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2939
+ # external source for authentication to Google Cloud, you must validate it before
2940
+ # providing it to a Google API client library. Providing an unvalidated credential
2941
+ # configuration to Google APIs can compromise the security of your systems and data.
2942
+ # For more information, refer to [Validate credential configurations from external
2943
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2933
2944
  # @return [::Object]
2934
2945
  # @!attribute [rw] scope
2935
2946
  # The OAuth scopes
@@ -2969,6 +2980,11 @@ module Google
2969
2980
  # default endpoint URL. The default value of nil uses the environment
2970
2981
  # universe (usually the default "googleapis.com" universe).
2971
2982
  # @return [::String,nil]
2983
+ # @!attribute [rw] logger
2984
+ # A custom logger to use for request/response debug logging, or the value
2985
+ # `:default` (the default) to construct a default logger, or `nil` to
2986
+ # explicitly disable logging.
2987
+ # @return [::Logger,:default,nil]
2972
2988
  #
2973
2989
  class Configuration
2974
2990
  extend ::Gapic::Config
@@ -2993,6 +3009,7 @@ module Google
2993
3009
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2994
3010
  config_attr :quota_project, nil, ::String, nil
2995
3011
  config_attr :universe_domain, nil, ::String, nil
3012
+ config_attr :logger, :default, ::Logger, nil, :default
2996
3013
 
2997
3014
  # @private
2998
3015
  def initialize parent_config = nil
@@ -124,14 +124,6 @@ module Google
124
124
  # Lists operations that match the specified filter in the request. If the
125
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
126
126
  #
127
- # NOTE: the `name` binding allows API services to override the binding
128
- # to use different resource name schemes, such as `users/*/operations`. To
129
- # override the binding, API services can add a binding such as
130
- # `"/v1/{name=users/*}/operations"` to their service configuration.
131
- # For backwards compatibility, the default name includes the operations
132
- # collection id, however overriding users must ensure the name binding
133
- # is the parent resource, without the operations collection id.
134
- #
135
127
  # @overload list_operations(request, options = nil)
136
128
  # Pass arguments to `list_operations` via a request object, either of type
137
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -221,7 +213,7 @@ module Google
221
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
222
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
223
215
  yield response, operation if block_given?
224
- return response
216
+ throw :response, response
225
217
  end
226
218
  rescue ::GRPC::BadStatus => e
227
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +309,7 @@ module Google
317
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
318
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
319
311
  yield response, operation if block_given?
320
- return response
312
+ throw :response, response
321
313
  end
322
314
  rescue ::GRPC::BadStatus => e
323
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +398,6 @@ module Google
406
398
 
407
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
408
400
  yield response, operation if block_given?
409
- return response
410
401
  end
411
402
  rescue ::GRPC::BadStatus => e
412
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,8 +412,9 @@ module Google
421
412
  # other methods to check whether the cancellation succeeded or whether the
422
413
  # operation completed despite cancellation. On successful cancellation,
423
414
  # the operation is not deleted; instead, it becomes an operation with
424
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # 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`.
426
418
  #
427
419
  # @overload cancel_operation(request, options = nil)
428
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -501,7 +493,6 @@ module Google
501
493
 
502
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
503
495
  yield response, operation if block_given?
504
- return response
505
496
  end
506
497
  rescue ::GRPC::BadStatus => e
507
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,7 +590,7 @@ module Google
599
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
600
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
601
592
  yield response, operation if block_given?
602
- return response
593
+ throw :response, response
603
594
  end
604
595
  rescue ::GRPC::BadStatus => e
605
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -649,6 +640,13 @@ module Google
649
640
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
650
641
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
651
642
  # * (`nil`) indicating no credentials
643
+ #
644
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
645
+ # external source for authentication to Google Cloud, you must validate it before
646
+ # providing it to a Google API client library. Providing an unvalidated credential
647
+ # configuration to Google APIs can compromise the security of your systems and data.
648
+ # For more information, refer to [Validate credential configurations from external
649
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
652
650
  # @return [::Object]
653
651
  # @!attribute [rw] scope
654
652
  # The OAuth scopes
@@ -688,6 +686,11 @@ module Google
688
686
  # default endpoint URL. The default value of nil uses the environment
689
687
  # universe (usually the default "googleapis.com" universe).
690
688
  # @return [::String,nil]
689
+ # @!attribute [rw] logger
690
+ # A custom logger to use for request/response debug logging, or the value
691
+ # `:default` (the default) to construct a default logger, or `nil` to
692
+ # explicitly disable logging.
693
+ # @return [::Logger,:default,nil]
691
694
  #
692
695
  class Configuration
693
696
  extend ::Gapic::Config
@@ -712,6 +715,7 @@ module Google
712
715
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
716
  config_attr :quota_project, nil, ::String, nil
714
717
  config_attr :universe_domain, nil, ::String, nil
718
+ config_attr :logger, :default, ::Logger, nil, :default
715
719
 
716
720
  # @private
717
721
  def initialize parent_config = nil