Class AssetServiceClient

java.lang.Object
com.google.cloud.asset.v1.AssetServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class AssetServiceClient extends Object implements BackgroundResource
Service Description: Asset service definition.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
   BatchGetAssetsHistoryRequest request =
       BatchGetAssetsHistoryRequest.newBuilder()
           .setParent(FolderName.of("[FOLDER]").toString())
           .addAllAssetNames(new ArrayList<String>())
           .setContentType(ContentType.forNumber(0))
           .setReadTimeWindow(TimeWindow.newBuilder().build())
           .addAllRelationshipTypes(new ArrayList<String>())
           .build();
   BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
 }
 

Note: close() needs to be called on the AssetServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

ExportAssets

Exports assets with time and resource types to a given Cloud Storage location/BigQuery table. For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API, which allows you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • exportAssetsAsync(ExportAssetsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • exportAssetsOperationCallable()

  • exportAssetsCallable()

ListAssets

Lists assets with time and resource types and returns paged results in response.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listAssets(ListAssetsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listAssets(ResourceName parent)

  • listAssets(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listAssetsPagedCallable()

  • listAssetsCallable()

BatchGetAssetsHistory

Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchGetAssetsHistory(BatchGetAssetsHistoryRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchGetAssetsHistoryCallable()

CreateFeed

Creates a feed in a parent project/folder/organization to listen to its asset updates.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createFeed(CreateFeedRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createFeed(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createFeedCallable()

GetFeed

Gets details about an asset feed.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getFeed(GetFeedRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getFeed(FeedName name)

  • getFeed(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getFeedCallable()

ListFeeds

Lists all asset feeds in a parent project/folder/organization.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listFeeds(ListFeedsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listFeeds(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listFeedsCallable()

UpdateFeed

Updates an asset feed configuration.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateFeed(UpdateFeedRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateFeed(Feed feed)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateFeedCallable()

DeleteFeed

Deletes an asset feed.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteFeed(DeleteFeedRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteFeed(FeedName name)

  • deleteFeed(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteFeedCallable()

SearchAllResources

Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the request will be rejected.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • searchAllResources(SearchAllResourcesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • searchAllResources(String scope, String query, List<String> assetTypes)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • searchAllResourcesPagedCallable()

  • searchAllResourcesCallable()

SearchAllIamPolicies

Searches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the request will be rejected.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • searchAllIamPolicies(SearchAllIamPoliciesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • searchAllIamPolicies(String scope, String query)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • searchAllIamPoliciesPagedCallable()

  • searchAllIamPoliciesCallable()

AnalyzeIamPolicy

Analyzes IAM policies to answer which identities have what accesses on which resources.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • analyzeIamPolicy(AnalyzeIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • analyzeIamPolicyCallable()

AnalyzeIamPolicyLongrunning

Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. This method implements the [google.longrunning.Operation][google.longrunning.Operation], which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • analyzeIamPolicyLongrunningAsync(AnalyzeIamPolicyLongrunningRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • analyzeIamPolicyLongrunningOperationCallable()

  • analyzeIamPolicyLongrunningCallable()

AnalyzeMove

Analyze moving a resource to a specified destination without kicking off the actual move. The analysis is best effort depending on the user's permissions of viewing different hierarchical policies and configurations. The policies and configuration are subject to change before the actual resource migration takes place.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • analyzeMove(AnalyzeMoveRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • analyzeMoveCallable()

QueryAssets

Issue a job that queries assets using a SQL statement compatible with [BigQuery SQL](https://cloud.google.com/bigquery/docs/introduction-sql).

If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`.

Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call.

Note, the query result has approximately 10 GB limitation enforced by [BigQuery](https://cloud.google.com/bigquery/docs/best-practices-performance-output). Queries return larger results will result in errors.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • queryAssets(QueryAssetsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • queryAssetsCallable()

CreateSavedQuery

Creates a saved query in a parent project/folder/organization.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createSavedQuery(CreateSavedQueryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createSavedQuery(FolderName parent, SavedQuery savedQuery, String savedQueryId)

  • createSavedQuery(OrganizationName parent, SavedQuery savedQuery, String savedQueryId)

  • createSavedQuery(ProjectName parent, SavedQuery savedQuery, String savedQueryId)

  • createSavedQuery(String parent, SavedQuery savedQuery, String savedQueryId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createSavedQueryCallable()

GetSavedQuery

Gets details about a saved query.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getSavedQuery(GetSavedQueryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getSavedQuery(SavedQueryName name)

  • getSavedQuery(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getSavedQueryCallable()

ListSavedQueries

Lists all saved queries in a parent project/folder/organization.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listSavedQueries(ListSavedQueriesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listSavedQueries(FolderName parent)

  • listSavedQueries(OrganizationName parent)

  • listSavedQueries(ProjectName parent)

  • listSavedQueries(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listSavedQueriesPagedCallable()

  • listSavedQueriesCallable()

UpdateSavedQuery

Updates a saved query.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateSavedQuery(UpdateSavedQueryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateSavedQuery(SavedQuery savedQuery, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateSavedQueryCallable()

DeleteSavedQuery

Deletes a saved query.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteSavedQuery(DeleteSavedQueryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteSavedQuery(SavedQueryName name)

  • deleteSavedQuery(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteSavedQueryCallable()

BatchGetEffectiveIamPolicies

Gets effective IAM policies for a batch of resources.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchGetEffectiveIamPolicies(BatchGetEffectiveIamPoliciesRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchGetEffectiveIamPoliciesCallable()

AnalyzeOrgPolicies

Analyzes organization policies under a scope.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • analyzeOrgPolicies(AnalyzeOrgPoliciesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • analyzeOrgPolicies(String scope, String constraint, String filter)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • analyzeOrgPoliciesPagedCallable()

  • analyzeOrgPoliciesCallable()

AnalyzeOrgPolicyGovernedContainers

Analyzes organization policies governed containers (projects, folders or organization) under a scope.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • analyzeOrgPolicyGovernedContainers(AnalyzeOrgPolicyGovernedContainersRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • analyzeOrgPolicyGovernedContainers(String scope, String constraint, String filter)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • analyzeOrgPolicyGovernedContainersPagedCallable()

  • analyzeOrgPolicyGovernedContainersCallable()

AnalyzeOrgPolicyGovernedAssets

Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope. This RPC supports custom constraints and the following canned constraints:

  • constraints/ainotebooks.accessMode
  • constraints/ainotebooks.disableFileDownloads
  • constraints/ainotebooks.disableRootAccess
  • constraints/ainotebooks.disableTerminal
  • constraints/ainotebooks.environmentOptions
  • constraints/ainotebooks.requireAutoUpgradeSchedule
  • constraints/ainotebooks.restrictVpcNetworks
  • constraints/compute.disableGuestAttributesAccess
  • constraints/compute.disableInstanceDataAccessApis
  • constraints/compute.disableNestedVirtualization
  • constraints/compute.disableSerialPortAccess
  • constraints/compute.disableSerialPortLogging
  • constraints/compute.disableVpcExternalIpv6
  • constraints/compute.requireOsLogin
  • constraints/compute.requireShieldedVm
  • constraints/compute.restrictLoadBalancerCreationForTypes
  • constraints/compute.restrictProtocolForwardingCreationForTypes
  • constraints/compute.restrictXpnProjectLienRemoval
  • constraints/compute.setNewProjectDefaultToZonalDNSOnly
  • constraints/compute.skipDefaultNetworkCreation
  • constraints/compute.trustedImageProjects
  • constraints/compute.vmCanIpForward
  • constraints/compute.vmExternalIpAccess
  • constraints/gcp.detailedAuditLoggingMode
  • constraints/gcp.resourceLocations
  • constraints/iam.allowedPolicyMemberDomains
  • constraints/iam.automaticIamGrantsForDefaultServiceAccounts
  • constraints/iam.disableServiceAccountCreation
  • constraints/iam.disableServiceAccountKeyCreation
  • constraints/iam.disableServiceAccountKeyUpload
  • constraints/iam.restrictCrossProjectServiceAccountLienRemoval
  • constraints/iam.serviceAccountKeyExpiryHours
  • constraints/resourcemanager.accessBoundaries
  • constraints/resourcemanager.allowedExportDestinations
  • constraints/sql.restrictAuthorizedNetworks
  • constraints/sql.restrictNoncompliantDiagnosticDataAccess
  • constraints/sql.restrictNoncompliantResourceCreation
  • constraints/sql.restrictPublicIp
  • constraints/storage.publicAccessPrevention
  • constraints/storage.restrictAuthTypes
  • constraints/storage.uniformBucketLevelAccess

This RPC only returns either resources of types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types) or IAM policies.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • analyzeOrgPolicyGovernedAssets(AnalyzeOrgPolicyGovernedAssetsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • analyzeOrgPolicyGovernedAssets(String scope, String constraint, String filter)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • analyzeOrgPolicyGovernedAssetsPagedCallable()

  • analyzeOrgPolicyGovernedAssetsCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of AssetServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 AssetServiceSettings assetServiceSettings =
     AssetServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 AssetServiceSettings assetServiceSettings =
     AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 AssetServiceSettings assetServiceSettings = AssetServiceSettings.newHttpJsonBuilder().build();
 AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

  • Constructor Details

    • AssetServiceClient

      protected AssetServiceClient(AssetServiceSettings settings) throws IOException
      Constructs an instance of AssetServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
      Throws:
      IOException
    • AssetServiceClient

      protected AssetServiceClient(AssetServiceStub stub)
  • Method Details

    • create

      public static final AssetServiceClient create() throws IOException
      Constructs an instance of AssetServiceClient with default settings.
      Throws:
      IOException
    • create

      public static final AssetServiceClient create(AssetServiceSettings settings) throws IOException
      Constructs an instance of AssetServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
      Throws:
      IOException
    • create

      public static final AssetServiceClient create(AssetServiceStub stub)
      Constructs an instance of AssetServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AssetServiceSettings).
    • getSettings

      public final AssetServiceSettings getSettings()
    • getStub

      public AssetServiceStub getStub()
    • getOperationsClient

      public final OperationsClient getOperationsClient()
      Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
    • getHttpJsonOperationsClient

      @BetaApi public final OperationsClient getHttpJsonOperationsClient()
      Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
    • exportAssetsAsync

      Exports assets with time and resource types to a given Cloud Storage location/BigQuery table. For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API, which allows you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ExportAssetsRequest request =
             ExportAssetsRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .setReadTime(Timestamp.newBuilder().build())
                 .addAllAssetTypes(new ArrayList<String>())
                 .setContentType(ContentType.forNumber(0))
                 .setOutputConfig(OutputConfig.newBuilder().build())
                 .addAllRelationshipTypes(new ArrayList<String>())
                 .build();
         ExportAssetsResponse response = assetServiceClient.exportAssetsAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • exportAssetsOperationCallable

      public final OperationCallable<ExportAssetsRequest,ExportAssetsResponse,ExportAssetsRequest> exportAssetsOperationCallable()
      Exports assets with time and resource types to a given Cloud Storage location/BigQuery table. For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API, which allows you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ExportAssetsRequest request =
             ExportAssetsRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .setReadTime(Timestamp.newBuilder().build())
                 .addAllAssetTypes(new ArrayList<String>())
                 .setContentType(ContentType.forNumber(0))
                 .setOutputConfig(OutputConfig.newBuilder().build())
                 .addAllRelationshipTypes(new ArrayList<String>())
                 .build();
         OperationFuture<ExportAssetsResponse, ExportAssetsRequest> future =
             assetServiceClient.exportAssetsOperationCallable().futureCall(request);
         // Do something.
         ExportAssetsResponse response = future.get();
       }
       
    • exportAssetsCallable

      public final UnaryCallable<ExportAssetsRequest,Operation> exportAssetsCallable()
      Exports assets with time and resource types to a given Cloud Storage location/BigQuery table. For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API, which allows you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ExportAssetsRequest request =
             ExportAssetsRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .setReadTime(Timestamp.newBuilder().build())
                 .addAllAssetTypes(new ArrayList<String>())
                 .setContentType(ContentType.forNumber(0))
                 .setOutputConfig(OutputConfig.newBuilder().build())
                 .addAllRelationshipTypes(new ArrayList<String>())
                 .build();
         ApiFuture<Operation> future = assetServiceClient.exportAssetsCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • listAssets

      public final AssetServiceClient.ListAssetsPagedResponse listAssets(ResourceName parent)
      Lists assets with time and resource types and returns paged results in response.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ResourceName parent = FolderName.of("[FOLDER]");
         for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. Name of the organization, folder, or project the assets belong to. Format: "organizations/[organization-number]" (such as "organizations/123"), "projects/[project-id]" (such as "projects/my-project-id"), "projects/[project-number]" (such as "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").
      Throws:
      ApiException - if the remote call fails
    • listAssets

      public final AssetServiceClient.ListAssetsPagedResponse listAssets(String parent)
      Lists assets with time and resource types and returns paged results in response.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
         for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. Name of the organization, folder, or project the assets belong to. Format: "organizations/[organization-number]" (such as "organizations/123"), "projects/[project-id]" (such as "projects/my-project-id"), "projects/[project-number]" (such as "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").
      Throws:
      ApiException - if the remote call fails
    • listAssets

      Lists assets with time and resource types and returns paged results in response.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ListAssetsRequest request =
             ListAssetsRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .setReadTime(Timestamp.newBuilder().build())
                 .addAllAssetTypes(new ArrayList<String>())
                 .setContentType(ContentType.forNumber(0))
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .addAllRelationshipTypes(new ArrayList<String>())
                 .build();
         for (Asset element : assetServiceClient.listAssets(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listAssetsPagedCallable

      Lists assets with time and resource types and returns paged results in response.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ListAssetsRequest request =
             ListAssetsRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .setReadTime(Timestamp.newBuilder().build())
                 .addAllAssetTypes(new ArrayList<String>())
                 .setContentType(ContentType.forNumber(0))
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .addAllRelationshipTypes(new ArrayList<String>())
                 .build();
         ApiFuture<Asset> future = assetServiceClient.listAssetsPagedCallable().futureCall(request);
         // Do something.
         for (Asset element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listAssetsCallable

      public final UnaryCallable<ListAssetsRequest,ListAssetsResponse> listAssetsCallable()
      Lists assets with time and resource types and returns paged results in response.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ListAssetsRequest request =
             ListAssetsRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .setReadTime(Timestamp.newBuilder().build())
                 .addAllAssetTypes(new ArrayList<String>())
                 .setContentType(ContentType.forNumber(0))
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .addAllRelationshipTypes(new ArrayList<String>())
                 .build();
         while (true) {
           ListAssetsResponse response = assetServiceClient.listAssetsCallable().call(request);
           for (Asset element : response.getAssetsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • batchGetAssetsHistory

      public final BatchGetAssetsHistoryResponse batchGetAssetsHistory(BatchGetAssetsHistoryRequest request)
      Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         BatchGetAssetsHistoryRequest request =
             BatchGetAssetsHistoryRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .addAllAssetNames(new ArrayList<String>())
                 .setContentType(ContentType.forNumber(0))
                 .setReadTimeWindow(TimeWindow.newBuilder().build())
                 .addAllRelationshipTypes(new ArrayList<String>())
                 .build();
         BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • batchGetAssetsHistoryCallable

      public final UnaryCallable<BatchGetAssetsHistoryRequest,BatchGetAssetsHistoryResponse> batchGetAssetsHistoryCallable()
      Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         BatchGetAssetsHistoryRequest request =
             BatchGetAssetsHistoryRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .addAllAssetNames(new ArrayList<String>())
                 .setContentType(ContentType.forNumber(0))
                 .setReadTimeWindow(TimeWindow.newBuilder().build())
                 .addAllRelationshipTypes(new ArrayList<String>())
                 .build();
         ApiFuture<BatchGetAssetsHistoryResponse> future =
             assetServiceClient.batchGetAssetsHistoryCallable().futureCall(request);
         // Do something.
         BatchGetAssetsHistoryResponse response = future.get();
       }
       
    • createFeed

      public final Feed createFeed(String parent)
      Creates a feed in a parent project/folder/organization to listen to its asset updates.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String parent = "parent-995424086";
         Feed response = assetServiceClient.createFeed(parent);
       }
       
      Parameters:
      parent - Required. The name of the project/folder/organization where this feed should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").
      Throws:
      ApiException - if the remote call fails
    • createFeed

      public final Feed createFeed(CreateFeedRequest request)
      Creates a feed in a parent project/folder/organization to listen to its asset updates.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         CreateFeedRequest request =
             CreateFeedRequest.newBuilder()
                 .setParent("parent-995424086")
                 .setFeedId("feedId-1278410919")
                 .setFeed(Feed.newBuilder().build())
                 .build();
         Feed response = assetServiceClient.createFeed(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createFeedCallable

      public final UnaryCallable<CreateFeedRequest,Feed> createFeedCallable()
      Creates a feed in a parent project/folder/organization to listen to its asset updates.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         CreateFeedRequest request =
             CreateFeedRequest.newBuilder()
                 .setParent("parent-995424086")
                 .setFeedId("feedId-1278410919")
                 .setFeed(Feed.newBuilder().build())
                 .build();
         ApiFuture<Feed> future = assetServiceClient.createFeedCallable().futureCall(request);
         // Do something.
         Feed response = future.get();
       }
       
    • getFeed

      public final Feed getFeed(FeedName name)
      Gets details about an asset feed.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
         Feed response = assetServiceClient.getFeed(name);
       }
       
      Parameters:
      name - Required. The name of the Feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id
      Throws:
      ApiException - if the remote call fails
    • getFeed

      public final Feed getFeed(String name)
      Gets details about an asset feed.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
         Feed response = assetServiceClient.getFeed(name);
       }
       
      Parameters:
      name - Required. The name of the Feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id
      Throws:
      ApiException - if the remote call fails
    • getFeed

      public final Feed getFeed(GetFeedRequest request)
      Gets details about an asset feed.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         GetFeedRequest request =
             GetFeedRequest.newBuilder()
                 .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
                 .build();
         Feed response = assetServiceClient.getFeed(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getFeedCallable

      public final UnaryCallable<GetFeedRequest,Feed> getFeedCallable()
      Gets details about an asset feed.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         GetFeedRequest request =
             GetFeedRequest.newBuilder()
                 .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
                 .build();
         ApiFuture<Feed> future = assetServiceClient.getFeedCallable().futureCall(request);
         // Do something.
         Feed response = future.get();
       }
       
    • listFeeds

      public final ListFeedsResponse listFeeds(String parent)
      Lists all asset feeds in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String parent = "parent-995424086";
         ListFeedsResponse response = assetServiceClient.listFeeds(parent);
       }
       
      Parameters:
      parent - Required. The parent project/folder/organization whose feeds are to be listed. It can only be using project/folder/organization number (such as "folders/12345")", or a project ID (such as "projects/my-project-id").
      Throws:
      ApiException - if the remote call fails
    • listFeeds

      public final ListFeedsResponse listFeeds(ListFeedsRequest request)
      Lists all asset feeds in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ListFeedsRequest request =
             ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
         ListFeedsResponse response = assetServiceClient.listFeeds(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listFeedsCallable

      public final UnaryCallable<ListFeedsRequest,ListFeedsResponse> listFeedsCallable()
      Lists all asset feeds in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ListFeedsRequest request =
             ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
         ApiFuture<ListFeedsResponse> future =
             assetServiceClient.listFeedsCallable().futureCall(request);
         // Do something.
         ListFeedsResponse response = future.get();
       }
       
    • updateFeed

      public final Feed updateFeed(Feed feed)
      Updates an asset feed configuration.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         Feed feed = Feed.newBuilder().build();
         Feed response = assetServiceClient.updateFeed(feed);
       }
       
      Parameters:
      feed - Required. The new values of feed details. It must match an existing feed and the field `name` must be in the format of: projects/project_number/feeds/feed_id or folders/folder_number/feeds/feed_id or organizations/organization_number/feeds/feed_id.
      Throws:
      ApiException - if the remote call fails
    • updateFeed

      public final Feed updateFeed(UpdateFeedRequest request)
      Updates an asset feed configuration.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         UpdateFeedRequest request =
             UpdateFeedRequest.newBuilder()
                 .setFeed(Feed.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Feed response = assetServiceClient.updateFeed(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateFeedCallable

      public final UnaryCallable<UpdateFeedRequest,Feed> updateFeedCallable()
      Updates an asset feed configuration.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         UpdateFeedRequest request =
             UpdateFeedRequest.newBuilder()
                 .setFeed(Feed.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Feed> future = assetServiceClient.updateFeedCallable().futureCall(request);
         // Do something.
         Feed response = future.get();
       }
       
    • deleteFeed

      public final void deleteFeed(FeedName name)
      Deletes an asset feed.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
         assetServiceClient.deleteFeed(name);
       }
       
      Parameters:
      name - Required. The name of the feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id
      Throws:
      ApiException - if the remote call fails
    • deleteFeed

      public final void deleteFeed(String name)
      Deletes an asset feed.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
         assetServiceClient.deleteFeed(name);
       }
       
      Parameters:
      name - Required. The name of the feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id
      Throws:
      ApiException - if the remote call fails
    • deleteFeed

      public final void deleteFeed(DeleteFeedRequest request)
      Deletes an asset feed.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         DeleteFeedRequest request =
             DeleteFeedRequest.newBuilder()
                 .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
                 .build();
         assetServiceClient.deleteFeed(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteFeedCallable

      public final UnaryCallable<DeleteFeedRequest,com.google.protobuf.Empty> deleteFeedCallable()
      Deletes an asset feed.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         DeleteFeedRequest request =
             DeleteFeedRequest.newBuilder()
                 .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
                 .build();
         ApiFuture<Empty> future = assetServiceClient.deleteFeedCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • searchAllResources

      public final AssetServiceClient.SearchAllResourcesPagedResponse searchAllResources(String scope, String query, List<String> assetTypes)
      Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the request will be rejected.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String scope = "scope109264468";
         String query = "query107944136";
         List<String> assetTypes = new ArrayList<>();
         for (ResourceSearchResult element :
             assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      scope - Required. A scope can be a project, a folder, or an organization. The search is limited to the resources within the `scope`. The caller must be granted the [`cloudasset.assets.searchAllResources`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) permission on the desired scope.

      The allowed values are:

      • projects/{PROJECT_ID} (e.g., "projects/foo-bar")
      • projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
      • folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
      • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
      query - Optional. The query statement. See [how to construct a query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) for more information. If not specified or empty, it will search all the resources within the specified `scope`.

      Examples:

      • `name:Important` to find Google Cloud resources whose name contains `Important` as a word.
      • `name=Important` to find the Google Cloud resource whose name is exactly `Important`.
      • `displayName:Impor*` to find Google Cloud resources whose display name contains `Impor` as a prefix of any word in the field.
      • `location:us-west*` to find Google Cloud resources whose location contains both `us` and `west` as prefixes.
      • `labels:prod` to find Google Cloud resources whose labels contain `prod` as a key or value.
      • `labels.env:prod` to find Google Cloud resources that have a label `env` and its value is `prod`.
      • `labels.env:*` to find Google Cloud resources that have a label `env`.
      • `tagKeys:env` to find Google Cloud resources that have directly attached tags where the [`TagKey.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey) contains `env`.
      • `tagValues:prod*` to find Google Cloud resources that have directly attached tags where the [`TagValue.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue) contains a word prefixed by `prod`.
      • `tagValueIds=tagValues/123` to find Google Cloud resources that have directly attached tags where the [`TagValue.name`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue) is exactly `tagValues/123`.
      • `effectiveTagKeys:env` to find Google Cloud resources that have directly attached or inherited tags where the [`TagKey.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey) contains `env`.
      • `effectiveTagValues:prod*` to find Google Cloud resources that have directly attached or inherited tags where the [`TagValue.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue) contains a word prefixed by `prod`.
      • `effectiveTagValueIds=tagValues/123` to find Google Cloud resources that have directly attached or inherited tags where the [`TagValue.name`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue) is exactly `tagValues/123`.
      • `kmsKey:key` to find Google Cloud resources encrypted with a customer-managed encryption key whose name contains `key` as a word. This field is deprecated. Use the `kmsKeys` field to retrieve Cloud KMS key information.
      • `kmsKeys:key` to find Google Cloud resources encrypted with customer-managed encryption keys whose name contains the word `key`.
      • `relationships:instance-group-1` to find Google Cloud resources that have relationships with `instance-group-1` in the related resource name.
      • `relationships:INSTANCE_TO_INSTANCEGROUP` to find Compute Engine instances that have relationships of type `INSTANCE_TO_INSTANCEGROUP`.
      • `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find Compute Engine instances that have relationships with `instance-group-1` in the Compute Engine instance group resource name, for relationship type `INSTANCE_TO_INSTANCEGROUP`.
      • `sccSecurityMarks.key=value` to find Cloud resources that are attached with security marks whose key is `key` and value is `value`.
      • `sccSecurityMarks.key:*` to find Cloud resources that are attached with security marks whose key is `key`.
      • `state:ACTIVE` to find Google Cloud resources whose state contains `ACTIVE` as a word.
      • `NOT state:ACTIVE` to find Google Cloud resources whose state doesn't contain `ACTIVE` as a word.
      • `createTime<1609459200` to find Google Cloud resources that were created before `2021-01-01 00:00:00 UTC`. `1609459200` is the epoch timestamp of `2021-01-01 00:00:00 UTC` in seconds.
      • `updateTime>1609459200` to find Google Cloud resources that were updated after `2021-01-01 00:00:00 UTC`. `1609459200` is the epoch timestamp of `2021-01-01 00:00:00 UTC` in seconds.
      • `Important` to find Google Cloud resources that contain `Important` as a word in any of the searchable fields.
      • `Impor*` to find Google Cloud resources that contain `Impor` as a prefix of any word in any of the searchable fields.
      • `Important location:(us-west1 OR global)` to find Google Cloud resources that contain `Important` as a word in any of the searchable fields and are also located in the `us-west1` region or the `global` location.
      assetTypes - Optional. A list of asset types that this request searches for. If empty, it will search all the asset types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types).

      Regular expressions are also supported. For example:

      • "compute.googleapis.com.*" snapshots resources whose asset type starts with "compute.googleapis.com".
      • ".*Instance" snapshots resources whose asset type ends with "Instance".
      • ".*Instance.*" snapshots resources whose asset type contains "Instance".

      See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported regular expression syntax. If the regular expression does not match any supported asset type, an INVALID_ARGUMENT error will be returned.

      Throws:
      ApiException - if the remote call fails
    • searchAllResources

      Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the request will be rejected.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         SearchAllResourcesRequest request =
             SearchAllResourcesRequest.newBuilder()
                 .setScope("scope109264468")
                 .setQuery("query107944136")
                 .addAllAssetTypes(new ArrayList<String>())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setOrderBy("orderBy-1207110587")
                 .setReadMask(FieldMask.newBuilder().build())
                 .build();
         for (ResourceSearchResult element :
             assetServiceClient.searchAllResources(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • searchAllResourcesPagedCallable

      Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the request will be rejected.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         SearchAllResourcesRequest request =
             SearchAllResourcesRequest.newBuilder()
                 .setScope("scope109264468")
                 .setQuery("query107944136")
                 .addAllAssetTypes(new ArrayList<String>())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setOrderBy("orderBy-1207110587")
                 .setReadMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<ResourceSearchResult> future =
             assetServiceClient.searchAllResourcesPagedCallable().futureCall(request);
         // Do something.
         for (ResourceSearchResult element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • searchAllResourcesCallable

      public final UnaryCallable<SearchAllResourcesRequest,SearchAllResourcesResponse> searchAllResourcesCallable()
      Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the request will be rejected.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         SearchAllResourcesRequest request =
             SearchAllResourcesRequest.newBuilder()
                 .setScope("scope109264468")
                 .setQuery("query107944136")
                 .addAllAssetTypes(new ArrayList<String>())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setOrderBy("orderBy-1207110587")
                 .setReadMask(FieldMask.newBuilder().build())
                 .build();
         while (true) {
           SearchAllResourcesResponse response =
               assetServiceClient.searchAllResourcesCallable().call(request);
           for (ResourceSearchResult element : response.getResultsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • searchAllIamPolicies

      public final AssetServiceClient.SearchAllIamPoliciesPagedResponse searchAllIamPolicies(String scope, String query)
      Searches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the request will be rejected.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String scope = "scope109264468";
         String query = "query107944136";
         for (IamPolicySearchResult element :
             assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      scope - Required. A scope can be a project, a folder, or an organization. The search is limited to the IAM policies within the `scope`. The caller must be granted the [`cloudasset.assets.searchAllIamPolicies`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) permission on the desired scope.

      The allowed values are:

      • projects/{PROJECT_ID} (e.g., "projects/foo-bar")
      • projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
      • folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
      • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
      query - Optional. The query statement. See [how to construct a query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query) for more information. If not specified or empty, it will search all the IAM policies within the specified `scope`. Note that the query string is compared against each IAM policy binding, including its principals, roles, and IAM conditions. The returned IAM policies will only contain the bindings that match your query. To learn more about the IAM policy structure, see the [IAM policy documentation](https://cloud.google.com/iam/help/allow-policies/structure).

      Examples:

      • `policy:amy@gmail.com` to find IAM policy bindings that specify user "amy@gmail.com".
      • `policy:roles/compute.admin` to find IAM policy bindings that specify the Compute Admin role.
      • `policy:comp*` to find IAM policy bindings that contain "comp" as a prefix of any word in the binding.
      • `policy.role.permissions:storage.buckets.update` to find IAM policy bindings that specify a role containing "storage.buckets.update" permission. Note that if callers don't have `iam.roles.get` access to a role's included permissions, policy bindings that specify this role will be dropped from the search results.
      • `policy.role.permissions:upd*` to find IAM policy bindings that specify a role containing "upd" as a prefix of any word in the role permission. Note that if callers don't have `iam.roles.get` access to a role's included permissions, policy bindings that specify this role will be dropped from the search results.
      • `resource:organizations/123456` to find IAM policy bindings that are set on "organizations/123456".
      • `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to find IAM policy bindings that are set on the project named "myproject".
      • `Important` to find IAM policy bindings that contain "Important" as a word in any of the searchable fields (except for the included permissions).
      • `resource:(instance1 OR instance2) policy:amy` to find IAM policy bindings that are set on resources "instance1" or "instance2" and also specify user "amy".
      • `roles:roles/compute.admin` to find IAM policy bindings that specify the Compute Admin role.
      • `memberTypes:user` to find IAM policy bindings that contain the principal type "user".
      Throws:
      ApiException - if the remote call fails
    • searchAllIamPolicies

      Searches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the request will be rejected.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         SearchAllIamPoliciesRequest request =
             SearchAllIamPoliciesRequest.newBuilder()
                 .setScope("scope109264468")
                 .setQuery("query107944136")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .addAllAssetTypes(new ArrayList<String>())
                 .setOrderBy("orderBy-1207110587")
                 .build();
         for (IamPolicySearchResult element :
             assetServiceClient.searchAllIamPolicies(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • searchAllIamPoliciesPagedCallable

      Searches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the request will be rejected.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         SearchAllIamPoliciesRequest request =
             SearchAllIamPoliciesRequest.newBuilder()
                 .setScope("scope109264468")
                 .setQuery("query107944136")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .addAllAssetTypes(new ArrayList<String>())
                 .setOrderBy("orderBy-1207110587")
                 .build();
         ApiFuture<IamPolicySearchResult> future =
             assetServiceClient.searchAllIamPoliciesPagedCallable().futureCall(request);
         // Do something.
         for (IamPolicySearchResult element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • searchAllIamPoliciesCallable

      public final UnaryCallable<SearchAllIamPoliciesRequest,SearchAllIamPoliciesResponse> searchAllIamPoliciesCallable()
      Searches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the request will be rejected.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         SearchAllIamPoliciesRequest request =
             SearchAllIamPoliciesRequest.newBuilder()
                 .setScope("scope109264468")
                 .setQuery("query107944136")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .addAllAssetTypes(new ArrayList<String>())
                 .setOrderBy("orderBy-1207110587")
                 .build();
         while (true) {
           SearchAllIamPoliciesResponse response =
               assetServiceClient.searchAllIamPoliciesCallable().call(request);
           for (IamPolicySearchResult element : response.getResultsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • analyzeIamPolicy

      public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest request)
      Analyzes IAM policies to answer which identities have what accesses on which resources.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeIamPolicyRequest request =
             AnalyzeIamPolicyRequest.newBuilder()
                 .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
                 .setSavedAnalysisQuery("savedAnalysisQuery376058885")
                 .setExecutionTimeout(Duration.newBuilder().build())
                 .build();
         AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • analyzeIamPolicyCallable

      public final UnaryCallable<AnalyzeIamPolicyRequest,AnalyzeIamPolicyResponse> analyzeIamPolicyCallable()
      Analyzes IAM policies to answer which identities have what accesses on which resources.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeIamPolicyRequest request =
             AnalyzeIamPolicyRequest.newBuilder()
                 .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
                 .setSavedAnalysisQuery("savedAnalysisQuery376058885")
                 .setExecutionTimeout(Duration.newBuilder().build())
                 .build();
         ApiFuture<AnalyzeIamPolicyResponse> future =
             assetServiceClient.analyzeIamPolicyCallable().futureCall(request);
         // Do something.
         AnalyzeIamPolicyResponse response = future.get();
       }
       
    • analyzeIamPolicyLongrunningAsync

      Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. This method implements the [google.longrunning.Operation][google.longrunning.Operation], which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeIamPolicyLongrunningRequest request =
             AnalyzeIamPolicyLongrunningRequest.newBuilder()
                 .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
                 .setSavedAnalysisQuery("savedAnalysisQuery376058885")
                 .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
                 .build();
         AnalyzeIamPolicyLongrunningResponse response =
             assetServiceClient.analyzeIamPolicyLongrunningAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • analyzeIamPolicyLongrunningOperationCallable

      Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. This method implements the [google.longrunning.Operation][google.longrunning.Operation], which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeIamPolicyLongrunningRequest request =
             AnalyzeIamPolicyLongrunningRequest.newBuilder()
                 .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
                 .setSavedAnalysisQuery("savedAnalysisQuery376058885")
                 .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
                 .build();
         OperationFuture<AnalyzeIamPolicyLongrunningResponse, AnalyzeIamPolicyLongrunningMetadata>
             future =
                 assetServiceClient.analyzeIamPolicyLongrunningOperationCallable().futureCall(request);
         // Do something.
         AnalyzeIamPolicyLongrunningResponse response = future.get();
       }
       
    • analyzeIamPolicyLongrunningCallable

      public final UnaryCallable<AnalyzeIamPolicyLongrunningRequest,Operation> analyzeIamPolicyLongrunningCallable()
      Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. This method implements the [google.longrunning.Operation][google.longrunning.Operation], which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeIamPolicyLongrunningRequest request =
             AnalyzeIamPolicyLongrunningRequest.newBuilder()
                 .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
                 .setSavedAnalysisQuery("savedAnalysisQuery376058885")
                 .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
                 .build();
         ApiFuture<Operation> future =
             assetServiceClient.analyzeIamPolicyLongrunningCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • analyzeMove

      public final AnalyzeMoveResponse analyzeMove(AnalyzeMoveRequest request)
      Analyze moving a resource to a specified destination without kicking off the actual move. The analysis is best effort depending on the user's permissions of viewing different hierarchical policies and configurations. The policies and configuration are subject to change before the actual resource migration takes place.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeMoveRequest request =
             AnalyzeMoveRequest.newBuilder()
                 .setResource(ProjectName.of("[PROJECT]").toString())
                 .setDestinationParent(FolderName.of("[FOLDER]").toString())
                 .build();
         AnalyzeMoveResponse response = assetServiceClient.analyzeMove(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • analyzeMoveCallable

      public final UnaryCallable<AnalyzeMoveRequest,AnalyzeMoveResponse> analyzeMoveCallable()
      Analyze moving a resource to a specified destination without kicking off the actual move. The analysis is best effort depending on the user's permissions of viewing different hierarchical policies and configurations. The policies and configuration are subject to change before the actual resource migration takes place.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeMoveRequest request =
             AnalyzeMoveRequest.newBuilder()
                 .setResource(ProjectName.of("[PROJECT]").toString())
                 .setDestinationParent(FolderName.of("[FOLDER]").toString())
                 .build();
         ApiFuture<AnalyzeMoveResponse> future =
             assetServiceClient.analyzeMoveCallable().futureCall(request);
         // Do something.
         AnalyzeMoveResponse response = future.get();
       }
       
    • queryAssets

      public final QueryAssetsResponse queryAssets(QueryAssetsRequest request)
      Issue a job that queries assets using a SQL statement compatible with [BigQuery SQL](https://cloud.google.com/bigquery/docs/introduction-sql).

      If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`.

      Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call.

      Note, the query result has approximately 10 GB limitation enforced by [BigQuery](https://cloud.google.com/bigquery/docs/best-practices-performance-output). Queries return larger results will result in errors.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         QueryAssetsRequest request =
             QueryAssetsRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setTimeout(Duration.newBuilder().build())
                 .setOutputConfig(QueryAssetsOutputConfig.newBuilder().build())
                 .build();
         QueryAssetsResponse response = assetServiceClient.queryAssets(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • queryAssetsCallable

      public final UnaryCallable<QueryAssetsRequest,QueryAssetsResponse> queryAssetsCallable()
      Issue a job that queries assets using a SQL statement compatible with [BigQuery SQL](https://cloud.google.com/bigquery/docs/introduction-sql).

      If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`.

      Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call.

      Note, the query result has approximately 10 GB limitation enforced by [BigQuery](https://cloud.google.com/bigquery/docs/best-practices-performance-output). Queries return larger results will result in errors.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         QueryAssetsRequest request =
             QueryAssetsRequest.newBuilder()
                 .setParent(FolderName.of("[FOLDER]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setTimeout(Duration.newBuilder().build())
                 .setOutputConfig(QueryAssetsOutputConfig.newBuilder().build())
                 .build();
         ApiFuture<QueryAssetsResponse> future =
             assetServiceClient.queryAssetsCallable().futureCall(request);
         // Do something.
         QueryAssetsResponse response = future.get();
       }
       
    • createSavedQuery

      public final SavedQuery createSavedQuery(FolderName parent, SavedQuery savedQuery, String savedQueryId)
      Creates a saved query in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         FolderName parent = FolderName.of("[FOLDER]");
         SavedQuery savedQuery = SavedQuery.newBuilder().build();
         String savedQueryId = "savedQueryId378086268";
         SavedQuery response = assetServiceClient.createSavedQuery(parent, savedQuery, savedQueryId);
       }
       
      Parameters:
      parent - Required. The name of the project/folder/organization where this saved_query should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").
      savedQuery - Required. The saved_query details. The `name` field must be empty as it will be generated based on the parent and saved_query_id.
      savedQueryId - Required. The ID to use for the saved query, which must be unique in the specified parent. It will become the final component of the saved query's resource name.

      This value should be 4-63 characters, and valid characters are `[a-z][0-9]-`.

      Notice that this field is required in the saved query creation, and the `name` field of the `saved_query` will be ignored.

      Throws:
      ApiException - if the remote call fails
    • createSavedQuery

      public final SavedQuery createSavedQuery(OrganizationName parent, SavedQuery savedQuery, String savedQueryId)
      Creates a saved query in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
         SavedQuery savedQuery = SavedQuery.newBuilder().build();
         String savedQueryId = "savedQueryId378086268";
         SavedQuery response = assetServiceClient.createSavedQuery(parent, savedQuery, savedQueryId);
       }
       
      Parameters:
      parent - Required. The name of the project/folder/organization where this saved_query should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").
      savedQuery - Required. The saved_query details. The `name` field must be empty as it will be generated based on the parent and saved_query_id.
      savedQueryId - Required. The ID to use for the saved query, which must be unique in the specified parent. It will become the final component of the saved query's resource name.

      This value should be 4-63 characters, and valid characters are `[a-z][0-9]-`.

      Notice that this field is required in the saved query creation, and the `name` field of the `saved_query` will be ignored.

      Throws:
      ApiException - if the remote call fails
    • createSavedQuery

      public final SavedQuery createSavedQuery(ProjectName parent, SavedQuery savedQuery, String savedQueryId)
      Creates a saved query in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         SavedQuery savedQuery = SavedQuery.newBuilder().build();
         String savedQueryId = "savedQueryId378086268";
         SavedQuery response = assetServiceClient.createSavedQuery(parent, savedQuery, savedQueryId);
       }
       
      Parameters:
      parent - Required. The name of the project/folder/organization where this saved_query should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").
      savedQuery - Required. The saved_query details. The `name` field must be empty as it will be generated based on the parent and saved_query_id.
      savedQueryId - Required. The ID to use for the saved query, which must be unique in the specified parent. It will become the final component of the saved query's resource name.

      This value should be 4-63 characters, and valid characters are `[a-z][0-9]-`.

      Notice that this field is required in the saved query creation, and the `name` field of the `saved_query` will be ignored.

      Throws:
      ApiException - if the remote call fails
    • createSavedQuery

      public final SavedQuery createSavedQuery(String parent, SavedQuery savedQuery, String savedQueryId)
      Creates a saved query in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         SavedQuery savedQuery = SavedQuery.newBuilder().build();
         String savedQueryId = "savedQueryId378086268";
         SavedQuery response = assetServiceClient.createSavedQuery(parent, savedQuery, savedQueryId);
       }
       
      Parameters:
      parent - Required. The name of the project/folder/organization where this saved_query should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").
      savedQuery - Required. The saved_query details. The `name` field must be empty as it will be generated based on the parent and saved_query_id.
      savedQueryId - Required. The ID to use for the saved query, which must be unique in the specified parent. It will become the final component of the saved query's resource name.

      This value should be 4-63 characters, and valid characters are `[a-z][0-9]-`.

      Notice that this field is required in the saved query creation, and the `name` field of the `saved_query` will be ignored.

      Throws:
      ApiException - if the remote call fails
    • createSavedQuery

      public final SavedQuery createSavedQuery(CreateSavedQueryRequest request)
      Creates a saved query in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         CreateSavedQueryRequest request =
             CreateSavedQueryRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setSavedQuery(SavedQuery.newBuilder().build())
                 .setSavedQueryId("savedQueryId378086268")
                 .build();
         SavedQuery response = assetServiceClient.createSavedQuery(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createSavedQueryCallable

      public final UnaryCallable<CreateSavedQueryRequest,SavedQuery> createSavedQueryCallable()
      Creates a saved query in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         CreateSavedQueryRequest request =
             CreateSavedQueryRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setSavedQuery(SavedQuery.newBuilder().build())
                 .setSavedQueryId("savedQueryId378086268")
                 .build();
         ApiFuture<SavedQuery> future =
             assetServiceClient.createSavedQueryCallable().futureCall(request);
         // Do something.
         SavedQuery response = future.get();
       }
       
    • getSavedQuery

      public final SavedQuery getSavedQuery(SavedQueryName name)
      Gets details about a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         SavedQueryName name = SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]");
         SavedQuery response = assetServiceClient.getSavedQuery(name);
       }
       
      Parameters:
      name - Required. The name of the saved query and it must be in the format of:
      • projects/project_number/savedQueries/saved_query_id
      • folders/folder_number/savedQueries/saved_query_id
      • organizations/organization_number/savedQueries/saved_query_id
      Throws:
      ApiException - if the remote call fails
    • getSavedQuery

      public final SavedQuery getSavedQuery(String name)
      Gets details about a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String name = SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString();
         SavedQuery response = assetServiceClient.getSavedQuery(name);
       }
       
      Parameters:
      name - Required. The name of the saved query and it must be in the format of:
      • projects/project_number/savedQueries/saved_query_id
      • folders/folder_number/savedQueries/saved_query_id
      • organizations/organization_number/savedQueries/saved_query_id
      Throws:
      ApiException - if the remote call fails
    • getSavedQuery

      public final SavedQuery getSavedQuery(GetSavedQueryRequest request)
      Gets details about a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         GetSavedQueryRequest request =
             GetSavedQueryRequest.newBuilder()
                 .setName(
                     SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString())
                 .build();
         SavedQuery response = assetServiceClient.getSavedQuery(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getSavedQueryCallable

      public final UnaryCallable<GetSavedQueryRequest,SavedQuery> getSavedQueryCallable()
      Gets details about a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         GetSavedQueryRequest request =
             GetSavedQueryRequest.newBuilder()
                 .setName(
                     SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString())
                 .build();
         ApiFuture<SavedQuery> future = assetServiceClient.getSavedQueryCallable().futureCall(request);
         // Do something.
         SavedQuery response = future.get();
       }
       
    • listSavedQueries

      public final AssetServiceClient.ListSavedQueriesPagedResponse listSavedQueries(FolderName parent)
      Lists all saved queries in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         FolderName parent = FolderName.of("[FOLDER]");
         for (SavedQuery element : assetServiceClient.listSavedQueries(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent project/folder/organization whose savedQueries are to be listed. It can only be using project/folder/organization number (such as "folders/12345")", or a project ID (such as "projects/my-project-id").
      Throws:
      ApiException - if the remote call fails
    • listSavedQueries

      Lists all saved queries in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
         for (SavedQuery element : assetServiceClient.listSavedQueries(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent project/folder/organization whose savedQueries are to be listed. It can only be using project/folder/organization number (such as "folders/12345")", or a project ID (such as "projects/my-project-id").
      Throws:
      ApiException - if the remote call fails
    • listSavedQueries

      public final AssetServiceClient.ListSavedQueriesPagedResponse listSavedQueries(ProjectName parent)
      Lists all saved queries in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         for (SavedQuery element : assetServiceClient.listSavedQueries(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent project/folder/organization whose savedQueries are to be listed. It can only be using project/folder/organization number (such as "folders/12345")", or a project ID (such as "projects/my-project-id").
      Throws:
      ApiException - if the remote call fails
    • listSavedQueries

      public final AssetServiceClient.ListSavedQueriesPagedResponse listSavedQueries(String parent)
      Lists all saved queries in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         for (SavedQuery element : assetServiceClient.listSavedQueries(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent project/folder/organization whose savedQueries are to be listed. It can only be using project/folder/organization number (such as "folders/12345")", or a project ID (such as "projects/my-project-id").
      Throws:
      ApiException - if the remote call fails
    • listSavedQueries

      Lists all saved queries in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ListSavedQueriesRequest request =
             ListSavedQueriesRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (SavedQuery element : assetServiceClient.listSavedQueries(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listSavedQueriesPagedCallable

      Lists all saved queries in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ListSavedQueriesRequest request =
             ListSavedQueriesRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<SavedQuery> future =
             assetServiceClient.listSavedQueriesPagedCallable().futureCall(request);
         // Do something.
         for (SavedQuery element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listSavedQueriesCallable

      public final UnaryCallable<ListSavedQueriesRequest,ListSavedQueriesResponse> listSavedQueriesCallable()
      Lists all saved queries in a parent project/folder/organization.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         ListSavedQueriesRequest request =
             ListSavedQueriesRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListSavedQueriesResponse response =
               assetServiceClient.listSavedQueriesCallable().call(request);
           for (SavedQuery element : response.getSavedQueriesList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • updateSavedQuery

      public final SavedQuery updateSavedQuery(SavedQuery savedQuery, com.google.protobuf.FieldMask updateMask)
      Updates a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         SavedQuery savedQuery = SavedQuery.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         SavedQuery response = assetServiceClient.updateSavedQuery(savedQuery, updateMask);
       }
       
      Parameters:
      savedQuery - Required. The saved query to update.

      The saved query's `name` field is used to identify the one to update, which has format as below:

      • projects/project_number/savedQueries/saved_query_id
      • folders/folder_number/savedQueries/saved_query_id
      • organizations/organization_number/savedQueries/saved_query_id
      updateMask - Required. The list of fields to update.
      Throws:
      ApiException - if the remote call fails
    • updateSavedQuery

      public final SavedQuery updateSavedQuery(UpdateSavedQueryRequest request)
      Updates a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         UpdateSavedQueryRequest request =
             UpdateSavedQueryRequest.newBuilder()
                 .setSavedQuery(SavedQuery.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         SavedQuery response = assetServiceClient.updateSavedQuery(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateSavedQueryCallable

      public final UnaryCallable<UpdateSavedQueryRequest,SavedQuery> updateSavedQueryCallable()
      Updates a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         UpdateSavedQueryRequest request =
             UpdateSavedQueryRequest.newBuilder()
                 .setSavedQuery(SavedQuery.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<SavedQuery> future =
             assetServiceClient.updateSavedQueryCallable().futureCall(request);
         // Do something.
         SavedQuery response = future.get();
       }
       
    • deleteSavedQuery

      public final void deleteSavedQuery(SavedQueryName name)
      Deletes a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         SavedQueryName name = SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]");
         assetServiceClient.deleteSavedQuery(name);
       }
       
      Parameters:
      name - Required. The name of the saved query to delete. It must be in the format of:
      • projects/project_number/savedQueries/saved_query_id
      • folders/folder_number/savedQueries/saved_query_id
      • organizations/organization_number/savedQueries/saved_query_id
      Throws:
      ApiException - if the remote call fails
    • deleteSavedQuery

      public final void deleteSavedQuery(String name)
      Deletes a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String name = SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString();
         assetServiceClient.deleteSavedQuery(name);
       }
       
      Parameters:
      name - Required. The name of the saved query to delete. It must be in the format of:
      • projects/project_number/savedQueries/saved_query_id
      • folders/folder_number/savedQueries/saved_query_id
      • organizations/organization_number/savedQueries/saved_query_id
      Throws:
      ApiException - if the remote call fails
    • deleteSavedQuery

      public final void deleteSavedQuery(DeleteSavedQueryRequest request)
      Deletes a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         DeleteSavedQueryRequest request =
             DeleteSavedQueryRequest.newBuilder()
                 .setName(
                     SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString())
                 .build();
         assetServiceClient.deleteSavedQuery(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteSavedQueryCallable

      public final UnaryCallable<DeleteSavedQueryRequest,com.google.protobuf.Empty> deleteSavedQueryCallable()
      Deletes a saved query.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         DeleteSavedQueryRequest request =
             DeleteSavedQueryRequest.newBuilder()
                 .setName(
                     SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString())
                 .build();
         ApiFuture<Empty> future = assetServiceClient.deleteSavedQueryCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • batchGetEffectiveIamPolicies

      public final BatchGetEffectiveIamPoliciesResponse batchGetEffectiveIamPolicies(BatchGetEffectiveIamPoliciesRequest request)
      Gets effective IAM policies for a batch of resources.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         BatchGetEffectiveIamPoliciesRequest request =
             BatchGetEffectiveIamPoliciesRequest.newBuilder()
                 .setScope(FolderName.of("[FOLDER]").toString())
                 .addAllNames(new ArrayList<String>())
                 .build();
         BatchGetEffectiveIamPoliciesResponse response =
             assetServiceClient.batchGetEffectiveIamPolicies(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • batchGetEffectiveIamPoliciesCallable

      public final UnaryCallable<BatchGetEffectiveIamPoliciesRequest,BatchGetEffectiveIamPoliciesResponse> batchGetEffectiveIamPoliciesCallable()
      Gets effective IAM policies for a batch of resources.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         BatchGetEffectiveIamPoliciesRequest request =
             BatchGetEffectiveIamPoliciesRequest.newBuilder()
                 .setScope(FolderName.of("[FOLDER]").toString())
                 .addAllNames(new ArrayList<String>())
                 .build();
         ApiFuture<BatchGetEffectiveIamPoliciesResponse> future =
             assetServiceClient.batchGetEffectiveIamPoliciesCallable().futureCall(request);
         // Do something.
         BatchGetEffectiveIamPoliciesResponse response = future.get();
       }
       
    • analyzeOrgPolicies

      public final AssetServiceClient.AnalyzeOrgPoliciesPagedResponse analyzeOrgPolicies(String scope, String constraint, String filter)
      Analyzes organization policies under a scope.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String scope = "scope109264468";
         String constraint = "constraint-190376483";
         String filter = "filter-1274492040";
         for (AnalyzeOrgPoliciesResponse.OrgPolicyResult element :
             assetServiceClient.analyzeOrgPolicies(scope, constraint, filter).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      scope - Required. The organization to scope the request. Only organization policies within the scope will be analyzed.
      • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
      constraint - Required. The name of the constraint to analyze organization policies for. The response only contains analyzed organization policies for the provided constraint.
      filter - The expression to filter [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]. Filtering is currently available for bare literal values and the following fields:
      • consolidated_policy.attached_resource
      • consolidated_policy.rules.enforce

      When filtering by a specific field, the only supported operator is `=`. For example, filtering by consolidated_policy.attached_resource="//cloudresourcemanager.googleapis.com/folders/001" will return all the Organization Policy results attached to "folders/001".

      Throws:
      ApiException - if the remote call fails
    • analyzeOrgPolicies

      Analyzes organization policies under a scope.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeOrgPoliciesRequest request =
             AnalyzeOrgPoliciesRequest.newBuilder()
                 .setScope("scope109264468")
                 .setConstraint("constraint-190376483")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (AnalyzeOrgPoliciesResponse.OrgPolicyResult element :
             assetServiceClient.analyzeOrgPolicies(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • analyzeOrgPoliciesPagedCallable

      Analyzes organization policies under a scope.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeOrgPoliciesRequest request =
             AnalyzeOrgPoliciesRequest.newBuilder()
                 .setScope("scope109264468")
                 .setConstraint("constraint-190376483")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<AnalyzeOrgPoliciesResponse.OrgPolicyResult> future =
             assetServiceClient.analyzeOrgPoliciesPagedCallable().futureCall(request);
         // Do something.
         for (AnalyzeOrgPoliciesResponse.OrgPolicyResult element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • analyzeOrgPoliciesCallable

      public final UnaryCallable<AnalyzeOrgPoliciesRequest,AnalyzeOrgPoliciesResponse> analyzeOrgPoliciesCallable()
      Analyzes organization policies under a scope.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeOrgPoliciesRequest request =
             AnalyzeOrgPoliciesRequest.newBuilder()
                 .setScope("scope109264468")
                 .setConstraint("constraint-190376483")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           AnalyzeOrgPoliciesResponse response =
               assetServiceClient.analyzeOrgPoliciesCallable().call(request);
           for (AnalyzeOrgPoliciesResponse.OrgPolicyResult element :
               response.getOrgPolicyResultsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • analyzeOrgPolicyGovernedContainers

      public final AssetServiceClient.AnalyzeOrgPolicyGovernedContainersPagedResponse analyzeOrgPolicyGovernedContainers(String scope, String constraint, String filter)
      Analyzes organization policies governed containers (projects, folders or organization) under a scope.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String scope = "scope109264468";
         String constraint = "constraint-190376483";
         String filter = "filter-1274492040";
         for (AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer element :
             assetServiceClient
                 .analyzeOrgPolicyGovernedContainers(scope, constraint, filter)
                 .iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      scope - Required. The organization to scope the request. Only organization policies within the scope will be analyzed. The output containers will also be limited to the ones governed by those in-scope organization policies.
      • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
      constraint - Required. The name of the constraint to analyze governed containers for. The analysis only contains organization policies for the provided constraint.
      filter - The expression to filter [AnalyzeOrgPolicyGovernedContainersResponse.governed_containers][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]. Filtering is currently available for bare literal values and the following fields:
      • parent
      • consolidated_policy.rules.enforce

      When filtering by a specific field, the only supported operator is `=`. For example, filtering by parent="//cloudresourcemanager.googleapis.com/folders/001" will return all the containers under "folders/001".

      Throws:
      ApiException - if the remote call fails
    • analyzeOrgPolicyGovernedContainers

      Analyzes organization policies governed containers (projects, folders or organization) under a scope.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeOrgPolicyGovernedContainersRequest request =
             AnalyzeOrgPolicyGovernedContainersRequest.newBuilder()
                 .setScope("scope109264468")
                 .setConstraint("constraint-190376483")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer element :
             assetServiceClient.analyzeOrgPolicyGovernedContainers(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • analyzeOrgPolicyGovernedContainersPagedCallable

      Analyzes organization policies governed containers (projects, folders or organization) under a scope.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeOrgPolicyGovernedContainersRequest request =
             AnalyzeOrgPolicyGovernedContainersRequest.newBuilder()
                 .setScope("scope109264468")
                 .setConstraint("constraint-190376483")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer> future =
             assetServiceClient.analyzeOrgPolicyGovernedContainersPagedCallable().futureCall(request);
         // Do something.
         for (AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer element :
             future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • analyzeOrgPolicyGovernedContainersCallable

      Analyzes organization policies governed containers (projects, folders or organization) under a scope.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeOrgPolicyGovernedContainersRequest request =
             AnalyzeOrgPolicyGovernedContainersRequest.newBuilder()
                 .setScope("scope109264468")
                 .setConstraint("constraint-190376483")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           AnalyzeOrgPolicyGovernedContainersResponse response =
               assetServiceClient.analyzeOrgPolicyGovernedContainersCallable().call(request);
           for (AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer element :
               response.getGovernedContainersList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • analyzeOrgPolicyGovernedAssets

      public final AssetServiceClient.AnalyzeOrgPolicyGovernedAssetsPagedResponse analyzeOrgPolicyGovernedAssets(String scope, String constraint, String filter)
      Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope. This RPC supports custom constraints and the following canned constraints:
      • constraints/ainotebooks.accessMode
      • constraints/ainotebooks.disableFileDownloads
      • constraints/ainotebooks.disableRootAccess
      • constraints/ainotebooks.disableTerminal
      • constraints/ainotebooks.environmentOptions
      • constraints/ainotebooks.requireAutoUpgradeSchedule
      • constraints/ainotebooks.restrictVpcNetworks
      • constraints/compute.disableGuestAttributesAccess
      • constraints/compute.disableInstanceDataAccessApis
      • constraints/compute.disableNestedVirtualization
      • constraints/compute.disableSerialPortAccess
      • constraints/compute.disableSerialPortLogging
      • constraints/compute.disableVpcExternalIpv6
      • constraints/compute.requireOsLogin
      • constraints/compute.requireShieldedVm
      • constraints/compute.restrictLoadBalancerCreationForTypes
      • constraints/compute.restrictProtocolForwardingCreationForTypes
      • constraints/compute.restrictXpnProjectLienRemoval
      • constraints/compute.setNewProjectDefaultToZonalDNSOnly
      • constraints/compute.skipDefaultNetworkCreation
      • constraints/compute.trustedImageProjects
      • constraints/compute.vmCanIpForward
      • constraints/compute.vmExternalIpAccess
      • constraints/gcp.detailedAuditLoggingMode
      • constraints/gcp.resourceLocations
      • constraints/iam.allowedPolicyMemberDomains
      • constraints/iam.automaticIamGrantsForDefaultServiceAccounts
      • constraints/iam.disableServiceAccountCreation
      • constraints/iam.disableServiceAccountKeyCreation
      • constraints/iam.disableServiceAccountKeyUpload
      • constraints/iam.restrictCrossProjectServiceAccountLienRemoval
      • constraints/iam.serviceAccountKeyExpiryHours
      • constraints/resourcemanager.accessBoundaries
      • constraints/resourcemanager.allowedExportDestinations
      • constraints/sql.restrictAuthorizedNetworks
      • constraints/sql.restrictNoncompliantDiagnosticDataAccess
      • constraints/sql.restrictNoncompliantResourceCreation
      • constraints/sql.restrictPublicIp
      • constraints/storage.publicAccessPrevention
      • constraints/storage.restrictAuthTypes
      • constraints/storage.uniformBucketLevelAccess

      This RPC only returns either resources of types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types) or IAM policies.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         String scope = "scope109264468";
         String constraint = "constraint-190376483";
         String filter = "filter-1274492040";
         for (AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset element :
             assetServiceClient
                 .analyzeOrgPolicyGovernedAssets(scope, constraint, filter)
                 .iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      scope - Required. The organization to scope the request. Only organization policies within the scope will be analyzed. The output assets will also be limited to the ones governed by those in-scope organization policies.
      • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
      constraint - Required. The name of the constraint to analyze governed assets for. The analysis only contains analyzed organization policies for the provided constraint.
      filter - The expression to filter [AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets].

      For governed resources, filtering is currently available for bare literal values and the following fields:

      • governed_resource.project
      • governed_resource.folders
      • consolidated_policy.rules.enforce When filtering by `governed_resource.project` or `consolidated_policy.rules.enforce`, the only supported operator is `=`. When filtering by `governed_resource.folders`, the supported operators are `=` and `:`. For example, filtering by `governed_resource.project="projects/12345678"` will return all the governed resources under "projects/12345678", including the project itself if applicable.

      For governed IAM policies, filtering is currently available for bare literal values and the following fields:

      • governed_iam_policy.project
      • governed_iam_policy.folders
      • consolidated_policy.rules.enforce When filtering by `governed_iam_policy.project` or `consolidated_policy.rules.enforce`, the only supported operator is `=`. When filtering by `governed_iam_policy.folders`, the supported operators are `=` and `:`. For example, filtering by `governed_iam_policy.folders:"folders/12345678"` will return all the governed IAM policies under "folders/001".
      Throws:
      ApiException - if the remote call fails
    • analyzeOrgPolicyGovernedAssets

      Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope. This RPC supports custom constraints and the following canned constraints:
      • constraints/ainotebooks.accessMode
      • constraints/ainotebooks.disableFileDownloads
      • constraints/ainotebooks.disableRootAccess
      • constraints/ainotebooks.disableTerminal
      • constraints/ainotebooks.environmentOptions
      • constraints/ainotebooks.requireAutoUpgradeSchedule
      • constraints/ainotebooks.restrictVpcNetworks
      • constraints/compute.disableGuestAttributesAccess
      • constraints/compute.disableInstanceDataAccessApis
      • constraints/compute.disableNestedVirtualization
      • constraints/compute.disableSerialPortAccess
      • constraints/compute.disableSerialPortLogging
      • constraints/compute.disableVpcExternalIpv6
      • constraints/compute.requireOsLogin
      • constraints/compute.requireShieldedVm
      • constraints/compute.restrictLoadBalancerCreationForTypes
      • constraints/compute.restrictProtocolForwardingCreationForTypes
      • constraints/compute.restrictXpnProjectLienRemoval
      • constraints/compute.setNewProjectDefaultToZonalDNSOnly
      • constraints/compute.skipDefaultNetworkCreation
      • constraints/compute.trustedImageProjects
      • constraints/compute.vmCanIpForward
      • constraints/compute.vmExternalIpAccess
      • constraints/gcp.detailedAuditLoggingMode
      • constraints/gcp.resourceLocations
      • constraints/iam.allowedPolicyMemberDomains
      • constraints/iam.automaticIamGrantsForDefaultServiceAccounts
      • constraints/iam.disableServiceAccountCreation
      • constraints/iam.disableServiceAccountKeyCreation
      • constraints/iam.disableServiceAccountKeyUpload
      • constraints/iam.restrictCrossProjectServiceAccountLienRemoval
      • constraints/iam.serviceAccountKeyExpiryHours
      • constraints/resourcemanager.accessBoundaries
      • constraints/resourcemanager.allowedExportDestinations
      • constraints/sql.restrictAuthorizedNetworks
      • constraints/sql.restrictNoncompliantDiagnosticDataAccess
      • constraints/sql.restrictNoncompliantResourceCreation
      • constraints/sql.restrictPublicIp
      • constraints/storage.publicAccessPrevention
      • constraints/storage.restrictAuthTypes
      • constraints/storage.uniformBucketLevelAccess

      This RPC only returns either resources of types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types) or IAM policies.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeOrgPolicyGovernedAssetsRequest request =
             AnalyzeOrgPolicyGovernedAssetsRequest.newBuilder()
                 .setScope("scope109264468")
                 .setConstraint("constraint-190376483")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset element :
             assetServiceClient.analyzeOrgPolicyGovernedAssets(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • analyzeOrgPolicyGovernedAssetsPagedCallable

      Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope. This RPC supports custom constraints and the following canned constraints:
      • constraints/ainotebooks.accessMode
      • constraints/ainotebooks.disableFileDownloads
      • constraints/ainotebooks.disableRootAccess
      • constraints/ainotebooks.disableTerminal
      • constraints/ainotebooks.environmentOptions
      • constraints/ainotebooks.requireAutoUpgradeSchedule
      • constraints/ainotebooks.restrictVpcNetworks
      • constraints/compute.disableGuestAttributesAccess
      • constraints/compute.disableInstanceDataAccessApis
      • constraints/compute.disableNestedVirtualization
      • constraints/compute.disableSerialPortAccess
      • constraints/compute.disableSerialPortLogging
      • constraints/compute.disableVpcExternalIpv6
      • constraints/compute.requireOsLogin
      • constraints/compute.requireShieldedVm
      • constraints/compute.restrictLoadBalancerCreationForTypes
      • constraints/compute.restrictProtocolForwardingCreationForTypes
      • constraints/compute.restrictXpnProjectLienRemoval
      • constraints/compute.setNewProjectDefaultToZonalDNSOnly
      • constraints/compute.skipDefaultNetworkCreation
      • constraints/compute.trustedImageProjects
      • constraints/compute.vmCanIpForward
      • constraints/compute.vmExternalIpAccess
      • constraints/gcp.detailedAuditLoggingMode
      • constraints/gcp.resourceLocations
      • constraints/iam.allowedPolicyMemberDomains
      • constraints/iam.automaticIamGrantsForDefaultServiceAccounts
      • constraints/iam.disableServiceAccountCreation
      • constraints/iam.disableServiceAccountKeyCreation
      • constraints/iam.disableServiceAccountKeyUpload
      • constraints/iam.restrictCrossProjectServiceAccountLienRemoval
      • constraints/iam.serviceAccountKeyExpiryHours
      • constraints/resourcemanager.accessBoundaries
      • constraints/resourcemanager.allowedExportDestinations
      • constraints/sql.restrictAuthorizedNetworks
      • constraints/sql.restrictNoncompliantDiagnosticDataAccess
      • constraints/sql.restrictNoncompliantResourceCreation
      • constraints/sql.restrictPublicIp
      • constraints/storage.publicAccessPrevention
      • constraints/storage.restrictAuthTypes
      • constraints/storage.uniformBucketLevelAccess

      This RPC only returns either resources of types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types) or IAM policies.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeOrgPolicyGovernedAssetsRequest request =
             AnalyzeOrgPolicyGovernedAssetsRequest.newBuilder()
                 .setScope("scope109264468")
                 .setConstraint("constraint-190376483")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset> future =
             assetServiceClient.analyzeOrgPolicyGovernedAssetsPagedCallable().futureCall(request);
         // Do something.
         for (AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset element :
             future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • analyzeOrgPolicyGovernedAssetsCallable

      public final UnaryCallable<AnalyzeOrgPolicyGovernedAssetsRequest,AnalyzeOrgPolicyGovernedAssetsResponse> analyzeOrgPolicyGovernedAssetsCallable()
      Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope. This RPC supports custom constraints and the following canned constraints:
      • constraints/ainotebooks.accessMode
      • constraints/ainotebooks.disableFileDownloads
      • constraints/ainotebooks.disableRootAccess
      • constraints/ainotebooks.disableTerminal
      • constraints/ainotebooks.environmentOptions
      • constraints/ainotebooks.requireAutoUpgradeSchedule
      • constraints/ainotebooks.restrictVpcNetworks
      • constraints/compute.disableGuestAttributesAccess
      • constraints/compute.disableInstanceDataAccessApis
      • constraints/compute.disableNestedVirtualization
      • constraints/compute.disableSerialPortAccess
      • constraints/compute.disableSerialPortLogging
      • constraints/compute.disableVpcExternalIpv6
      • constraints/compute.requireOsLogin
      • constraints/compute.requireShieldedVm
      • constraints/compute.restrictLoadBalancerCreationForTypes
      • constraints/compute.restrictProtocolForwardingCreationForTypes
      • constraints/compute.restrictXpnProjectLienRemoval
      • constraints/compute.setNewProjectDefaultToZonalDNSOnly
      • constraints/compute.skipDefaultNetworkCreation
      • constraints/compute.trustedImageProjects
      • constraints/compute.vmCanIpForward
      • constraints/compute.vmExternalIpAccess
      • constraints/gcp.detailedAuditLoggingMode
      • constraints/gcp.resourceLocations
      • constraints/iam.allowedPolicyMemberDomains
      • constraints/iam.automaticIamGrantsForDefaultServiceAccounts
      • constraints/iam.disableServiceAccountCreation
      • constraints/iam.disableServiceAccountKeyCreation
      • constraints/iam.disableServiceAccountKeyUpload
      • constraints/iam.restrictCrossProjectServiceAccountLienRemoval
      • constraints/iam.serviceAccountKeyExpiryHours
      • constraints/resourcemanager.accessBoundaries
      • constraints/resourcemanager.allowedExportDestinations
      • constraints/sql.restrictAuthorizedNetworks
      • constraints/sql.restrictNoncompliantDiagnosticDataAccess
      • constraints/sql.restrictNoncompliantResourceCreation
      • constraints/sql.restrictPublicIp
      • constraints/storage.publicAccessPrevention
      • constraints/storage.restrictAuthTypes
      • constraints/storage.uniformBucketLevelAccess

      This RPC only returns either resources of types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types) or IAM policies.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
         AnalyzeOrgPolicyGovernedAssetsRequest request =
             AnalyzeOrgPolicyGovernedAssetsRequest.newBuilder()
                 .setScope("scope109264468")
                 .setConstraint("constraint-190376483")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           AnalyzeOrgPolicyGovernedAssetsResponse response =
               assetServiceClient.analyzeOrgPolicyGovernedAssetsCallable().call(request);
           for (AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset element :
               response.getGovernedAssetsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException