Class AssetServiceClient (3.49.0)

GitHub RepositoryProduct Reference

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 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 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. This method implements the 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.

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. 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 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.

Inheritance

java.lang.Object > AssetServiceClient

Static Methods

create()

public static final AssetServiceClient create()

Constructs an instance of AssetServiceClient with default settings.

Returns
Type Description
AssetServiceClient
Exceptions
Type Description
IOException

create(AssetServiceSettings settings)

public static final AssetServiceClient create(AssetServiceSettings settings)

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.

Parameter
Name Description
settings AssetServiceSettings
Returns
Type Description
AssetServiceClient
Exceptions
Type Description
IOException

create(AssetServiceStub stub)

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).

Parameter
Name Description
stub AssetServiceStub
Returns
Type Description
AssetServiceClient

Constructors

AssetServiceClient(AssetServiceSettings settings)

protected AssetServiceClient(AssetServiceSettings settings)

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.

Parameter
Name Description
settings AssetServiceSettings

AssetServiceClient(AssetServiceStub stub)

protected AssetServiceClient(AssetServiceStub stub)
Parameter
Name Description
stub AssetServiceStub

Methods

analyzeIamPolicy(AnalyzeIamPolicyRequest request)

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);
 }
 
Parameter
Name Description
request AnalyzeIamPolicyRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AnalyzeIamPolicyResponse

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();
 }
 
Returns
Type Description
UnaryCallable<AnalyzeIamPolicyRequest,AnalyzeIamPolicyResponse>

analyzeIamPolicyLongrunningAsync(AnalyzeIamPolicyLongrunningRequest request)

public final OperationFuture<AnalyzeIamPolicyLongrunningResponse,AnalyzeIamPolicyLongrunningMetadata> analyzeIamPolicyLongrunningAsync(AnalyzeIamPolicyLongrunningRequest request)

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. This method implements the 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();
 }
 
Parameter
Name Description
request AnalyzeIamPolicyLongrunningRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<AnalyzeIamPolicyLongrunningResponse,AnalyzeIamPolicyLongrunningMetadata>

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. This method implements the 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();
 }
 
Returns
Type Description
UnaryCallable<AnalyzeIamPolicyLongrunningRequest,Operation>

analyzeIamPolicyLongrunningOperationCallable()

public final OperationCallable<AnalyzeIamPolicyLongrunningRequest,AnalyzeIamPolicyLongrunningResponse,AnalyzeIamPolicyLongrunningMetadata> 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. This method implements the 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();
 }
 
Returns
Type Description
OperationCallable<AnalyzeIamPolicyLongrunningRequest,AnalyzeIamPolicyLongrunningResponse,AnalyzeIamPolicyLongrunningMetadata>

analyzeMove(AnalyzeMoveRequest request)

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);
 }
 
Parameter
Name Description
request AnalyzeMoveRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AnalyzeMoveResponse

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();
 }
 
Returns
Type Description
UnaryCallable<AnalyzeMoveRequest,AnalyzeMoveResponse>

analyzeOrgPolicies(AnalyzeOrgPoliciesRequest request)

public final AssetServiceClient.AnalyzeOrgPoliciesPagedResponse analyzeOrgPolicies(AnalyzeOrgPoliciesRequest request)

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);
   }
 }
 
Parameter
Name Description
request AnalyzeOrgPoliciesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AssetServiceClient.AnalyzeOrgPoliciesPagedResponse

analyzeOrgPolicies(String scope, String constraint, String filter)

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
Name Description
scope String

Required. The organization to scope the request. Only organization policies within the scope will be analyzed.

  • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")

constraint String

Required. The name of the constraint to analyze organization policies for. The response only contains analyzed organization policies for the provided constraint.

filter String

The expression to filter 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".

Returns
Type Description
AssetServiceClient.AnalyzeOrgPoliciesPagedResponse

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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<AnalyzeOrgPoliciesRequest,AnalyzeOrgPoliciesResponse>

analyzeOrgPoliciesPagedCallable()

public final UnaryCallable<AnalyzeOrgPoliciesRequest,AssetServiceClient.AnalyzeOrgPoliciesPagedResponse> 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);
   }
 }
 
Returns
Type Description
UnaryCallable<AnalyzeOrgPoliciesRequest,AnalyzeOrgPoliciesPagedResponse>

analyzeOrgPolicyGovernedAssets(AnalyzeOrgPolicyGovernedAssetsRequest request)

public final AssetServiceClient.AnalyzeOrgPolicyGovernedAssetsPagedResponse analyzeOrgPolicyGovernedAssets(AnalyzeOrgPolicyGovernedAssetsRequest request)

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 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);
   }
 }
 
Parameter
Name Description
request AnalyzeOrgPolicyGovernedAssetsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AssetServiceClient.AnalyzeOrgPolicyGovernedAssetsPagedResponse

analyzeOrgPolicyGovernedAssets(String scope, String constraint, String filter)

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 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
Name Description
scope String

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 String

Required. The name of the constraint to analyze governed assets for. The analysis only contains analyzed organization policies for the provided constraint.

filter String

The expression to filter 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".

Returns
Type Description
AssetServiceClient.AnalyzeOrgPolicyGovernedAssetsPagedResponse

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 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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<AnalyzeOrgPolicyGovernedAssetsRequest,AnalyzeOrgPolicyGovernedAssetsResponse>

