google-cloud-asset-v1 0.5.3 → 0.6.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: 789eee25202a6d2431bb58e180904105ea5cc6a88d90d588c8688896c1a342ba
4
- data.tar.gz: ee795aa5fa7486f627a2710ece7b3b0a720b2568aeae95808d08e1273d5750e2
3
+ metadata.gz: 47903709aadc0bfaa500654626a56c96aae048c5b901a5b0c60d79e6186ae997
4
+ data.tar.gz: 720eb8288342eb67e1d314ac048500bea99c7f8c6a71d1edd941048ecfac1134
5
5
  SHA512:
6
- metadata.gz: 21fd1d6ff7c8b782c6c79363192bc4ab7001f3fbeef546dbca732f2afdeffa8618e9d65ebe9974373f3d996f4ce5fbb07e2e1e639cb67debe53b1dd982676a02
7
- data.tar.gz: 322fd1f8985f3391256f7fe0526e2b9dc72f93a5a21934521f02cebd4c07dc0fe99b696bdf545a3fd68e3be8aba07bd0e30f75604de8728a53981b7fc6290584
6
+ metadata.gz: 9eaef8da1ab7e67c1efa41f4f31c88587508eb2350e2d703833967a1cb66d10a2e44e30d6af121d290a5e6f97671b8cef4c1d020965674bcdef919edc31faa6a
7
+ data.tar.gz: 5aa1b26f56d54da1627fefc83a3d6bc2bd74ae9b058ec943aa162183f1624ba0b922b0c79a60869640545a43b67cec442d8e1d77048209e3f60f60150ff1520f
@@ -119,6 +119,16 @@ module Google
119
119
  retry_codes: [4, 14]
120
120
  }
121
121
 
122
+ default_config.rpcs.analyze_iam_policy.timeout = 300.0
123
+ default_config.rpcs.analyze_iam_policy.retry_policy = {
124
+ initial_delay: 0.1,
125
+ max_delay: 60.0,
126
+ multiplier: 1.3,
127
+ retry_codes: [14]
128
+ }
129
+
130
+ default_config.rpcs.export_iam_policy_analysis.timeout = 60.0
131
+
122
132
  default_config
123
133
  end
124
134
  yield @configure if block_given?
@@ -214,14 +224,13 @@ module Google
214
224
  # Exports assets with time and resource types to a given Cloud Storage
215
225
  # location/BigQuery table. For Cloud Storage location destinations, the
216
226
  # output format is newline-delimited JSON. Each line represents a
217
- # {::Google::Cloud::Asset::V1::Asset google.cloud.asset.v1.Asset} in the JSON
218
- # format; for BigQuery table destinations, the output table stores the fields
219
- # in asset proto as columns. This API implements the
220
- # {::Google::Longrunning::Operation google.longrunning.Operation} API , which
221
- # allows you to keep track of the export. We recommend intervals of at least
222
- # 2 seconds with exponential retry to poll the export operation result. For
223
- # regular-size resource parent, the export operation usually finishes within
224
- # 5 minutes.
227
+ # {::Google::Cloud::Asset::V1::Asset google.cloud.asset.v1.Asset} in the JSON format; for BigQuery table
228
+ # destinations, the output table stores the fields in asset proto as columns.
229
+ # This API implements the {::Google::Longrunning::Operation google.longrunning.Operation} API
230
+ # , which allows you to keep track of the export. We recommend intervals of
231
+ # at least 2 seconds with exponential retry to poll the export operation
232
+ # result. For regular-size resource parent, the export operation usually
233
+ # finishes within 5 minutes.
225
234
  #
226
235
  # @overload export_assets(request, options = nil)
227
236
  # Pass arguments to `export_assets` via a request object, either of type
@@ -250,17 +259,29 @@ module Google
250
259
  # data collection and indexing, there is a volatile window during which
251
260
  # running the same query may get different results.
252
261
  # @param asset_types [::Array<::String>]
