google-cloud-os_config-v1alpha 0.1.2 → 0.3.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.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/AUTHENTICATION.md +7 -25
  4. data/README.md +1 -1
  5. data/lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb +529 -43
  6. data/lib/google/cloud/os_config/v1alpha/os_config_zonal_service/operations.rb +115 -12
  7. data/lib/google/cloud/os_config/v1alpha/os_config_zonal_service/paths.rb +42 -0
  8. data/lib/google/cloud/os_config/v1alpha/version.rb +1 -1
  9. data/lib/google/cloud/osconfig/v1alpha/config_common_pb.rb +1 -0
  10. data/lib/google/cloud/osconfig/v1alpha/instance_os_policies_compliance_pb.rb +3 -2
  11. data/lib/google/cloud/osconfig/v1alpha/inventory_pb.rb +13 -2
  12. data/lib/google/cloud/osconfig/v1alpha/os_policy_assignment_reports_pb.rb +93 -0
  13. data/lib/google/cloud/osconfig/v1alpha/os_policy_assignments_pb.rb +10 -2
  14. data/lib/google/cloud/osconfig/v1alpha/os_policy_pb.rb +8 -1
  15. data/lib/google/cloud/osconfig/v1alpha/osconfig_common_pb.rb +1 -0
  16. data/lib/google/cloud/osconfig/v1alpha/osconfig_zonal_service_pb.rb +3 -2
  17. data/lib/google/cloud/osconfig/v1alpha/osconfig_zonal_service_services_pb.rb +7 -1
  18. data/lib/google/cloud/osconfig/v1alpha/vulnerability_pb.rb +12 -2
  19. data/proto_docs/google/api/resource.rb +10 -71
  20. data/proto_docs/google/cloud/osconfig/v1alpha/inventory.rb +30 -4
  21. data/proto_docs/google/cloud/osconfig/v1alpha/os_policy.rb +44 -11
  22. data/proto_docs/google/cloud/osconfig/v1alpha/os_policy_assignment_reports.rb +293 -0
  23. data/proto_docs/google/cloud/osconfig/v1alpha/os_policy_assignments.rb +33 -5
  24. data/proto_docs/google/cloud/osconfig/v1alpha/vulnerability.rb +38 -5
  25. data/proto_docs/google/type/date.rb +53 -0
  26. metadata +6 -3
@@ -143,6 +143,7 @@ module Google
143
143
 
144
144
  @operations_client = Operations.new do |config|
145
145
  config.credentials = credentials
146
+ config.quota_project = @quota_project_id
146
147
  config.endpoint = @config.endpoint
147
148
  end
148
149
 
@@ -213,6 +214,28 @@ module Google
213
214
  #
214
215
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
215
216
  #
217
+ # @example Basic example
218
+ # require "google/cloud/os_config/v1alpha"
219
+ #
220
+ # # Create a client object. The client can be reused for multiple calls.
221
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
222
+ #
223
+ # # Create a request. To set request fields, pass in keyword arguments.
224
+ # request = Google::Cloud::OsConfig::V1alpha::CreateOSPolicyAssignmentRequest.new
225
+ #
226
+ # # Call the create_os_policy_assignment method.
227
+ # result = client.create_os_policy_assignment request
228
+ #
229
+ # # The returned object is of type Gapic::Operation. You can use this
230
+ # # object to check the status of an operation, cancel it, or wait
231
+ # # for results. Here is how to block until completion:
232
+ # result.wait_until_done! timeout: 60
233
+ # if result.response?
234
+ # p result.response
235
+ # else
236
+ # puts "Error!"
237
+ # end
238
+ #
216
239
  def create_os_policy_assignment request, options = nil
217
240
  raise ::ArgumentError, "request must be provided" if request.nil?
218
241
 
@@ -230,9 +253,11 @@ module Google
230
253
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
231
254
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
232
255
 
233
- header_params = {
234
- "parent" => request.parent
235
- }
256
+ header_params = {}
257
+ if request.parent
258
+ header_params["parent"] = request.parent
259
+ end
260
+
236
261
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
237
262
  metadata[:"x-goog-request-params"] ||= request_params_header
238
263
 
@@ -292,6 +317,28 @@ module Google
292
317
  #
293
318
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
294
319
  #
