From 1094bbe56e29aaf49f271fb060b6e53512862494 Mon Sep 17 00:00:00 2001 From: Summer Ji Date: Wed, 9 Dec 2020 16:59:53 -0800 Subject: [PATCH] [samplecode][2/3]Implemente Unary Paged RPC method's sample code (#576) --- .../goldens/logging/MetricsClient.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/integration/goldens/logging/MetricsClient.java b/test/integration/goldens/logging/MetricsClient.java index 283f4d1d5b..e63a29ac2e 100644 --- a/test/integration/goldens/logging/MetricsClient.java +++ b/test/integration/goldens/logging/MetricsClient.java @@ -152,6 +152,17 @@ public MetricsServiceV2Stub getStub() { /** * Lists logs-based metrics. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The name of the project containing the metrics: *

"projects/[PROJECT_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -168,6 +179,17 @@ public final ListLogMetricsPagedResponse listLogMetrics(ProjectName parent) { /** * Lists logs-based metrics. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The name of the project containing the metrics: *

"projects/[PROJECT_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails