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

Commit

Permalink
chore: update gapic-generator-java to 0.0.20 (#415)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yoshi-automation committed Feb 19, 2021
1 parent 01a203a commit 821c8f9
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 9 deletions.
Expand Up @@ -51,6 +51,14 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* String projectId = "projectId-894832108";
* String traceId = "traceId-1067401920";
* Trace response = traceServiceClient.getTrace(projectId, traceId);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the TraceServiceClient object to clean up resources such
* as threads. In the example above, try-with-resources is used, which automatically calls close().
*
Expand Down Expand Up @@ -153,6 +161,17 @@ public TraceServiceStub getStub() {
/**
* Returns of a list of traces that match the specified filter conditions.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* String projectId = "projectId-894832108";
* for (Trace element : traceServiceClient.listTraces(projectId).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param projectId Required. ID of the Cloud project where the trace data is stored.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -165,6 +184,26 @@ public final ListTracesPagedResponse listTraces(String projectId) {
/**
* Returns of a list of traces that match the specified filter conditions.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* ListTracesRequest request =
* ListTracesRequest.newBuilder()
* .setProjectId("projectId-894832108")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setStartTime(Timestamp.newBuilder().build())
* .setEndTime(Timestamp.newBuilder().build())
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .build();
* for (Trace element : traceServiceClient.listTraces(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -177,6 +216,26 @@ public final ListTracesPagedResponse listTraces(ListTracesRequest request) {
* Returns of a list of traces that match the specified filter conditions.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* ListTracesRequest request =
* ListTracesRequest.newBuilder()
* .setProjectId("projectId-894832108")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setStartTime(Timestamp.newBuilder().build())
* .setEndTime(Timestamp.newBuilder().build())
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .build();
* ApiFuture<Trace> future = traceServiceClient.listTracesPagedCallable().futureCall(request);
* // Do something.
* for (Trace element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<ListTracesRequest, ListTracesPagedResponse> listTracesPagedCallable() {
return stub.listTracesPagedCallable();
Expand All @@ -187,6 +246,23 @@ public final UnaryCallable<ListTracesRequest, ListTracesPagedResponse> listTrace
* Returns of a list of traces that match the specified filter conditions.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* while (true) {
* ListTracesResponse response = traceServiceClient.listTracesCallable().call(request);
* for (Trace element : response.getResponsesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<ListTracesRequest, ListTracesResponse> listTracesCallable() {
return stub.listTracesCallable();
Expand All @@ -196,6 +272,16 @@ public final UnaryCallable<ListTracesRequest, ListTracesResponse> listTracesCall
/**
* Gets a single trace by its ID.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* String projectId = "projectId-894832108";
* String traceId = "traceId-1067401920";
* Trace response = traceServiceClient.getTrace(projectId, traceId);
* }
* }</pre>
*
* @param projectId Required. ID of the Cloud project where the trace data is stored.
* @param traceId Required. ID of the trace to return.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
Expand All @@ -210,6 +296,19 @@ public final Trace getTrace(String projectId, String traceId) {
/**
* Gets a single trace by its ID.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* GetTraceRequest request =
* GetTraceRequest.newBuilder()
* .setProjectId("projectId-894832108")
* .setTraceId("traceId-1067401920")
* .build();
* Trace response = traceServiceClient.getTrace(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -222,6 +321,19 @@ public final Trace getTrace(GetTraceRequest request) {
* Gets a single trace by its ID.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* GetTraceRequest request =
* GetTraceRequest.newBuilder()
* .setProjectId("projectId-894832108")
* .setTraceId("traceId-1067401920")
* .build();
* ApiFuture<Trace> future = traceServiceClient.getTraceCallable().futureCall(request);
* // Do something.
* Trace response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetTraceRequest, Trace> getTraceCallable() {
return stub.getTraceCallable();
Expand All @@ -234,6 +346,16 @@ public final UnaryCallable<GetTraceRequest, Trace> getTraceCallable() {
* overwritten by the provided values, and any new fields provided are merged with the existing
* trace data. If the ID does not match, a new trace is created.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* String projectId = "projectId-894832108";
* Traces traces = Traces.newBuilder().build();
* traceServiceClient.patchTraces(projectId, traces);
* }
* }</pre>
*
* @param projectId Required. ID of the Cloud project where the trace data is stored.
* @param traces Required. The body of the message.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
Expand All @@ -251,6 +373,19 @@ public final void patchTraces(String projectId, Traces traces) {
* overwritten by the provided values, and any new fields provided are merged with the existing
* trace data. If the ID does not match, a new trace is created.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* PatchTracesRequest request =
* PatchTracesRequest.newBuilder()
* .setProjectId("projectId-894832108")
* .setTraces(Traces.newBuilder().build())
* .build();
* traceServiceClient.patchTraces(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -266,6 +401,19 @@ public final void patchTraces(PatchTracesRequest request) {
* trace data. If the ID does not match, a new trace is created.
*
* <p>Sample code:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* PatchTracesRequest request =
* PatchTracesRequest.newBuilder()
* .setProjectId("projectId-894832108")
* .setTraces(Traces.newBuilder().build())
* .build();
* ApiFuture<Empty> future = traceServiceClient.patchTracesCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }</pre>
*/
public final UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
return stub.patchTracesCallable();
Expand Down
Expand Up @@ -25,6 +25,14 @@
* trace tree. Spans for a single trace may span multiple services.
*
* <p>Sample for TraceServiceClient:
*
* <pre>{@code
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* String projectId = "projectId-894832108";
* String traceId = "traceId-1067401920";
* Trace response = traceServiceClient.getTrace(projectId, traceId);
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.cloud.trace.v1;
Expand Down
Expand Up @@ -182,18 +182,22 @@ public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}

@Override
public UnaryCallable<ListTracesRequest, ListTracesResponse> listTracesCallable() {
return listTracesCallable;
}

@Override
public UnaryCallable<ListTracesRequest, ListTracesPagedResponse> listTracesPagedCallable() {
return listTracesPagedCallable;
}

@Override
public UnaryCallable<GetTraceRequest, Trace> getTraceCallable() {
return getTraceCallable;
}

@Override
public UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
return patchTracesCallable;
}
Expand Down

0 comments on commit 821c8f9

Please sign in to comment.