320
+ # @example Basic example
321
+ # require "google/cloud/os_config/v1alpha"
322
+ #
323
+ # # Create a client object. The client can be reused for multiple calls.
324
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
325
+ #
326
+ # # Create a request. To set request fields, pass in keyword arguments.
327
+ # request = Google::Cloud::OsConfig::V1alpha::UpdateOSPolicyAssignmentRequest.new
328
+ #
329
+ # # Call the update_os_policy_assignment method.
330
+ # result = client.update_os_policy_assignment request
331
+ #
332
+ # # The returned object is of type Gapic::Operation. You can use this
333
+ # # object to check the status of an operation, cancel it, or wait
334
+ # # for results. Here is how to block until completion:
335
+ # result.wait_until_done! timeout: 60
336
+ # if result.response?
337
+ # p result.response
338
+ # else
339
+ # puts "Error!"
340
+ # end
341
+ #
295
342
  def update_os_policy_assignment request, options = nil
296
343
  raise ::ArgumentError, "request must be provided" if request.nil?
297
344
 
@@ -309,9 +356,11 @@ module Google
309
356
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
310
357
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
311
358
 
312
- header_params = {
313
- "os_policy_assignment.name" => request.os_policy_assignment.name
314
- }
359
+ header_params = {}
360
+ if request.os_policy_assignment&.name
361
+ header_params["os_policy_assignment.name"] = request.os_policy_assignment.name
362
+ end
363
+
315
364
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
316
365
  metadata[:"x-goog-request-params"] ||= request_params_header
317
366
 
@@ -368,6 +417,21 @@ module Google
368
417
  #
369
418
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
370
419
  #
420
+ # @example Basic example
421
+ # require "google/cloud/os_config/v1alpha"
422
+ #
423
+ # # Create a client object. The client can be reused for multiple calls.
424
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
425
+ #
426
+ # # Create a request. To set request fields, pass in keyword arguments.
427
+ # request = Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentRequest.new
428
+ #
429
+ # # Call the get_os_policy_assignment method.
430
+ # result = client.get_os_policy_assignment request
431
+ #
432
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment.
433
+ # p result
434
+ #
371
435
  def get_os_policy_assignment request, options = nil
372
436
  raise ::ArgumentError, "request must be provided" if request.nil?
373
437
 
@@ -385,9 +449,11 @@ module Google
385
449
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
386
450
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
387
451
 
388
- header_params = {
389
- "name" => request.name
390
- }
452
+ header_params = {}
453
+ if request.name
454
+ header_params["name"] = request.name
455
+ end
456
+
391
457
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
392
458
  metadata[:"x-goog-request-params"] ||= request_params_header
393
459
 
@@ -444,6 +510,27 @@ module Google
444
510
  #
445
511
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
446
512
  #
513
+ # @example Basic example
514
+ # require "google/cloud/os_config/v1alpha"
515
+ #
516
+ # # Create a client object. The client can be reused for multiple calls.
517
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
518
+ #
519
+ # # Create a request. To set request fields, pass in keyword arguments.
520
+ # request = Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentsRequest.new
521
+ #
522
+ # # Call the list_os_policy_assignments method.
523
+ # result = client.list_os_policy_assignments request
524
+ #
525
+ # # The returned object is of type Gapic::PagedEnumerable. You can
526
+ # # iterate over all elements by calling #each, and the enumerable
527
+ # # will lazily make API calls to fetch subsequent pages. Other
528
+ # # methods are also available for managing paging directly.
529
+ # result.each do |response|
530
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment.
531
+ # p response
532
+ # end
533
+ #
447
534
  def list_os_policy_assignments request, options = nil
448
535
  raise ::ArgumentError, "request must be provided" if request.nil?
449
536
 
@@ -461,9 +548,11 @@ module Google
461
548
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
462
549
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
463
550
 
464
- header_params = {
465
- "parent" => request.parent
466
- }
551
+ header_params = {}
552
+ if request.parent
553
+ header_params["parent"] = request.parent
554
+ end
555
+
467
556
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
468
557
  metadata[:"x-goog-request-params"] ||= request_params_header
469
558
 
@@ -519,6 +608,27 @@ module Google
519
608
  #
520
609
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
521
610
  #
