google-cloud-asset-v1 0.5.2 → 0.8.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: 9dbd360a64ed48dfbf749f266ab5c5338e8ded9409c34d28a7688f58c2c952e6
4
- data.tar.gz: 9515e97298798479197877d170ec3b496ac28f214e72b5c283fcda41315d2323
3
+ metadata.gz: '05390bfafbb8f33e2657eafdb8ea02df48f64fe22566b08677f7283e93247abf'
4
+ data.tar.gz: d4fc94fdf2eb291f3c16092cf1642567a27b2cb750ed5c0a2ccf0211f3cfc291
5
5
  SHA512:
6
- metadata.gz: 2e50236aa6ef4801b77150d09b9c3bfc75fde0022e54b00d7310670255f7306c8ed54e3de05ecdaf408c6b5819b3773b7981e0c265656cc95be0209ed44ebcf1
7
- data.tar.gz: 252d7eb1beeb6fb3f265403318ae903d6da4a0785fb2b3ae049fe31bc173c309ae71f746139cd80b69511b9e97594730068148bef038a8ec46fcc08090502b7b
6
+ metadata.gz: 6109bc11e6dee3a83b058f27b9ffff14dc921eda4b055667cf9ad6cd1ebb43238d088545441d67006b036d80fd3f55d5d81eb46bb88ee3b08cc4b2b2fe941079
7
+ data.tar.gz: f872c116d26b2479e77d9922c3a49cdbbb37ed1b7f3e40cfdd823353075041a13cb7d4f8d716df134f537c87907f8ed6f3ff26f35bfb095da2c249c9603af3e6
@@ -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.analyze_iam_policy_longrunning.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,161 @@ 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
+ # Required. The request query.
1062
+ # @param execution_timeout [::Google::Protobuf::Duration, ::Hash]
1063
+ # Optional. 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
+ # @yield [response, operation] Access the result along with the RPC operation
1075
+ # @yieldparam response [::Google::Cloud::Asset::V1::AnalyzeIamPolicyResponse]
1076
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1077
+ #
1078
+ # @return [::Google::Cloud::Asset::V1::AnalyzeIamPolicyResponse]
1079
+ #
1080
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1081
+ #
1082
+ def analyze_iam_policy request, options = nil
1083
+ raise ::ArgumentError, "request must be provided" if request.nil?
1084
+
1085
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::AnalyzeIamPolicyRequest
1086
+
1087
+ # Converts hash and nil to an options object
1088
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1089
+
1090
+ # Customize the options with defaults
1091
+ metadata = @config.rpcs.analyze_iam_policy.metadata.to_h
1092
+
1093
+ # Set x-goog-api-client and x-goog-user-project headers
1094
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1095
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1096
+ gapic_version: ::Google::Cloud::Asset::V1::VERSION
1097
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1098
+
1099
+ header_params = {
1100
+ "analysis_query.scope" => request.analysis_query.scope
1101
+ }
1102
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1103
+ metadata[:"x-goog-request-params"] ||= request_params_header
1104
+
1105
+ options.apply_defaults timeout: @config.rpcs.analyze_iam_policy.timeout,
1106
+ metadata: metadata,
1107
+ retry_policy: @config.rpcs.analyze_iam_policy.retry_policy
1108
+ options.apply_defaults metadata: @config.metadata,
1109
+ retry_policy: @config.retry_policy
1110
+
1111
+ @asset_service_stub.call_rpc :analyze_iam_policy, request, options: options do |response, operation|
1112
+ yield response, operation if block_given?
1113
+ return response
1114
+ end
1115
+ rescue ::GRPC::BadStatus => e
1116
+ raise ::Google::Cloud::Error.from_error(e)
1117
+ end
1118
+
1119
+ ##
1120
+ # Analyzes IAM policies asynchronously to answer which identities have what
1121
+ # accesses on which resources, and writes the analysis results to a Google
1122
+ # Cloud Storage or a BigQuery destination. For Cloud Storage destination, the
1123
+ # output format is the JSON format that represents a
1124
+ # {::Google::Cloud::Asset::V1::AnalyzeIamPolicyResponse AnalyzeIamPolicyResponse}. This method implements the
1125
+ # {::Google::Longrunning::Operation google.longrunning.Operation}, which allows you to track the operation
1126
+ # status. We recommend intervals of at least 2 seconds with exponential
1127
+ # backoff retry to poll the operation result. The metadata contains the
1128
+ # request to help callers to map responses to requests.
1129
+ #
1130
+ # @overload analyze_iam_policy_longrunning(request, options = nil)
1131
+ # Pass arguments to `analyze_iam_policy_longrunning` via a request object, either of type
1132
+ # {::Google::Cloud::Asset::V1::AnalyzeIamPolicyLongrunningRequest} or an equivalent Hash.
1133
+ #
1134
+ # @param request [::Google::Cloud::Asset::V1::AnalyzeIamPolicyLongrunningRequest, ::Hash]
1135
+ # A request object representing the call parameters. Required. To specify no
1136
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1137
+ # @param options [::Gapic::CallOptions, ::Hash]
1138
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1139
+ #
1140
+ # @overload analyze_iam_policy_longrunning(analysis_query: nil, output_config: nil)
1141
+ # Pass arguments to `analyze_iam_policy_longrunning` via keyword arguments. Note that at
1142
+ # least one keyword argument is required. To specify no parameters, or to keep all
1143
+ # the default parameter values, pass an empty Hash as a request object (see above).
1144
+ #
1145
+ # @param analysis_query [::Google::Cloud::Asset::V1::IamPolicyAnalysisQuery, ::Hash]
1146
+ # Required. The request query.
1147
+ # @param output_config [::Google::Cloud::Asset::V1::IamPolicyAnalysisOutputConfig, ::Hash]
1148
+ # Required. Output configuration indicating where the results will be output to.
1149
+ #
1150
+ # @yield [response, operation] Access the result along with the RPC operation
1151
+ # @yieldparam response [::Gapic::Operation]
1152
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1153
+ #
1154
+ # @return [::Gapic::Operation]
1155
+ #
1156
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1157
+ #
1158
+ def analyze_iam_policy_longrunning request, options = nil
1159
+ raise ::ArgumentError, "request must be provided" if request.nil?
1160
+
1161
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::AnalyzeIamPolicyLongrunningRequest
1162
+
1163
+ # Converts hash and nil to an options object
1164
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1165
+
1166
+ # Customize the options with defaults
1167
+ metadata = @config.rpcs.analyze_iam_policy_longrunning.metadata.to_h
1168
+
1169
+ # Set x-goog-api-client and x-goog-user-project headers
1170
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1171
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1172
+ gapic_version: ::Google::Cloud::Asset::V1::VERSION
1173
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1174
+
1175
+ header_params = {
1176
+ "analysis_query.scope" => request.analysis_query.scope
1177
+ }
1178
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1179
+ metadata[:"x-goog-request-params"] ||= request_params_header
1180
+
1181
+ options.apply_defaults timeout: @config.rpcs.analyze_iam_policy_longrunning.timeout,
1182
+ metadata: metadata,
1183
+ retry_policy: @config.rpcs.analyze_iam_policy_longrunning.retry_policy
1184
+ options.apply_defaults metadata: @config.metadata,
1185
+ retry_policy: @config.retry_policy
1186
+
1187
+ @asset_service_stub.call_rpc :analyze_iam_policy_longrunning, request, options: options do |response, operation|
1188
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1189
+ yield response, operation if block_given?
1190
+ return response
1191
+ end
1192
+ rescue ::GRPC::BadStatus => e
1193
+ raise ::Google::Cloud::Error.from_error(e)
1194
+ end
1195
+
1006
1196
  ##
1007
1197
  # Configuration class for the AssetService API.
1008
1198
  #
@@ -1088,7 +1278,7 @@ module Google
1088
1278
 
1089
1279
  config_attr :endpoint, "cloudasset.googleapis.com", ::String
1090
1280
  config_attr :credentials, nil do |value|
1091
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1281
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1092
1282
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1093
1283
  allowed.any? { |klass| klass === value }
1094
1284
  end
@@ -1184,6 +1374,16 @@ module Google
1184
1374
  # @return [::Gapic::Config::Method]
1185
1375
  #
1186
1376
  attr_reader :search_all_iam_policies
1377
+ ##
1378
+ # RPC-specific configuration for `analyze_iam_policy`
1379
+ # @return [::Gapic::Config::Method]
1380
+ #
1381
+ attr_reader :analyze_iam_policy
1382
+ ##
1383
+ # RPC-specific configuration for `analyze_iam_policy_longrunning`
1384
+ # @return [::Gapic::Config::Method]
1385
+ #
1386
+ attr_reader :analyze_iam_policy_longrunning
1187
1387
 
1188
1388
  # @private
1189
1389
  def initialize parent_rpcs = nil
@@ -1205,6 +1405,10 @@ module Google
1205
1405
  @search_all_resources = ::Gapic::Config::Method.new search_all_resources_config
1206
1406
  search_all_iam_policies_config = parent_rpcs&.search_all_iam_policies if parent_rpcs&.respond_to? :search_all_iam_policies
1207
1407
  @search_all_iam_policies = ::Gapic::Config::Method.new search_all_iam_policies_config
1408
+ analyze_iam_policy_config = parent_rpcs&.analyze_iam_policy if parent_rpcs&.respond_to? :analyze_iam_policy
1409
+ @analyze_iam_policy = ::Gapic::Config::Method.new analyze_iam_policy_config
1410
+ analyze_iam_policy_longrunning_config = parent_rpcs&.analyze_iam_policy_longrunning if parent_rpcs&.respond_to? :analyze_iam_policy_longrunning
1411
+ @analyze_iam_policy_longrunning = ::Gapic::Config::Method.new analyze_iam_policy_longrunning_config
1208
1412
 
1209
1413
  yield self if block_given?
1210
1414
  end