Search in sources :

Example 6 with Feed

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);
    }
}
Also used : AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) Feed(com.google.cloud.asset.v1.Feed)

Example 7 with Feed

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();
    }
}
Also used : AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) CreateFeedRequest(com.google.cloud.asset.v1.CreateFeedRequest) Feed(com.google.cloud.asset.v1.Feed)

Example 8 with Feed

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);
    }
}
Also used : AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) CreateFeedRequest(com.google.cloud.asset.v1.CreateFeedRequest) Feed(com.google.cloud.asset.v1.Feed)

Example 9 with Feed

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;
            }
        }
    }
}
Also used : ListAssetsRequest(com.google.cloud.asset.v1.ListAssetsRequest) AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) ArrayList(java.util.ArrayList) Asset(com.google.cloud.asset.v1.Asset) ListAssetsResponse(com.google.cloud.asset.v1.ListAssetsResponse)

Example 10 with Feed

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();
    }
}
Also used : UpdateFeedRequest(com.google.cloud.asset.v1.UpdateFeedRequest) AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) Feed(com.google.cloud.asset.v1.Feed)

Aggregations

AssetServiceClient (com.google.cloud.asset.v1.AssetServiceClient)24 Feed (com.google.cloud.asset.v1.Feed)13 ArrayList (java.util.ArrayList)6 CreateFeedRequest (com.google.cloud.asset.v1.CreateFeedRequest)3 ExportAssetsRequest (com.google.cloud.asset.v1.ExportAssetsRequest)3 UpdateFeedRequest (com.google.cloud.asset.v1.UpdateFeedRequest)3 Asset (com.google.cloud.asset.v1.Asset)2 DeleteFeedRequest (com.google.cloud.asset.v1.DeleteFeedRequest)2 ExportAssetsResponse (com.google.cloud.asset.v1.ExportAssetsResponse)2 FeedName (com.google.cloud.asset.v1.FeedName)2 GetFeedRequest (com.google.cloud.asset.v1.GetFeedRequest)2 ListAssetsRequest (com.google.cloud.asset.v1.ListAssetsRequest)2 ResourceName (com.google.api.resourcenames.ResourceName)1 ListAssetsPagedResponse (com.google.cloud.asset.v1.AssetServiceClient.ListAssetsPagedResponse)1 BatchGetAssetsHistoryRequest (com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest)1 BatchGetAssetsHistoryResponse (com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse)1 ListAssetsResponse (com.google.cloud.asset.v1.ListAssetsResponse)1 Operation (com.google.longrunning.Operation)1 AbstractMessage (com.google.protobuf.AbstractMessage)1 Empty (com.google.protobuf.Empty)1