google-cloud-asset-v1 0.21.1 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8af562b0115d3d973426bda368ef1ec3e9068ec877174ce025f6da784f197e3
4
- data.tar.gz: d7dcef2f57cd7ec3b82dae5491518ecfb655e7a71174ab02e72609fe8493cdb8
3
+ metadata.gz: 8cc1b419784cf746cafa20ca39158e6344d101e6861461c5621db2f1e580ddc3
4
+ data.tar.gz: 4cd6921bbbea34aa66cbcc7864e0347c8f9aa6ca23e384a8a63ed3e9affced3b
5
5
  SHA512:
6
- metadata.gz: 650b132db2f02dcc24ad3f36cd631034d8da3b01054ab3ce5ff90466b8e3aa50de6e72613ecb836317ae094c9040c25e9fbd99fa4dbdb525f9bae732cb4e856f
7
- data.tar.gz: 95f1007bd217d967d4d47f76d7a1ad516f1ebf0a8a86d2bb0a907dce0444fab8e4f046532c0a8af88410078ba45f2dbec1332ec70808228795fe5020a4c98bd3
6
+ metadata.gz: 06d22c1799c844023dd9336ebc3d92de04e01ef97973832efaac80f836212e063e95d5a938a15270adb3f73215a792883afb9d14a593c85ee912e1c5e917c142
7
+ data.tar.gz: 0d9584daa580108316348200dc95bc856a3da6dde332c43d223870ec8b6e5d7271491a279dd3a7be851cb455f6899c5da3b57fbf1ae280c1b42e2f0b2b776910
data/README.md CHANGED
@@ -46,7 +46,7 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
@@ -1118,8 +1118,8 @@ module Google
1118
1118
  end
1119
1119
 
1120
1120
  ##
1121
- # Searches all Cloud resources within the specified scope, such as a project,
1122
- # folder, or organization. The caller must be granted the
1121
+ # Searches all Google Cloud resources within the specified scope, such as a
1122
+ # project, folder, or organization. The caller must be granted the
1123
1123
  # `cloudasset.assets.searchAllResources` permission on the desired scope,
1124
1124
  # otherwise the request will be rejected.
1125
1125
  #
@@ -1159,44 +1159,48 @@ module Google
1159
1159
  #
1160
1160
  # Examples:
1161
1161
  #
1162
- # * `name:Important` to find Cloud resources whose name contains
1162
+ # * `name:Important` to find Google Cloud resources whose name contains
1163
1163
  # "Important" as a word.
1164
- # * `name=Important` to find the Cloud resource whose name is exactly
1164
+ # * `name=Important` to find the Google Cloud resource whose name is exactly
1165
1165
  # "Important".
1166
- # * `displayName:Impor*` to find Cloud resources whose display name
1166
+ # * `displayName:Impor*` to find Google Cloud resources whose display name
1167
1167
  # contains "Impor" as a prefix of any word in the field.
1168
- # * `location:us-west*` to find Cloud resources whose location contains both
1169
- # "us" and "west" as prefixes.
1170
- # * `labels:prod` to find Cloud resources whose labels contain "prod" as
1171
- # a key or value.
1172
- # * `labels.env:prod` to find Cloud resources that have a label "env"
1168
+ # * `location:us-west*` to find Google Cloud resources whose location
1169
+ # contains both "us" and "west" as prefixes.
1170
+ # * `labels:prod` to find Google Cloud resources whose labels contain "prod"
1171
+ # as a key or value.
1172
+ # * `labels.env:prod` to find Google Cloud resources that have a label "env"
1173
1173
  # and its value is "prod".