253
- # A list of asset types of which to take a snapshot for. Example:
254
- # "compute.googleapis.com/Disk". If specified, only matching assets will be
255
- # returned. See [Introduction to Cloud Asset
262
+ # A list of asset types to take a snapshot for. For example:
263
+ # "compute.googleapis.com/Disk".
264
+ #
265
+ # Regular expressions are also supported. For example:
266
+ #
267
+ # * "compute.googleapis.com.*" snapshots resources whose asset type starts
268
+ # with "compute.googleapis.com".
269
+ # * ".*Instance" snapshots resources whose asset type ends with "Instance".
270
+ # * ".*Instance.*" snapshots resources whose asset type contains "Instance".
271
+ #
272
+ # See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
273
+ # regular expression syntax. If the regular expression does not match any
274
+ # supported asset type, an INVALID_ARGUMENT error will be returned.
275
+ #
276
+ # If specified, only matching assets will be returned, otherwise, it will
277
+ # snapshot all asset types. See [Introduction to Cloud Asset
256
278
  # Inventory](https://cloud.google.com/asset-inventory/docs/overview)
257
279
  # for all supported asset types.
258
280
  # @param content_type [::Google::Cloud::Asset::V1::ContentType]
259
281
  # Asset content type. If not specified, no content but the asset name will be
260
282
  # returned.
261
283
  # @param output_config [::Google::Cloud::Asset::V1::OutputConfig, ::Hash]
262
- # Required. Output configuration indicating where the results will be output
263
- # to.
284
+ # Required. Output configuration indicating where the results will be output to.
264
285
  #
265
286
  # @yield [response, operation] Access the result along with the RPC operation
266
287
  # @yieldparam response [::Gapic::Operation]
@@ -429,8 +450,9 @@ module Google
429
450
  # Required. This is the client-assigned asset feed identifier and it needs to
430
451
  # be unique under a specific parent project/folder/organization.
431
452
  # @param feed [::Google::Cloud::Asset::V1::Feed, ::Hash]
432
- # Required. The feed details. The field `name` must be empty and it will be
433
- # generated in the format of: projects/project_number/feeds/feed_id
453
+ # Required. The feed details. The field `name` must be empty and it will be generated
454
+ # in the format of:
455
+ # projects/project_number/feeds/feed_id
434
456
  # folders/folder_number/feeds/feed_id
435
457
  # organizations/organization_number/feeds/feed_id
436
458
  #
@@ -635,8 +657,8 @@ module Google
635
657
  # the default parameter values, pass an empty Hash as a request object (see above).
636
658
  #
637
659
  # @param feed [::Google::Cloud::Asset::V1::Feed, ::Hash]
638
- # Required. The new values of feed details. It must match an existing feed
639
- # and the field `name` must be in the format of:
660
+ # Required. The new values of feed details. It must match an existing feed and the
661
+ # field `name` must be in the format of:
640
662
  # projects/project_number/feeds/feed_id or
641
663
  # folders/folder_number/feeds/feed_id or
642
664
  # organizations/organization_number/feeds/feed_id.
@@ -760,9 +782,9 @@ module Google
760
782
  end
761
783
 
762
784
  ##
763
- # Searches all the resources within the given accessible scope (e.g., a
764
- # project, a folder or an organization). Callers should have
765
- # cloud.assets.SearchAllResources permission upon the requested scope,
785
+ # Searches all Cloud resources within the specified scope, such as a project,
786
+ # folder, or organization. The caller must be granted the
787
+ # `cloudasset.assets.searchAllResources` permission on the desired scope,
766
788
  # otherwise the request will be rejected.
767
789
  #
768
790
  # @overload search_all_resources(request, options = nil)
@@ -781,70 +803,76 @@ module Google
781
803
  # the default parameter values, pass an empty Hash as a request object (see above).
782
804
  #
783
805
  # @param scope [::String]
784
- # Required. A scope can be a project, a folder or an organization. The search
785
- # is limited to the resources within the `scope`.
806
+ # Required. A scope can be a project, a folder, or an organization. The search is
807
+ # limited to the resources within the `scope`. The caller must be granted the
808
+ # [`cloudasset.assets.searchAllResources`](http://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
809
+ # permission on the desired scope.
786
810
  #
787
811
  # The allowed values are:
788
812
  #
789
- # * projects/\\{PROJECT_ID}
790
- # * projects/\\{PROJECT_NUMBER}
791
- # * folders/\\{FOLDER_NUMBER}
792
- # * organizations/\\{ORGANIZATION_NUMBER}
813
+ # * projects/\\{PROJECT_ID} (e.g., "projects/foo-bar")
814
+ # * projects/\\{PROJECT_NUMBER} (e.g., "projects/12345678")
815
+ # * folders/\\{FOLDER_NUMBER} (e.g., "folders/1234567")
816
+ # * organizations/\\{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
793
817
  # @param query [::String]