611
+ # @example Basic example
612
+ # require "google/cloud/os_config/v1alpha"
613
+ #
614
+ # # Create a client object. The client can be reused for multiple calls.
615
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
616
+ #
617
+ # # Create a request. To set request fields, pass in keyword arguments.
618
+ # request = Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentRevisionsRequest.new
619
+ #
620
+ # # Call the list_os_policy_assignment_revisions method.
621
+ # result = client.list_os_policy_assignment_revisions request
622
+ #
623
+ # # The returned object is of type Gapic::PagedEnumerable. You can
624
+ # # iterate over all elements by calling #each, and the enumerable
625
+ # # will lazily make API calls to fetch subsequent pages. Other
626
+ # # methods are also available for managing paging directly.
627
+ # result.each do |response|
628
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment.
629
+ # p response
630
+ # end
631
+ #
522
632
  def list_os_policy_assignment_revisions request, options = nil
523
633
  raise ::ArgumentError, "request must be provided" if request.nil?
524
634
 
@@ -536,9 +646,11 @@ module Google
536
646
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
537
647
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
538
648
 
539
- header_params = {
540
- "name" => request.name
541
- }
649
+ header_params = {}
650
+ if request.name
651
+ header_params["name"] = request.name
652
+ end
653
+
542
654
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
543
655
  metadata[:"x-goog-request-params"] ||= request_params_header
544
656
 
@@ -599,6 +711,28 @@ module Google
599
711
  #
600
712
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
601
713
  #
714
+ # @example Basic example
715
+ # require "google/cloud/os_config/v1alpha"
716
+ #
717
+ # # Create a client object. The client can be reused for multiple calls.
718
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
719
+ #
720
+ # # Create a request. To set request fields, pass in keyword arguments.
721
+ # request = Google::Cloud::OsConfig::V1alpha::DeleteOSPolicyAssignmentRequest.new
722
+ #
723
+ # # Call the delete_os_policy_assignment method.
724
+ # result = client.delete_os_policy_assignment request
725
+ #
726
+ # # The returned object is of type Gapic::Operation. You can use this
727
+ # # object to check the status of an operation, cancel it, or wait
728
+ # # for results. Here is how to block until completion:
729
+ # result.wait_until_done! timeout: 60
730
+ # if result.response?
731
+ # p result.response
732
+ # else
733
+ # puts "Error!"
734
+ # end
735
+ #
602
736
  def delete_os_policy_assignment request, options = nil
603
737
  raise ::ArgumentError, "request must be provided" if request.nil?
604
738
 
@@ -616,9 +750,11 @@ module Google
616
750
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
617
751
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
618
752
 
619
- header_params = {
620
- "name" => request.name
621
- }
753
+ header_params = {}
754
+ if request.name
755
+ header_params["name"] = request.name
756
+ end
757
+
622
758
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
623
759
  metadata[:"x-goog-request-params"] ||= request_params_header
624
760
 
@@ -643,6 +779,8 @@ module Google
643
779
  # Get OS policies compliance data for the specified Compute Engine VM
644
780
  # instance.
645
781
  #
782
+ # @deprecated This method is deprecated and may be removed in the next major version update.
783
+ #
646
784
  # @overload get_instance_os_policies_compliance(request, options = nil)
647
785
  # Pass arguments to `get_instance_os_policies_compliance` via a request object, either of type
648
786
  # {::Google::Cloud::OsConfig::V1alpha::GetInstanceOSPoliciesComplianceRequest} or an equivalent Hash.
@@ -677,6 +815,21 @@ module Google
677
815
  #
678
816
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
679
817
  #
818
+ # @example Basic example
819
+ # require "google/cloud/os_config/v1alpha"
820
+ #
821
+ # # Create a client object. The client can be reused for multiple calls.
822
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
823
+ #
824
+ # # Create a request. To set request fields, pass in keyword arguments.
825
+ # request = Google::Cloud::OsConfig::V1alpha::GetInstanceOSPoliciesComplianceRequest.new
826
+ #
827
+ # # Call the get_instance_os_policies_compliance method.
828
+ # result = client.get_instance_os_policies_compliance request
829
+ #
830
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance.
831
+ # p result
832
+ #
680
833
  def get_instance_os_policies_compliance request, options = nil
681
834
  raise ::ArgumentError, "request must be provided" if request.nil?
682
835
 