analyzeOrgPolicyGovernedAssetsPagedCallable()

public final UnaryCallable<AnalyzeOrgPolicyGovernedAssetsRequest,AssetServiceClient.AnalyzeOrgPolicyGovernedAssetsPagedResponse> 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 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);
   }
 }
 
Returns
Type Description
UnaryCallable<AnalyzeOrgPolicyGovernedAssetsRequest,AnalyzeOrgPolicyGovernedAssetsPagedResponse>

analyzeOrgPolicyGovernedContainers(AnalyzeOrgPolicyGovernedContainersRequest request)

public final AssetServiceClient.AnalyzeOrgPolicyGovernedContainersPagedResponse analyzeOrgPolicyGovernedContainers(AnalyzeOrgPolicyGovernedContainersRequest request)

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);
   }
 }
 
Parameter
Name Description
request AnalyzeOrgPolicyGovernedContainersRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AssetServiceClient.AnalyzeOrgPolicyGovernedContainersPagedResponse

analyzeOrgPolicyGovernedContainers(String scope, String constraint, String filter)

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
Name Description
scope String

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 String

Required. The name of the constraint to analyze governed containers for. The analysis only contains organization policies for the provided constraint.

filter String

The expression to filter 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".

Returns
Type Description
AssetServiceClient.AnalyzeOrgPolicyGovernedContainersPagedResponse

analyzeOrgPolicyGovernedContainersCallable()

public final UnaryCallable<AnalyzeOrgPolicyGovernedContainersRequest,AnalyzeOrgPolicyGovernedContainersResponse> 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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<AnalyzeOrgPolicyGovernedContainersRequest,AnalyzeOrgPolicyGovernedContainersResponse>

analyzeOrgPolicyGovernedContainersPagedCallable()

public final UnaryCallable<AnalyzeOrgPolicyGovernedContainersRequest,AssetServiceClient.AnalyzeOrgPolicyGovernedContainersPagedResponse> 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);
   }
 }
 
Returns
Type Description
UnaryCallable<AnalyzeOrgPolicyGovernedContainersRequest,AnalyzeOrgPolicyGovernedContainersPagedResponse>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

batchGetAssetsHistory(BatchGetAssetsHistoryRequest request)

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);
 }
 
Parameter
Name Description
request BatchGetAssetsHistoryRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchGetAssetsHistoryResponse

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();
 }
 
Returns
Type Description
UnaryCallable<BatchGetAssetsHistoryRequest,BatchGetAssetsHistoryResponse>

batchGetEffectiveIamPolicies(BatchGetEffectiveIamPoliciesRequest request)

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);
 }
 
Parameter
Name Description
request BatchGetEffectiveIamPoliciesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchGetEffectiveIamPoliciesResponse

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();
 }
 
Returns
Type Description
UnaryCallable<BatchGetEffectiveIamPoliciesRequest,BatchGetEffectiveIamPoliciesResponse>

close()

public final void close()

createFeed(CreateFeedRequest request)

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);
 }
 
Parameter
Name Description
request CreateFeedRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Feed

createFeed(String parent)

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);
 }
 
Parameter
Name Description
parent String

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").

Returns
Type Description
Feed

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();
 }
 
Returns
Type Description
UnaryCallable<CreateFeedRequest,Feed>

createSavedQuery(CreateSavedQueryRequest request)

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);
 }
 
Parameter
Name Description
request CreateSavedQueryRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SavedQuery

createSavedQuery(FolderName parent, SavedQuery savedQuery, String savedQueryId)

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
Name Description
parent FolderName

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 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 String

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-.

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

Returns
Type Description
SavedQuery

createSavedQuery(OrganizationName parent, SavedQuery savedQuery, String savedQueryId)

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
Name Description
parent OrganizationName

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 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 String

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-.

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

Returns
Type Description
SavedQuery

createSavedQuery(ProjectName parent, SavedQuery savedQuery, String savedQueryId)

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
Name Description
parent ProjectName

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 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 String

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-.

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

Returns
Type Description
SavedQuery

createSavedQuery(String parent, SavedQuery savedQuery, String savedQueryId)

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
Name Description
parent String

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 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 String

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-.

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

Returns
Type Description
SavedQuery

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();
 }
 
Returns
Type Description
UnaryCallable<CreateSavedQueryRequest,SavedQuery>

deleteFeed(DeleteFeedRequest request)

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);
 }
 
Parameter
Name Description
request DeleteFeedRequest

The request object containing all of the parameters for the API call.

deleteFeed(FeedName name)

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);
 }
 
Parameter
Name Description
name FeedName

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

deleteFeed(String name)

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);
 }
 
Parameter
Name Description
name String

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

deleteFeedCallable()

public final UnaryCallable<DeleteFeedRequest,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();
 }
 
Returns
Type Description
UnaryCallable<DeleteFeedRequest,Empty>

deleteSavedQuery(DeleteSavedQueryRequest request)

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);
 }
 
Parameter
Name Description
request DeleteSavedQueryRequest

The request object containing all of the parameters for the API call.

deleteSavedQuery(SavedQueryName name)

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);
 }
 
Parameter
Name Description
name