google-cloud-security_center-v1 0.7.2 → 0.9.1

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.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/security_center/v1/security_center/client.rb +623 -151
  3. data/lib/google/cloud/security_center/v1/security_center/operations.rb +145 -33
  4. data/lib/google/cloud/security_center/v1/version.rb +1 -1
  5. data/lib/google/cloud/securitycenter/v1/asset_pb.rb +2 -2
  6. data/lib/google/cloud/securitycenter/v1/finding_pb.rb +15 -2
  7. data/lib/google/cloud/securitycenter/v1/folder_pb.rb +1 -1
  8. data/lib/google/cloud/securitycenter/v1/indicator_pb.rb +24 -0
  9. data/lib/google/cloud/securitycenter/v1/notification_config_pb.rb +2 -2
  10. data/lib/google/cloud/securitycenter/v1/notification_message_pb.rb +2 -2
  11. data/lib/google/cloud/securitycenter/v1/organization_settings_pb.rb +2 -2
  12. data/lib/google/cloud/securitycenter/v1/resource_pb.rb +3 -2
  13. data/lib/google/cloud/securitycenter/v1/run_asset_discovery_response_pb.rb +2 -2
  14. data/lib/google/cloud/securitycenter/v1/security_marks_pb.rb +2 -2
  15. data/lib/google/cloud/securitycenter/v1/securitycenter_service_pb.rb +2 -2
  16. data/lib/google/cloud/securitycenter/v1/securitycenter_service_services_pb.rb +1 -1
  17. data/lib/google/cloud/securitycenter/v1/source_pb.rb +2 -2
  18. data/lib/google/cloud/securitycenter/v1/vulnerability_pb.rb +86 -0
  19. data/proto_docs/google/cloud/securitycenter/v1/finding.rb +35 -0
  20. data/proto_docs/google/cloud/securitycenter/v1/indicator.rb +41 -0
  21. data/proto_docs/google/cloud/securitycenter/v1/resource.rb +3 -0
  22. data/proto_docs/google/cloud/securitycenter/v1/securitycenter_service.rb +22 -23
  23. data/proto_docs/google/cloud/securitycenter/v1/vulnerability.rb +226 -0
  24. metadata +8 -4
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client::Configuration}
42
42
  # for a description of the configuration fields.
43
43
  #
44
- # ## Example
44
+ # @example
45
45
  #
46
- # To modify the configuration for all SecurityCenter clients:
47
- #
48
- # ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.configure do |config|
49
- # config.timeout = 10.0
50
- # end
46
+ # # Modify the configuration for all SecurityCenter clients
47
+ # ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
51
50
  #
52
51
  # @yield [config] Configure the Client client.
53
52
  # @yieldparam config [Client::Configuration]
@@ -173,19 +172,15 @@ module Google
173
172
  ##
174
173
  # Create a new SecurityCenter client object.
175
174
  #
176
- # ## Examples
177
- #
178
- # To create a new SecurityCenter client with the default
179
- # configuration:
175
+ # @example
180
176
  #
181
- # client = ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
177
+ # # Create a client using the default configuration
178
+ # client = ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
182
179
  #
183
- # To create a new SecurityCenter client with a custom
184
- # configuration:
185
- #
186
- # client = ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new do |config|
187
- # config.timeout = 10.0
188
- # end
180
+ # # Create a client using a custom configuration
181
+ # client = ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new do |config|
182
+ # config.timeout = 10.0
183
+ # end
189
184
  #
190
185
  # @yield [config] Configure the SecurityCenter client.
191
186
  # @yieldparam config [Client::Configuration]
@@ -205,10 +200,9 @@ module Google
205
200
 
206
201
  # Create credentials
207
202
  credentials = @config.credentials
208
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
203
+ # Use self-signed JWT if the endpoint is unchanged from default,
209
204
  # but only if the default endpoint does not have a region prefix.
210
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
211
- @config.endpoint == Client.configure.endpoint &&
205
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
212
206
  !@config.endpoint.split(".").first.include?("-")
213
207
  credentials ||= Credentials.default scope: @config.scope,
214
208
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -263,8 +257,8 @@ module Google
263
257
  # Required. Resource name of the new source's parent. Its format should be
264
258
  # "organizations/[organization_id]".
265
259
  # @param source [::Google::Cloud::SecurityCenter::V1::Source, ::Hash]
266
- # Required. The Source being created, only the display_name and description
267
- # will be used. All other fields will be ignored.
260
+ # Required. The Source being created, only the display_name and description will be
261
+ # used. All other fields will be ignored.
268
262
  #
269
263
  # @yield [response, operation] Access the result along with the RPC operation
270
264
  # @yieldparam response [::Google::Cloud::SecurityCenter::V1::Source]
@@ -274,6 +268,21 @@ module Google
274
268
  #
275
269
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
276
270
  #
271
+ # @example Basic example
272
+ # require "google/cloud/security_center/v1"
273
+ #
274
+ # # Create a client object. The client can be reused for multiple calls.
275
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
276
+ #
277
+ # # Create a request. To set request fields, pass in keyword arguments.
278
+ # request = Google::Cloud::SecurityCenter::V1::CreateSourceRequest.new
279
+ #
280
+ # # Call the create_source method.
281
+ # result = client.create_source request
282
+ #
283
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::Source.
284
+ # p result
285
+ #
277
286
  def create_source request, options = nil
278
287
  raise ::ArgumentError, "request must be provided" if request.nil?
279
288
 
@@ -291,16 +300,20 @@ module Google
291
300
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
292
301
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
293
302
 
294
- header_params = {
295
- "parent" => request.parent
296
- }
303
+ header_params = {}
304
+ if request.parent
305
+ header_params["parent"] = request.parent
306
+ end
307
+
297
308
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
298
309
  metadata[:"x-goog-request-params"] ||= request_params_header
299
310
 
300
311
  options.apply_defaults timeout: @config.rpcs.create_source.timeout,
301
312
  metadata: metadata,
302
313
  retry_policy: @config.rpcs.create_source.retry_policy
303
- options.apply_defaults metadata: @config.metadata,
314
+
315
+ options.apply_defaults timeout: @config.timeout,
316
+ metadata: @config.metadata,
304
317
  retry_policy: @config.retry_policy
305
318
 
306
319
  @security_center_stub.call_rpc :create_source, request, options: options do |response, operation|
@@ -338,8 +351,8 @@ module Google
338
351
  # It must be alphanumeric and less than or equal to 32 characters and
339
352
  # greater than 0 characters in length.
340
353
  # @param finding [::Google::Cloud::SecurityCenter::V1::Finding, ::Hash]
341
- # Required. The Finding being created. The name and security_marks will be
342
- # ignored as they are both output only fields on this resource.
354
+ # Required. The Finding being created. The name and security_marks will be ignored as
355
+ # they are both output only fields on this resource.
343
356
  #
344
357
  # @yield [response, operation] Access the result along with the RPC operation
345
358
  # @yieldparam response [::Google::Cloud::SecurityCenter::V1::Finding]
@@ -349,6 +362,21 @@ module Google
349
362
  #
350
363
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
351
364
  #
365
+ # @example Basic example
366
+ # require "google/cloud/security_center/v1"
367
+ #
368
+ # # Create a client object. The client can be reused for multiple calls.
369
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
370
+ #
371
+ # # Create a request. To set request fields, pass in keyword arguments.
372
+ # request = Google::Cloud::SecurityCenter::V1::CreateFindingRequest.new
373
+ #
374
+ # # Call the create_finding method.
375
+ # result = client.create_finding request
376
+ #
377
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::Finding.
378
+ # p result
379
+ #
352
380
  def create_finding request, options = nil
353
381
  raise ::ArgumentError, "request must be provided" if request.nil?
354
382
 
@@ -366,16 +394,20 @@ module Google
366
394
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
367
395
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
368
396
 
369
- header_params = {
370
- "parent" => request.parent
371
- }
397
+ header_params = {}
398
+ if request.parent
399
+ header_params["parent"] = request.parent
400
+ end
401
+
372
402
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
373
403
  metadata[:"x-goog-request-params"] ||= request_params_header
374
404
 
375
405
  options.apply_defaults timeout: @config.rpcs.create_finding.timeout,
376
406
  metadata: metadata,
377
407
  retry_policy: @config.rpcs.create_finding.retry_policy
378
- options.apply_defaults metadata: @config.metadata,
408
+
409
+ options.apply_defaults timeout: @config.timeout,
410
+ metadata: @config.metadata,
379
411
  retry_policy: @config.retry_policy
380
412
 
381
413
  @security_center_stub.call_rpc :create_finding, request, options: options do |response, operation|
@@ -405,17 +437,16 @@ module Google
405
437
  # the default parameter values, pass an empty Hash as a request object (see above).
406
438
  #
407
439
  # @param parent [::String]
408
- # Required. Resource name of the new notification config's parent. Its format
409
- # is "organizations/[organization_id]".
440
+ # Required. Resource name of the new notification config's parent. Its format is
441
+ # "organizations/[organization_id]".
410
442
  # @param config_id [::String]
411
443
  # Required.
412
444
  # Unique identifier provided by the client within the parent scope.
413
445
  # It must be between 1 and 128 characters, and contains alphanumeric
414
446
  # characters, underscores or hyphens only.
415
447
  # @param notification_config [::Google::Cloud::SecurityCenter::V1::NotificationConfig, ::Hash]
416
- # Required. The notification config being created. The name and the service
417
- # account will be ignored as they are both output only fields on this
418
- # resource.
448
+ # Required. The notification config being created. The name and the service account
449
+ # will be ignored as they are both output only fields on this resource.
419
450
  #
420
451
  # @yield [response, operation] Access the result along with the RPC operation
421
452
  # @yieldparam response [::Google::Cloud::SecurityCenter::V1::NotificationConfig]
@@ -425,6 +456,21 @@ module Google
425
456
  #
426
457
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
427
458
  #
459
+ # @example Basic example
460
+ # require "google/cloud/security_center/v1"
461
+ #
462
+ # # Create a client object. The client can be reused for multiple calls.
463
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
464
+ #
465
+ # # Create a request. To set request fields, pass in keyword arguments.
466
+ # request = Google::Cloud::SecurityCenter::V1::CreateNotificationConfigRequest.new
467
+ #
468
+ # # Call the create_notification_config method.
469
+ # result = client.create_notification_config request
470
+ #
471
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::NotificationConfig.
472
+ # p result
473
+ #
428
474
  def create_notification_config request, options = nil
429
475
  raise ::ArgumentError, "request must be provided" if request.nil?
430
476
 
@@ -442,16 +488,20 @@ module Google
442
488
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
443
489
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
444
490
 
445
- header_params = {
446
- "parent" => request.parent
447
- }
491
+ header_params = {}
492
+ if request.parent
493
+ header_params["parent"] = request.parent
494
+ end
495
+
448
496
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
449
497
  metadata[:"x-goog-request-params"] ||= request_params_header
450
498
 
451
499
  options.apply_defaults timeout: @config.rpcs.create_notification_config.timeout,
452
500
  metadata: metadata,
453
501
  retry_policy: @config.rpcs.create_notification_config.retry_policy
454
- options.apply_defaults metadata: @config.metadata,
502
+
503
+ options.apply_defaults timeout: @config.timeout,
504
+ metadata: @config.metadata,
455
505
  retry_policy: @config.retry_policy
456
506
 
457
507
  @security_center_stub.call_rpc :create_notification_config, request, options: options do |response, operation|
@@ -492,6 +542,21 @@ module Google
492
542
  #
493
543
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
494
544
  #
545
+ # @example Basic example
546
+ # require "google/cloud/security_center/v1"
547
+ #
548
+ # # Create a client object. The client can be reused for multiple calls.
549
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
550
+ #
551
+ # # Create a request. To set request fields, pass in keyword arguments.
552
+ # request = Google::Cloud::SecurityCenter::V1::DeleteNotificationConfigRequest.new
553
+ #
554
+ # # Call the delete_notification_config method.
555
+ # result = client.delete_notification_config request
556
+ #
557
+ # # The returned object is of type Google::Protobuf::Empty.
558
+ # p result
559
+ #
495
560
  def delete_notification_config request, options = nil
496
561
  raise ::ArgumentError, "request must be provided" if request.nil?
497
562
 
@@ -509,16 +574,20 @@ module Google
509
574
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
510
575
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
511
576
 
512
- header_params = {
513
- "name" => request.name
514
- }
577
+ header_params = {}
578
+ if request.name
579
+ header_params["name"] = request.name
580
+ end
581
+
515
582
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
516
583
  metadata[:"x-goog-request-params"] ||= request_params_header
517
584
 
518
585
  options.apply_defaults timeout: @config.rpcs.delete_notification_config.timeout,
519
586
  metadata: metadata,
520
587
  retry_policy: @config.rpcs.delete_notification_config.retry_policy
521
- options.apply_defaults metadata: @config.metadata,
588
+
589
+ options.apply_defaults timeout: @config.timeout,
590
+ metadata: @config.metadata,
522
591
  retry_policy: @config.retry_policy
523
592
 
524
593
  @security_center_stub.call_rpc :delete_notification_config, request, options: options do |response, operation|
@@ -562,6 +631,21 @@ module Google
562
631
  #
563
632
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
564
633
  #
634
+ # @example Basic example
635
+ # require "google/cloud/security_center/v1"
636
+ #
637
+ # # Create a client object. The client can be reused for multiple calls.
638
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
639
+ #
640
+ # # Create a request. To set request fields, pass in keyword arguments.
641
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
642
+ #
643
+ # # Call the get_iam_policy method.
644
+ # result = client.get_iam_policy request
645
+ #
646
+ # # The returned object is of type Google::Iam::V1::Policy.
647
+ # p result
648
+ #
565
649
  def get_iam_policy request, options = nil