794
- # Optional. The query statement. An empty query can be specified to search
795
- # all the resources of certain `asset_types` within the given `scope`.
818
+ # Optional. The query statement. See [how to construct a
819
+ # query](http://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
820
+ # for more information. If not specified or empty, it will search all the
821
+ # resources within the specified `scope`. Note that the query string is
822
+ # compared against each Cloud IAM policy binding, including its members,
823
+ # roles, and Cloud IAM conditions. The returned Cloud IAM policies will only
824
+ # contain the bindings that match your query. To learn more about the IAM
825
+ # policy structure, see [IAM policy
826
+ # doc](https://cloud.google.com/iam/docs/policies#structure).
796
827
  #
797
828
  # Examples:
798
829
  #
799
- # * `name : "Important"` to find Cloud resources whose name contains
830
+ # * `name:Important` to find Cloud resources whose name contains
800
831
  # "Important" as a word.
801
- # * `displayName : "Impor*"` to find Cloud resources whose display name
802
- # contains "Impor" as a word prefix.
803
- # * `description : "*por*"` to find Cloud resources whose description
832
+ # * `displayName:Impor*` to find Cloud resources whose display name
833
+ # contains "Impor" as a prefix.
834
+ # * `description:*por*` to find Cloud resources whose description
804
835
  # contains "por" as a substring.
805
- # * `location : "us-west*"` to find Cloud resources whose location is
836
+ # * `location:us-west*` to find Cloud resources whose location is
806
837
  # prefixed with "us-west".
807
- # * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
838
+ # * `labels:prod` to find Cloud resources whose labels contain "prod" as
808
839
  # a key or value.
809
- # * `labels.env : "prod"` to find Cloud resources which have a label "env"
840
+ # * `labels.env:prod` to find Cloud resources that have a label "env"
810
841
  # and its value is "prod".
811
- # * `labels.env : *` to find Cloud resources which have a label "env".
812
- # * `"Important"` to find Cloud resources which contain "Important" as a word
842
+ # * `labels.env:*` to find Cloud resources that have a label "env".
843
+ # * `Important` to find Cloud resources that contain "Important" as a word
813
844
  # in any of the searchable fields.
814
- # * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
845
+ # * `Impor*` to find Cloud resources that contain "Impor" as a prefix
815
846
  # in any of the searchable fields.
816
- # * `"*por*"` to find Cloud resources which contain "por" as a substring in
847
+ # * `*por*` to find Cloud resources that contain "por" as a substring in
817
848
  # any of the searchable fields.
818
- # * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
819
- # resources which contain "Important" as a word in any of the searchable
849
+ # * `Important location:(us-west1 OR global)` to find Cloud
850
+ # resources that contain "Important" as a word in any of the searchable
820
851
  # fields and are also located in the "us-west1" region or the "global"
821
852
  # location.
822
- #
823
- # See [how to construct a
824
- # query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
825
- # for more details.
826
853
  # @param asset_types [::Array<::String>]
827
- # Optional. A list of asset types that this request searches for. If empty,
828
- # it will search all the [searchable asset
854
+ # Optional. A list of asset types that this request searches for. If empty, it will
855
+ # search all the [searchable asset
829
856
  # types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types).
830
857
  # @param page_size [::Integer]
831
- # Optional. The page size for search result pagination. Page size is capped
832
- # at 500 even if a larger value is given. If set to zero, server will pick an
833
- # appropriate default. Returned results may be fewer than requested. When
834
- # this happens, there could be more results as long as `next_page_token` is
835
- # returned.
858
+ # Optional. The page size for search result pagination. Page size is capped at 500 even
859
+ # if a larger value is given. If set to zero, server will pick an appropriate
860
+ # default. Returned results may be fewer than requested. When this happens,
861
+ # there could be more results as long as `next_page_token` is returned.
836
862
  # @param page_token [::String]
837
- # Optional. If present, then retrieve the next batch of results from the
838
- # preceding call to this method. `page_token` must be the value of
839
- # `next_page_token` from the previous response. The values of all other
840
- # method parameters, must be identical to those in the previous call.
863
+ # Optional. If present, then retrieve the next batch of results from the preceding call
864
+ # to this method. `page_token` must be the value of `next_page_token` from
865
+ # the previous response. The values of all other method parameters, must be
866
+ # identical to those in the previous call.
841
867
  # @param order_by [::String]
842
- # Optional. A comma separated list of fields specifying the sorting order of
843
- # the results. The default order is ascending. Add " DESC" after the field
844
- # name to indicate descending order. Redundant space characters are ignored.
845
- # Example: "location DESC, name". See [supported resource metadata
846
- # fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
847
- # for more details.
868
+ # Optional. A comma separated list of fields specifying the sorting order of the
869
+ # results. The default order is ascending. Add " DESC" after the field name
870
+ # to indicate descending order. Redundant space characters are ignored.
871
+ # Example: "location DESC, name". Only string fields in the response are
872
+ # sortable, including `name`, `displayName`, `description`, `location`. All
873
+ # the other fields such as repeated fields (e.g., `networkTags`), map
874
+ # fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`)
875
+ # are not supported.
848
876
  #
849
877
  # @yield [response, operation] Access the result along with the RPC operation
850
878
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::ResourceSearchResult>]
@@ -893,9 +921,9 @@ module Google
893
921
  end
894
922
 
895
923
  ##
896
- # Searches all the IAM policies within the given accessible scope (e.g., a
897
- # project, a folder or an organization). Callers should have
898
- # cloud.assets.SearchAllIamPolicies permission upon the requested scope,
924
+ # Searches all IAM policies within the specified scope, such as a project,
925
+ # folder, or organization. The caller must be granted the
926
+ # `cloudasset.assets.searchAllIamPolicies` permission on the desired scope,
899
927
  # otherwise the request will be rejected.
900
928
  #
901
929
  # @overload search_all_iam_policies(request, options = nil)
@@ -914,48 +942,55 @@ module Google
914
942
  # the default parameter values, pass an empty Hash as a request object (see above).
915
943
  #
916
944
  # @param scope [::String]
917
- # Required. A scope can be a project, a folder or an organization. The search
918
- # is limited to the IAM policies within the `scope`.
945
+ # Required. A scope can be a project, a folder, or an organization. The search is
946
+ # limited to the IAM policies within the `scope`. The caller must be granted
947
+ # the
948
+ # [`cloudasset.assets.searchAllIamPolicies`](http://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
949
+ # permission on the desired scope.
919
950
  #
920
951
  # The allowed values are:
921
952
  #
922
- # * projects/\\{PROJECT_ID}
923
- # * projects/\\{PROJECT_NUMBER}
924
- # * folders/\\{FOLDER_NUMBER}
925
- # * organizations/\\{ORGANIZATION_NUMBER}
953
+ # * projects/\\{PROJECT_ID} (e.g., "projects/foo-bar")
954
+ # * projects/\\{PROJECT_NUMBER} (e.g., "projects/12345678")
955
+ # * folders/\\{FOLDER_NUMBER} (e.g., "folders/1234567")
956
+ # * organizations/\\{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
926
957
  # @param query [::String]
927
- # Optional. The query statement. An empty query can be specified to search
928
- # all the IAM policies within the given `scope`.
958
+ # Optional. The query statement. See [how to construct a
959
+ # query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
960
+ # for more information. If not specified or empty, it will search all the
961
+ # IAM policies within the specified `scope`.
929
962
  #
930
963
  # Examples:
931
964
  #
