Search in sources :

Example 1 with UpdateFeedRequest

use of com.google.cloud.asset.v1.UpdateFeedRequest 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)

Example 2 with UpdateFeedRequest

use of com.google.cloud.asset.v1.UpdateFeedRequest in project gapic-generator-java by googleapis.

the class SyncUpdateFeed method syncUpdateFeed.

public static void syncUpdateFeed() 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();
        Feed response = assetServiceClient.updateFeed(request);
    }
}
Also used : UpdateFeedRequest(com.google.cloud.asset.v1.UpdateFeedRequest) AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) Feed(com.google.cloud.asset.v1.Feed)

Example 3 with UpdateFeedRequest

use of com.google.cloud.asset.v1.UpdateFeedRequest in project java-asset by googleapis.

the class UpdateFeedExample method updateFeed.

// Update a feed
public static void updateFeed(String feedName, String topic) throws Exception {
    // String feedName = "MY_FEED_NAME"
    // String topic = "projects/[PROJECT_ID]/topics/[TOPIC_NAME]"
    Feed feed = Feed.newBuilder().setName(feedName).setFeedOutputConfig(FeedOutputConfig.newBuilder().setPubsubDestination(PubsubDestination.newBuilder().setTopic(topic).build()).build()).build();
    UpdateFeedRequest request = UpdateFeedRequest.newBuilder().setFeed(feed).setUpdateMask(FieldMask.newBuilder().addPaths("feed_output_config.pubsub_destination.topic").build()).build();
    // the "close" method on the client to safely clean up any remaining background resources.
    try (AssetServiceClient client = AssetServiceClient.create()) {
        Feed response = client.updateFeed(request);
        System.out.println("Feed updated successfully: " + response.getName());
    } catch (Exception e) {
        System.out.println("Error during UpdateFeed: \n" + e.toString());
    }
}
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)3 Feed (com.google.cloud.asset.v1.Feed)3 UpdateFeedRequest (com.google.cloud.asset.v1.UpdateFeedRequest)3