google-cloud-assured_workloads-v1 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5de2c75249c685998ad9bb6e7cb638abdd7092bc7d044a9ca1aa59219a4f261
4
- data.tar.gz: 1580148f76123c5939684548ce1c4d8fb5b71b068cc516d3b74093e619fc11df
3
+ metadata.gz: b0a15f8dcfadab73f5c5d2a5098c15c191c2eb4f4adcfd929de11a4407543049
4
+ data.tar.gz: ea835efc5dfb60a08c51a3f4aff40a517078180d288456980ccd492f64f85b7b
5
5
  SHA512:
6
- metadata.gz: f3f5fe0fe0ae77a0f6db480006ce48fbf890528b85b06ab1d4dc1b93da2c5c33cee1d1d33ce2d9a0b96249afcfc7c30713fef7a127e3666e0db37d2243812252
7
- data.tar.gz: b4f6bb2d4e8b9c63120a1680f6787588ed24c57231cc715545219f9e45955512d4dee4b15627c765b61ca552afdd54872d3aa5b072b6a0d02749e7d15668e817
6
+ metadata.gz: 9770da2b639d444a449ef7b739a28dc5ac91b9940a24c0c99e5b9c3b38d69e833a6eb44ed1b0881e83755981ec193fd8146b9d1e30600c306f8de6ce5bc095a8
7
+ data.tar.gz: 1223ecf3481fa693e9cc974ebea01a9e0264a1fa06d177cb06296472665daad859a8b441640ec49fd51a109ddc3fa87e2072d35ce15eee653a75c13fd9ef5e29
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -37,7 +37,7 @@ request = ::Google::Cloud::AssuredWorkloads::V1::CreateWorkloadRequest.new # (re
37
37
  response = client.create_workload request
38
38
  ```
39
39
 
40
- View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-assured_workloads-v1/latest)
40
+ View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest)
41
41
  for class and method documentation.
42
42
 
43
43
  See also the [Product Documentation](https://cloud.google.com/assured-workloads/)
@@ -69,16 +69,21 @@ module GRPC
69
69
  end
70
70
  ```
71
71
 
72
+
73
+ ## Google Cloud Samples
74
+
75
+ To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
76
+
72
77
  ## Supported Ruby Versions
73
78
 
74
- This library is supported on Ruby 2.5+.
79
+ This library is supported on Ruby 2.6+.
75
80
 
76
81
  Google provides official support for Ruby versions that are actively supported
77
82
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
78
- in security maintenance, and not end of life. Currently, this means Ruby 2.5
79
- and later. Older versions of Ruby _may_ still work, but are unsupported and not
80
- recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
81
- about the Ruby support schedule.
83
+ in security maintenance, and not end of life. Older versions of Ruby _may_
84
+ still work, but are unsupported and not recommended. See
85
+ https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
86
+ support schedule.
82
87
 
83
88
  ## Which client should I use?
84
89
 
@@ -183,8 +183,8 @@ module Google
183
183
  # @param workload [::Google::Cloud::AssuredWorkloads::V1::Workload, ::Hash]
184
184
  # Required. Assured Workload to create
185
185
  # @param external_id [::String]
186
- # Optional. A identifier associated with the workload and underlying projects
187
- # which allows for the break down of billing costs for a workload. The value
186
+ # Optional. A identifier associated with the workload and underlying projects which
187
+ # allows for the break down of billing costs for a workload. The value
188
188
  # provided for the identifier will add a label to the workload and contained
189
189
  # projects with the identifier as the value.
190
190
  #
@@ -283,7 +283,7 @@ module Google
283
283
  #
284
284
  # @param workload [::Google::Cloud::AssuredWorkloads::V1::Workload, ::Hash]
285
285
  # Required. The workload to update.
286
- # The workloads `name` field is used to identify the workload to be updated.
286
+ # The workload's `name` field is used to identify the workload to be updated.
287
287
  # Format:
288
288
  # organizations/\\{org_id}/locations/\\{location_id}/workloads/\\{workload_id}
289
289
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
@@ -353,6 +353,102 @@ module Google
353
353
  raise ::Google::Cloud::Error.from_error(e)
354
354
  end
355
355
 
356
+ ##
357
+ # Restrict the list of resources allowed in the Workload environment.
358
+ # The current list of allowed products can be found at
359
+ # https://cloud.google.com/assured-workloads/docs/supported-products
360
+ # In addition to assuredworkloads.workload.update permission, the user should
361
+ # also have orgpolicy.policy.set permission on the folder resource
362
+ # to use this functionality.
363
+ #
364
+ # @overload restrict_allowed_resources(request, options = nil)
365
+ # Pass arguments to `restrict_allowed_resources` via a request object, either of type
366
+ # {::Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesRequest} or an equivalent Hash.
367
+ #
368
+ # @param request [::Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesRequest, ::Hash]
369
+ # A request object representing the call parameters. Required. To specify no
370
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
371
+ # @param options [::Gapic::CallOptions, ::Hash]
372
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
373
+ #
374
+ # @overload restrict_allowed_resources(name: nil, restriction_type: nil)
375
+ # Pass arguments to `restrict_allowed_resources` via keyword arguments. Note that at
376
+ # least one keyword argument is required. To specify no parameters, or to keep all
377
+ # the default parameter values, pass an empty Hash as a request object (see above).
378
+ #
379
+ # @param name [::String]
380
+ # Required. The resource name of the Workload. This is the workloads's
381
+ # relative path in the API, formatted as
382
+ # "organizations/\\{organization_id}/locations/\\{location_id}/workloads/\\{workload_id}".
383
+ # For example,
384
+ # "organizations/123/locations/us-east1/workloads/assured-workload-1".
385
+ # @param restriction_type [::Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesRequest::RestrictionType]
386
+ # Required. The type of restriction for using gcp products in the Workload environment.
387
+ #
388
+ # @yield [response, operation] Access the result along with the RPC operation
389
+ # @yieldparam response [::Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesResponse]
390
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
391
+ #
392
+ # @return [::Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesResponse]
393
+ #
394
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
395
+ #
396
+ # @example Basic example
397
+ # require "google/cloud/assured_workloads/v1"
398
+ #
399
+ # # Create a client object. The client can be reused for multiple calls.
400
+ # client = Google::Cloud::AssuredWorkloads::V1::AssuredWorkloadsService::Client.new
401
+ #
402
+ # # Create a request. To set request fields, pass in keyword arguments.
403
+ # request = Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesRequest.new
404
+ #
405
+ # # Call the restrict_allowed_resources method.
406
+ # result = client.restrict_allowed_resources request
407
+ #
408
+ # # The returned object is of type Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesResponse.
409
+ # p result
410
+ #
411
+ def restrict_allowed_resources request, options = nil
412
+ raise ::ArgumentError, "request must be provided" if request.nil?
413
+
414
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesRequest
415
+
416
+ # Converts hash and nil to an options object
417
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
418
+
419
+ # Customize the options with defaults
420
+ metadata = @config.rpcs.restrict_allowed_resources.metadata.to_h
421
+
422
+ # Set x-goog-api-client and x-goog-user-project headers
423
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
424
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
425
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1::VERSION
426
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
427
+
428
+ header_params = {}
429
+ if request.name
430
+ header_params["name"] = request.name
431
+ end
432
+
433
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
434
+ metadata[:"x-goog-request-params"] ||= request_params_header
435
+
436
+ options.apply_defaults timeout: @config.rpcs.restrict_allowed_resources.timeout,
437
+ metadata: metadata,
438
+ retry_policy: @config.rpcs.restrict_allowed_resources.retry_policy
439
+
440
+ options.apply_defaults timeout: @config.timeout,
441
+ metadata: @config.metadata,
442
+ retry_policy: @config.retry_policy
443
+
444
+ @assured_workloads_service_stub.call_rpc :restrict_allowed_resources, request, options: options do |response, operation|
445
+ yield response, operation if block_given?
446
+ return response
447
+ end
448
+ rescue ::GRPC::BadStatus => e
449
+ raise ::Google::Cloud::Error.from_error(e)
450
+ end
451
+
356
452
  ##
357
453
  # Deletes the workload. Make sure that workload's direct children are already
358
454
  # in a deleted state, otherwise the request will fail with a
@@ -464,8 +560,8 @@ module Google
464
560
  # the default parameter values, pass an empty Hash as a request object (see above).
465
561
  #
466
562
  # @param name [::String]
467
- # Required. The resource name of the Workload to fetch. This is the
468
- # workloads's relative path in the API, formatted as
563
+ # Required. The resource name of the Workload to fetch. This is the workloads's
564
+ # relative path in the API, formatted as
469
565
  # "organizations/\\{organization_id}/locations/\\{location_id}/workloads/\\{workload_id}".
