use of com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest in project gapic-generator-java by googleapis.
the class AsyncBatchGetAssetsHistory method asyncBatchGetAssetsHistory.
public static void asyncBatchGetAssetsHistory() throws Exception {
// It may require modifications to work in your environment.
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();
}
}
use of com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest in project java-asset by googleapis.
the class BatchGetAssetsHistoryExample method main.
// Export assets for a project.
// @param args path where the results will be exported to.
public static void main(String... args) throws Exception {
// Asset names, e.g.: "//storage.googleapis.com/[BUCKET_NAME]"
String[] assetNames = args[0].split(",");
try (AssetServiceClient client = AssetServiceClient.create()) {
ProjectName parent = ProjectName.of(projectId);
ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
TimeWindow readTimeWindow = TimeWindow.newBuilder().build();
BatchGetAssetsHistoryRequest request = BatchGetAssetsHistoryRequest.newBuilder().setParent(parent.toString()).addAllAssetNames(Arrays.asList(assetNames)).setContentType(contentType).setReadTimeWindow(readTimeWindow).build();
BatchGetAssetsHistoryResponse response = client.batchGetAssetsHistory(request);
System.out.println(response);
}
}
Aggregations