Skip to content

Commit 386c987

Browse files
committed
remove ParentName as param in LoggingClient
1 parent bb14eb1 commit 386c987

File tree

2 files changed

+10
-58
lines changed

2 files changed

+10
-58
lines changed

google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
333333
*
334334
* <pre><code>
335335
* try (LoggingClient loggingClient = LoggingClient.create()) {
336-
* List&lt;ParentName&gt; resourceNames = new ArrayList&lt;&gt;();
336+
* List&lt;String&gt; resourceNames = new ArrayList&lt;&gt;();
337337
* String filter = "";
338338
* String orderBy = "";
339339
* for (LogEntry element : loggingClient.listLogEntries(resourceNames, filter, orderBy).iterateAll()) {
@@ -360,54 +360,6 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
360360
* timestamps are returned in order of their `insert_id` values.
361361
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
362362
*/
363-
public final ListLogEntriesPagedResponse listLogEntries(
364-
List<ParentName> resourceNames, String filter, String orderBy) {
365-
ListLogEntriesRequest request =
366-
ListLogEntriesRequest.newBuilder()
367-
.addAllResourceNames(
368-
resourceNames == null ? null : ParentName.toStringList(resourceNames))
369-
.setFilter(filter)
370-
.setOrderBy(orderBy)
371-
.build();
372-
return listLogEntries(request);
373-
}
374-
375-
// AUTO-GENERATED DOCUMENTATION AND METHOD
376-
/**
377-
* Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways
378-
* to export log entries, see [Exporting Logs](/logging/docs/export).
379-
*
380-
* <p>Sample code:
381-
*
382-
* <pre><code>
383-
* try (LoggingClient loggingClient = LoggingClient.create()) {
384-
* List&lt;ParentName&gt; resourceNames = new ArrayList&lt;&gt;();
385-
* String filter = "";
386-
* String orderBy = "";
387-
* for (LogEntry element : loggingClient.listLogEntries(ParentName.toStringList(resourceNames), filter, orderBy).iterateAll()) {
388-
* // doThingsWith(element);
389-
* }
390-
* }
391-
* </code></pre>
392-
*
393-
* @param resourceNames Required. Names of one or more parent resources from which to retrieve log
394-
* entries:
395-
* <p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
396-
* "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
397-
* <p>Projects listed in the `project_ids` field are added to this list.
398-
* @param filter Optional. A filter that chooses which log entries to return. See [Advanced Logs
399-
* Filters](/logging/docs/view/advanced_filters). Only log entries that match the filter are
400-
* returned. An empty filter matches all log entries in the resources listed in
401-
* `resource_names`. Referencing a parent resource that is not listed in `resource_names` will
402-
* cause the filter to return no results. The maximum length of the filter is 20000
403-
* characters.
404-
* @param orderBy Optional. How the results should be sorted. Presently, the only permitted values
405-
* are `"timestamp asc"` (default) and `"timestamp desc"`. The first option returns entries in
406-
* order of increasing values of `LogEntry.timestamp` (oldest first), and the second option
407-
* returns entries in order of decreasing timestamps (newest first). Entries with equal
408-
* timestamps are returned in order of their `insert_id` values.
409-
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
410-
*/
411363
public final ListLogEntriesPagedResponse listLogEntries(
412364
List<String> resourceNames, String filter, String orderBy) {
413365
ListLogEntriesRequest request =
@@ -428,9 +380,9 @@ public final ListLogEntriesPagedResponse listLogEntries(
428380
*
429381
* <pre><code>
430382
* try (LoggingClient loggingClient = LoggingClient.create()) {
431-
* List&lt;ParentName&gt; resourceNames = new ArrayList&lt;&gt;();
383+
* List&lt;String&gt; resourceNames = new ArrayList&lt;&gt;();
432384
* ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
433-
* .addAllResourceNames(ParentName.toStringList(resourceNames))
385+
* .addAllResourceNames(resourceNames)
434386
* .build();
435387
* for (LogEntry element : loggingClient.listLogEntries(request).iterateAll()) {
436388
* // doThingsWith(element);
@@ -454,9 +406,9 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
454406
*
455407
* <pre><code>
456408
* try (LoggingClient loggingClient = LoggingClient.create()) {
457-
* List&lt;ParentName&gt; resourceNames = new ArrayList&lt;&gt;();
409+
* List&lt;String&gt; resourceNames = new ArrayList&lt;&gt;();
458410
* ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
459-
* .addAllResourceNames(ParentName.toStringList(resourceNames))
411+
* .addAllResourceNames(resourceNames)
460412
* .build();
461413
* ApiFuture&lt;ListLogEntriesPagedResponse&gt; future = loggingClient.listLogEntriesPagedCallable().futureCall(request);
462414
* // Do something
@@ -480,9 +432,9 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
480432
*
481433
* <pre><code>
482434
* try (LoggingClient loggingClient = LoggingClient.create()) {
483-
* List&lt;ParentName&gt; resourceNames = new ArrayList&lt;&gt;();
435+
* List&lt;String&gt; resourceNames = new ArrayList&lt;&gt;();
484436
* ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
485-
* .addAllResourceNames(ParentName.toStringList(resourceNames))
437+
* .addAllResourceNames(resourceNames)
486438
* .build();
487439
* while (true) {
488440
* ListLogEntriesResponse response = loggingClient.listLogEntriesCallable().call(request);

google-cloud-clients/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/LoggingClientTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public void listLogEntriesTest() {
147147
.build();
148148
mockLoggingServiceV2.addResponse(expectedResponse);
149149

150-
List<ParentName> resourceNames = new ArrayList<>();
150+
List<String> resourceNames = new ArrayList<>();
151151
String filter = "filter-1274492040";
152152
String orderBy = "orderBy1234304744";
153153

@@ -162,7 +162,7 @@ public void listLogEntriesTest() {
162162
Assert.assertEquals(1, actualRequests.size());
163163
ListLogEntriesRequest actualRequest = (ListLogEntriesRequest) actualRequests.get(0);
164164

165-
Assert.assertEquals(resourceNames, ParentName.parseList(actualRequest.getResourceNamesList()));
165+
Assert.assertEquals(resourceNames, actualRequest.getResourceNamesList());
166166
Assert.assertEquals(filter, actualRequest.getFilter());
167167
Assert.assertEquals(orderBy, actualRequest.getOrderBy());
168168
Assert.assertTrue(
@@ -178,7 +178,7 @@ public void listLogEntriesExceptionTest() throws Exception {
178178
mockLoggingServiceV2.addException(exception);
179179

180180
try {
181-
List<ParentName> resourceNames = new ArrayList<>();
181+
List<String> resourceNames = new ArrayList<>();
182182
String filter = "filter-1274492040";
183183
String orderBy = "orderBy1234304744";
184184

0 commit comments

Comments
 (0)