470
566
  # For example,
471
567
  # "organizations/123/locations/us-east1/workloads/assured-workload-1".
@@ -636,6 +732,275 @@ module Google
636
732
  raise ::Google::Cloud::Error.from_error(e)
637
733
  end
638
734
 
735
+ ##
736
+ # Lists the Violations in the AssuredWorkload Environment.
737
+ # Callers may also choose to read across multiple Workloads as per
738
+ # [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash
739
+ # character) as a wildcard character instead of workload-id in the parent.
740
+ # Format `organizations/{org_id}/locations/{location}/workloads/-`
741
+ #
742
+ # @overload list_violations(request, options = nil)
743
+ # Pass arguments to `list_violations` via a request object, either of type
744
+ # {::Google::Cloud::AssuredWorkloads::V1::ListViolationsRequest} or an equivalent Hash.
745
+ #
746
+ # @param request [::Google::Cloud::AssuredWorkloads::V1::ListViolationsRequest, ::Hash]
747
+ # A request object representing the call parameters. Required. To specify no
748
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
749
+ # @param options [::Gapic::CallOptions, ::Hash]
750
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
751
+ #
752
+ # @overload list_violations(parent: nil, interval: nil, page_size: nil, page_token: nil, filter: nil)
753
+ # Pass arguments to `list_violations` via keyword arguments. Note that at
754
+ # least one keyword argument is required. To specify no parameters, or to keep all
755
+ # the default parameter values, pass an empty Hash as a request object (see above).
756
+ #
757
+ # @param parent [::String]
758
+ # Required. The Workload name.
759
+ # Format `organizations/{org_id}/locations/{location}/workloads/{workload}`.
760
+ # @param interval [::Google::Cloud::AssuredWorkloads::V1::TimeWindow, ::Hash]
761
+ # Optional. Specifies the time window for retrieving active Violations.
762
+ # When specified, retrieves Violations that were active between start_time
763
+ # and end_time.
764
+ # @param page_size [::Integer]
765
+ # Optional. Page size.
766
+ # @param page_token [::String]
767
+ # Optional. Page token returned from previous request.
768
+ # @param filter [::String]
769
+ # Optional. A custom filter for filtering by the Violations properties.
770
+ #
771
+ # @yield [response, operation] Access the result along with the RPC operation
772
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Violation>]
773
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
774
+ #
775
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Violation>]
776
+ #
777
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
778
+ #
779
+ # @example Basic example
780
+ # require "google/cloud/assured_workloads/v1"
781
+ #
782
+ # # Create a client object. The client can be reused for multiple calls.
783
+ # client = Google::Cloud::AssuredWorkloads::V1::AssuredWorkloadsService::Client.new
784
+ #
785
+ # # Create a request. To set request fields, pass in keyword arguments.
786
+ # request = Google::Cloud::AssuredWorkloads::V1::ListViolationsRequest.new
787
+ #
788
+ # # Call the list_violations method.
789
+ # result = client.list_violations request
790
+ #
791
+ # # The returned object is of type Gapic::PagedEnumerable. You can
792
+ # # iterate over all elements by calling #each, and the enumerable
793
+ # # will lazily make API calls to fetch subsequent pages. Other
794
+ # # methods are also available for managing paging directly.
795
+ # result.each do |response|
796
+ # # Each element is of type ::Google::Cloud::AssuredWorkloads::V1::Violation.
797
+ # p response
798
+ # end
799
+ #
800
+ def list_violations request, options = nil
801
+ raise ::ArgumentError, "request must be provided" if request.nil?
802
+
803
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1::ListViolationsRequest
804
+
805
+ # Converts hash and nil to an options object
806
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
807
+
808
+ # Customize the options with defaults
809
+ metadata = @config.rpcs.list_violations.metadata.to_h
810
+
811
+ # Set x-goog-api-client and x-goog-user-project headers
812
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
813
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
814
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1::VERSION
815
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
816
+
817
+ options.apply_defaults timeout: @config.rpcs.list_violations.timeout,
818
+ metadata: metadata,
819
+ retry_policy: @config.rpcs.list_violations.retry_policy
820
+
821
+ options.apply_defaults timeout: @config.timeout,
822
+ metadata: @config.metadata,
823
+ retry_policy: @config.retry_policy
824
+
825
+ @assured_workloads_service_stub.call_rpc :list_violations, request, options: options do |response, operation|
826
+ response = ::Gapic::PagedEnumerable.new @assured_workloads_service_stub, :list_violations, request, response, operation, options
827
+ yield response, operation if block_given?
828
+ return response
829
+ end
830
+ rescue ::GRPC::BadStatus => e
831
+ raise ::Google::Cloud::Error.from_error(e)
832
+ end
833
+
834
+ ##
835
+ # Retrieves Assured Workload Violation based on ID.
836
+ #
837
+ # @overload get_violation(request, options = nil)
838
+ # Pass arguments to `get_violation` via a request object, either of type
839
+ # {::Google::Cloud::AssuredWorkloads::V1::GetViolationRequest} or an equivalent Hash.
840
+ #
841
+ # @param request [::Google::Cloud::AssuredWorkloads::V1::GetViolationRequest, ::Hash]
842
+ # A request object representing the call parameters. Required. To specify no
843
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
844
+ # @param options [::Gapic::CallOptions, ::Hash]
845
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
846
+ #
847
+ # @overload get_violation(name: nil)
848
+ # Pass arguments to `get_violation` via keyword arguments. Note that at
849
+ # least one keyword argument is required. To specify no parameters, or to keep all
850
+ # the default parameter values, pass an empty Hash as a request object (see above).
851
+ #
852
+ # @param name [::String]
853
+ # Required. The resource name of the Violation to fetch (ie. Violation.name).
854
+ # Format:
855
+ # organizations/\\{organization}/locations/\\{location}/workloads/\\{workload}/violations/\\{violation}
856
+ #
857
+ # @yield [response, operation] Access the result along with the RPC operation
858
+ # @yieldparam response [::Google::Cloud::AssuredWorkloads::V1::Violation]
859
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
860
+ #
861
+ # @return [::Google::Cloud::AssuredWorkloads::V1::Violation]
862
+ #
863
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
864
+ #
865
+ # @example Basic example
866
+ # require "google/cloud/assured_workloads/v1"
867
+ #
868
+ # # Create a client object. The client can be reused for multiple calls.
869
+ # client = Google::Cloud::AssuredWorkloads::V1::AssuredWorkloadsService::Client.new
870
+ #
871
+ # # Create a request. To set request fields, pass in keyword arguments.
872
+ # request = Google::Cloud::AssuredWorkloads::V1::GetViolationRequest.new
873
+ #
874
+ # # Call the get_violation method.
875
+ # result = client.get_violation request
876
+ #
877
+ # # The returned object is of type Google::Cloud::AssuredWorkloads::V1::Violation.
878
+ # p result
879
+ #
880
+ def get_violation request, options = nil
881
+ raise ::ArgumentError, "request must be provided" if request.nil?
882
+
883
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1::GetViolationRequest
884
+
885
+ # Converts hash and nil to an options object
886
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
887
+
888
+ # Customize the options with defaults
889
+ metadata = @config.rpcs.get_violation.metadata.to_h
890
+
891
+ # Set x-goog-api-client and x-goog-user-project headers
892
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
893
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
894
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1::VERSION
895
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
896
+
897
+ options.apply_defaults timeout: @config.rpcs.get_violation.timeout,
898
+ metadata: metadata,
899
+ retry_policy: @config.rpcs.get_violation.retry_policy
900
+
901
+ options.apply_defaults timeout: @config.timeout,
902
+ metadata: @config.metadata,
903
+ retry_policy: @config.retry_policy
904
+
905
+ @assured_workloads_service_stub.call_rpc :get_violation, request, options: options do |response, operation|
906
+ yield response, operation if block_given?
907
+ return response
908
+ end
909
+ rescue ::GRPC::BadStatus => e
910
+ raise ::Google::Cloud::Error.from_error(e)
911
+ end
912
+
913
+ ##
914
+ # Acknowledges an existing violation. By acknowledging a violation, users
915
+ # acknowledge the existence of a compliance violation in their workload and
916
+ # decide to ignore it due to a valid business justification. Acknowledgement
917
+ # is a permanent operation and it cannot be reverted.
918
+ #
919
+ # @overload acknowledge_violation(request, options = nil)
920
+ # Pass arguments to `acknowledge_violation` via a request object, either of type
921
+ # {::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationRequest} or an equivalent Hash.
922
+ #
923
+ # @param request [::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationRequest, ::Hash]
924
+ # A request object representing the call parameters. Required. To specify no
925
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
926
+ # @param options [::Gapic::CallOptions, ::Hash]
927
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
928
+ #
929
+ # @overload acknowledge_violation(name: nil, comment: nil, non_compliant_org_policy: nil)
930
+ # Pass arguments to `acknowledge_violation` via keyword arguments. Note that at
931
+ # least one keyword argument is required. To specify no parameters, or to keep all
932
+ # the default parameter values, pass an empty Hash as a request object (see above).
933
+ #
934
+ # @param name [::String]
935
+ # Required. The resource name of the Violation to acknowledge.
936
+ # Format:
937
+ # organizations/\\{organization}/locations/\\{location}/workloads/\\{workload}/violations/\\{violation}
938
+ # @param comment [::String]
939
+ # Required. Business justification explaining the need for violation acknowledgement
940
+ # @param non_compliant_org_policy [::String]
941
+ # Optional. Name of the OrgPolicy which was modified with non-compliant change and
942
+ # resulted in this violation.
943
+ # Format:
944
+ # projects/\\{project_number}/policies/\\{constraint_name}
945
+ # folders/\\{folder_id}/policies/\\{constraint_name}
946
+ # organizations/\\{organization_id}/policies/\\{constraint_name}
947
+ #
948
+ # @yield [response, operation] Access the result along with the RPC operation
949
+ # @yieldparam response [::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse]
950
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
951
+ #
952
+ # @return [::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse]
953
+ #
954
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
955
+ #
956
+ # @example Basic example
957
+ # require "google/cloud/assured_workloads/v1"
958
+ #
959
+ # # Create a client object. The client can be reused for multiple calls.
960
+ # client = Google::Cloud::AssuredWorkloads::V1::AssuredWorkloadsService::Client.new
961
+ #
962
+ # # Create a request. To set request fields, pass in keyword arguments.
963
+ # request = Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationRequest.new
964
+ #
965
+ # # Call the acknowledge_violation method.
966
+ # result = client.acknowledge_violation request
967
+ #
968
+ # # The returned object is of type Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse.
969
+ # p result
970
+ #
971
+ def acknowledge_violation request, options = nil
972
+ raise ::ArgumentError, "request must be provided" if request.nil?
973
+
974
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationRequest
975
+
976
+ # Converts hash and nil to an options object
977
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
978
+
979
+ # Customize the options with defaults
980
+ metadata = @config.rpcs.acknowledge_violation.metadata.to_h
981
+
982
+ # Set x-goog-api-client and x-goog-user-project headers
983
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
984
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
985
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1::VERSION
986
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
987
+
988
+ options.apply_defaults timeout: @config.rpcs.acknowledge_violation.timeout,
989
+ metadata: metadata,
990
+ retry_policy: @config.rpcs.acknowledge_violation.retry_policy
991
+
992
+ options.apply_defaults timeout: @config.timeout,
993
+ metadata: @config.metadata,
994
+ retry_policy: @config.retry_policy
995
+
996
+ @assured_workloads_service_stub.call_rpc :acknowledge_violation, request, options: options do |response, operation|
997
+ yield response, operation if block_given?
998
+ return response
999
+ end
1000
+ rescue ::GRPC::BadStatus => e
1001
+ raise ::Google::Cloud::Error.from_error(e)
1002
+ end
1003
+
639
1004
  ##
640
1005
  # Configuration class for the AssuredWorkloadsService API.
641
1006
  #
@@ -782,6 +1147,11 @@ module Google
782
1147
  #
783
1148
  attr_reader :update_workload
784
1149
  ##
1150
+ # RPC-specific configuration for `restrict_allowed_resources`
1151
+ # @return [::Gapic::Config::Method]
1152
+ #
1153
+ attr_reader :restrict_allowed_resources
1154
+ ##
785
1155
  # RPC-specific configuration for `delete_workload`
786
1156
  # @return [::Gapic::Config::Method]
787
1157
  #
@@ -796,6 +1166,21 @@ module Google
796
1166
  # @return [::Gapic::Config::Method]
797
1167
  #
798
1168
  attr_reader :list_workloads
1169
+ ##
1170
+ # RPC-specific configuration for `list_violations`
1171
+ # @return [::Gapic::Config::Method]
1172
+ #
1173
+ attr_reader :list_violations
1174
+ ##
1175
+ # RPC-specific configuration for `get_violation`
1176
+ # @return [::Gapic::Config::Method]
1177
+ #
1178
+ attr_reader :get_violation
1179
+ ##
1180
+ # RPC-specific configuration for `acknowledge_violation`
1181
+ # @return [::Gapic::Config::Method]
1182
+ #
1183
+ attr_reader :acknowledge_violation
799
1184
 