566
650
  raise ::ArgumentError, "request must be provided" if request.nil?
567
651
 
@@ -579,16 +663,20 @@ module Google
579
663
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
580
664
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
581
665
 
582
- header_params = {
583
- "resource" => request.resource
584
- }
666
+ header_params = {}
667
+ if request.resource
668
+ header_params["resource"] = request.resource
669
+ end
670
+
585
671
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
586
672
  metadata[:"x-goog-request-params"] ||= request_params_header
587
673
 
588
674
  options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
589
675
  metadata: metadata,
590
676
  retry_policy: @config.rpcs.get_iam_policy.retry_policy
591
- options.apply_defaults metadata: @config.metadata,
677
+
678
+ options.apply_defaults timeout: @config.timeout,
679
+ metadata: @config.metadata,
592
680
  retry_policy: @config.retry_policy
593
681
 
594
682
  @security_center_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
@@ -629,6 +717,21 @@ module Google
629
717
  #
630
718
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
631
719
  #
720
+ # @example Basic example
721
+ # require "google/cloud/security_center/v1"
722
+ #
723
+ # # Create a client object. The client can be reused for multiple calls.
724
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
725
+ #
726
+ # # Create a request. To set request fields, pass in keyword arguments.
727
+ # request = Google::Cloud::SecurityCenter::V1::GetNotificationConfigRequest.new
728
+ #
729
+ # # Call the get_notification_config method.
730
+ # result = client.get_notification_config request
731
+ #
732
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::NotificationConfig.
733
+ # p result
734
+ #
632
735
  def get_notification_config request, options = nil
633
736
  raise ::ArgumentError, "request must be provided" if request.nil?
634
737
 
@@ -646,16 +749,20 @@ module Google
646
749
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
647
750
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
648
751
 
649
- header_params = {
650
- "name" => request.name
651
- }
752
+ header_params = {}
753
+ if request.name
754
+ header_params["name"] = request.name
755
+ end
756
+
652
757
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
653
758
  metadata[:"x-goog-request-params"] ||= request_params_header
654
759
 
655
760
  options.apply_defaults timeout: @config.rpcs.get_notification_config.timeout,
656
761
  metadata: metadata,
657
762
  retry_policy: @config.rpcs.get_notification_config.retry_policy
658
- options.apply_defaults metadata: @config.metadata,
763
+
764
+ options.apply_defaults timeout: @config.timeout,
765
+ metadata: @config.metadata,
659
766
  retry_policy: @config.retry_policy
660
767
 
661
768
  @security_center_stub.call_rpc :get_notification_config, request, options: options do |response, operation|
@@ -685,8 +792,8 @@ module Google
685
792
  # the default parameter values, pass an empty Hash as a request object (see above).
686
793
  #
687
794
  # @param name [::String]
688
- # Required. Name of the organization to get organization settings for. Its
689
- # format is "organizations/[organization_id]/organizationSettings".
795
+ # Required. Name of the organization to get organization settings for. Its format is
796
+ # "organizations/[organization_id]/organizationSettings".
690
797
  #
691
798
  # @yield [response, operation] Access the result along with the RPC operation
692
799
  # @yieldparam response [::Google::Cloud::SecurityCenter::V1::OrganizationSettings]
@@ -696,6 +803,21 @@ module Google
696
803
  #
697
804
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
698
805
  #
806
+ # @example Basic example
807
+ # require "google/cloud/security_center/v1"
808
+ #
809
+ # # Create a client object. The client can be reused for multiple calls.
810
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
811
+ #
812
+ # # Create a request. To set request fields, pass in keyword arguments.
813
+ # request = Google::Cloud::SecurityCenter::V1::GetOrganizationSettingsRequest.new
814
+ #
815
+ # # Call the get_organization_settings method.
816
+ # result = client.get_organization_settings request
817
+ #
818
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::OrganizationSettings.
819
+ # p result
820
+ #
699
821
  def get_organization_settings request, options = nil
700
822
  raise ::ArgumentError, "request must be provided" if request.nil?
701
823
 
@@ -713,16 +835,20 @@ module Google
713
835
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
714
836
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
715
837
 
716
- header_params = {
717
- "name" => request.name
718
- }
838
+ header_params = {}
839
+ if request.name
840
+ header_params["name"] = request.name
841
+ end
842
+
719
843
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
720
844
  metadata[:"x-goog-request-params"] ||= request_params_header
721
845
 
722
846
  options.apply_defaults timeout: @config.rpcs.get_organization_settings.timeout,
723
847
  metadata: metadata,
724
848
  retry_policy: @config.rpcs.get_organization_settings.retry_policy
725
- options.apply_defaults metadata: @config.metadata,
849
+
850
+ options.apply_defaults timeout: @config.timeout,
851
+ metadata: @config.metadata,
726
852
  retry_policy: @config.retry_policy
727
853
 
728
854
  @security_center_stub.call_rpc :get_organization_settings, request, options: options do |response, operation|
@@ -763,6 +889,21 @@ module Google
763
889
  #
764
890
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
765
891
  #
892
+ # @example Basic example
893
+ # require "google/cloud/security_center/v1"
894
+ #
895
+ # # Create a client object. The client can be reused for multiple calls.
896
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
897
+ #
898
+ # # Create a request. To set request fields, pass in keyword arguments.
899
+ # request = Google::Cloud::SecurityCenter::V1::GetSourceRequest.new
900
+ #
901
+ # # Call the get_source method.
902
+ # result = client.get_source request
903
+ #
904
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::Source.
905
+ # p result
906
+ #
766
907
  def get_source request, options = nil
767
908
  raise ::ArgumentError, "request must be provided" if request.nil?
768
909
 
@@ -780,16 +921,20 @@ module Google
780
921
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
781
922
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
782
923
 
783
- header_params = {
784
- "name" => request.name
785
- }
924
+ header_params = {}
925
+ if request.name
926
+ header_params["name"] = request.name
927
+ end
928
+
786
929
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
787
930
  metadata[:"x-goog-request-params"] ||= request_params_header
788
931
 
789
932
  options.apply_defaults timeout: @config.rpcs.get_source.timeout,
790
933
  metadata: metadata,
791
934
  retry_policy: @config.rpcs.get_source.retry_policy
792
- options.apply_defaults metadata: @config.metadata,
935
+
936
+ options.apply_defaults timeout: @config.timeout,
937
+ metadata: @config.metadata,
793
938
  retry_policy: @config.retry_policy
794
939
 
795
940
  @security_center_stub.call_rpc :get_source, request, options: options do |response, operation|
@@ -887,9 +1032,9 @@ module Google
887
1032
  # Use a negated partial match on the empty string to filter based on a
888
1033
  # property not existing: `-resource_properties.my_property : ""`
