diff --git a/asset/src/main/java/com/example/asset/BatchGetAssetsHistoryExample.java b/asset/src/main/java/com/example/asset/BatchGetAssetsHistoryExample.java index 9963abeb5fe..e244bfe767c 100644 --- a/asset/src/main/java/com/example/asset/BatchGetAssetsHistoryExample.java +++ b/asset/src/main/java/com/example/asset/BatchGetAssetsHistoryExample.java @@ -42,12 +42,13 @@ public static void main(String... args) throws Exception { 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(); + 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); } diff --git a/asset/src/main/java/com/example/asset/CreateFeedExample.java b/asset/src/main/java/com/example/asset/CreateFeedExample.java index fe99cc16eb6..fd66425de91 100644 --- a/asset/src/main/java/com/example/asset/CreateFeedExample.java +++ b/asset/src/main/java/com/example/asset/CreateFeedExample.java @@ -27,22 +27,26 @@ public class CreateFeedExample { // Create a feed - public static void createFeed( - String[] assetNames, String feedId, String topic, String projectId) throws Exception { + public static void createFeed(String[] assetNames, String feedId, String topic, String projectId) + throws Exception { // String[] assetNames = {"MY_ASSET_NAME"} // String FeedId = "MY_FEED_ID" // String topic = "projects/[PROJECT_ID]/topics/[TOPIC_NAME]" // String projectID = "MY_PROJECT_ID" - Feed feed = Feed.newBuilder() - .addAllAssetNames(Arrays.asList(assetNames)) - .setFeedOutputConfig( - FeedOutputConfig.newBuilder().setPubsubDestination( - PubsubDestination.newBuilder().setTopic(topic).build()).build()).build(); - CreateFeedRequest request = CreateFeedRequest.newBuilder() - .setParent(String.format(ProjectName.of(projectId).toString())) - .setFeedId(feedId) - .setFeed(feed) - .build(); + Feed feed = + Feed.newBuilder() + .addAllAssetNames(Arrays.asList(assetNames)) + .setFeedOutputConfig( + FeedOutputConfig.newBuilder() + .setPubsubDestination(PubsubDestination.newBuilder().setTopic(topic).build()) + .build()) + .build(); + CreateFeedRequest request = + CreateFeedRequest.newBuilder() + .setParent(String.format(ProjectName.of(projectId).toString())) + .setFeedId(feedId) + .setFeed(feed) + .build(); // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call // the "close" method on the client to safely clean up any remaining background resources. diff --git a/asset/src/main/java/com/example/asset/ListAssetsExample.java b/asset/src/main/java/com/example/asset/ListAssetsExample.java index b315aef7236..b9de8b1fc10 100644 --- a/asset/src/main/java/com/example/asset/ListAssetsExample.java +++ b/asset/src/main/java/com/example/asset/ListAssetsExample.java @@ -49,18 +49,18 @@ public static void listAssets(String projectId, String[] assetTypes, ContentType ProjectName parent = ProjectName.of(projectId); // Build initial ListAssetsRequest without setting page token. - ListAssetsRequest request = ListAssetsRequest.newBuilder() - .setParent(parent.toString()) - .addAllAssetTypes(Arrays.asList(assetTypes)) - .setContentType(contentType) - .build(); + ListAssetsRequest request = + ListAssetsRequest.newBuilder() + .setParent(parent.toString()) + .addAllAssetTypes(Arrays.asList(assetTypes)) + .setContentType(contentType) + .build(); // Repeatedly call ListAssets until page token is empty. ListAssetsPagedResponse response = client.listAssets(request); System.out.println(response); while (!response.getNextPageToken().isEmpty()) { - request = request.toBuilder() - .setPageToken(response.getNextPageToken()).build(); + request = request.toBuilder().setPageToken(response.getNextPageToken()).build(); response = client.listAssets(request); System.out.println(response); } diff --git a/asset/src/main/java/com/example/asset/SearchAllResourcesExample.java b/asset/src/main/java/com/example/asset/SearchAllResourcesExample.java index fa961008c19..42896575405 100644 --- a/asset/src/main/java/com/example/asset/SearchAllResourcesExample.java +++ b/asset/src/main/java/com/example/asset/SearchAllResourcesExample.java @@ -54,9 +54,9 @@ public static void searchAllResources(String scope, String query) { } catch (IOException e) { System.out.println(String.format("Failed to create client:%n%s", e.toString())); } catch (InvalidArgumentException e) { - System.out.println(String.format("Invalid request:%n%s", e.toString())); + System.out.println(String.format("Invalid request:%n%s", e.toString())); } catch (ApiException e) { - System.out.println(String.format("Error during SearchAllResources:%n%s", e.toString())); + System.out.println(String.format("Error during SearchAllResources:%n%s", e.toString())); } } } diff --git a/asset/src/main/java/com/example/asset/UpdateFeedExample.java b/asset/src/main/java/com/example/asset/UpdateFeedExample.java index d3e65172325..1719d5a15dc 100644 --- a/asset/src/main/java/com/example/asset/UpdateFeedExample.java +++ b/asset/src/main/java/com/example/asset/UpdateFeedExample.java @@ -30,16 +30,22 @@ public class UpdateFeedExample { 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(); + 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(); // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call // the "close" method on the client to safely clean up any remaining background resources.