800
1185
  # @private
801
1186
  def initialize parent_rpcs = nil
@@ -803,12 +1188,20 @@ module Google
803
1188
  @create_workload = ::Gapic::Config::Method.new create_workload_config
804
1189
  update_workload_config = parent_rpcs.update_workload if parent_rpcs.respond_to? :update_workload
805
1190
  @update_workload = ::Gapic::Config::Method.new update_workload_config
1191
+ restrict_allowed_resources_config = parent_rpcs.restrict_allowed_resources if parent_rpcs.respond_to? :restrict_allowed_resources
1192
+ @restrict_allowed_resources = ::Gapic::Config::Method.new restrict_allowed_resources_config
806
1193
  delete_workload_config = parent_rpcs.delete_workload if parent_rpcs.respond_to? :delete_workload
807
1194
  @delete_workload = ::Gapic::Config::Method.new delete_workload_config
808
1195
  get_workload_config = parent_rpcs.get_workload if parent_rpcs.respond_to? :get_workload
809
1196
  @get_workload = ::Gapic::Config::Method.new get_workload_config
810
1197
  list_workloads_config = parent_rpcs.list_workloads if parent_rpcs.respond_to? :list_workloads
811
1198
  @list_workloads = ::Gapic::Config::Method.new list_workloads_config