889
1034
  # @param group_by [::String]
890
- # Required. Expression that defines what assets fields to use for grouping.
891
- # The string value should follow SQL syntax: comma separated list of fields.
892
- # For example:
1035
+ # Required. Expression that defines what assets fields to use for grouping. The string
1036
+ # value should follow SQL syntax: comma separated list of fields. For
1037
+ # example:
893
1038
  # "security_center_properties.resource_project,security_center_properties.project".
894
1039
  #
895
1040
  # The following fields are supported when compare_duration is not set:
@@ -954,6 +1099,27 @@ module Google
954
1099
  #
955
1100
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
956
1101
  #
1102
+ # @example Basic example
1103
+ # require "google/cloud/security_center/v1"
1104
+ #
1105
+ # # Create a client object. The client can be reused for multiple calls.
1106
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
1107
+ #
1108
+ # # Create a request. To set request fields, pass in keyword arguments.
1109
+ # request = Google::Cloud::SecurityCenter::V1::GroupAssetsRequest.new
1110
+ #
1111
+ # # Call the group_assets method.
1112
+ # result = client.group_assets request
1113
+ #
1114
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1115
+ # # iterate over all elements by calling #each, and the enumerable
1116
+ # # will lazily make API calls to fetch subsequent pages. Other
1117
+ # # methods are also available for managing paging directly.
1118
+ # result.each do |response|
1119
+ # # Each element is of type ::Google::Cloud::SecurityCenter::V1::GroupResult.
1120
+ # p response
1121
+ # end
1122
+ #
957
1123
  def group_assets request, options = nil
958
1124
  raise ::ArgumentError, "request must be provided" if request.nil?
959
1125
 
@@ -971,16 +1137,20 @@ module Google
971
1137
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
972
1138
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
973
1139
 
974
- header_params = {
975
- "parent" => request.parent
976
- }
1140
+ header_params = {}
1141
+ if request.parent
1142
+ header_params["parent"] = request.parent
1143
+ end
1144
+
977
1145
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
978
1146
  metadata[:"x-goog-request-params"] ||= request_params_header
979
1147
 
980
1148
  options.apply_defaults timeout: @config.rpcs.group_assets.timeout,
981
1149
  metadata: metadata,
982
1150
  retry_policy: @config.rpcs.group_assets.retry_policy
983
- options.apply_defaults metadata: @config.metadata,
1151
+
1152
+ options.apply_defaults timeout: @config.timeout,
1153
+ metadata: @config.metadata,
984
1154
  retry_policy: @config.retry_policy
985
1155
 
986
1156
  @security_center_stub.call_rpc :group_assets, request, options: options do |response, operation|
@@ -1085,9 +1255,9 @@ module Google
1085
1255
  # * resource.project_display_name: `=`, `:`
1086
1256
  # * resource.type: `=`, `:`
1087
1257
  # @param group_by [::String]
1088
- # Required. Expression that defines what assets fields to use for grouping
1089
- # (including `state_change`). The string value should follow SQL syntax:
1090
- # comma separated list of fields. For example: "parent,resource_name".
1258
+ # Required. Expression that defines what assets fields to use for grouping (including
1259
+ # `state_change`). The string value should follow SQL syntax: comma separated
1260
+ # list of fields. For example: "parent,resource_name".
1091
1261
  #
1092
1262
  # The following fields are supported:
1093
1263
  #
@@ -1154,6 +1324,27 @@ module Google
1154
1324
  #
1155
1325
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1156
1326
  #
1327
+ # @example Basic example
1328
+ # require "google/cloud/security_center/v1"
1329
+ #
1330
+ # # Create a client object. The client can be reused for multiple calls.
1331
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
1332
+ #
1333
+ # # Create a request. To set request fields, pass in keyword arguments.
1334
+ # request = Google::Cloud::SecurityCenter::V1::GroupFindingsRequest.new
1335
+ #
1336
+ # # Call the group_findings method.
1337
+ # result = client.group_findings request
1338
+ #
1339
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1340
+ # # iterate over all elements by calling #each, and the enumerable
1341
+ # # will lazily make API calls to fetch subsequent pages. Other
1342
+ # # methods are also available for managing paging directly.
1343
+ # result.each do |response|
1344
+ # # Each element is of type ::Google::Cloud::SecurityCenter::V1::GroupResult.
1345
+ # p response
1346
+ # end
1347
+ #
1157
1348
  def group_findings request, options = nil
1158
1349
  raise ::ArgumentError, "request must be provided" if request.nil?
1159
1350
 
@@ -1171,16 +1362,20 @@ module Google
1171
1362
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
1172
1363
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1173
1364
 
1174
- header_params = {
1175
- "parent" => request.parent
1176
- }
1365
+ header_params = {}
1366
+ if request.parent
1367
+ header_params["parent"] = request.parent
1368
+ end
1369
+
1177
1370
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1178
1371
  metadata[:"x-goog-request-params"] ||= request_params_header
1179
1372
 
1180
1373
  options.apply_defaults timeout: @config.rpcs.group_findings.timeout,
1181
1374
  metadata: metadata,
1182
1375
  retry_policy: @config.rpcs.group_findings.retry_policy
1183
- options.apply_defaults metadata: @config.metadata,
1376
+
1377
+ options.apply_defaults timeout: @config.timeout,
1378
+ metadata: @config.metadata,
1184
1379
  retry_policy: @config.retry_policy
1185
1380
 
1186
1381
  @security_center_stub.call_rpc :group_findings, request, options: options do |response, operation|
@@ -1349,6 +1544,27 @@ module Google
1349
1544
  #
1350
1545
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1351
1546
  #
1547
+ # @example Basic example
1548
+ # require "google/cloud/security_center/v1"
1549
+ #
1550
+ # # Create a client object. The client can be reused for multiple calls.
1551
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
1552
+ #
1553
+ # # Create a request. To set request fields, pass in keyword arguments.
1554
+ # request = Google::Cloud::SecurityCenter::V1::ListAssetsRequest.new
1555
+ #
1556
+ # # Call the list_assets method.
1557
+ # result = client.list_assets request
1558
+ #
1559
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1560
+ # # iterate over all elements by calling #each, and the enumerable
1561
+ # # will lazily make API calls to fetch subsequent pages. Other
1562
+ # # methods are also available for managing paging directly.
1563
+ # result.each do |response|
1564
+ # # Each element is of type ::Google::Cloud::SecurityCenter::V1::ListAssetsResponse::ListAssetsResult.
1565
+ # p response
1566
+ # end
1567
+ #
1352
1568
  def list_assets request, options = nil
1353
1569
  raise ::ArgumentError, "request must be provided" if request.nil?
1354
1570
 
@@ -1366,16 +1582,20 @@ module Google
1366
1582
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
1367
1583
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1368
1584
 
1369
- header_params = {
1370
- "parent" => request.parent
1371
- }
1585
+ header_params = {}
1586
+ if request.parent
1587
+ header_params["parent"] = request.parent
1588
+ end
1589
+
1372
1590
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1373
1591
  metadata[:"x-goog-request-params"] ||= request_params_header
1374
1592
 
1375
1593
  options.apply_defaults timeout: @config.rpcs.list_assets.timeout,
1376
1594
  metadata: metadata,
1377
1595
  retry_policy: @config.rpcs.list_assets.retry_policy
1378
- options.apply_defaults metadata: @config.metadata,
1596
+
1597
+ options.apply_defaults timeout: @config.timeout,
1598
+ metadata: @config.metadata,
1379
1599
  retry_policy: @config.retry_policy
1380
1600
 
1381
1601
  @security_center_stub.call_rpc :list_assets, request, options: options do |response, operation|
@@ -1551,6 +1771,27 @@ module Google
1551
1771
  #
1552
1772
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1553
1773
  #
1774
+ # @example Basic example
1775
+ # require "google/cloud/security_center/v1"
1776
+ #
1777
+ # # Create a client object. The client can be reused for multiple calls.
1778
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
1779
+ #
1780
+ # # Create a request. To set request fields, pass in keyword arguments.
1781
+ # request = Google::Cloud::SecurityCenter::V1::ListFindingsRequest.new
1782
+ #
1783
+ # # Call the list_findings method.
1784
+ # result = client.list_findings request
1785
+ #
1786
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1787
+ # # iterate over all elements by calling #each, and the enumerable
1788
+ # # will lazily make API calls to fetch subsequent pages. Other
1789
+ # # methods are also available for managing paging directly.
1790
+ # result.each do |response|
1791
+ # # Each element is of type ::Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult.
1792
+ # p response
1793
+ # end
1794
+ #
1554
1795
  def list_findings request, options = nil
1555
1796
  raise ::ArgumentError, "request must be provided" if request.nil?
1556
1797
 
@@ -1568,16 +1809,20 @@ module Google
1568
1809
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
1569
1810
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1570
1811
 
1571
- header_params = {
1572
- "parent" => request.parent
1573
- }
1812
+ header_params = {}
1813
+ if request.parent
1814
+ header_params["parent"] = request.parent
1815
+ end
1816
+
1574
1817
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1575
1818
  metadata[:"x-goog-request-params"] ||= request_params_header
1576
1819
 
1577
1820
  options.apply_defaults timeout: @config.rpcs.list_findings.timeout,
1578
1821
  metadata: metadata,
1579
1822
  retry_policy: @config.rpcs.list_findings.retry_policy
1580
- options.apply_defaults metadata: @config.metadata,
1823
+
1824
+ options.apply_defaults timeout: @config.timeout,
1825
+ metadata: @config.metadata,
1581
1826
  retry_policy: @config.retry_policy
1582
1827
 
1583
1828
  @security_center_stub.call_rpc :list_findings, request, options: options do |response, operation|
@@ -1626,6 +1871,27 @@ module Google
1626
1871
  #
1627
1872
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1628
1873
  #
1874
+ # @example Basic example
1875
+ # require "google/cloud/security_center/v1"
1876
+ #
1877
+ # # Create a client object. The client can be reused for multiple calls.
1878
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
1879
+ #
1880
+ # # Create a request. To set request fields, pass in keyword arguments.
1881
+ # request = Google::Cloud::SecurityCenter::V1::ListNotificationConfigsRequest.new
1882
+ #
1883
+ # # Call the list_notification_configs method.
1884
+ # result = client.list_notification_configs request
1885
+ #
1886
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1887
+ # # iterate over all elements by calling #each, and the enumerable
1888
+ # # will lazily make API calls to fetch subsequent pages. Other
1889
+ # # methods are also available for managing paging directly.
1890
+ # result.each do |response|
1891
+ # # Each element is of type ::Google::Cloud::SecurityCenter::V1::NotificationConfig.
1892
+ # p response
1893
+ # end
1894
+ #
1629
1895
  def list_notification_configs request, options = nil
1630
1896
  raise ::ArgumentError, "request must be provided" if request.nil?
1631
1897
 
@@ -1643,16 +1909,20 @@ module Google
1643
1909
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
1644
1910
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1645
1911
 
1646
- header_params = {
1647
- "parent" => request.parent
1648
- }
1912
+ header_params = {}
1913
+ if request.parent
1914
+ header_params["parent"] = request.parent
1915
+ end
1916
+
1649
1917
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1650
1918
  metadata[:"x-goog-request-params"] ||= request_params_header
1651
1919
 
1652
1920
  options.apply_defaults timeout: @config.rpcs.list_notification_configs.timeout,
1653
1921
  metadata: metadata,
1654
1922
  retry_policy: @config.rpcs.list_notification_configs.retry_policy
1655
- options.apply_defaults metadata: @config.metadata,
1923
+
1924
+ options.apply_defaults timeout: @config.timeout,
1925
+ metadata: @config.metadata,
1656
1926
  retry_policy: @config.retry_policy
1657
1927
 
1658
1928
  @security_center_stub.call_rpc :list_notification_configs, request, options: options do |response, operation|
@@ -1683,8 +1953,8 @@ module Google
1683
1953
  # the default parameter values, pass an empty Hash as a request object (see above).
1684
1954
  #
1685
1955
  # @param parent [::String]
1686
- # Required. Resource name of the parent of sources to list. Its format should
1687
- # be "organizations/[organization_id], folders/[folder_id], or
1956
+ # Required. Resource name of the parent of sources to list. Its format should be
1957
+ # "organizations/[organization_id], folders/[folder_id], or
1688
1958
  # projects/[project_id]".
1689
1959
  # @param page_token [::String]
1690
1960
  # The value returned by the last `ListSourcesResponse`; indicates
@@ -1702,6 +1972,27 @@ module Google
1702
1972
  #
1703
1973
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1704
1974
  #
1975
+ # @example Basic example
1976
+ # require "google/cloud/security_center/v1"
1977
+ #
1978
+ # # Create a client object. The client can be reused for multiple calls.
1979
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
1980
+ #
1981
+ # # Create a request. To set request fields, pass in keyword arguments.
1982
+ # request = Google::Cloud::SecurityCenter::V1::ListSourcesRequest.new
1983
+ #
1984
+ # # Call the list_sources method.
1985
+ # result = client.list_sources request
1986
+ #
1987
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1988
+ # # iterate over all elements by calling #each, and the enumerable
1989
+ # # will lazily make API calls to fetch subsequent pages. Other
1990
+ # # methods are also available for managing paging directly.
1991
+ # result.each do |response|
1992
+ # # Each element is of type ::Google::Cloud::SecurityCenter::V1::Source.
1993
+ # p response
1994
+ # end
1995
+ #
1705
1996
  def list_sources request, options = nil
1706
1997
  raise ::ArgumentError, "request must be provided" if request.nil?
1707
1998
 
