google-cloud-asset-v1 0.4.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: f46ad7edc434252f8c8dee87bfba260b8aa24346e300cf6ab7d442e81c89c3e1
4
- data.tar.gz: 56d5a1b6d03b3b5a8ec8448266abd000d76dc0e06245b6590a7f2739e32852f7
3
+ metadata.gz: 47903709aadc0bfaa500654626a56c96aae048c5b901a5b0c60d79e6186ae997
4
+ data.tar.gz: 720eb8288342eb67e1d314ac048500bea99c7f8c6a71d1edd941048ecfac1134
5
5
  SHA512:
6
- metadata.gz: f12603eeb775698889082767fec48569b8a072e9029a42f9f4399e50148d9e322fb608fa2a13c8236980aae9249b63c011f7146aa7fa856a2a249a00bd435cf0
7
- data.tar.gz: 433f992728d70ada4cce95693659300799287c9482be3d481ab9e9ea02fc8c712b0e4acc4a1be603272ae1a9c9634d5a1134204591e3644fb0249faf7e949b55
6
+ metadata.gz: 9eaef8da1ab7e67c1efa41f4f31c88587508eb2350e2d703833967a1cb66d10a2e44e30d6af121d290a5e6f97671b8cef4c1d020965674bcdef919edc31faa6a
7
+ data.tar.gz: 5aa1b26f56d54da1627fefc83a3d6bc2bd74ae9b058ec943aa162183f1624ba0b922b0c79a60869640545a43b67cec442d8e1d77048209e3f60f60150ff1520f
data/README.md CHANGED
@@ -18,6 +18,7 @@ In order to use this library, you first need to go through the following steps:
18
18
 
19
19
  1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
20
20
  1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
21
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/cloudasset.googleapis.com)
21
22
  1. {file:AUTHENTICATION.md Set up authentication.}
22
23
 
23
24
  ## Quick Start
@@ -33,6 +34,9 @@ response = client.export_assets request
33
34
  View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-asset-v1/latest)
34
35
  for class and method documentation.
35
36
 
37
+ See also the [Product Documentation](https://cloud.google.com/asset-inventory/)
38
+ for general usage information.
39
+
36
40
  ## Enabling Logging
37
41
 
38
42
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
@@ -72,7 +72,35 @@ module Google
72
72
  initial_delay: 0.1,
73
73
  max_delay: 60.0,
74
74
  multiplier: 1.3,
75
- retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
75
+ retry_codes: [4, 14]
76
+ }
77
+
78
+ default_config.rpcs.create_feed.timeout = 60.0
79
+
80
+ default_config.rpcs.get_feed.timeout = 60.0
81
+ default_config.rpcs.get_feed.retry_policy = {
82
+ initial_delay: 0.1,
83
+ max_delay: 60.0,
84
+ multiplier: 1.3,
85
+ retry_codes: [4, 14]
86
+ }
87
+
88
+ default_config.rpcs.list_feeds.timeout = 60.0
89
+ default_config.rpcs.list_feeds.retry_policy = {
90
+ initial_delay: 0.1,
91
+ max_delay: 60.0,
92
+ multiplier: 1.3,
93
+ retry_codes: [4, 14]
94
+ }
95
+
96
+ default_config.rpcs.update_feed.timeout = 60.0
97
+
98
+ default_config.rpcs.delete_feed.timeout = 60.0
99
+ default_config.rpcs.delete_feed.retry_policy = {
100
+ initial_delay: 0.1,
101
+ max_delay: 60.0,
102
+ multiplier: 1.3,
103
+ retry_codes: [4, 14]
76
104
  }
77
105
 
78
106
  default_config.rpcs.search_all_resources.timeout = 15.0
@@ -80,7 +108,7 @@ module Google
80
108
  initial_delay: 0.1,
81
109
  max_delay: 60.0,
82
110
  multiplier: 1.3,
83
- retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
111
+ retry_codes: [4, 14]
84
112
  }
85
113
 
86
114
  default_config.rpcs.search_all_iam_policies.timeout = 15.0
@@ -88,9 +116,19 @@ module Google
88
116
  initial_delay: 0.1,
89
117
  max_delay: 60.0,
90
118
  multiplier: 1.3,
91
- retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
119
+ retry_codes: [4, 14]
92
120
  }
93
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
+
94
132
  default_config
95
133
  end
96
134
  yield @configure if block_given?
@@ -184,10 +222,15 @@ module Google
184
222
 
185
223
  ##
186
224
  # Exports assets with time and resource types to a given Cloud Storage
187
- # location. The output format is newline-delimited JSON.
188
- # This API implements the
189
- # {::Google::Longrunning::Operation google.longrunning.Operation} API allowing
190
- # you to keep track of the export.
225
+ # location/BigQuery table. For Cloud Storage location destinations, the
226
+ # output format is newline-delimited JSON. Each line represents a
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.
191
234
  #
192
235
  # @overload export_assets(request, options = nil)
193
236
  # Pass arguments to `export_assets` via a request object, either of type
@@ -216,17 +259,29 @@ module Google
216
259
  # data collection and indexing, there is a volatile window during which
217
260
  # running the same query may get different results.
218
261
  # @param asset_types [::Array<::String>]
219
- # A list of asset types of which to take a snapshot for. For example:
220
- # "compute.googleapis.com/Disk". If specified, only matching assets will be
221
- # 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
222
278
  # Inventory](https://cloud.google.com/asset-inventory/docs/overview)
223
279
  # for all supported asset types.
224
280
  # @param content_type [::Google::Cloud::Asset::V1::ContentType]
225
281
  # Asset content type. If not specified, no content but the asset name will be
226
282
  # returned.
227
283
  # @param output_config [::Google::Cloud::Asset::V1::OutputConfig, ::Hash]
228
- # Required. Output configuration indicating where the results will be output
229
- # to. All results will be in newline delimited JSON format.
284
+ # Required. Output configuration indicating where the results will be output to.
230
285
  #
231
286
  # @yield [response, operation] Access the result along with the RPC operation
232
287
  # @yieldparam response [::Gapic::Operation]
@@ -276,10 +331,10 @@ module Google
276
331
 
277
332
  ##
278
333
  # Batch gets the update history of assets that overlap a time window.
279
- # For RESOURCE content, this API outputs history with asset in both
280
- # non-delete or deleted status.
281
334
  # For IAM_POLICY content, this API outputs history when the asset and its
282
335
  # attached IAM POLICY both exist. This can create gaps in the output history.
336
+ # Otherwise, this API outputs history with asset in both non-delete or
337
+ # deleted status.
283
338
  # If a specified asset does not exist, this API returns an INVALID_ARGUMENT
284
339
  # error.
285
340
  #
@@ -303,13 +358,11 @@ module Google
303
358
  # organization number (such as "organizations/123"), a project ID (such as
304
359
  # "projects/my-project-id")", or a project number (such as "projects/12345").
305
360
  # @param asset_names [::Array<::String>]
306
- # A list of the full names of the assets. For example:
361
+ # A list of the full names of the assets.
362
+ # See: https://cloud.google.com/asset-inventory/docs/resource-name-format
363
+ # Example:
364
+ #
307
365
  # `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
308
- # See [Resource
309
- # Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
310
- # and [Resource Name
311
- # Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
312
- # for more info.
313
366
  #
314
367
  # The request becomes a no-op if the asset name list is empty, and the max
315
368
  # size of the asset name list is 100 in one request.
@@ -397,8 +450,9 @@ module Google
397
450
  # Required. This is the client-assigned asset feed identifier and it needs to
398
451
  # be unique under a specific parent project/folder/organization.
399
452
  # @param feed [::Google::Cloud::Asset::V1::Feed, ::Hash]