1174
- # * `labels.env:*` to find Cloud resources that have a label "env".
1175
- # * `kmsKey:key` to find Cloud resources encrypted with a customer-managed
1176
- # encryption key whose name contains the word "key".
1177
- # * `relationships:instance-group-1` to find Cloud resources that have
1174
+ # * `labels.env:*` to find Google Cloud resources that have a label "env".
1175
+ # * `kmsKey:key` to find Google Cloud resources encrypted with a
1176
+ # customer-managed encryption key whose name contains "key" as a word. This
1177
+ # field is deprecated. Please use the `kmsKeys` field to retrieve Cloud KMS
1178
+ # key information.
1179
+ # * `kmsKeys:key` to find Google Cloud resources encrypted with
1180
+ # customer-managed encryption keys whose name contains the word "key".
1181
+ # * `relationships:instance-group-1` to find Google Cloud resources that have
1178
1182
  # relationships with "instance-group-1" in the related resource name.
1179
- # * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that
1180
- # have relationships of type "INSTANCE_TO_INSTANCEGROUP".
1183
+ # * `relationships:INSTANCE_TO_INSTANCEGROUP` to find Compute Engine
1184
+ # instances that have relationships of type "INSTANCE_TO_INSTANCEGROUP".
1181
1185
  # * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find
1182
- # compute instances that have relationships with "instance-group-1" in the
1183
- # compute instance group resource name, for relationship type
1186
+ # Compute Engine instances that have relationships with "instance-group-1"
1187
+ # in the Compute Engine instance group resource name, for relationship type
1184
1188
  # "INSTANCE_TO_INSTANCEGROUP".
1185
- # * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a
1186
- # word.
1187
- # * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain
1189
+ # * `state:ACTIVE` to find Google Cloud resources whose state contains
1188
1190
  # "ACTIVE" as a word.
1189
- # * `createTime<1609459200` to find Cloud resources that were created before
1190
- # "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of
1191
+ # * `NOT state:ACTIVE` to find Google Cloud resources whose state doesn't
1192
+ # contain "ACTIVE" as a word.
1193
+ # * `createTime<1609459200` to find Google Cloud resources that were created
1194
+ # before "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of
1191
1195
  # "2021-01-01 00:00:00 UTC" in seconds.
1192
- # * `updateTime>1609459200` to find Cloud resources that were updated after
1193
- # "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of
1196
+ # * `updateTime>1609459200` to find Google Cloud resources that were updated
1197
+ # after "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of
1194
1198
  # "2021-01-01 00:00:00 UTC" in seconds.
1195
- # * `Important` to find Cloud resources that contain "Important" as a word
1196
- # in any of the searchable fields.
1197
- # * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any
1199
+ # * `Important` to find Google Cloud resources that contain "Important" as a
1198
1200
  # word in any of the searchable fields.
1199
- # * `Important location:(us-west1 OR global)` to find Cloud
1201
+ # * `Impor*` to find Google Cloud resources that contain "Impor" as a prefix
1202
+ # of any word in any of the searchable fields.
1203
+ # * `Important location:(us-west1 OR global)` to find Google Cloud
1200
1204
  # resources that contain "Important" as a word in any of the searchable
1201
1205
  # fields and are also located in the "us-west1" region or the "global"
1202
1206
  # location.
@@ -1239,16 +1243,15 @@ module Google
1239
1243
  # * displayName
1240
1244
  # * description
1241
1245
  # * location
1242
- # * kmsKey
1243
1246
  # * createTime
1244
1247
  # * updateTime
1245
1248
  # * state
1246
1249
  # * parentFullResourceName
1247
1250
  # * parentAssetType
1248
1251
  #
1249
- # All the other fields such as repeated fields (e.g., `networkTags`), map
1250
- # fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`)
1251
- # are not supported.
1252
+ # All the other fields such as repeated fields (e.g., `networkTags`,
1253
+ # `kmsKeys`), map fields (e.g., `labels`) and struct fields (e.g.,
1254
+ # `additionalAttributes`) are not supported.
1252
1255
  # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
1253
1256
  # Optional. A comma-separated list of fields specifying which fields to be
1254
1257
  # returned in ResourceSearchResult. Only '*' or combination of top level
@@ -1269,7 +1272,9 @@ module Google
1269
1272
  # * tagValueIds
1270
1273
  # * labels
1271
1274
  # * networkTags
1272
- # * kmsKey
1275
+ # * kmsKey (This field is deprecated. Please use the `kmsKeys` field to
1276
+ # retrieve Cloud KMS key information.)
1277
+ # * kmsKeys
1273
1278
  # * createTime
1274
1279
  # * updateTime
1275
1280
  # * state
@@ -1392,8 +1397,8 @@ module Google
1392
1397
  # query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
1393
1398
  # for more information. If not specified or empty, it will search all the
1394
1399
  # IAM policies within the specified `scope`. Note that the query string is
1395
- # compared against each Cloud IAM policy binding, including its principals,
1396
- # roles, and Cloud IAM conditions. The returned Cloud IAM policies will only
1400
+ # compared against each IAM policy binding, including its principals,
1401
+ # roles, and IAM conditions. The returned IAM policies will only
1397
1402
  # contain the bindings that match your query. To learn more about the IAM
1398
1403
  # policy structure, see the [IAM policy
1399
1404
  # documentation](https://cloud.google.com/iam/help/allow-policies/structure).
@@ -1803,14 +1808,14 @@ module Google
1803
1808
  #
1804
1809
  # @param resource [::String]
1805
1810
  # Required. Name of the resource to perform the analysis against.
1806
- # Only GCP Project are supported as of today. Hence, this can only be Project
1807
- # ID (such as "projects/my-project-id") or a Project Number (such as
1808
- # "projects/12345").
1811
+ # Only Google Cloud projects are supported as of today. Hence, this can only
1812
+ # be a project ID (such as "projects/my-project-id") or a project number
1813
+ # (such as "projects/12345").
1809
1814
  # @param destination_parent [::String]
1810
- # Required. Name of the GCP Folder or Organization to reparent the target
1811
- # resource. The analysis will be performed against hypothetically moving the
1812
- # resource to this specified desitination parent. This can only be a Folder
1813
- # number (such as "folders/123") or an Organization number (such as
1815
+ # Required. Name of the Google Cloud folder or organization to reparent the
1816
+ # target resource. The analysis will be performed against hypothetically
1817
+ # moving the resource to this specified desitination parent. This can only be
1818
+ # a folder number (such as "folders/123") or an organization number (such as
1814
1819
  # "organizations/123").
1815
1820
  # @param view [::Google::Cloud::Asset::V1::AnalyzeMoveRequest::AnalysisView]
1816
1821
  # Analysis view indicating what information should be included in the
@@ -2065,7 +2070,7 @@ module Google
2065
2070
  # resource name.
2066
2071
  #
2067
2072
  # This value should be 4-63 characters, and valid characters
2068
- # are /[a-z][0-9]-/.
2073
+ # are `[a-z][0-9]-`.
2069
2074
  #
2070
2075
  # Notice that this field is required in the saved query creation, and the
2071
2076
  # `name` field of the `saved_query` will be ignored.
@@ -2621,6 +2626,374 @@ module Google
2621
2626
  raise ::Google::Cloud::Error.from_error(e)
2622
2627
  end
2623
2628
 
2629
+ ##
2630
+ # Analyzes organization policies under a scope.
2631
+ #
2632
+ # @overload analyze_org_policies(request, options = nil)
2633
+ # Pass arguments to `analyze_org_policies` via a request object, either of type
2634
+ # {::Google::Cloud::Asset::V1::AnalyzeOrgPoliciesRequest} or an equivalent Hash.
2635
+ #
2636
+ # @param request [::Google::Cloud::Asset::V1::AnalyzeOrgPoliciesRequest, ::Hash]
2637
+ # A request object representing the call parameters. Required. To specify no
2638
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2639
+ # @param options [::Gapic::CallOptions, ::Hash]
2640
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2641
+ #
2642
+ # @overload analyze_org_policies(scope: nil, constraint: nil, filter: nil, page_size: nil, page_token: nil)
2643
+ # Pass arguments to `analyze_org_policies` via keyword arguments. Note that at
2644
+ # least one keyword argument is required. To specify no parameters, or to keep all
2645
+ # the default parameter values, pass an empty Hash as a request object (see above).
2646
+ #
2647
+ # @param scope [::String]
2648
+ # Required. The organization to scope the request. Only organization
2649
+ # policies within the scope will be analyzed.
2650
+ #
2651
+ # * organizations/\\{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
2652
+ # @param constraint [::String]
2653
+ # Required. The name of the constraint to analyze organization policies for.
2654
+ # The response only contains analyzed organization policies for the provided
2655
+ # constraint.
2656
+ # @param filter [::String]
2657
+ # The expression to filter
2658
+ # {::Google::Cloud::Asset::V1::AnalyzeOrgPoliciesResponse#org_policy_results AnalyzeOrgPoliciesResponse.org_policy_results}.
2659
+ # The only supported field is `consolidated_policy.attached_resource`, and
2660
+ # the only supported operator is `=`.
2661
+ #
2662
+ # Example:
2663
+ # consolidated_policy.attached_resource="//cloudresourcemanager.googleapis.com/folders/001"
2664
+ # will return the org policy results of"folders/001".
2665
+ # @param page_size [::Integer]
2666
+ # The maximum number of items to return per page. If unspecified,
2667
+ # {::Google::Cloud::Asset::V1::AnalyzeOrgPoliciesResponse#org_policy_results AnalyzeOrgPoliciesResponse.org_policy_results}
2668
+ # will contain 20 items with a maximum of 200.
2669
+ # @param page_token [::String]
2670
+ # The pagination token to retrieve the next page.
2671
+ #
2672
+ # @yield [response, operation] Access the result along with the RPC operation
2673
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::AnalyzeOrgPoliciesResponse::OrgPolicyResult>]
2674
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2675
+ #
2676
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::AnalyzeOrgPoliciesResponse::OrgPolicyResult>]
2677
+ #
2678
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2679
+ #
2680
+ # @example Basic example
2681
+ # require "google/cloud/asset/v1"
2682
+ #
2683
+ # # Create a client object. The client can be reused for multiple calls.
2684
+ # client = Google::Cloud::Asset::V1::AssetService::Client.new
2685
+ #
2686
+ # # Create a request. To set request fields, pass in keyword arguments.
2687
+ # request = Google::Cloud::Asset::V1::AnalyzeOrgPoliciesRequest.new
2688
+ #
2689
+ # # Call the analyze_org_policies method.
2690
+ # result = client.analyze_org_policies request
2691
+ #
2692
+ # # The returned object is of type Gapic::PagedEnumerable. You can
2693
+ # # iterate over all elements by calling #each, and the enumerable
2694
+ # # will lazily make API calls to fetch subsequent pages. Other
2695
+ # # methods are also available for managing paging directly.
2696
+ # result.each do |response|
2697
+ # # Each element is of type ::Google::Cloud::Asset::V1::AnalyzeOrgPoliciesResponse::OrgPolicyResult.
2698
+ # p response
2699
+ # end
2700
+ #
2701
+ def analyze_org_policies request, options = nil
2702
+ raise ::ArgumentError, "request must be provided" if request.nil?
2703
+
2704
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::AnalyzeOrgPoliciesRequest
2705
+
2706
+ # Converts hash and nil to an options object
2707
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2708
+
2709
+ # Customize the options with defaults
2710
+ metadata = @config.rpcs.analyze_org_policies.metadata.to_h
2711
+
2712
+ # Set x-goog-api-client and x-goog-user-project headers
2713
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2714
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2715
+ gapic_version: ::Google::Cloud::Asset::V1::VERSION
2716
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2717
+
2718
+ header_params = {}
2719
+ if request.scope
2720
+ header_params["scope"] = request.scope
2721
+ end
2722
+
2723
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2724
+ metadata[:"x-goog-request-params"] ||= request_params_header
2725
+
2726
+ options.apply_defaults timeout: @config.rpcs.analyze_org_policies.timeout,
2727
+ metadata: metadata,
2728
+ retry_policy: @config.rpcs.analyze_org_policies.retry_policy
2729
+
2730
+ options.apply_defaults timeout: @config.timeout,
2731
+ metadata: @config.metadata,
2732
+ retry_policy: @config.retry_policy
2733
+
2734
+ @asset_service_stub.call_rpc :analyze_org_policies, request, options: options do |response, operation|
2735
+ response = ::Gapic::PagedEnumerable.new @asset_service_stub, :analyze_org_policies, request, response, operation, options
2736
+ yield response, operation if block_given?
2737
+ return response
2738
+ end
2739
+ rescue ::GRPC::BadStatus => e
2740
+ raise ::Google::Cloud::Error.from_error(e)
2741
+ end
2742
+
2743
+ ##
2744
+ # Analyzes organization policies governed containers (projects, folders or
2745
+ # organization) under a scope.
2746
+ #
2747
+ # @overload analyze_org_policy_governed_containers(request, options = nil)
2748
+ # Pass arguments to `analyze_org_policy_governed_containers` via a request object, either of type
2749
+ # {::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedContainersRequest} or an equivalent Hash.
2750
+ #
2751
+ # @param request [::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedContainersRequest, ::Hash]
2752
+ # A request object representing the call parameters. Required. To specify no
2753
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2754
+ # @param options [::Gapic::CallOptions, ::Hash]
2755
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2756
+ #
2757
+ # @overload analyze_org_policy_governed_containers(scope: nil, constraint: nil, filter: nil, page_size: nil, page_token: nil)
2758
+ # Pass arguments to `analyze_org_policy_governed_containers` via keyword arguments. Note that at
2759
+ # least one keyword argument is required. To specify no parameters, or to keep all
2760
+ # the default parameter values, pass an empty Hash as a request object (see above).
2761
+ #
2762
+ # @param scope [::String]
2763
+ # Required. The organization to scope the request. Only organization
2764
+ # policies within the scope will be analyzed. The output containers will
2765
+ # also be limited to the ones governed by those in-scope organization
2766
+ # policies.
2767
+ #
2768
+ # * organizations/\\{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
2769
+ # @param constraint [::String]
2770
+ # Required. The name of the constraint to analyze governed containers for.
2771
+ # The analysis only contains organization policies for the provided
2772
+ # constraint.
2773
+ # @param filter [::String]
2774
+ # The expression to filter the governed containers in result.
2775
+ # The only supported field is `parent`, and the only supported operator is
2776
+ # `=`.
2777
+ #
2778
+ # Example:
2779
+ # parent="//cloudresourcemanager.googleapis.com/folders/001" will return all
2780
+ # containers under "folders/001".
2781
+ # @param page_size [::Integer]
2782
+ # The maximum number of items to return per page. If unspecified,
2783
+ # {::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedContainersResponse#governed_containers AnalyzeOrgPolicyGovernedContainersResponse.governed_containers}
2784
+ # will contain 100 items with a maximum of 200.
2785
+ # @param page_token [::String]
2786
+ # The pagination token to retrieve the next page.
2787
+ #
2788
+ # @yield [response, operation] Access the result along with the RPC operation
2789
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedContainersResponse::GovernedContainer>]
2790
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2791
+ #
2792
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedContainersResponse::GovernedContainer>]
2793
+ #
2794
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2795
+ #
2796
+ # @example Basic example
2797
+ # require "google/cloud/asset/v1"
2798
+ #
2799
+ # # Create a client object. The client can be reused for multiple calls.
2800
+ # client = Google::Cloud::Asset::V1::AssetService::Client.new
2801
+ #
2802
+ # # Create a request. To set request fields, pass in keyword arguments.
2803
+ # request = Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedContainersRequest.new
2804
+ #
2805
+ # # Call the analyze_org_policy_governed_containers method.
2806
+ # result = client.analyze_org_policy_governed_containers request
2807
+ #
2808
+ # # The returned object is of type Gapic::PagedEnumerable. You can
2809
+ # # iterate over all elements by calling #each, and the enumerable
2810
+ # # will lazily make API calls to fetch subsequent pages. Other
2811
+ # # methods are also available for managing paging directly.
2812
+ # result.each do |response|
2813
+ # # Each element is of type ::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedContainersResponse::GovernedContainer.
2814
+ # p response
2815
+ # end
2816
+ #
2817
+ def analyze_org_policy_governed_containers request, options = nil
2818
+ raise ::ArgumentError, "request must be provided" if request.nil?
2819
+
2820
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedContainersRequest
2821
+
2822
+ # Converts hash and nil to an options object
2823
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2824
+
2825
+ # Customize the options with defaults
2826
+ metadata = @config.rpcs.analyze_org_policy_governed_containers.metadata.to_h
2827
+
2828
+ # Set x-goog-api-client and x-goog-user-project headers
2829
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2830
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2831
+ gapic_version: ::Google::Cloud::Asset::V1::VERSION
2832
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2833
+
2834
+ header_params = {}
2835
+ if request.scope
2836
+ header_params["scope"] = request.scope
2837
+ end
2838
+
2839
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2840
+ metadata[:"x-goog-request-params"] ||= request_params_header
2841
+
2842
+ options.apply_defaults timeout: @config.rpcs.analyze_org_policy_governed_containers.timeout,
2843
+ metadata: metadata,
2844
+ retry_policy: @config.rpcs.analyze_org_policy_governed_containers.retry_policy
2845
+
2846
+ options.apply_defaults timeout: @config.timeout,
2847
+ metadata: @config.metadata,
2848
+ retry_policy: @config.retry_policy
2849
+
2850
+ @asset_service_stub.call_rpc :analyze_org_policy_governed_containers, request, options: options do |response, operation|
2851
+ response = ::Gapic::PagedEnumerable.new @asset_service_stub, :analyze_org_policy_governed_containers, request, response, operation, options
2852
+ yield response, operation if block_given?
2853
+ return response
2854
+ end
2855
+ rescue ::GRPC::BadStatus => e
2856
+ raise ::Google::Cloud::Error.from_error(e)
2857
+ end
2858
+
2859
+ ##
2860
+ # Analyzes organization policies governed assets (Google Cloud resources or
2861
+ # policies) under a scope. This RPC supports custom constraints and the
2862
+ # following 10 canned constraints:
2863
+ #
2864
+ # * storage.uniformBucketLevelAccess
2865
+ # * iam.disableServiceAccountKeyCreation
2866
+ # * iam.allowedPolicyMemberDomains
2867
+ # * compute.vmExternalIpAccess
2868
+ # * appengine.enforceServiceAccountActAsCheck
2869
+ # * gcp.resourceLocations
2870
+ # * compute.trustedImageProjects
2871
+ # * compute.skipDefaultNetworkCreation
2872
+ # * compute.requireOsLogin
2873
+ # * compute.disableNestedVirtualization
2874
+ #
2875
+ # This RPC only returns either resources of types supported by [searchable
2876
+ # asset
2877
+ # types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types),
2878
+ # or IAM policies.
2879
+ #
2880
+ # @overload analyze_org_policy_governed_assets(request, options = nil)
2881
+ # Pass arguments to `analyze_org_policy_governed_assets` via a request object, either of type
2882
+ # {::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedAssetsRequest} or an equivalent Hash.
2883
+ #
2884
+ # @param request [::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedAssetsRequest, ::Hash]
2885
+ # A request object representing the call parameters. Required. To specify no
2886
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2887
+ # @param options [::Gapic::CallOptions, ::Hash]
2888
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2889
+ #
2890
+ # @overload analyze_org_policy_governed_assets(scope: nil, constraint: nil, filter: nil, page_size: nil, page_token: nil)
2891
+ # Pass arguments to `analyze_org_policy_governed_assets` via keyword arguments. Note that at
2892
+ # least one keyword argument is required. To specify no parameters, or to keep all
2893
+ # the default parameter values, pass an empty Hash as a request object (see above).
2894
+ #
2895
+ # @param scope [::String]
2896
+ # Required. The organization to scope the request. Only organization
2897
+ # policies within the scope will be analyzed. The output assets will
2898
+ # also be limited to the ones governed by those in-scope organization
2899
+ # policies.
2900
+ #
2901
+ # * organizations/\\{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
2902
+ # @param constraint [::String]
2903
+ # Required. The name of the constraint to analyze governed assets for. The
2904
+ # analysis only contains analyzed organization policies for the provided
2905
+ # constraint.
2906
+ # @param filter [::String]
2907
+ # The expression to filter the governed assets in result. The only supported
2908
+ # fields for governed resources are `governed_resource.project` and
2909
+ # `governed_resource.folders`. The only supported fields for governed iam
2910
+ # policies are `governed_iam_policy.project` and
2911
+ # `governed_iam_policy.folders`. The only supported operator is `=`.
2912
+ #
2913
+ # Example 1: governed_resource.project="projects/12345678" filter will return
2914
+ # all governed resources under projects/12345678 including the project
2915
+ # ifself, if applicable.
2916
+ #
2917
+ # Example 2: governed_iam_policy.folders="folders/12345678" filter will
2918
+ # return all governed iam policies under folders/12345678, if applicable.
2919
+ # @param page_size [::Integer]
2920
+ # The maximum number of items to return per page. If unspecified,
2921
+ # {::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedAssetsResponse#governed_assets AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets}
2922
+ # will contain 100 items with a maximum of 200.
2923
+ # @param page_token [::String]
2924
+ # The pagination token to retrieve the next page.
2925
+ #
2926
+ # @yield [response, operation] Access the result along with the RPC operation
2927
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedAssetsResponse::GovernedAsset>]
2928
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2929
+ #
2930
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedAssetsResponse::GovernedAsset>]
2931
+ #
2932
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2933
+ #
2934
+ # @example Basic example
2935
+ # require "google/cloud/asset/v1"
2936
+ #
2937
+ # # Create a client object. The client can be reused for multiple calls.
2938
+ # client = Google::Cloud::Asset::V1::AssetService::Client.new
2939
+ #
2940
+ # # Create a request. To set request fields, pass in keyword arguments.
2941
+ # request = Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedAssetsRequest.new
2942
+ #
2943
+ # # Call the analyze_org_policy_governed_assets method.
2944
+ # result = client.analyze_org_policy_governed_assets request
2945
+ #
2946
+ # # The returned object is of type Gapic::PagedEnumerable. You can
2947
+ # # iterate over all elements by calling #each, and the enumerable
2948
+ # # will lazily make API calls to fetch subsequent pages. Other
2949
+ # # methods are also available for managing paging directly.
2950
+ # result.each do |response|
2951
+ # # Each element is of type ::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedAssetsResponse::GovernedAsset.
2952
+ # p response
2953
+ # end
2954
+ #
2955
+ def analyze_org_policy_governed_assets request, options = nil
2956
+ raise ::ArgumentError, "request must be provided" if request.nil?
2957
+
2958
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::AnalyzeOrgPolicyGovernedAssetsRequest
2959
+
2960
+ # Converts hash and nil to an options object
2961
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2962
+
2963
+ # Customize the options with defaults
2964
+ metadata = @config.rpcs.analyze_org_policy_governed_assets.metadata.to_h
2965
+
2966
+ # Set x-goog-api-client and x-goog-user-project headers
2967
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2968
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2969
+ gapic_version: ::Google::Cloud::Asset::V1::VERSION
2970
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2971
+
2972
+ header_params = {}
2973
+ if request.scope
2974
+ header_params["scope"] = request.scope
2975
+ end
2976
+
2977
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2978
+ metadata[:"x-goog-request-params"] ||= request_params_header
2979
+
2980
+ options.apply_defaults timeout: @config.rpcs.analyze_org_policy_governed_assets.timeout,
2981
+ metadata: metadata,
2982
+ retry_policy: @config.rpcs.analyze_org_policy_governed_assets.retry_policy
2983
+
2984
+ options.apply_defaults timeout: @config.timeout,
2985
+ metadata: @config.metadata,
2986
+ retry_policy: @config.retry_policy
2987
+
2988
+ @asset_service_stub.call_rpc :analyze_org_policy_governed_assets, request, options: options do |response, operation|
2989
+ response = ::Gapic::PagedEnumerable.new @asset_service_stub, :analyze_org_policy_governed_assets, request, response, operation, options
2990
+ yield response, operation if block_given?
2991
+ return response
2992
+ end
2993
+ rescue ::GRPC::BadStatus => e
2994
+ raise ::Google::Cloud::Error.from_error(e)
2995
+ end
2996
+
2624
2997
  ##