@@ -1719,16 +2010,20 @@ module Google
1719
2010
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
1720
2011
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1721
2012
 
1722
- header_params = {
1723
- "parent" => request.parent
1724
- }
2013
+ header_params = {}
2014
+ if request.parent
2015
+ header_params["parent"] = request.parent
2016
+ end
2017
+
1725
2018
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1726
2019
  metadata[:"x-goog-request-params"] ||= request_params_header
1727
2020
 
1728
2021
  options.apply_defaults timeout: @config.rpcs.list_sources.timeout,
1729
2022
  metadata: metadata,
1730
2023
  retry_policy: @config.rpcs.list_sources.retry_policy
1731
- options.apply_defaults metadata: @config.metadata,
2024
+
2025
+ options.apply_defaults timeout: @config.timeout,
2026
+ metadata: @config.metadata,
1732
2027
  retry_policy: @config.retry_policy
1733
2028
 
1734
2029
  @security_center_stub.call_rpc :list_sources, request, options: options do |response, operation|
@@ -1764,8 +2059,8 @@ module Google
1764
2059
  # the default parameter values, pass an empty Hash as a request object (see above).
1765
2060
  #
1766
2061
  # @param parent [::String]
1767
- # Required. Name of the organization to run asset discovery for. Its format
1768
- # is "organizations/[organization_id]".
2062
+ # Required. Name of the organization to run asset discovery for. Its format is
2063
+ # "organizations/[organization_id]".
1769
2064
  #
1770
2065
  # @yield [response, operation] Access the result along with the RPC operation
1771
2066
  # @yieldparam response [::Gapic::Operation]
@@ -1775,6 +2070,28 @@ module Google
1775
2070
  #
1776
2071
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1777
2072
  #
2073
+ # @example Basic example
2074
+ # require "google/cloud/security_center/v1"
2075
+ #
2076
+ # # Create a client object. The client can be reused for multiple calls.
2077
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
2078
+ #
2079
+ # # Create a request. To set request fields, pass in keyword arguments.
2080
+ # request = Google::Cloud::SecurityCenter::V1::RunAssetDiscoveryRequest.new
2081
+ #
2082
+ # # Call the run_asset_discovery method.
2083
+ # result = client.run_asset_discovery request
2084
+ #
2085
+ # # The returned object is of type Gapic::Operation. You can use this
2086
+ # # object to check the status of an operation, cancel it, or wait
2087
+ # # for results. Here is how to block until completion:
2088
+ # result.wait_until_done! timeout: 60
2089
+ # if result.response?
2090
+ # p result.response
2091
+ # else
2092
+ # puts "Error!"
2093
+ # end
2094
+ #
1778
2095
  def run_asset_discovery request, options = nil
1779
2096
  raise ::ArgumentError, "request must be provided" if request.nil?
1780
2097
 
@@ -1792,16 +2109,20 @@ module Google
1792
2109
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
1793
2110
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1794
2111
 
1795
- header_params = {
1796
- "parent" => request.parent
1797
- }
2112
+ header_params = {}
2113
+ if request.parent
2114
+ header_params["parent"] = request.parent
2115
+ end
2116
+
1798
2117
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1799
2118
  metadata[:"x-goog-request-params"] ||= request_params_header
1800
2119
 
1801
2120
  options.apply_defaults timeout: @config.rpcs.run_asset_discovery.timeout,
1802
2121
  metadata: metadata,
1803
2122
  retry_policy: @config.rpcs.run_asset_discovery.retry_policy
1804
- options.apply_defaults metadata: @config.metadata,
2123
+
2124
+ options.apply_defaults timeout: @config.timeout,
2125
+ metadata: @config.metadata,
1805
2126
  retry_policy: @config.retry_policy
1806
2127
 
1807
2128
  @security_center_stub.call_rpc :run_asset_discovery, request, options: options do |response, operation|
@@ -1849,6 +2170,21 @@ module Google
1849
2170
  #
1850
2171
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1851
2172
  #
2173
+ # @example Basic example
2174
+ # require "google/cloud/security_center/v1"
2175
+ #
2176
+ # # Create a client object. The client can be reused for multiple calls.
2177
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
2178
+ #
2179
+ # # Create a request. To set request fields, pass in keyword arguments.
2180
+ # request = Google::Cloud::SecurityCenter::V1::SetFindingStateRequest.new
2181
+ #
2182
+ # # Call the set_finding_state method.
2183
+ # result = client.set_finding_state request
2184
+ #
2185
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::Finding.
2186
+ # p result
2187
+ #
1852
2188
  def set_finding_state request, options = nil
1853
2189
  raise ::ArgumentError, "request must be provided" if request.nil?
1854
2190
 
@@ -1866,16 +2202,20 @@ module Google
1866
2202
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
1867
2203
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1868
2204
 
1869
- header_params = {
1870
- "name" => request.name
1871
- }
2205
+ header_params = {}
2206
+ if request.name
2207
+ header_params["name"] = request.name
2208
+ end
2209
+
1872
2210
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1873
2211
  metadata[:"x-goog-request-params"] ||= request_params_header
1874
2212
 
1875
2213
  options.apply_defaults timeout: @config.rpcs.set_finding_state.timeout,
1876
2214
  metadata: metadata,
1877
2215
  retry_policy: @config.rpcs.set_finding_state.retry_policy
1878
- options.apply_defaults metadata: @config.metadata,
2216
+
2217
+ options.apply_defaults timeout: @config.timeout,
2218
+ metadata: @config.metadata,
1879
2219
  retry_policy: @config.retry_policy
1880
2220
 
1881
2221
  @security_center_stub.call_rpc :set_finding_state, request, options: options do |response, operation|
@@ -1921,6 +2261,21 @@ module Google
1921
2261
  #
1922
2262
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1923
2263
  #
2264
+ # @example Basic example
2265
+ # require "google/cloud/security_center/v1"
2266
+ #
2267
+ # # Create a client object. The client can be reused for multiple calls.
2268
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
2269
+ #
2270
+ # # Create a request. To set request fields, pass in keyword arguments.
2271
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
2272
+ #
2273
+ # # Call the set_iam_policy method.
2274
+ # result = client.set_iam_policy request
2275
+ #
2276
+ # # The returned object is of type Google::Iam::V1::Policy.
2277
+ # p result
2278
+ #
1924
2279
  def set_iam_policy request, options = nil
1925
2280
  raise ::ArgumentError, "request must be provided" if request.nil?
1926
2281
 
@@ -1938,16 +2293,20 @@ module Google
1938
2293
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
1939
2294
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1940
2295
 
1941
- header_params = {
1942
- "resource" => request.resource
1943
- }
2296
+ header_params = {}
2297
+ if request.resource
2298
+ header_params["resource"] = request.resource
2299
+ end
2300
+
1944
2301
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1945
2302
  metadata[:"x-goog-request-params"] ||= request_params_header
1946
2303
 
1947
2304
  options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