@@ -694,9 +847,11 @@ module Google
694
847
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
695
848
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
696
849
 
697
- header_params = {
698
- "name" => request.name
699
- }
850
+ header_params = {}
851
+ if request.name
852
+ header_params["name"] = request.name
853
+ end
854
+
700
855
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
701
856
  metadata[:"x-goog-request-params"] ||= request_params_header
702
857
 
@@ -720,6 +875,8 @@ module Google
720
875
  # List OS policies compliance data for all Compute Engine VM instances in the
721
876
  # specified zone.
722
877
  #
878
+ # @deprecated This method is deprecated and may be removed in the next major version update.
879
+ #
723
880
  # @overload list_instance_os_policies_compliances(request, options = nil)
724
881
  # Pass arguments to `list_instance_os_policies_compliances` via a request object, either of type
725
882
  # {::Google::Cloud::OsConfig::V1alpha::ListInstanceOSPoliciesCompliancesRequest} or an equivalent Hash.
@@ -760,6 +917,27 @@ module Google
760
917
  #
761
918
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
762
919
  #
920
+ # @example Basic example
921
+ # require "google/cloud/os_config/v1alpha"
922
+ #
923
+ # # Create a client object. The client can be reused for multiple calls.
924
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
925
+ #
926
+ # # Create a request. To set request fields, pass in keyword arguments.
927
+ # request = Google::Cloud::OsConfig::V1alpha::ListInstanceOSPoliciesCompliancesRequest.new
928
+ #
929
+ # # Call the list_instance_os_policies_compliances method.
930
+ # result = client.list_instance_os_policies_compliances request
931
+ #
932
+ # # The returned object is of type Gapic::PagedEnumerable. You can
933
+ # # iterate over all elements by calling #each, and the enumerable
934
+ # # will lazily make API calls to fetch subsequent pages. Other
935
+ # # methods are also available for managing paging directly.
936
+ # result.each do |response|
937
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance.
938
+ # p response
939
+ # end
940
+ #
763
941
  def list_instance_os_policies_compliances request, options = nil
764
942
  raise ::ArgumentError, "request must be provided" if request.nil?
765
943
 
@@ -777,9 +955,11 @@ module Google
777
955
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
778
956
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
779
957
 
780
- header_params = {
781
- "parent" => request.parent
782
- }
958
+ header_params = {}
959
+ if request.parent
960
+ header_params["parent"] = request.parent
961
+ end
962
+
783
963
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
784
964
  metadata[:"x-goog-request-params"] ||= request_params_header
785
965
 
@@ -800,6 +980,222 @@ module Google
800
980
  raise ::Google::Cloud::Error.from_error(e)
801
981
  end
802
982
 
