From 386c987bf831c34377e08a3e2638eb5d5ff5385b Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Mon, 2 Jul 2018 16:38:44 -0700 Subject: [PATCH] remove ParentName as param in LoggingClient --- .../cloud/logging/v2/LoggingClient.java | 62 +++---------------- .../cloud/logging/v2/LoggingClientTest.java | 6 +- 2 files changed, 10 insertions(+), 58 deletions(-) diff --git a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java b/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java index aa70290237af..ff9d5204daf6 100644 --- a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java +++ b/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java @@ -333,7 +333,7 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ * *

    * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   List<ParentName> resourceNames = new ArrayList<>();
+   *   List<String> resourceNames = new ArrayList<>();
    *   String filter = "";
    *   String orderBy = "";
    *   for (LogEntry element : loggingClient.listLogEntries(resourceNames, filter, orderBy).iterateAll()) {
@@ -360,54 +360,6 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
    *     timestamps are returned in order of their `insert_id` values.
    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
    */
-  public final ListLogEntriesPagedResponse listLogEntries(
-      List resourceNames, String filter, String orderBy) {
-    ListLogEntriesRequest request =
-        ListLogEntriesRequest.newBuilder()
-            .addAllResourceNames(
-                resourceNames == null ? null : ParentName.toStringList(resourceNames))
-            .setFilter(filter)
-            .setOrderBy(orderBy)
-            .build();
-    return listLogEntries(request);
-  }
-
-  // AUTO-GENERATED DOCUMENTATION AND METHOD
-  /**
-   * Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways
-   * to export log entries, see [Exporting Logs](/logging/docs/export).
-   *
-   * 

Sample code: - * - *


-   * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   List<ParentName> resourceNames = new ArrayList<>();
-   *   String filter = "";
-   *   String orderBy = "";
-   *   for (LogEntry element : loggingClient.listLogEntries(ParentName.toStringList(resourceNames), filter, orderBy).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * - * @param resourceNames Required. Names of one or more parent resources from which to retrieve log - * entries: - *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" - *

Projects listed in the `project_ids` field are added to this list. - * @param filter Optional. A filter that chooses which log entries to return. See [Advanced Logs - * Filters](/logging/docs/view/advanced_filters). Only log entries that match the filter are - * returned. An empty filter matches all log entries in the resources listed in - * `resource_names`. Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of the filter is 20000 - * characters. - * @param orderBy Optional. How the results should be sorted. Presently, the only permitted values - * are `"timestamp asc"` (default) and `"timestamp desc"`. The first option returns entries in - * order of increasing values of `LogEntry.timestamp` (oldest first), and the second option - * returns entries in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ public final ListLogEntriesPagedResponse listLogEntries( List resourceNames, String filter, String orderBy) { ListLogEntriesRequest request = @@ -428,9 +380,9 @@ public final ListLogEntriesPagedResponse listLogEntries( * *


    * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   List<ParentName> resourceNames = new ArrayList<>();
+   *   List<String> resourceNames = new ArrayList<>();
    *   ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
-   *     .addAllResourceNames(ParentName.toStringList(resourceNames))
+   *     .addAllResourceNames(resourceNames)
    *     .build();
    *   for (LogEntry element : loggingClient.listLogEntries(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -454,9 +406,9 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
    *
    * 

    * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   List<ParentName> resourceNames = new ArrayList<>();
+   *   List<String> resourceNames = new ArrayList<>();
    *   ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
-   *     .addAllResourceNames(ParentName.toStringList(resourceNames))
+   *     .addAllResourceNames(resourceNames)
    *     .build();
    *   ApiFuture<ListLogEntriesPagedResponse> future = loggingClient.listLogEntriesPagedCallable().futureCall(request);
    *   // Do something
@@ -480,9 +432,9 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
    *
    * 

    * try (LoggingClient loggingClient = LoggingClient.create()) {
-   *   List<ParentName> resourceNames = new ArrayList<>();
+   *   List<String> resourceNames = new ArrayList<>();
    *   ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
-   *     .addAllResourceNames(ParentName.toStringList(resourceNames))
+   *     .addAllResourceNames(resourceNames)
    *     .build();
    *   while (true) {
    *     ListLogEntriesResponse response = loggingClient.listLogEntriesCallable().call(request);
diff --git a/google-cloud-clients/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/LoggingClientTest.java b/google-cloud-clients/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/LoggingClientTest.java
index a36bf5b8a29d..ca14269170ad 100644
--- a/google-cloud-clients/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/LoggingClientTest.java
+++ b/google-cloud-clients/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/LoggingClientTest.java
@@ -147,7 +147,7 @@ public void listLogEntriesTest() {
             .build();
     mockLoggingServiceV2.addResponse(expectedResponse);
 
-    List resourceNames = new ArrayList<>();
+    List resourceNames = new ArrayList<>();
     String filter = "filter-1274492040";
     String orderBy = "orderBy1234304744";
 
@@ -162,7 +162,7 @@ public void listLogEntriesTest() {
     Assert.assertEquals(1, actualRequests.size());
     ListLogEntriesRequest actualRequest = (ListLogEntriesRequest) actualRequests.get(0);
 
-    Assert.assertEquals(resourceNames, ParentName.parseList(actualRequest.getResourceNamesList()));
+    Assert.assertEquals(resourceNames, actualRequest.getResourceNamesList());
     Assert.assertEquals(filter, actualRequest.getFilter());
     Assert.assertEquals(orderBy, actualRequest.getOrderBy());
     Assert.assertTrue(
@@ -178,7 +178,7 @@ public void listLogEntriesExceptionTest() throws Exception {
     mockLoggingServiceV2.addException(exception);
 
     try {
-      List resourceNames = new ArrayList<>();
+      List resourceNames = new ArrayList<>();
       String filter = "filter-1274492040";
       String orderBy = "orderBy1234304744";