932
- # * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
933
- # specify user "amy@gmail.com".
934
- # * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
935
- # specify the Compute Admin role.
936
- # * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
937
- # policy bindings that specify a role containing "storage.buckets.update"
938
- # permission.
939
- # * `resource : "organizations/123"` to find Cloud IAM policy bindings that
940
- # are set on "organizations/123".
941
- # * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
942
- # to find Cloud IAM policy bindings that are set on "organizations/123" or
943
- # "folders/1234", and also specify user "amy".
944
- #
945
- # See [how to construct a
946
- # query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
947
- # for more details.
965
+ # * `policy:amy@gmail.com` to find IAM policy bindings that specify user
966
+ # "amy@gmail.com".
967
+ # * `policy:roles/compute.admin` to find IAM policy bindings that specify
968
+ # the Compute Admin role.
969
+ # * `policy.role.permissions:storage.buckets.update` to find IAM policy
970
+ # bindings that specify a role containing "storage.buckets.update"
971
+ # permission. Note that if callers don't have `iam.roles.get` access to a
972
+ # role's included permissions, policy bindings that specify this role will
973
+ # be dropped from the search results.
974
+ # * `resource:organizations/123456` to find IAM policy bindings
975
+ # that are set on "organizations/123456".
976
+ # * `Important` to find IAM policy bindings that contain "Important" as a
977
+ # word in any of the searchable fields (except for the included
978
+ # permissions).
979
+ # * `*por*` to find IAM policy bindings that contain "por" as a substring
980
+ # in any of the searchable fields (except for the included permissions).
981
+ # * `resource:(instance1 OR instance2) policy:amy` to find
982
+ # IAM policy bindings that are set on resources "instance1" or
983
+ # "instance2" and also specify user "amy".
948
984
  # @param page_size [::Integer]
949
- # Optional. The page size for search result pagination. Page size is capped
950
- # at 500 even if a larger value is given. If set to zero, server will pick an
951
- # appropriate default. Returned results may be fewer than requested. When
952
- # this happens, there could be more results as long as `next_page_token` is
953
- # returned.
985
+ # Optional. The page size for search result pagination. Page size is capped at 500 even
986
+ # if a larger value is given. If set to zero, server will pick an appropriate
987
+ # default. Returned results may be fewer than requested. When this happens,
988
+ # there could be more results as long as `next_page_token` is returned.
954
989
  # @param page_token [::String]
955
- # Optional. If present, retrieve the next batch of results from the preceding
956
- # call to this method. `page_token` must be the value of `next_page_token`
957
- # from the previous response. The values of all other method parameters must
958
- # be identical to those in the previous call.
990
+ # Optional. If present, retrieve the next batch of results from the preceding call to
991
+ # this method. `page_token` must be the value of `next_page_token` from the
992
+ # previous response. The values of all other method parameters must be
993
+ # identical to those in the previous call.
959
994
  #
960
995
  # @yield [response, operation] Access the result along with the RPC operation
961
996
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::IamPolicySearchResult>]
@@ -1003,6 +1038,176 @@ module Google
1003
1038
  raise ::Google::Cloud::Error.from_error(e)
1004
1039
  end
1005
1040
 