983
+ ##
984
+ # Get the OS policy asssignment report for the specified Compute Engine VM
985
+ # instance.
986
+ #
987
+ # @overload get_os_policy_assignment_report(request, options = nil)
988
+ # Pass arguments to `get_os_policy_assignment_report` via a request object, either of type
989
+ # {::Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentReportRequest} or an equivalent Hash.
990
+ #
991
+ # @param request [::Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentReportRequest, ::Hash]
992
+ # A request object representing the call parameters. Required. To specify no
993
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
994
+ # @param options [::Gapic::CallOptions, ::Hash]
995
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
996
+ #
997
+ # @overload get_os_policy_assignment_report(name: nil)
998
+ # Pass arguments to `get_os_policy_assignment_report` via keyword arguments. Note that at
999
+ # least one keyword argument is required. To specify no parameters, or to keep all
1000
+ # the default parameter values, pass an empty Hash as a request object (see above).
1001
+ #
1002
+ # @param name [::String]
1003
+ # Required. API resource name for OS policy assignment report.
1004
+ #
1005
+ # Format:
1006
+ # `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report`
1007
+ #
1008
+ # For `{project}`, either `project-number` or `project-id` can be provided.
1009
+ # For `{instance_id}`, either Compute Engine `instance-id` or `instance-name`
1010
+ # can be provided.
1011
+ # For `{assignment_id}`, the OSPolicyAssignment id must be provided.
1012
+ #
1013
+ # @yield [response, operation] Access the result along with the RPC operation
1014
+ # @yieldparam response [::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport]
1015
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1016
+ #
1017
+ # @return [::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport]
1018
+ #
1019
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1020
+ #
1021
+ # @example Basic example
1022
+ # require "google/cloud/os_config/v1alpha"
1023
+ #
1024
+ # # Create a client object. The client can be reused for multiple calls.
1025
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
1026
+ #
1027
+ # # Create a request. To set request fields, pass in keyword arguments.
1028
+ # request = Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentReportRequest.new
1029
+ #
1030
+ # # Call the get_os_policy_assignment_report method.
1031
+ # result = client.get_os_policy_assignment_report request
1032
+ #
1033
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport.
1034
+ # p result
1035
+ #
1036
+ def get_os_policy_assignment_report request, options = nil
1037
+ raise ::ArgumentError, "request must be provided" if request.nil?
1038
+
1039
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentReportRequest
1040
+
1041
+ # Converts hash and nil to an options object
1042
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1043
+
1044
+ # Customize the options with defaults
1045
+ metadata = @config.rpcs.get_os_policy_assignment_report.metadata.to_h
1046
+
1047
+ # Set x-goog-api-client and x-goog-user-project headers
1048
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1049
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1050
+ gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1051
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1052
+
1053
+ header_params = {}
1054
+ if request.name
1055
+ header_params["name"] = request.name
1056
+ end
1057
+
1058
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1059
+ metadata[:"x-goog-request-params"] ||= request_params_header
1060
+
1061
+ options.apply_defaults timeout: @config.rpcs.get_os_policy_assignment_report.timeout,
1062
+ metadata: metadata,
1063
+ retry_policy: @config.rpcs.get_os_policy_assignment_report.retry_policy
1064
+
1065
+ options.apply_defaults timeout: @config.timeout,
1066
+ metadata: @config.metadata,
1067
+ retry_policy: @config.retry_policy
1068
+
1069
+ @os_config_zonal_service_stub.call_rpc :get_os_policy_assignment_report, request, options: options do |response, operation|
1070
+ yield response, operation if block_given?
1071
+ return response
1072
+ end
1073
+ rescue ::GRPC::BadStatus => e
1074
+ raise ::Google::Cloud::Error.from_error(e)
1075
+ end
1076
+
1077
+ ##
1078
+ # List OS policy asssignment reports for all Compute Engine VM instances in
1079
+ # the specified zone.
1080
+ #
1081
+ # @overload list_os_policy_assignment_reports(request, options = nil)
1082
+ # Pass arguments to `list_os_policy_assignment_reports` via a request object, either of type
1083
+ # {::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentReportsRequest} or an equivalent Hash.
1084
+ #
1085
+ # @param request [::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentReportsRequest, ::Hash]
1086
+ # A request object representing the call parameters. Required. To specify no
1087
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1088
+ # @param options [::Gapic::CallOptions, ::Hash]
1089
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1090
+ #
1091
+ # @overload list_os_policy_assignment_reports(parent: nil, page_size: nil, filter: nil, page_token: nil)
1092
+ # Pass arguments to `list_os_policy_assignment_reports` via keyword arguments. Note that at
1093
+ # least one keyword argument is required. To specify no parameters, or to keep all
1094
+ # the default parameter values, pass an empty Hash as a request object (see above).
1095
+ #
1096
+ # @param parent [::String]
1097
+ # Required. The parent resource name.
1098
+ #
1099
+ # Format:
1100
+ # `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports`
1101
+ #
1102
+ # For `{project}`, either `project-number` or `project-id` can be provided.
1103
+ # For `{instance}`, either `instance-name`, `instance-id`, or `-` can be
1104
+ # provided. If '-' is provided, the response will include
1105
+ # OSPolicyAssignmentReports for all instances in the project/location.
1106
+ # For `{assignment}`, either `assignment-id` or `-` can be provided. If '-'
1107
+ # is provided, the response will include OSPolicyAssignmentReports for all
1108
+ # OSPolicyAssignments in the project/location.
1109
+ # Either \\{instance} or \\{assignment} must be `-`.
1110
+ #
1111
+ # For example:
1112
+ # `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports`
1113
+ # returns all reports for the instance
1114
+ # `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports`
1115
+ # returns all the reports for the given assignment across all instances.
1116
+ # `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports`
1117
+ # returns all the reports for all assignments across all instances.
1118
+ # @param page_size [::Integer]
1119
+ # The maximum number of results to return.
1120
+ # @param filter [::String]
1121
+ # If provided, this field specifies the criteria that must be met by the
1122
+ # `OSPolicyAssignmentReport` API resource that is included in the response.
1123
+ # @param page_token [::String]
1124
+ # A pagination token returned from a previous call to the
1125
+ # `ListOSPolicyAssignmentReports` method that indicates where this listing
1126
+ # should continue from.
1127
+ #
1128
+ # @yield [response, operation] Access the result along with the RPC operation
1129
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport>]
1130
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1131
+ #
1132
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport>]
1133
+ #
1134
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1135
+ #
1136
+ # @example Basic example
1137
+ # require "google/cloud/os_config/v1alpha"
1138
+ #
1139
+ # # Create a client object. The client can be reused for multiple calls.
1140
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
1141
+ #
1142
+ # # Create a request. To set request fields, pass in keyword arguments.
1143
+ # request = Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentReportsRequest.new
1144
+ #
1145
+ # # Call the list_os_policy_assignment_reports method.
1146
+ # result = client.list_os_policy_assignment_reports request
1147
+ #
1148
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1149
+ # # iterate over all elements by calling #each, and the enumerable
1150
+ # # will lazily make API calls to fetch subsequent pages. Other
1151
+ # # methods are also available for managing paging directly.
1152
+ # result.each do |response|
1153
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport.
1154
+ # p response
1155
+ # end
1156
+ #
1157
+ def list_os_policy_assignment_reports request, options = nil
1158
+ raise ::ArgumentError, "request must be provided" if request.nil?
1159
+
1160
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentReportsRequest
1161
+
1162
+ # Converts hash and nil to an options object
1163
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1164
+
1165
+ # Customize the options with defaults
1166
+ metadata = @config.rpcs.list_os_policy_assignment_reports.metadata.to_h
1167
+
1168
+ # Set x-goog-api-client and x-goog-user-project headers
1169
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1170
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1171
+ gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1172
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1173
+
1174
+ header_params = {}
1175
+ if request.parent
1176
+ header_params["parent"] = request.parent
1177
+ end
1178
+
1179
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1180
+ metadata[:"x-goog-request-params"] ||= request_params_header
1181
+
1182
+ options.apply_defaults timeout: @config.rpcs.list_os_policy_assignment_reports.timeout,
1183
+ metadata: metadata,
1184
+ retry_policy: @config.rpcs.list_os_policy_assignment_reports.retry_policy
1185
+
1186
+ options.apply_defaults timeout: @config.timeout,
1187
+ metadata: @config.metadata,
1188
+ retry_policy: @config.retry_policy
1189
+
1190
+ @os_config_zonal_service_stub.call_rpc :list_os_policy_assignment_reports, request, options: options do |response, operation|
1191
+ response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignment_reports, request, response, operation, options
1192
+ yield response, operation if block_given?
1193
+ return response
1194
+ end
1195
+ rescue ::GRPC::BadStatus => e
1196
+ raise ::Google::Cloud::Error.from_error(e)
1197
+ end
1198
+
803
1199
  ##