400
- # Required. The feed details. The field `name` must be empty and it will be
401
- # 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
402
456
  # folders/folder_number/feeds/feed_id
403
457
  # organizations/organization_number/feeds/feed_id
404
458
  #
@@ -603,8 +657,8 @@ module Google
603
657
  # the default parameter values, pass an empty Hash as a request object (see above).
604
658
  #
605
659
  # @param feed [::Google::Cloud::Asset::V1::Feed, ::Hash]
606
- # Required. The new values of feed details. It must match an existing feed
607
- # 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:
608
662
  # projects/project_number/feeds/feed_id or
609
663
  # folders/folder_number/feeds/feed_id or
610
664
  # organizations/organization_number/feeds/feed_id.
@@ -728,9 +782,9 @@ module Google
728
782
  end
729
783
 
730
784
  ##
731
- # Searches all the resources within the given accessible scope (e.g., a
732
- # project, a folder or an organization). Callers should have
733
- # 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,
734
788
  # otherwise the request will be rejected.
735
789
  #
736
790
  # @overload search_all_resources(request, options = nil)
@@ -749,70 +803,76 @@ module Google
749
803
  # the default parameter values, pass an empty Hash as a request object (see above).
750
804
  #
751
805
  # @param scope [::String]
752
- # Required. A scope can be a project, a folder or an organization. The search
753
- # 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.
754
810
  #
755
811
  # The allowed values are:
756
812
  #
757
- # * projects/\\{PROJECT_ID}
758
- # * projects/\\{PROJECT_NUMBER}
759
- # * folders/\\{FOLDER_NUMBER}
760
- # * 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")
761
817
  # @param query [::String]
762
- # Optional. The query statement. An empty query can be specified to search
763
- # 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).
764
827
  #
765
828
  # Examples:
766
829
  #
767
- # * `name : "Important"` to find Cloud resources whose name contains
830
+ # * `name:Important` to find Cloud resources whose name contains
768
831
  # "Important" as a word.
769
- # * `displayName : "Impor*"` to find Cloud resources whose display name
770
- # contains "Impor" as a word prefix.
771
- # * `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
772
835
  # contains "por" as a substring.
773
- # * `location : "us-west*"` to find Cloud resources whose location is
836
+ # * `location:us-west*` to find Cloud resources whose location is
774
837
  # prefixed with "us-west".
775
- # * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
838
+ # * `labels:prod` to find Cloud resources whose labels contain "prod" as
776
839
  # a key or value.
777
- # * `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"
778
841
  # and its value is "prod".
779
- # * `labels.env : *` to find Cloud resources which have a label "env".
780
- # * `"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
781
844
  # in any of the searchable fields.
782
- # * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
845
+ # * `Impor*` to find Cloud resources that contain "Impor" as a prefix
783
846
  # in any of the searchable fields.
784
- # * `"*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
785
848
  # any of the searchable fields.
786
- # * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
787
- # 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
788
851
  # fields and are also located in the "us-west1" region or the "global"
789
852
  # location.
790
- #
791
- # See [how to construct a
792
- # query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
793
- # for more details.
794
853
  # @param asset_types [::Array<::String>]
795
- # Optional. A list of asset types that this request searches for. If empty,
796
- # 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
797
856
  # types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types).
798
857
  # @param page_size [::Integer]
799
- # Optional. The page size for search result pagination. Page size is capped
800
- # at 500 even if a larger value is given. If set to zero, server will pick an
801
- # appropriate default. Returned results may be fewer than requested. When
802
- # this happens, there could be more results as long as `next_page_token` is
803
- # 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.
804
862
  # @param page_token [::String]
805
- # Optional. If present, then retrieve the next batch of results from the
806
- # preceding call to this method. `page_token` must be the value of
807
- # `next_page_token` from the previous response. The values of all other
808
- # 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.
809
867
  # @param order_by [::String]