1948
2305
  metadata: metadata,
1949
2306
  retry_policy: @config.rpcs.set_iam_policy.retry_policy
1950
- options.apply_defaults metadata: @config.metadata,
2307
+
2308
+ options.apply_defaults timeout: @config.timeout,
2309
+ metadata: @config.metadata,
1951
2310
  retry_policy: @config.retry_policy
1952
2311
 
1953
2312
  @security_center_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
@@ -1993,6 +2352,21 @@ module Google
1993
2352
  #
1994
2353
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1995
2354
  #
2355
+ # @example Basic example
2356
+ # require "google/cloud/security_center/v1"
2357
+ #
2358
+ # # Create a client object. The client can be reused for multiple calls.
2359
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
2360
+ #
2361
+ # # Create a request. To set request fields, pass in keyword arguments.
2362
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
2363
+ #
2364
+ # # Call the test_iam_permissions method.
2365
+ # result = client.test_iam_permissions request
2366
+ #
2367
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
2368
+ # p result
2369
+ #
1996
2370
  def test_iam_permissions request, options = nil
1997
2371
  raise ::ArgumentError, "request must be provided" if request.nil?
1998
2372
 
@@ -2010,16 +2384,20 @@ module Google
2010
2384
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
2011
2385
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2012
2386
 
2013
- header_params = {
2014
- "resource" => request.resource
2015
- }
2387
+ header_params = {}
2388
+ if request.resource
2389
+ header_params["resource"] = request.resource
2390
+ end
2391
+
2016
2392
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2017
2393
  metadata[:"x-goog-request-params"] ||= request_params_header
2018
2394
 
2019
2395
  options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
2020
2396
  metadata: metadata,
2021
2397
  retry_policy: @config.rpcs.test_iam_permissions.retry_policy
2022
- options.apply_defaults metadata: @config.metadata,
2398
+
2399
+ options.apply_defaults timeout: @config.timeout,
2400
+ metadata: @config.metadata,
2023
2401
  retry_policy: @config.retry_policy
2024
2402
 
2025
2403
  @security_center_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
@@ -2050,8 +2428,8 @@ module Google
2050
2428
  # the default parameter values, pass an empty Hash as a request object (see above).
2051
2429
  #
2052
2430
  # @param finding [::Google::Cloud::SecurityCenter::V1::Finding, ::Hash]
2053
- # Required. The finding resource to update or create if it does not already
2054
- # exist. parent, security_marks, and update_time will be ignored.
2431
+ # Required. The finding resource to update or create if it does not already exist.
2432
+ # parent, security_marks, and update_time will be ignored.
2055
2433
  #
2056
2434
  # In the case of creation, the finding id portion of the name must be
2057
2435
  # alphanumeric and less than or equal to 32 characters and greater than 0
@@ -2073,6 +2451,21 @@ module Google
2073
2451
  #
2074
2452
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
2075
2453
  #
2454
+ # @example Basic example
2455
+ # require "google/cloud/security_center/v1"
2456
+ #
2457
+ # # Create a client object. The client can be reused for multiple calls.
2458
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
2459
+ #
2460
+ # # Create a request. To set request fields, pass in keyword arguments.
2461
+ # request = Google::Cloud::SecurityCenter::V1::UpdateFindingRequest.new
2462
+ #
2463
+ # # Call the update_finding method.
2464
+ # result = client.update_finding request
2465
+ #
2466
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::Finding.
2467
+ # p result
2468
+ #
2076
2469
  def update_finding request, options = nil
2077
2470
  raise ::ArgumentError, "request must be provided" if request.nil?
2078
2471
 
@@ -2090,16 +2483,20 @@ module Google
2090
2483
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
2091
2484
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2092
2485
 
2093
- header_params = {
2094
- "finding.name" => request.finding.name
2095
- }
2486
+ header_params = {}
2487
+ if request.finding&.name
2488
+ header_params["finding.name"] = request.finding.name
2489
+ end
2490
+
2096
2491
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2097
2492
  metadata[:"x-goog-request-params"] ||= request_params_header
2098
2493
 
2099
2494
  options.apply_defaults timeout: @config.rpcs.update_finding.timeout,
2100
2495
  metadata: metadata,
2101
2496
  retry_policy: @config.rpcs.update_finding.retry_policy
2102
- options.apply_defaults metadata: @config.metadata,
2497
+
2498
+ options.apply_defaults timeout: @config.timeout,
2499
+ metadata: @config.metadata,
2103
2500
  retry_policy: @config.retry_policy
2104
2501
 
2105
2502
  @security_center_stub.call_rpc :update_finding, request, options: options do |response, operation|
@@ -2144,6 +2541,21 @@ module Google
2144
2541
  #
2145
2542
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
2146
2543
  #
2544
+ # @example Basic example
2545
+ # require "google/cloud/security_center/v1"
2546
+ #
2547
+ # # Create a client object. The client can be reused for multiple calls.
2548
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
2549
+ #
2550
+ # # Create a request. To set request fields, pass in keyword arguments.
2551
+ # request = Google::Cloud::SecurityCenter::V1::UpdateNotificationConfigRequest.new
2552
+ #
2553
+ # # Call the update_notification_config method.
2554
+ # result = client.update_notification_config request
2555
+ #
2556
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::NotificationConfig.
2557
+ # p result
2558
+ #
2147
2559
  def update_notification_config request, options = nil
2148
2560
  raise ::ArgumentError, "request must be provided" if request.nil?
2149
2561
 
@@ -2161,16 +2573,20 @@ module Google
2161
2573
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
2162
2574
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2163
2575
 
2164
- header_params = {
2165
- "notification_config.name" => request.notification_config.name
2166
- }
2576
+ header_params = {}
2577
+ if request.notification_config&.name
2578
+ header_params["notification_config.name"] = request.notification_config.name
2579
+ end
2580
+
2167
2581
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2168
2582
  metadata[:"x-goog-request-params"] ||= request_params_header
2169
2583
 
2170
2584
  options.apply_defaults timeout: @config.rpcs.update_notification_config.timeout,
2171
2585
  metadata: metadata,
2172
2586
  retry_policy: @config.rpcs.update_notification_config.retry_policy
2173
- options.apply_defaults metadata: @config.metadata,
2587
+
2588
+ options.apply_defaults timeout: @config.timeout,
2589
+ metadata: @config.metadata,
2174
2590
  retry_policy: @config.retry_policy
2175
2591
 
2176
2592
  @security_center_stub.call_rpc :update_notification_config, request, options: options do |response, operation|
@@ -2214,6 +2630,21 @@ module Google
2214
2630
  #
2215
2631
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
2216
2632
  #
2633
+ # @example Basic example
2634
+ # require "google/cloud/security_center/v1"
2635
+ #
2636
+ # # Create a client object. The client can be reused for multiple calls.
2637
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
2638
+ #
2639
+ # # Create a request. To set request fields, pass in keyword arguments.
2640
+ # request = Google::Cloud::SecurityCenter::V1::UpdateOrganizationSettingsRequest.new
2641
+ #
2642
+ # # Call the update_organization_settings method.
2643
+ # result = client.update_organization_settings request
2644
+ #
2645
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::OrganizationSettings.
2646
+ # p result
2647
+ #
2217
2648
  def update_organization_settings request, options = nil
2218
2649
  raise ::ArgumentError, "request must be provided" if request.nil?
2219
2650
 
@@ -2231,16 +2662,20 @@ module Google
2231
2662
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
2232
2663
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2233
2664
 
2234
- header_params = {
2235
- "organization_settings.name" => request.organization_settings.name
2236
- }
2665
+ header_params = {}
2666
+ if request.organization_settings&.name
2667
+ header_params["organization_settings.name"] = request.organization_settings.name
2668
+ end
2669
+
2237
2670
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2238
2671
  metadata[:"x-goog-request-params"] ||= request_params_header
2239
2672
 
2240
2673
  options.apply_defaults timeout: @config.rpcs.update_organization_settings.timeout,
2241
2674
  metadata: metadata,
2242
2675
  retry_policy: @config.rpcs.update_organization_settings.retry_policy
2243
- options.apply_defaults metadata: @config.metadata,
2676
+
2677
+ options.apply_defaults timeout: @config.timeout,
2678
+ metadata: @config.metadata,
2244
2679
  retry_policy: @config.retry_policy
2245
2680
 
2246
2681
  @security_center_stub.call_rpc :update_organization_settings, request, options: options do |response, operation|
@@ -2284,6 +2719,21 @@ module Google
2284
2719
  #
2285
2720
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
2286
2721
  #
2722
+ # @example Basic example
2723
+ # require "google/cloud/security_center/v1"
2724
+ #
2725
+ # # Create a client object. The client can be reused for multiple calls.
2726
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
2727
+ #
2728
+ # # Create a request. To set request fields, pass in keyword arguments.
2729
+ # request = Google::Cloud::SecurityCenter::V1::UpdateSourceRequest.new
2730
+ #
2731
+ # # Call the update_source method.
2732
+ # result = client.update_source request
2733
+ #
2734
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::Source.
2735
+ # p result
2736
+ #
2287
2737
  def update_source request, options = nil
2288
2738
  raise ::ArgumentError, "request must be provided" if request.nil?
2289
2739
 
@@ -2301,16 +2751,20 @@ module Google
2301
2751
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
2302
2752
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2303
2753
 
2304
- header_params = {
2305
- "source.name" => request.source.name
2306
- }
2754
+ header_params = {}
2755
+ if request.source&.name
2756
+ header_params["source.name"] = request.source.name
2757
+ end
2758
+
2307
2759
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2308
2760
  metadata[:"x-goog-request-params"] ||= request_params_header
2309
2761
 
2310
2762
  options.apply_defaults timeout: @config.rpcs.update_source.timeout,
2311
2763
  metadata: metadata,
2312
2764
  retry_policy: @config.rpcs.update_source.retry_policy
2313
- options.apply_defaults metadata: @config.metadata,
2765
+
2766
+ options.apply_defaults timeout: @config.timeout,
2767
+ metadata: @config.metadata,
2314
2768
  retry_policy: @config.retry_policy
2315
2769
 
2316
2770
  @security_center_stub.call_rpc :update_source, request, options: options do |response, operation|
@@ -2360,6 +2814,21 @@ module Google
2360
2814
  #
2361
2815
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
2362
2816
  #
2817
+ # @example Basic example
2818
+ # require "google/cloud/security_center/v1"
2819
+ #
2820
+ # # Create a client object. The client can be reused for multiple calls.
2821
+ # client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
2822
+ #
2823
+ # # Create a request. To set request fields, pass in keyword arguments.
2824
+ # request = Google::Cloud::SecurityCenter::V1::UpdateSecurityMarksRequest.new
2825
+ #
2826
+ # # Call the update_security_marks method.
2827
+ # result = client.update_security_marks request
2828
+ #
2829
+ # # The returned object is of type Google::Cloud::SecurityCenter::V1::SecurityMarks.
2830
+ # p result
2831
+ #
2363
2832
  def update_security_marks request, options = nil
2364
2833
  raise ::ArgumentError, "request must be provided" if request.nil?
2365
2834
 
@@ -2377,16 +2846,20 @@ module Google
2377
2846
  gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
2378
2847
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2379
2848
 
2380
- header_params = {
2381
- "security_marks.name" => request.security_marks.name
2382
- }
2849
+ header_params = {}
2850
+ if request.security_marks&.name
2851
+ header_params["security_marks.name"] = request.security_marks.name
2852
+ end
2853
+
2383
2854
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2384
2855
  metadata[:"x-goog-request-params"] ||= request_params_header
2385
2856
 
2386
2857
  options.apply_defaults timeout: @config.rpcs.update_security_marks.timeout,
2387
2858
  metadata: metadata,
2388
2859
  retry_policy: @config.rpcs.update_security_marks.retry_policy
2389
- options.apply_defaults metadata: @config.metadata,
2860
+
2861
+ options.apply_defaults timeout: @config.timeout,
2862
+ metadata: @config.metadata,
2390
2863
  retry_policy: @config.retry_policy
2391
2864
 
2392
2865
  @security_center_stub.call_rpc :update_security_marks, request, options: options do |response, operation|
@@ -2410,22 +2883,21 @@ module Google
2410
2883
  # Configuration can be applied globally to all clients, or to a single client
2411
2884
  # on construction.
2412
2885
  #
2413
- # # Examples
2414
- #
2415
- # To modify the global config, setting the timeout for create_source
2416
- # to 20 seconds, and all remaining timeouts to 10 seconds:
2417
- #
2418
- # ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.configure do |config|
2419
- # config.timeout = 10.0
2420
- # config.rpcs.create_source.timeout = 20.0
2421
- # end
2422
- #
2423
- # To apply the above configuration only to a new client:
2424
- #
2425
- # client = ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new do |config|
2426
- # config.timeout = 10.0
2427
- # config.rpcs.create_source.timeout = 20.0
2428
- # end
2886
+ # @example
2887
+ #
2888
+ # # Modify the global config, setting the timeout for
2889
+ # # create_source to 20 seconds,
2890
+ # # and all remaining timeouts to 10 seconds.
2891
+ # ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.configure do |config|
2892
+ # config.timeout = 10.0
2893
+ # config.rpcs.create_source.timeout = 20.0
2894
+ # end
2895
+ #
2896
+ # # Apply the above configuration only to a new client.
2897
+ # client = ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new do |config|
2898
+ # config.timeout = 10.0
2899
+ # config.rpcs.create_source.timeout = 20.0
2900
+ # end
2429
2901
  #
2430
2902
  # @!attribute [rw] endpoint
2431
2903
  # The hostname or hostname:port of the service endpoint.