2625
2998
  # Configuration class for the AssetService API.
2626
2999
  #
@@ -2856,6 +3229,21 @@ module Google
2856
3229
  # @return [::Gapic::Config::Method]
2857
3230
  #
2858
3231
  attr_reader :batch_get_effective_iam_policies
3232
+ ##
3233
+ # RPC-specific configuration for `analyze_org_policies`
3234
+ # @return [::Gapic::Config::Method]
3235
+ #
3236
+ attr_reader :analyze_org_policies
3237
+ ##
3238
+ # RPC-specific configuration for `analyze_org_policy_governed_containers`
3239
+ # @return [::Gapic::Config::Method]
3240
+ #
3241
+ attr_reader :analyze_org_policy_governed_containers
3242
+ ##
3243
+ # RPC-specific configuration for `analyze_org_policy_governed_assets`
3244
+ # @return [::Gapic::Config::Method]
3245
+ #
3246
+ attr_reader :analyze_org_policy_governed_assets
2859
3247
 
2860
3248
  # @private
2861
3249
  def initialize parent_rpcs = nil
@@ -2899,6 +3287,12 @@ module Google
2899
3287
  @delete_saved_query = ::Gapic::Config::Method.new delete_saved_query_config
2900
3288
  batch_get_effective_iam_policies_config = parent_rpcs.batch_get_effective_iam_policies if parent_rpcs.respond_to? :batch_get_effective_iam_policies
2901
3289
  @batch_get_effective_iam_policies = ::Gapic::Config::Method.new batch_get_effective_iam_policies_config
3290
+ analyze_org_policies_config = parent_rpcs.analyze_org_policies if parent_rpcs.respond_to? :analyze_org_policies
3291
+ @analyze_org_policies = ::Gapic::Config::Method.new analyze_org_policies_config
3292
+ analyze_org_policy_governed_containers_config = parent_rpcs.analyze_org_policy_governed_containers if parent_rpcs.respond_to? :analyze_org_policy_governed_containers
3293
+ @analyze_org_policy_governed_containers = ::Gapic::Config::Method.new analyze_org_policy_governed_containers_config
3294
+ analyze_org_policy_governed_assets_config = parent_rpcs.analyze_org_policy_governed_assets if parent_rpcs.respond_to? :analyze_org_policy_governed_assets
3295
+ @analyze_org_policy_governed_assets = ::Gapic::Config::Method.new analyze_org_policy_governed_assets_config
2902
3296
 
2903
3297
  yield self if block_given?
2904
3298
  end
@@ -34,7 +34,7 @@ module Google
34
34
  ##
35
35
  # Asset service definition.
36
36
  #
37
- # To load this service and instantiate a client:
37
+ # @example Load this service and instantiate a gRPC client
38
38
  #
39
39
  # require "google/cloud/asset/v1/asset_service"
40
40
  # client = ::Google::Cloud::Asset::V1::AssetService::Client.new