use of com.google.cloud.asset.v1.FeedName in project gapic-generator-java by googleapis.
the class SyncDeleteFeedFeedname method syncDeleteFeedFeedname.
public static void syncDeleteFeedFeedname() throws Exception {
// It may require modifications to work in your environment.
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
assetServiceClient.deleteFeed(name);
}
}
use of com.google.cloud.asset.v1.FeedName in project gapic-generator-java by googleapis.
the class SyncGetFeedFeedname method syncGetFeedFeedname.
public static void syncGetFeedFeedname() throws Exception {
// It may require modifications to work in your environment.
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
Feed response = assetServiceClient.getFeed(name);
}
}
use of com.google.cloud.asset.v1.FeedName in project java-asset by googleapis.
the class GetFeedExample method getFeed.
// Get a feed with full feed name
public static void getFeed(String feedName) throws Exception {
// the "close" method on the client to safely clean up any remaining background resources.
try (AssetServiceClient client = AssetServiceClient.create()) {
Feed feed = client.getFeed(feedName);
System.out.println("Get a feed: " + feedName);
} catch (Exception e) {
System.out.println("Error during GetFeed: \n" + e.toString());
}
}
use of com.google.cloud.asset.v1.FeedName in project java-asset by googleapis.
the class DeleteFeedExample method deleteFeed.
// Delete a feed with full feed name
public static void deleteFeed(String feedName) throws Exception {
// the "close" method on the client to safely clean up any remaining background resources.
try (AssetServiceClient client = AssetServiceClient.create()) {
client.deleteFeed(feedName);
System.out.println("Feed deleted");
} catch (Exception e) {
System.out.println("Error during DeleteFeed: \n" + e.toString());
}
}
use of com.google.cloud.asset.v1.FeedName 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());
}
}
Aggregations