804
1200
  # Get inventory data for the specified VM instance. If the VM has no
805
1201
  # associated inventory, the message `NOT_FOUND` is returned.
@@ -840,6 +1236,21 @@ module Google
840
1236
  #
841
1237
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
842
1238
  #
1239
+ # @example Basic example
1240
+ # require "google/cloud/os_config/v1alpha"
1241
+ #
1242
+ # # Create a client object. The client can be reused for multiple calls.
1243
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
1244
+ #
1245
+ # # Create a request. To set request fields, pass in keyword arguments.
1246
+ # request = Google::Cloud::OsConfig::V1alpha::GetInventoryRequest.new
1247
+ #
1248
+ # # Call the get_inventory method.
1249
+ # result = client.get_inventory request
1250
+ #
1251
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::Inventory.
1252
+ # p result
1253
+ #
843
1254
  def get_inventory request, options = nil
844
1255
  raise ::ArgumentError, "request must be provided" if request.nil?
845
1256
 
@@ -857,9 +1268,11 @@ module Google
857
1268
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
858
1269
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
859
1270
 
860
- header_params = {
861
- "name" => request.name
862
- }
1271
+ header_params = {}
1272
+ if request.name
1273
+ header_params["name"] = request.name
1274
+ end
1275
+
863
1276
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
864
1277
  metadata[:"x-goog-request-params"] ||= request_params_header
865
1278
 
@@ -900,11 +1313,9 @@ module Google
900
1313
  # @param parent [::String]
901
1314
  # Required. The parent resource name.
902
1315
  #
903
- # Format: `projects/{project}/locations/{location}/instances/{instance}`
1316
+ # Format: `projects/{project}/locations/{location}/instances/-`
904
1317
  #
905
- # For `{project}`, either `project-number` or `project-id` can be
906
- # provided. For `{instance}`, only hyphen or dash character is supported to
907
- # list inventories across VMs.
1318
+ # For `{project}`, either `project-number` or `project-id` can be provided.
908
1319
  # @param view [::Google::Cloud::OsConfig::V1alpha::InventoryView]
909
1320
  # Inventory view indicating what information should be included in the
910
1321
  # inventory resource. If unspecified, the default view is BASIC.
@@ -926,6 +1337,27 @@ module Google
926
1337
  #
927
1338
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
928
1339
  #
1340
+ # @example Basic example
1341
+ # require "google/cloud/os_config/v1alpha"
1342
+ #
1343
+ # # Create a client object. The client can be reused for multiple calls.
1344
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
1345
+ #
1346
+ # # Create a request. To set request fields, pass in keyword arguments.
1347
+ # request = Google::Cloud::OsConfig::V1alpha::ListInventoriesRequest.new
1348
+ #
1349
+ # # Call the list_inventories method.
1350
+ # result = client.list_inventories request
1351
+ #
1352
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1353
+ # # iterate over all elements by calling #each, and the enumerable
1354
+ # # will lazily make API calls to fetch subsequent pages. Other
1355
+ # # methods are also available for managing paging directly.
1356
+ # result.each do |response|
1357
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::Inventory.
1358
+ # p response
1359
+ # end
1360
+ #
929
1361
  def list_inventories request, options = nil
930
1362
  raise ::ArgumentError, "request must be provided" if request.nil?
931
1363
 
@@ -943,9 +1375,11 @@ module Google
943
1375
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
944
1376
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
945
1377
 
946
- header_params = {
947
- "parent" => request.parent
948
- }
1378
+ header_params = {}
1379
+ if request.parent
1380
+ header_params["parent"] = request.parent
1381
+ end
1382
+
949
1383
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
950
1384
  metadata[:"x-goog-request-params"] ||= request_params_header
951
1385
 
@@ -1003,6 +1437,21 @@ module Google
1003
1437
  #
1004
1438
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1005
1439
  #
1440
+ # @example Basic example
1441
+ # require "google/cloud/os_config/v1alpha"
1442
+ #
1443
+ # # Create a client object. The client can be reused for multiple calls.
1444
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
1445
+ #
1446
+ # # Create a request. To set request fields, pass in keyword arguments.
1447
+ # request = Google::Cloud::OsConfig::V1alpha::GetVulnerabilityReportRequest.new
1448
+ #
1449
+ # # Call the get_vulnerability_report method.
1450
+ # result = client.get_vulnerability_report request
1451
+ #
1452
+ # # The returned object is of type Google::Cloud::OsConfig::V1alpha::VulnerabilityReport.
1453
+ # p result
1454
+ #
1006
1455
  def get_vulnerability_report request, options = nil
1007
1456
  raise ::ArgumentError, "request must be provided" if request.nil?
1008
1457
 
@@ -1020,9 +1469,11 @@ module Google
1020
1469
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1021
1470
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1022
1471
 
1023
- header_params = {
1024
- "name" => request.name
1025
- }
1472
+ header_params = {}
1473
+ if request.name
1474
+ header_params["name"] = request.name
1475
+ end
1476
+
1026
1477
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1027
1478
  metadata[:"x-goog-request-params"] ||= request_params_header
1028
1479
 
@@ -1063,11 +1514,9 @@ module Google
1063
1514
  # @param parent [::String]
1064
1515
  # Required. The parent resource name.
1065
1516
  #
1066
- # Format: `projects/{project}/locations/{location}/instances/{instance}`
1517
+ # Format: `projects/{project}/locations/{location}/instances/-`
1067
1518
  #