1041
+ ##
1042
+ # Analyzes IAM policies to answer which identities have what accesses on
1043
+ # which resources.
1044
+ #
1045
+ # @overload analyze_iam_policy(request, options = nil)
1046
+ # Pass arguments to `analyze_iam_policy` via a request object, either of type
1047
+ # {::Google::Cloud::Asset::V1::AnalyzeIamPolicyRequest} or an equivalent Hash.
1048
+ #
1049
+ # @param request [::Google::Cloud::Asset::V1::AnalyzeIamPolicyRequest, ::Hash]
1050
+ # A request object representing the call parameters. Required. To specify no
1051
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1052
+ # @param options [::Gapic::CallOptions, ::Hash]
1053
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1054
+ #
1055
+ # @overload analyze_iam_policy(analysis_query: nil, execution_timeout: nil)
1056
+ # Pass arguments to `analyze_iam_policy` via keyword arguments. Note that at
1057
+ # least one keyword argument is required. To specify no parameters, or to keep all
1058
+ # the default parameter values, pass an empty Hash as a request object (see above).
1059
+ #
1060
+ # @param analysis_query [::Google::Cloud::Asset::V1::IamPolicyAnalysisQuery, ::Hash]
1061
+ # The request query.
1062
+ # @param execution_timeout [::Google::Protobuf::Duration, ::Hash]
1063
+ # Amount of time executable has to complete. See JSON representation of
1064
+ # [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json).
1065
+ #
1066
+ # If this field is set with a value less than the RPC deadline, and the
1067
+ # execution of your query hasn't finished in the specified
1068
+ # execution timeout, you will get a response with partial result.
1069
+ # Otherwise, your query's execution will continue until the RPC deadline.
1070
+ # If it's not finished until then, you will get a DEADLINE_EXCEEDED error.
1071
+ #
1072
+ # Default is empty.
1073
+ #
1074
+ # (-- We had discussion of whether we should have this field in the --)
1075
+ # (-- request or use the RPC deadline instead. We finally choose this --)
1076
+ # (-- approach for the following reasons (detailed in --)
1077
+ # (-- go/analyze-iam-policy-deadlines): --)
1078
+ # (-- * HTTP clients have very limited support of the RPC deadline. --)
1079
+ # (-- There is an X-Server-Timeout header introduced in 2019/09, but --)
1080
+ # (-- only implemented in the C++ HTTP server library. --)
1081
+ # (-- * The purpose of the RPC deadline is for RPC clients to --)
1082
+ # (-- communicate its max waiting time to the server. This deadline --)
1083
+ # (-- could be further propagated to the downstream servers. It is --)
1084
+ # (-- mainly used for servers to cancel the request processing --)
1085
+ # (-- to avoid resource wasting. Overloading the RPC deadline for --)
1086
+ # (-- other purposes could make our backend system harder to reason --)
1087
+ # (-- about. --)
1088
+ #
1089
+ # @yield [response, operation] Access the result along with the RPC operation
1090
+ # @yieldparam response [::Google::Cloud::Asset::V1::AnalyzeIamPolicyResponse]
1091
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1092
+ #
1093
+ # @return [::Google::Cloud::Asset::V1::AnalyzeIamPolicyResponse]
1094
+ #
1095
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1096
+ #
1097
+ def analyze_iam_policy request, options = nil
1098
+ raise ::ArgumentError, "request must be provided" if request.nil?
1099
+
1100
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::AnalyzeIamPolicyRequest
1101
+
1102
+ # Converts hash and nil to an options object
1103
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1104
+
1105
+ # Customize the options with defaults
1106
+ metadata = @config.rpcs.analyze_iam_policy.metadata.to_h
1107
+
1108
+ # Set x-goog-api-client and x-goog-user-project headers
1109
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1110
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1111
+ gapic_version: ::Google::Cloud::Asset::V1::VERSION
1112
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1113
+
1114
+ header_params = {
1115
+ "analysis_query.scope" => request.analysis_query.scope
1116
+ }
1117
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1118
+ metadata[:"x-goog-request-params"] ||= request_params_header
1119
+
1120
+ options.apply_defaults timeout: @config.rpcs.analyze_iam_policy.timeout,
1121
+ metadata: metadata,
1122
+ retry_policy: @config.rpcs.analyze_iam_policy.retry_policy
1123
+ options.apply_defaults metadata: @config.metadata,
1124
+ retry_policy: @config.retry_policy
1125
+
1126
+ @asset_service_stub.call_rpc :analyze_iam_policy, request, options: options do |response, operation|
1127
+ yield response, operation if block_given?
1128
+ return response
1129
+ end
1130
+ rescue ::GRPC::BadStatus => e
1131
+ raise ::Google::Cloud::Error.from_error(e)
1132
+ end
1133
+
1134
+ ##
1135
+ # Exports the answers of which identities have what accesses on which
1136
+ # resources to a Google Cloud Storage or a BigQuery destination. For Cloud
1137
+ # Storage destination, the output format is the JSON format that represents a
1138
+ # {::Google::Cloud::Asset::V1::AnalyzeIamPolicyResponse google.cloud.asset.v1.AnalyzeIamPolicyResponse}.
1139
+ # This method implements the
1140
+ # {::Google::Longrunning::Operation google.longrunning.Operation}, which allows
1141
+ # you to track the export status. We recommend intervals of at least 2
1142
+ # seconds with exponential retry to poll the export operation result. The
1143
+ # metadata contains the request to help callers to map responses to requests.
1144
+ #
1145
+ # @overload export_iam_policy_analysis(request, options = nil)
1146
+ # Pass arguments to `export_iam_policy_analysis` via a request object, either of type
1147
+ # {::Google::Cloud::Asset::V1::ExportIamPolicyAnalysisRequest} or an equivalent Hash.
1148
+ #
1149
+ # @param request [::Google::Cloud::Asset::V1::ExportIamPolicyAnalysisRequest, ::Hash]
1150
+ # A request object representing the call parameters. Required. To specify no
1151
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1152
+ # @param options [::Gapic::CallOptions, ::Hash]
1153
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1154
+ #
1155
+ # @overload export_iam_policy_analysis(analysis_query: nil, output_config: nil)
1156
+ # Pass arguments to `export_iam_policy_analysis` via keyword arguments. Note that at
1157
+ # least one keyword argument is required. To specify no parameters, or to keep all
1158
+ # the default parameter values, pass an empty Hash as a request object (see above).
1159
+ #
1160
+ # @param analysis_query [::Google::Cloud::Asset::V1::IamPolicyAnalysisQuery, ::Hash]
1161
+ # The request query.
1162
+ # @param output_config [::Google::Cloud::Asset::V1::IamPolicyAnalysisOutputConfig, ::Hash]
1163
+ # Output configuration indicating where the results will be output to.
1164
+ #
1165
+ # @yield [response, operation] Access the result along with the RPC operation
1166
+ # @yieldparam response [::Gapic::Operation]
1167
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1168
+ #
1169
+ # @return [::Gapic::Operation]
1170
+ #
1171
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1172
+ #
1173
+ def export_iam_policy_analysis request, options = nil
1174
+ raise ::ArgumentError, "request must be provided" if request.nil?
1175
+
1176
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::ExportIamPolicyAnalysisRequest
1177
+
1178
+ # Converts hash and nil to an options object
1179
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1180
+
1181
+ # Customize the options with defaults
1182
+ metadata = @config.rpcs.export_iam_policy_analysis.metadata.to_h
1183
+
1184
+ # Set x-goog-api-client and x-goog-user-project headers
1185
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1186
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1187
+ gapic_version: ::Google::Cloud::Asset::V1::VERSION
1188
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1189
+
1190
+ header_params = {
1191
+ "analysis_query.scope" => request.analysis_query.scope
1192
+ }
1193
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1194
+ metadata[:"x-goog-request-params"] ||= request_params_header
1195
+
1196
+ options.apply_defaults timeout: @config.rpcs.export_iam_policy_analysis.timeout,
1197
+ metadata: metadata,
1198
+ retry_policy: @config.rpcs.export_iam_policy_analysis.retry_policy
1199
+ options.apply_defaults metadata: @config.metadata,
1200
+ retry_policy: @config.retry_policy
1201
+
1202
+ @asset_service_stub.call_rpc :export_iam_policy_analysis, request, options: options do |response, operation|
1203
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1204
+ yield response, operation if block_given?
1205
+ return response
1206
+ end
1207
+ rescue ::GRPC::BadStatus => e
1208
+ raise ::Google::Cloud::Error.from_error(e)
1209
+ end
1210
+
1006
1211
  ##
