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

Commit

Permalink
fix: restore GAPIC v2 retry configs (#176)
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/b94bacd6-05ee-45c2-be4d-b0f667030fab/targets

PiperOrigin-RevId: 312088359
Source-Link: googleapis/googleapis@5a90d46
  • Loading branch information
yoshi-automation committed Jun 3, 2020
1 parent 206e373 commit 1682d12
Show file tree
Hide file tree
Showing 14 changed files with 371 additions and 371 deletions.
Expand Up @@ -54,8 +54,8 @@
* <code>
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* String projectId = "";
* String traceId = "";
* Trace response = traceServiceClient.getTrace(projectId, traceId);
* Traces traces = Traces.newBuilder().build();
* traceServiceClient.patchTraces(projectId, traces);
* }
* </code>
* </pre>
Expand Down Expand Up @@ -163,6 +163,88 @@ public TraceServiceStub getStub() {
return stub;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you
* send matches that of an existing trace, any fields in the existing trace and its spans are
* 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 = "";
* Traces traces = Traces.newBuilder().build();
* traceServiceClient.patchTraces(projectId, traces);
* }
* </code></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
*/
public final void patchTraces(String projectId, Traces traces) {
PatchTracesRequest request =
PatchTracesRequest.newBuilder().setProjectId(projectId).setTraces(traces).build();
patchTraces(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you
* send matches that of an existing trace, any fields in the existing trace and its spans are
* 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 = "";
* Traces traces = Traces.newBuilder().build();
* PatchTracesRequest request = PatchTracesRequest.newBuilder()
* .setProjectId(projectId)
* .setTraces(traces)
* .build();
* traceServiceClient.patchTraces(request);
* }
* </code></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
*/
public final void patchTraces(PatchTracesRequest request) {
patchTracesCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you
* send matches that of an existing trace, any fields in the existing trace and its spans are
* 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 = "";
* Traces traces = Traces.newBuilder().build();
* PatchTracesRequest request = PatchTracesRequest.newBuilder()
* .setProjectId(projectId)
* .setTraces(traces)
* .build();
* ApiFuture&lt;Void&gt; future = traceServiceClient.patchTracesCallable().futureCall(request);
* // Do something
* future.get();
* }
* </code></pre>
*/
public final UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
return stub.patchTracesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns of a list of traces that match the specified filter conditions.
Expand Down Expand Up @@ -339,88 +421,6 @@ public final UnaryCallable<GetTraceRequest, Trace> getTraceCallable() {
return stub.getTraceCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you
* send matches that of an existing trace, any fields in the existing trace and its spans are
* 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 = "";
* Traces traces = Traces.newBuilder().build();
* traceServiceClient.patchTraces(projectId, traces);
* }
* </code></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
*/
public final void patchTraces(String projectId, Traces traces) {
PatchTracesRequest request =
PatchTracesRequest.newBuilder().setProjectId(projectId).setTraces(traces).build();
patchTraces(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you
* send matches that of an existing trace, any fields in the existing trace and its spans are
* 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 = "";
* Traces traces = Traces.newBuilder().build();
* PatchTracesRequest request = PatchTracesRequest.newBuilder()
* .setProjectId(projectId)
* .setTraces(traces)
* .build();
* traceServiceClient.patchTraces(request);
* }
* </code></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
*/
public final void patchTraces(PatchTracesRequest request) {
patchTracesCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you
* send matches that of an existing trace, any fields in the existing trace and its spans are
* 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 = "";
* Traces traces = Traces.newBuilder().build();
* PatchTracesRequest request = PatchTracesRequest.newBuilder()
* .setProjectId(projectId)
* .setTraces(traces)
* .build();
* ApiFuture&lt;Void&gt; future = traceServiceClient.patchTracesCallable().futureCall(request);
* // Do something
* future.get();
* }
* </code></pre>
*/
public final UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
return stub.patchTracesCallable();
}

@Override
public final void close() {
stub.close();
Expand Down
Expand Up @@ -54,16 +54,16 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of getTrace to 30 seconds:
* <p>For example, to set the total timeout of patchTraces to 30 seconds:
*
* <pre>
* <code>
* TraceServiceSettings.Builder traceServiceSettingsBuilder =
* TraceServiceSettings.newBuilder();
* traceServiceSettingsBuilder
* .getTraceSettings()
* .patchTracesSettings()
* .setRetrySettings(
* traceServiceSettingsBuilder.getTraceSettings().getRetrySettings().toBuilder()
* traceServiceSettingsBuilder.patchTracesSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* TraceServiceSettings traceServiceSettings = traceServiceSettingsBuilder.build();
Expand All @@ -73,6 +73,11 @@
@Generated("by gapic-generator")
@BetaApi
public class TraceServiceSettings extends ClientSettings<TraceServiceSettings> {
/** Returns the object with the settings used for calls to patchTraces. */
public UnaryCallSettings<PatchTracesRequest, Empty> patchTracesSettings() {
return ((TraceServiceStubSettings) getStubSettings()).patchTracesSettings();
}

/** Returns the object with the settings used for calls to listTraces. */
public PagedCallSettings<ListTracesRequest, ListTracesResponse, ListTracesPagedResponse>
listTracesSettings() {
Expand All @@ -84,11 +89,6 @@ public UnaryCallSettings<GetTraceRequest, Trace> getTraceSettings() {
return ((TraceServiceStubSettings) getStubSettings()).getTraceSettings();
}

/** Returns the object with the settings used for calls to patchTraces. */
public UnaryCallSettings<PatchTracesRequest, Empty> patchTracesSettings() {
return ((TraceServiceStubSettings) getStubSettings()).patchTracesSettings();
}

public static final TraceServiceSettings create(TraceServiceStubSettings stub)
throws IOException {
return new TraceServiceSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -186,6 +186,11 @@ public Builder applyToAllUnaryMethods(
return this;
}

/** Returns the builder for the settings used for calls to patchTraces. */
public UnaryCallSettings.Builder<PatchTracesRequest, Empty> patchTracesSettings() {
return getStubSettingsBuilder().patchTracesSettings();
}

/** Returns the builder for the settings used for calls to listTraces. */
public PagedCallSettings.Builder<ListTracesRequest, ListTracesResponse, ListTracesPagedResponse>
listTracesSettings() {
Expand All @@ -197,11 +202,6 @@ public UnaryCallSettings.Builder<GetTraceRequest, Trace> getTraceSettings() {
return getStubSettingsBuilder().getTraceSettings();
}

/** Returns the builder for the settings used for calls to patchTraces. */
public UnaryCallSettings.Builder<PatchTracesRequest, Empty> patchTracesSettings() {
return getStubSettingsBuilder().patchTracesSettings();
}

@Override
public TraceServiceSettings build() throws IOException {
return new TraceServiceSettings(this);
Expand Down
Expand Up @@ -32,8 +32,8 @@
* <code>
* try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
* String projectId = "";
* String traceId = "";
* Trace response = traceServiceClient.getTrace(projectId, traceId);
* Traces traces = Traces.newBuilder().build();
* traceServiceClient.patchTraces(projectId, traces);
* }
* </code>
* </pre>
Expand Down
Expand Up @@ -49,6 +49,13 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public class GrpcTraceServiceStub extends TraceServiceStub {

private static final MethodDescriptor<PatchTracesRequest, Empty> patchTracesMethodDescriptor =
MethodDescriptor.<PatchTracesRequest, Empty>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.devtools.cloudtrace.v1.TraceService/PatchTraces")
.setRequestMarshaller(ProtoUtils.marshaller(PatchTracesRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor<ListTracesRequest, ListTracesResponse>
listTracesMethodDescriptor =
MethodDescriptor.<ListTracesRequest, ListTracesResponse>newBuilder()
Expand All @@ -64,20 +71,13 @@ public class GrpcTraceServiceStub extends TraceServiceStub {
.setRequestMarshaller(ProtoUtils.marshaller(GetTraceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Trace.getDefaultInstance()))
.build();
private static final MethodDescriptor<PatchTracesRequest, Empty> patchTracesMethodDescriptor =
MethodDescriptor.<PatchTracesRequest, Empty>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.devtools.cloudtrace.v1.TraceService/PatchTraces")
.setRequestMarshaller(ProtoUtils.marshaller(PatchTracesRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();

private final BackgroundResource backgroundResources;

private final UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable;
private final UnaryCallable<ListTracesRequest, ListTracesResponse> listTracesCallable;
private final UnaryCallable<ListTracesRequest, ListTracesPagedResponse> listTracesPagedCallable;
private final UnaryCallable<GetTraceRequest, Trace> getTraceCallable;
private final UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable;

private final GrpcStubCallableFactory callableFactory;

Expand Down Expand Up @@ -118,6 +118,19 @@ protected GrpcTraceServiceStub(
throws IOException {
this.callableFactory = callableFactory;

GrpcCallSettings<PatchTracesRequest, Empty> patchTracesTransportSettings =
GrpcCallSettings.<PatchTracesRequest, Empty>newBuilder()
.setMethodDescriptor(patchTracesMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<PatchTracesRequest>() {
@Override
public Map<String, String> extract(PatchTracesRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("project_id", String.valueOf(request.getProjectId()));
return params.build();
}
})
.build();
GrpcCallSettings<ListTracesRequest, ListTracesResponse> listTracesTransportSettings =
GrpcCallSettings.<ListTracesRequest, ListTracesResponse>newBuilder()
.setMethodDescriptor(listTracesMethodDescriptor)
Expand All @@ -135,20 +148,10 @@ public Map<String, String> extract(ListTracesRequest request) {
GrpcCallSettings.<GetTraceRequest, Trace>newBuilder()
.setMethodDescriptor(getTraceMethodDescriptor)
.build();
GrpcCallSettings<PatchTracesRequest, Empty> patchTracesTransportSettings =
GrpcCallSettings.<PatchTracesRequest, Empty>newBuilder()
.setMethodDescriptor(patchTracesMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<PatchTracesRequest>() {
@Override
public Map<String, String> extract(PatchTracesRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("project_id", String.valueOf(request.getProjectId()));
return params.build();
}
})
.build();

this.patchTracesCallable =
callableFactory.createUnaryCallable(
patchTracesTransportSettings, settings.patchTracesSettings(), clientContext);
this.listTracesCallable =
callableFactory.createUnaryCallable(
listTracesTransportSettings, settings.listTracesSettings(), clientContext);
Expand All @@ -158,13 +161,14 @@ public Map<String, String> extract(PatchTracesRequest request) {
this.getTraceCallable =
callableFactory.createUnaryCallable(
getTraceTransportSettings, settings.getTraceSettings(), clientContext);
this.patchTracesCallable =
callableFactory.createUnaryCallable(
patchTracesTransportSettings, settings.patchTracesSettings(), clientContext);

backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}

public UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
return patchTracesCallable;
}

public UnaryCallable<ListTracesRequest, ListTracesPagedResponse> listTracesPagedCallable() {
return listTracesPagedCallable;
}
Expand All @@ -177,10 +181,6 @@ public UnaryCallable<GetTraceRequest, Trace> getTraceCallable() {
return getTraceCallable;
}

public UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
return patchTracesCallable;
}

@Override
public final void close() {
shutdown();
Expand Down
Expand Up @@ -38,6 +38,10 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public abstract class TraceServiceStub implements BackgroundResource {

public UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
throw new UnsupportedOperationException("Not implemented: patchTracesCallable()");
}

public UnaryCallable<ListTracesRequest, ListTracesPagedResponse> listTracesPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listTracesPagedCallable()");
}
Expand All @@ -50,10 +54,6 @@ public UnaryCallable<GetTraceRequest, Trace> getTraceCallable() {
throw new UnsupportedOperationException("Not implemented: getTraceCallable()");
}

public UnaryCallable<PatchTracesRequest, Empty> patchTracesCallable() {
throw new UnsupportedOperationException("Not implemented: patchTracesCallable()");
}

@Override
public abstract void close();
}

0 comments on commit 1682d12

Please sign in to comment.