810
- # Optional. A comma separated list of fields specifying the sorting order of
811
- # the results. The default order is ascending. Add " DESC" after the field
812
- # name to indicate descending order. Redundant space characters are ignored.
813
- # Example: "location DESC, name". See [supported resource metadata
814
- # fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
815
- # 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.
816
876
  #
817
877
  # @yield [response, operation] Access the result along with the RPC operation
818
878
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::ResourceSearchResult>]
@@ -861,9 +921,9 @@ module Google
861
921
  end
862
922
 
863
923
  ##
864
- # Searches all the IAM policies within the given accessible scope (e.g., a
865
- # project, a folder or an organization). Callers should have
866
- # 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,
867
927
  # otherwise the request will be rejected.
868
928
  #
869
929
  # @overload search_all_iam_policies(request, options = nil)
@@ -882,48 +942,55 @@ module Google
882
942
  # the default parameter values, pass an empty Hash as a request object (see above).
883
943
  #
884
944
  # @param scope [::String]
885
- # Required. A scope can be a project, a folder or an organization. The search
886
- # 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.
887
950
  #
888
951
  # The allowed values are:
889
952
  #
890
- # * projects/\\{PROJECT_ID}
891
- # * projects/\\{PROJECT_NUMBER}
892
- # * folders/\\{FOLDER_NUMBER}
893
- # * 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")
894
957
  # @param query [::String]
895
- # Optional. The query statement. An empty query can be specified to search
896
- # 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`.
897
962
  #
898
963
  # Examples:
899
964
  #
900
- # * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
901
- # specify user "amy@gmail.com".
902
- # * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
903
- # specify the Compute Admin role.
904
- # * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
905
- # policy bindings that specify a role containing "storage.buckets.update"
906
- # permission.
907
- # * `resource : "organizations/123"` to find Cloud IAM policy bindings that
908
- # are set on "organizations/123".
909
- # * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
910
- # to find Cloud IAM policy bindings that are set on "organizations/123" or
911
- # "folders/1234", and also specify user "amy".
912
- #
913
- # See [how to construct a
914
- # query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
915
- # 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".
916
984
  # @param page_size [::Integer]
917
- # Optional. The page size for search result pagination. Page size is capped
918
- # at 500 even if a larger value is given. If set to zero, server will pick an
919
- # appropriate default. Returned results may be fewer than requested. When
920
- # this happens, there could be more results as long as `next_page_token` is
921
- # 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.
922
989
  # @param page_token [::String]
923
- # Optional. If present, retrieve the next batch of results from the preceding
924
- # call to this method. `page_token` must be the value of `next_page_token`
925
- # from the previous response. The values of all other method parameters must
926
- # 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.
927
994
  #
928
995
  # @yield [response, operation] Access the result along with the RPC operation
929
996
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::IamPolicySearchResult>]
@@ -971,6 +1038,176 @@ module Google
971
1038
  raise ::Google::Cloud::Error.from_error(e)
972
1039
  end
973
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
+
974
1211
  ##
975
1212
  # Configuration class for the AssetService API.
976
1213
  #
@@ -1056,7 +1293,7 @@ module Google
1056
1293
 
1057
1294
  config_attr :endpoint, "cloudasset.googleapis.com", ::String
1058
1295
  config_attr :credentials, nil do |value|
1059
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1296
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1060
1297
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1061
1298
  allowed.any? { |klass| klass === value }
1062
1299
  end
@@ -1152,6 +1389,16 @@ module Google
1152
1389
  # @return [::Gapic::Config::Method]
1153
1390
  #
1154
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
1155
1402
 
1156
1403
  # @private
1157
1404
  def initialize parent_rpcs = nil
@@ -1173,6 +1420,10 @@ module Google
1173
1420
  @search_all_resources = ::Gapic::Config::Method.new search_all_resources_config
1174
1421
  search_all_iam_policies_config = parent_rpcs&.search_all_iam_policies if parent_rpcs&.respond_to? :search_all_iam_policies
1175
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
1176
1427
 
1177
1428
  yield self if block_given?
1178
1429
  end