1199
+ list_violations_config = parent_rpcs.list_violations if parent_rpcs.respond_to? :list_violations
1200
+ @list_violations = ::Gapic::Config::Method.new list_violations_config
1201
+ get_violation_config = parent_rpcs.get_violation if parent_rpcs.respond_to? :get_violation
1202
+ @get_violation = ::Gapic::Config::Method.new get_violation_config
1203
+ acknowledge_violation_config = parent_rpcs.acknowledge_violation if parent_rpcs.respond_to? :acknowledge_violation
1204
+ @acknowledge_violation = ::Gapic::Config::Method.new acknowledge_violation_config
812
1205
 
813
1206
  yield self if block_given?
814
1207
  end
@@ -95,6 +95,9 @@ module Google
95
95
  channel_args: @config.channel_args,
96
96
  interceptors: @config.interceptors
97
97
  )
98
+
99
+ # Used by an LRO wrapper for some methods of this service
100
+ @operations_client = self
98
101
  end
99
102
 
100
103
  # Service calls
@@ -41,6 +41,27 @@ module Google
41
41
  "organizations/#{organization}/locations/#{location}"
42
42
  end
43
43
 
44
+ ##
45
+ # Create a fully-qualified Violation resource string.
46
+ #
47
+ # The resource will be in the following format:
48
+ #
49
+ # `organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation}`
50
+ #
51
+ # @param organization [String]
52
+ # @param location [String]
53
+ # @param workload [String]
54
+ # @param violation [String]
55
+ #
56
+ # @return [::String]
57
+ def violation_path organization:, location:, workload:, violation:
58
+ raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
59
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
60
+ raise ::ArgumentError, "workload cannot contain /" if workload.to_s.include? "/"
61
+
62
+ "organizations/#{organization}/locations/#{location}/workloads/#{workload}/violations/#{violation}"
63
+ end
64
+
44
65
  ##
45
66
  # Create a fully-qualified Workload resource string.
46
67
  #
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module AssuredWorkloads
23
23
  module V1
24
- VERSION = "0.2.1"
24
+ VERSION = "0.4.0"
25
25
  end
26
26
  end
27
27
  end
@@ -25,6 +25,8 @@ module Google
25
25
  ##
26
26
  # To load this package, including all its services, and instantiate a client:
27
27
  #
28
+ # @example
29
+ #
28
30
  # require "google/cloud/assured_workloads/v1"
29
31
  # client = ::Google::Cloud::AssuredWorkloads::V1::AssuredWorkloadsService::Client.new
30
32
  #