Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Commit 821c8f9

Browse files
chore: update gapic-generator-java to 0.0.20 (#415)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/ca0c8ac8-6f14-468f-80f2-67e8a2c09f54/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 357800868 Source-Link: googleapis/googleapis@e8bc447 PiperOrigin-RevId: 356341083 Source-Link: googleapis/googleapis@8d8c008 docs: generate sample code in the Java microgenerator
1 parent 01a203a commit 821c8f9

File tree

9 files changed

+309
-9
lines changed

9 files changed

+309
-9
lines changed

‎google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceClient.java

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@
5151
* <p>This class provides the ability to make remote calls to the backing service through method
5252
* calls that map to API methods. Sample code to get started:
5353
*
54+
* <pre>{@code
55+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
56+
* String projectId = "projectId-894832108";
57+
* String traceId = "traceId-1067401920";
58+
* Trace response = traceServiceClient.getTrace(projectId, traceId);
59+
* }
60+
* }</pre>
61+
*
5462
* <p>Note: close() needs to be called on the TraceServiceClient object to clean up resources such
5563
* as threads. In the example above, try-with-resources is used, which automatically calls close().
5664
*
@@ -153,6 +161,17 @@ public TraceServiceStub getStub() {
153161
/**
154162
* Returns of a list of traces that match the specified filter conditions.
155163
*
164+
* <p>Sample code:
165+
*
166+
* <pre>{@code
167+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
168+
* String projectId = "projectId-894832108";
169+
* for (Trace element : traceServiceClient.listTraces(projectId).iterateAll()) {
170+
* // doThingsWith(element);
171+
* }
172+
* }
173+
* }</pre>
174+
*
156175
* @param projectId Required. ID of the Cloud project where the trace data is stored.
157176
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
158177
*/
@@ -165,6 +184,26 @@ public final ListTracesPagedResponse listTraces(String projectId) {
165184
/**
166185
* Returns of a list of traces that match the specified filter conditions.
167186
*
187+
* <p>Sample code:
188+
*
189+
* <pre>{@code
190+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
191+
* ListTracesRequest request =
192+
* ListTracesRequest.newBuilder()
193+
* .setProjectId("projectId-894832108")
194+
* .setPageSize(883849137)
195+
* .setPageToken("pageToken873572522")
196+
* .setStartTime(Timestamp.newBuilder().build())
197+
* .setEndTime(Timestamp.newBuilder().build())
198+
* .setFilter("filter-1274492040")
199+
* .setOrderBy("orderBy-1207110587")
200+
* .build();
201+
* for (Trace element : traceServiceClient.listTraces(request).iterateAll()) {
202+
* // doThingsWith(element);
203+
* }
204+
* }
205+
* }</pre>
206+
*
168207
* @param request The request object containing all of the parameters for the API call.
169208
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
170209
*/
@@ -177,6 +216,26 @@ public final ListTracesPagedResponse listTraces(ListTracesRequest request) {
177216
* Returns of a list of traces that match the specified filter conditions.
178217
*
179218
* <p>Sample code:
219+
*
220+
* <pre>{@code
221+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
222+
* ListTracesRequest request =
223+
* ListTracesRequest.newBuilder()
224+
* .setProjectId("projectId-894832108")
225+
* .setPageSize(883849137)
226+
* .setPageToken("pageToken873572522")
227+
* .setStartTime(Timestamp.newBuilder().build())
228+
* .setEndTime(Timestamp.newBuilder().build())
229+
* .setFilter("filter-1274492040")
230+
* .setOrderBy("orderBy-1207110587")
231+
* .build();
232+
* ApiFuture<Trace> future = traceServiceClient.listTracesPagedCallable().futureCall(request);
233+
* // Do something.
234+
* for (Trace element : future.get().iterateAll()) {
235+
* // doThingsWith(element);
236+
* }
237+
* }
238+
* }</pre>
180239
*/
181240
public final UnaryCallable<ListTracesRequest, ListTracesPagedResponse> listTracesPagedCallable() {
182241
return stub.listTracesPagedCallable();
@@ -187,6 +246,23 @@ public final UnaryCallable<ListTracesRequest, ListTracesPagedResponse> listTrace
187246
* Returns of a list of traces that match the specified filter conditions.
188247
*
189248
* <p>Sample code:
249+
*
250+
* <pre>{@code
251+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
252+
* while (true) {
253+
* ListTracesResponse response = traceServiceClient.listTracesCallable().call(request);
254+
* for (Trace element : response.getResponsesList()) {
255+
* // doThingsWith(element);
256+
* }
257+
* String nextPageToken = response.getNextPageToken();
258+
* if (!Strings.isNullOrEmpty(nextPageToken)) {
259+
* request = request.toBuilder().setPageToken(nextPageToken).build();
260+
* } else {
261+
* break;
262+
* }
263+
* }
264+
* }
265+
* }</pre>
190266
*/
191267
public final UnaryCallable<ListTracesRequest, ListTracesResponse> listTracesCallable() {
192268
return stub.listTracesCallable();
@@ -196,6 +272,16 @@ public final UnaryCallable<ListTracesRequest, ListTracesResponse> listTracesCall
196272
/**
197273
* Gets a single trace by its ID.
198274
*
275+
* <p>Sample code:
276+
*
277+
* <pre>{@code
278+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
279+
* String projectId = "projectId-894832108";
280+
* String traceId = "traceId-1067401920";
281+
* Trace response = traceServiceClient.getTrace(projectId, traceId);
282+
* }
283+
* }</pre>
284+
*
199285
* @param projectId Required. ID of the Cloud project where the trace data is stored.
200286
* @param traceId Required. ID of the trace to return.
201287
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -210,6 +296,19 @@ public final Trace getTrace(String projectId, String traceId) {
210296
/**
211297
* Gets a single trace by its ID.
212298
*
299+
* <p>Sample code:
300+
*
301+
* <pre>{@code
302+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
303+
* GetTraceRequest request =
304+
* GetTraceRequest.newBuilder()
305+
* .setProjectId("projectId-894832108")
306+
* .setTraceId("traceId-1067401920")
307+
* .build();
308+
* Trace response = traceServiceClient.getTrace(request);
309+
* }
310+
* }</pre>
311+
*
213312
* @param request The request object containing all of the parameters for the API call.
214313
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
215314
*/
@@ -222,6 +321,19 @@ public final Trace getTrace(GetTraceRequest request) {
222321
* Gets a single trace by its ID.
223322
*
224323
* <p>Sample code:
324+
*
325+
* <pre>{@code
326+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
327+
* GetTraceRequest request =
328+
* GetTraceRequest.newBuilder()
329+
* .setProjectId("projectId-894832108")
330+
* .setTraceId("traceId-1067401920")
331+
* .build();
332+
* ApiFuture<Trace> future = traceServiceClient.getTraceCallable().futureCall(request);
333+
* // Do something.
334+
* Trace response = future.get();
335+
* }
336+
* }</pre>
225337
*/
226338
public final UnaryCallable<GetTraceRequest, Trace> getTraceCallable() {
227339
return stub.getTraceCallable();
@@ -234,6 +346,16 @@ public final UnaryCallable<GetTraceRequest, Trace> getTraceCallable() {
234346
* overwritten by the provided values, and any new fields provided are merged with the existing
235347
* trace data. If the ID does not match, a new trace is created.
236348
*
349+
* <p>Sample code:
350+
*
351+
* <pre>{@code
352+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
353+
* String projectId = "projectId-894832108";
354+
* Traces traces = Traces.newBuilder().build();
355+
* traceServiceClient.patchTraces(projectId, traces);
356+
* }
357+
* }</pre>
358+
*
237359
* @param projectId Required. ID of the Cloud project where the trace data is stored.
238360
* @param traces Required. The body of the message.
239361
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -251,6 +373,19 @@ public final void patchTraces(String projectId, Traces traces) {
251373
* overwritten by the provided values, and any new fields provided are merged with the existing
252374
* trace data. If the ID does not match, a new trace is created.
253375
*
376+
* <p>Sample code:
377+
*
378+
* <pre>{@code
379+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
380+
* PatchTracesRequest request =
381+
* PatchTracesRequest.newBuilder()
382+
* .setProjectId("projectId-894832108")
383+
* .setTraces(Traces.newBuilder().build())
384+
* .build();
385+
* traceServiceClient.patchTraces(request);
386+
* }
387+
* }</pre>
388+
*
254389
* @param request The request object containing all of the parameters for the API call.
255390
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
256391
*/
@@ -266,6 +401,19 @@ public final void patchTraces(PatchTracesRequest request) {
266401
* trace data. If the ID does not match, a new trace is created.
267402
*
268403
* <p>Sample code:
404+
*
405+
* <pre>{@code
406+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
407+
* PatchTracesRequest request =
408+
* PatchTracesRequest.newBuilder()
409+
* .setProjectId("projectId-894832108")
410+
* .setTraces(Traces.newBuilder().build())
411+
* .build();
412+
* ApiFuture<Empty> future = traceServiceClient.patchTracesCallable().futureCall(request);
413+
* // Do something.
414+
* future.get();
415+
* }
416+
* }</pre>
269417
*/
270418
public final UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
271419
return stub.patchTracesCallable();

‎google-cloud-trace/src/main/java/com/google/cloud/trace/v1/package-info.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
* trace tree. Spans for a single trace may span multiple services.
2626
*
2727
* <p>Sample for TraceServiceClient:
28+
*
29+
* <pre>{@code
30+
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
31+
* String projectId = "projectId-894832108";
32+
* String traceId = "traceId-1067401920";
33+
* Trace response = traceServiceClient.getTrace(projectId, traceId);
34+
* }
35+
* }</pre>
2836
*/
2937
@Generated("by gapic-generator-java")
3038
package com.google.cloud.trace.v1;

‎google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/GrpcTraceServiceStub.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,22 @@ public GrpcOperationsStub getOperationsStub() {
182182
return operationsStub;
183183
}
184184

185+
@Override
185186
public UnaryCallable<ListTracesRequest, ListTracesResponse> listTracesCallable() {
186187
return listTracesCallable;
187188
}
188189

190+
@Override
189191
public UnaryCallable<ListTracesRequest, ListTracesPagedResponse> listTracesPagedCallable() {
190192
return listTracesPagedCallable;
191193
}
192194

195+
@Override
193196
public UnaryCallable<GetTraceRequest, Trace> getTraceCallable() {
194197
return getTraceCallable;
195198
}
196199

200+
@Override
197201
public UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
198202
return patchTracesCallable;
199203
}

0 commit comments

Comments
 (0)