use of com.google.cloud.asset.v1.Feed in project gapic-generator-java by googleapis.
the class SyncGetFeedString method syncGetFeedString.
public static void syncGetFeedString() throws Exception {
// It may require modifications to work in your environment.
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
Feed response = assetServiceClient.getFeed(name);
}
}
use of com.google.cloud.asset.v1.Feed in project gapic-generator-java by googleapis.
the class AsyncCreateFeed method asyncCreateFeed.
public static void asyncCreateFeed() throws Exception {
// It may require modifications to work in your environment.
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();
}
}
use of com.google.cloud.asset.v1.Feed in project gapic-generator-java by googleapis.
the class SyncCreateFeed method syncCreateFeed.
public static void syncCreateFeed() throws Exception {
// It may require modifications to work in your environment.
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);
}
}
use of com.google.cloud.asset.v1.Feed in project gapic-generator-java by googleapis.
the class AsyncListAssetsPaged method asyncListAssetsPaged.
public static void asyncListAssetsPaged() throws Exception {
// It may require modifications to work in your environment.
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;
}
}
}
}
use of com.google.cloud.asset.v1.Feed in project gapic-generator-java by googleapis.
the class AsyncUpdateFeed method asyncUpdateFeed.
public static void asyncUpdateFeed() throws Exception {
// It may require modifications to work in your environment.
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();
}
}
Aggregations