- 3.59.0 (latest)
- 3.58.0
- 3.57.0
- 3.56.0
- 3.55.0
- 3.53.0
- 3.52.0
- 3.51.0
- 3.50.0
- 3.49.0
- 3.48.0
- 3.47.0
- 3.46.0
- 3.45.0
- 3.44.0
- 3.43.0
- 3.41.0
- 3.40.0
- 3.39.0
- 3.38.0
- 3.37.0
- 3.36.0
- 3.35.0
- 3.34.0
- 3.33.0
- 3.32.0
- 3.31.0
- 3.28.0
- 3.27.0
- 3.26.0
- 3.25.0
- 3.24.0
- 3.23.0
- 3.22.0
- 3.21.0
- 3.20.0
- 3.19.0
- 3.18.0
- 3.17.0
- 3.16.0
- 3.15.0
- 3.14.0
- 3.13.0
- 3.12.0
- 3.11.0
- 3.10.0
- 3.9.0
- 3.8.0
- 3.7.2-SNAPSHOT
- 3.6.0
- 3.4.1
- 3.3.1
- 3.2.17
public class AssetServiceClient 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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
BatchGetAssetsHistoryRequest request =
BatchGetAssetsHistoryRequest.newBuilder()
.setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
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:
AssetServiceSettings assetServiceSettings =
AssetServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
To customize the endpoint:
AssetServiceSettings assetServiceSettings =
AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final AssetServiceClient create()
Constructs an instance of AssetServiceClient with default settings.
Type | Description |
AssetServiceClient |
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.
Name | Description |
settings | AssetServiceSettings |
Type | Description |
AssetServiceClient |
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).
Name | Description |
stub | AssetServiceStub |
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.
Name | Description |
settings | AssetServiceSettings |
AssetServiceClient(AssetServiceStub stub)
protected AssetServiceClient(AssetServiceStub stub)
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyRequest request =
AnalyzeIamPolicyRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setExecutionTimeout(Duration.newBuilder().build())
.build();
AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
}
Name | Description |
request | AnalyzeIamPolicyRequest The request object containing all of the parameters for the API call. |
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyRequest request =
AnalyzeIamPolicyRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setExecutionTimeout(Duration.newBuilder().build())
.build();
ApiFuture<AnalyzeIamPolicyResponse> future =
assetServiceClient.analyzeIamPolicyCallable().futureCall(request);
// Do something.
AnalyzeIamPolicyResponse response = future.get();
}
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyLongrunningRequest request =
AnalyzeIamPolicyLongrunningRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
.build();
AnalyzeIamPolicyLongrunningResponse response =
assetServiceClient.analyzeIamPolicyLongrunningAsync(request).get();
}
Name | Description |
request | AnalyzeIamPolicyLongrunningRequest The request object containing all of the parameters for the API call. |
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyLongrunningRequest request =
AnalyzeIamPolicyLongrunningRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
.build();
ApiFuture<Operation> future =
assetServiceClient.analyzeIamPolicyLongrunningCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyLongrunningRequest request =
AnalyzeIamPolicyLongrunningRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
.build();
OperationFuture<AnalyzeIamPolicyLongrunningResponse, AnalyzeIamPolicyLongrunningMetadata>
future =
assetServiceClient.analyzeIamPolicyLongrunningOperationCallable().futureCall(request);
// Do something.
AnalyzeIamPolicyLongrunningResponse response = future.get();
}
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeMoveRequest request =
AnalyzeMoveRequest.newBuilder()
.setResource("resource-341064690")
.setDestinationParent("destinationParent-1733659048")
.build();
AnalyzeMoveResponse response = assetServiceClient.analyzeMove(request);
}
Name | Description |
request | AnalyzeMoveRequest The request object containing all of the parameters for the API call. |
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeMoveRequest request =
AnalyzeMoveRequest.newBuilder()
.setResource("resource-341064690")
.setDestinationParent("destinationParent-1733659048")
.build();
ApiFuture<AnalyzeMoveResponse> future =
assetServiceClient.analyzeMoveCallable().futureCall(request);
// Do something.
AnalyzeMoveResponse response = future.get();
}
Type | Description |
UnaryCallable<AnalyzeMoveRequest,AnalyzeMoveResponse> |
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
BatchGetAssetsHistoryRequest request =
BatchGetAssetsHistoryRequest.newBuilder()
.setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
.addAllAssetNames(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setReadTimeWindow(TimeWindow.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
}
Name | Description |
request | BatchGetAssetsHistoryRequest The request object containing all of the parameters for the API call. |
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
BatchGetAssetsHistoryRequest request =
BatchGetAssetsHistoryRequest.newBuilder()
.setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").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();
}
Type | Description |
UnaryCallable<BatchGetAssetsHistoryRequest,BatchGetAssetsHistoryResponse> |
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:
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);
}
Name | Description |
request | CreateFeedRequest The request object containing all of the parameters for the API call. |
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String parent = "parent-995424086";
Feed response = assetServiceClient.createFeed(parent);
}
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"). |
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:
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();
}
Type | Description |
UnaryCallable<CreateFeedRequest,Feed> |
deleteFeed(DeleteFeedRequest request)
public final void deleteFeed(DeleteFeedRequest request)
Deletes an asset feed.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
DeleteFeedRequest request =
DeleteFeedRequest.newBuilder()
.setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
.build();
assetServiceClient.deleteFeed(request);
}
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
assetServiceClient.deleteFeed(name);
}
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
assetServiceClient.deleteFeed(name);
}
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:
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();
}
Type | Description |
UnaryCallable<DeleteFeedRequest,Empty> |
exportAssetsAsync(ExportAssetsRequest request)
public final OperationFuture<ExportAssetsResponse,ExportAssetsRequest> exportAssetsAsync(ExportAssetsRequest request)
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 proto 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.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ExportAssetsRequest request =
ExportAssetsRequest.newBuilder()
.setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").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();
}
Name | Description |
request | ExportAssetsRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<ExportAssetsResponse,ExportAssetsRequest> |
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 in the JSON format; for BigQuery table destinations, the output table stores the fields in asset proto 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.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ExportAssetsRequest request =
ExportAssetsRequest.newBuilder()
.setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").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();
}
Type | Description |
UnaryCallable<ExportAssetsRequest,Operation> |
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 in the JSON format; for BigQuery table destinations, the output table stores the fields in asset proto 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.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ExportAssetsRequest request =
ExportAssetsRequest.newBuilder()
.setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").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();
}
Type | Description |
OperationCallable<ExportAssetsRequest,ExportAssetsResponse,ExportAssetsRequest> |
getFeed(FeedName name)
public final Feed getFeed(FeedName name)
Gets details about an asset feed.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
Feed response = assetServiceClient.getFeed(name);
}
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 |
Type | Description |
Feed |
getFeed(GetFeedRequest request)
public final Feed getFeed(GetFeedRequest request)
Gets details about an asset feed.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
GetFeedRequest request =
GetFeedRequest.newBuilder()
.setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
.build();
Feed response = assetServiceClient.getFeed(request);
}
Name | Description |
request | GetFeedRequest The request object containing all of the parameters for the API call. |
Type | Description |
Feed |
getFeed(String name)
public final Feed getFeed(String name)
Gets details about an asset feed.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
Feed response = assetServiceClient.getFeed(name);
}
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 |
Type | Description |
Feed |
getFeedCallable()
public final UnaryCallable<GetFeedRequest,Feed> getFeedCallable()
Gets details about an asset feed.
Sample code:
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();
}
Type | Description |
UnaryCallable<GetFeedRequest,Feed> |
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.
Type | Description |
OperationsClient |
getSettings()
public final AssetServiceSettings getSettings()
Type | Description |
AssetServiceSettings |
getStub()
public AssetServiceStub getStub()
Type | Description |
AssetServiceStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listAssets(ResourceName parent)
public final AssetServiceClient.ListAssetsPagedResponse listAssets(ResourceName parent)
Lists assets with time and resource types and returns paged results in response.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ResourceName parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | com.google.api.resourcenames.ResourceName Required. Name of the organization or project the assets belong to. Format: "organizations/[organization-number]" (such as "organizations/123"), "projects/[project-id]" (such as "projects/my-project-id"), or "projects/[project-number]" (such as "projects/12345"). |
Type | Description |
AssetServiceClient.ListAssetsPagedResponse |
listAssets(ListAssetsRequest request)
public final AssetServiceClient.ListAssetsPagedResponse listAssets(ListAssetsRequest request)
Lists assets with time and resource types and returns paged results in response.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListAssetsRequest request =
ListAssetsRequest.newBuilder()
.setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").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);
}
}
Name | Description |
request | ListAssetsRequest The request object containing all of the parameters for the API call. |
Type | Description |
AssetServiceClient.ListAssetsPagedResponse |
listAssets(String parent)
public final AssetServiceClient.ListAssetsPagedResponse listAssets(String parent)
Lists assets with time and resource types and returns paged results in response.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. Name of the organization or project the assets belong to. Format: "organizations/[organization-number]" (such as "organizations/123"), "projects/[project-id]" (such as "projects/my-project-id"), or "projects/[project-number]" (such as "projects/12345"). |
Type | Description |
AssetServiceClient.ListAssetsPagedResponse |
listAssetsCallable()
public final UnaryCallable<ListAssetsRequest,ListAssetsResponse> listAssetsCallable()
Lists assets with time and resource types and returns paged results in response.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListAssetsRequest request =
ListAssetsRequest.newBuilder()
.setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").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.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListAssetsRequest,ListAssetsResponse> |
listAssetsPagedCallable()
public final UnaryCallable<ListAssetsRequest,AssetServiceClient.ListAssetsPagedResponse> listAssetsPagedCallable()
Lists assets with time and resource types and returns paged results in response.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListAssetsRequest request =
ListAssetsRequest.newBuilder()
.setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").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);
}
}
Type | Description |
UnaryCallable<ListAssetsRequest,ListAssetsPagedResponse> |
listFeeds(ListFeedsRequest request)
public final ListFeedsResponse listFeeds(ListFeedsRequest request)
Lists all asset feeds in a parent project/folder/organization.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListFeedsRequest request =
ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
ListFeedsResponse response = assetServiceClient.listFeeds(request);
}
Name | Description |
request | ListFeedsRequest The request object containing all of the parameters for the API call. |
Type | Description |
ListFeedsResponse |
listFeeds(String parent)
public final ListFeedsResponse listFeeds(String parent)
Lists all asset feeds in a parent project/folder/organization.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String parent = "parent-995424086";
ListFeedsResponse response = assetServiceClient.listFeeds(parent);
}
Name | Description |
parent | String 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"). |
Type | Description |
ListFeedsResponse |
listFeedsCallable()
public final UnaryCallable<ListFeedsRequest,ListFeedsResponse> listFeedsCallable()
Lists all asset feeds in a parent project/folder/organization.
Sample code:
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();
}
Type | Description |
UnaryCallable<ListFeedsRequest,ListFeedsResponse> |
searchAllIamPolicies(SearchAllIamPoliciesRequest request)
public final AssetServiceClient.SearchAllIamPoliciesPagedResponse searchAllIamPolicies(SearchAllIamPoliciesRequest request)
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:
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);
}
}
Name | Description |
request | SearchAllIamPoliciesRequest The request object containing all of the parameters for the API call. |
Type | Description |
AssetServiceClient.SearchAllIamPoliciesPagedResponse |
searchAllIamPolicies(String scope, String query)
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:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String scope = "scope109264468";
String query = "query107944136";
for (IamPolicySearchResult element :
assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
scope | String Required. A scope can be a project, a folder, or an organization. The search is
limited to the IAM policies within the The allowed values are:
|
query | String Optional. The query statement. See how to construct a
query
for more information. If not specified or empty, it will search all the IAM policies within
the specified Examples:
|
Type | Description |
AssetServiceClient.SearchAllIamPoliciesPagedResponse |
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:
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.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<SearchAllIamPoliciesRequest,SearchAllIamPoliciesResponse> |
searchAllIamPoliciesPagedCallable()
public final UnaryCallable<SearchAllIamPoliciesRequest,AssetServiceClient.SearchAllIamPoliciesPagedResponse> 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:
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);
}
}
Type | Description |
UnaryCallable<SearchAllIamPoliciesRequest,SearchAllIamPoliciesPagedResponse> |
searchAllResources(SearchAllResourcesRequest request)
public final AssetServiceClient.SearchAllResourcesPagedResponse searchAllResources(SearchAllResourcesRequest request)
Searches all 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:
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);
}
}
Name | Description |
request | SearchAllResourcesRequest The request object containing all of the parameters for the API call. |
Type | Description |
AssetServiceClient.SearchAllResourcesPagedResponse |
searchAllResources(String scope, String query, List<String> assetTypes)
public final AssetServiceClient.SearchAllResourcesPagedResponse searchAllResources(String scope, String query, List<String> assetTypes)
Searches all 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:
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);
}
}
Name | Description |
scope | String Required. A scope can be a project, a folder, or an organization. The search is
limited to the resources within the The allowed values are:
|
query | String Optional. The query statement. See how to construct a
query
for more information. If not specified or empty, it will search all the resources within
the specified Examples:
|
assetTypes | List<String> Optional. A list of asset types that this request searches for. If empty, it will search all the searchable asset types. Regular expressions are also supported. For example:
See RE2 for all supported regular expression syntax. If the regular expression does not match any supported asset type, an INVALID_ARGUMENT error will be returned. |
Type | Description |
AssetServiceClient.SearchAllResourcesPagedResponse |
searchAllResourcesCallable()
public final UnaryCallable<SearchAllResourcesRequest,SearchAllResourcesResponse> searchAllResourcesCallable()
Searches all 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:
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.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<SearchAllResourcesRequest,SearchAllResourcesResponse> |
searchAllResourcesPagedCallable()
public final UnaryCallable<SearchAllResourcesRequest,AssetServiceClient.SearchAllResourcesPagedResponse> searchAllResourcesPagedCallable()
Searches all 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:
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);
}
}
Type | Description |
UnaryCallable<SearchAllResourcesRequest,SearchAllResourcesPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateFeed(Feed feed)
public final Feed updateFeed(Feed feed)
Updates an asset feed configuration.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
Feed feed = Feed.newBuilder().build();
Feed response = assetServiceClient.updateFeed(feed);
}
Name | Description |
feed | Feed Required. The new values of feed details. It must match an existing feed and the
field |
Type | Description |
Feed |
updateFeed(UpdateFeedRequest request)
public final Feed updateFeed(UpdateFeedRequest request)
Updates an asset feed configuration.
Sample code:
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
UpdateFeedRequest request =
UpdateFeedRequest.newBuilder()
.setFeed(Feed.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Feed response = assetServiceClient.updateFeed(request);
}
Name | Description |
request | UpdateFeedRequest The request object containing all of the parameters for the API call. |
Type | Description |
Feed |
updateFeedCallable()
public final UnaryCallable<UpdateFeedRequest,Feed> updateFeedCallable()
Updates an asset feed configuration.
Sample code:
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();
}
Type | Description |
UnaryCallable<UpdateFeedRequest,Feed> |