1068
1519
  # For `{project}`, either `project-number` or `project-id` can be provided.
1069
- # For `{instance}`, only `-` character is supported to list vulnerability
1070
- # reports across VMs.
1071
1520
  # @param page_size [::Integer]
1072
1521
  # The maximum number of results to return.
1073
1522
  # @param page_token [::String]
@@ -1086,6 +1535,27 @@ module Google
1086
1535
  #
1087
1536
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1088
1537
  #
1538
+ # @example Basic example
1539
+ # require "google/cloud/os_config/v1alpha"
1540
+ #
1541
+ # # Create a client object. The client can be reused for multiple calls.
1542
+ # client = Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.new
1543
+ #
1544
+ # # Create a request. To set request fields, pass in keyword arguments.
1545
+ # request = Google::Cloud::OsConfig::V1alpha::ListVulnerabilityReportsRequest.new
1546
+ #
1547
+ # # Call the list_vulnerability_reports method.
1548
+ # result = client.list_vulnerability_reports request
1549
+ #
1550
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1551
+ # # iterate over all elements by calling #each, and the enumerable
1552
+ # # will lazily make API calls to fetch subsequent pages. Other
1553
+ # # methods are also available for managing paging directly.
1554
+ # result.each do |response|
1555
+ # # Each element is of type ::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport.
1556
+ # p response
1557
+ # end
1558
+ #
1089
1559
  def list_vulnerability_reports request, options = nil
1090
1560
  raise ::ArgumentError, "request must be provided" if request.nil?
1091
1561
 
@@ -1103,9 +1573,11 @@ module Google
1103
1573
  gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
1104
1574
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1105
1575
 
1106
- header_params = {
1107
- "parent" => request.parent
1108
- }
1576
+ header_params = {}
1577
+ if request.parent
1578
+ header_params["parent"] = request.parent
1579
+ end
1580
+
1109
1581
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1110
1582
  metadata[:"x-goog-request-params"] ||= request_params_header
1111
1583
 
@@ -1302,6 +1774,16 @@ module Google
1302
1774
  #
1303
1775
  attr_reader :list_instance_os_policies_compliances
1304
1776
  ##
1777
+ # RPC-specific configuration for `get_os_policy_assignment_report`
1778
+ # @return [::Gapic::Config::Method]
1779
+ #
1780
+ attr_reader :get_os_policy_assignment_report
1781
+ ##
1782
+ # RPC-specific configuration for `list_os_policy_assignment_reports`
1783
+ # @return [::Gapic::Config::Method]
1784
+ #
1785
+ attr_reader :list_os_policy_assignment_reports
1786
+ ##
1305
1787
  # RPC-specific configuration for `get_inventory`
1306
1788
  # @return [::Gapic::Config::Method]
1307
1789
  #
@@ -1340,6 +1822,10 @@ module Google
1340
1822
  @get_instance_os_policies_compliance = ::Gapic::Config::Method.new get_instance_os_policies_compliance_config
1341
1823
  list_instance_os_policies_compliances_config = parent_rpcs.list_instance_os_policies_compliances if parent_rpcs.respond_to? :list_instance_os_policies_compliances
1342
1824
  @list_instance_os_policies_compliances = ::Gapic::Config::Method.new list_instance_os_policies_compliances_config
1825
+ get_os_policy_assignment_report_config = parent_rpcs.get_os_policy_assignment_report if parent_rpcs.respond_to? :get_os_policy_assignment_report
1826
+ @get_os_policy_assignment_report = ::Gapic::Config::Method.new get_os_policy_assignment_report_config
1827
+ list_os_policy_assignment_reports_config = parent_rpcs.list_os_policy_assignment_reports if parent_rpcs.respond_to? :list_os_policy_assignment_reports
1828
+ @list_os_policy_assignment_reports = ::Gapic::Config::Method.new list_os_policy_assignment_reports_config
1343
1829
  get_inventory_config = parent_rpcs.get_inventory if parent_rpcs.respond_to? :get_inventory
1344
1830
  @get_inventory = ::Gapic::Config::Method.new get_inventory_config
1345
1831
  list_inventories_config = parent_rpcs.list_inventories if parent_rpcs.respond_to? :list_inventories