1007
1212
  # Configuration class for the AssetService API.
1008
1213
  #
@@ -1184,6 +1389,16 @@ module Google
1184
1389
  # @return [::Gapic::Config::Method]
1185
1390
  #
1186
1391
  attr_reader :search_all_iam_policies
1392
+ ##
1393
+ # RPC-specific configuration for `analyze_iam_policy`
1394
+ # @return [::Gapic::Config::Method]
1395
+ #
1396
+ attr_reader :analyze_iam_policy
1397
+ ##
1398
+ # RPC-specific configuration for `export_iam_policy_analysis`
1399
+ # @return [::Gapic::Config::Method]
1400
+ #
1401
+ attr_reader :export_iam_policy_analysis
1187
1402
 
1188
1403
  # @private
1189
1404
  def initialize parent_rpcs = nil
@@ -1205,6 +1420,10 @@ module Google
1205
1420
  @search_all_resources = ::Gapic::Config::Method.new search_all_resources_config
1206
1421
  search_all_iam_policies_config = parent_rpcs&.search_all_iam_policies if parent_rpcs&.respond_to? :search_all_iam_policies
1207
1422
  @search_all_iam_policies = ::Gapic::Config::Method.new search_all_iam_policies_config
1423
+ analyze_iam_policy_config = parent_rpcs&.analyze_iam_policy if parent_rpcs&.respond_to? :analyze_iam_policy
1424
+ @analyze_iam_policy = ::Gapic::Config::Method.new analyze_iam_policy_config
1425
+ export_iam_policy_analysis_config = parent_rpcs&.export_iam_policy_analysis if parent_rpcs&.respond_to? :export_iam_policy_analysis
1426
+ @export_iam_policy_analysis = ::Gapic::Config::Method.new export_iam_policy_analysis_config
1208
1427
 
1209
1428
  yield self if block_given?
1210
1429
  end