Skip to content

Commit c47243e

Browse files
Removing devtools from package, refreshing tests
1 parent 33679df commit c47243e

8 files changed

Lines changed: 188 additions & 171 deletions

File tree

gcloud-java-cloudtrace/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<groupId>com.google.cloud</groupId>
1313
<artifactId>gcloud-java-pom</artifactId>
14-
<version>0.2.8-SNAPSHOT</version>
14+
<version>0.2.9-SNAPSHOT</version>
1515
</parent>
1616
<properties>
1717
<site.installationModule>gcloud-java-cloudtrace</site.installationModule>

gcloud-java-cloudtrace/src/main/java/com/google/cloud/devtools/cloudtrace/spi/v1/TraceServiceApi.java renamed to gcloud-java-cloudtrace/src/main/java/com/google/cloud/cloudtrace/spi/v1/TraceServiceApi.java

Lines changed: 96 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* or implied. See the License for the specific language governing permissions and limitations under
1212
* the License.
1313
*/
14-
package com.google.cloud.devtools.cloudtrace.spi.v1;
14+
package com.google.cloud.cloudtrace.spi.v1;
1515

1616
import com.google.api.gax.core.PageAccessor;
1717
import com.google.api.gax.grpc.ApiCallable;
@@ -45,8 +45,8 @@
4545
* <code>
4646
* try (TraceServiceApi traceServiceApi = TraceServiceApi.create()) {
4747
* String projectId = "";
48-
* String traceId = "";
49-
* Trace response = traceServiceApi.getTrace(projectId, traceId);
48+
* Traces traces = Traces.newBuilder().build();
49+
* traceServiceApi.patchTraces(projectId, traces);
5050
* }
5151
* </code>
5252
* </pre>
@@ -94,10 +94,10 @@ public class TraceServiceApi implements AutoCloseable {
9494
private final ScheduledExecutorService executor;
9595
private final List<AutoCloseable> closeables = new ArrayList<>();
9696

97+
private final ApiCallable<PatchTracesRequest, Empty> patchTracesCallable;
98+
private final ApiCallable<GetTraceRequest, Trace> getTraceCallable;
9799
private final ApiCallable<ListTracesRequest, ListTracesResponse> listTracesCallable;
98100
private final ApiCallable<ListTracesRequest, PageAccessor<Trace>> listTracesPagedCallable;
99-
private final ApiCallable<GetTraceRequest, Trace> getTraceCallable;
100-
private final ApiCallable<PatchTracesRequest, Empty> patchTracesCallable;
101101

102102
public final TraceServiceSettings getSettings() {
103103
return settings;
@@ -129,14 +129,14 @@ protected TraceServiceApi(TraceServiceSettings settings) throws IOException {
129129
this.executor = settings.getExecutorProvider().getOrBuildExecutor();
130130
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);
131131

132+
this.patchTracesCallable =
133+
ApiCallable.create(settings.patchTracesSettings(), this.channel, this.executor);
134+
this.getTraceCallable =
135+
ApiCallable.create(settings.getTraceSettings(), this.channel, this.executor);
132136
this.listTracesCallable =
133137
ApiCallable.create(settings.listTracesSettings(), this.channel, this.executor);
134138
this.listTracesPagedCallable =
135139
ApiCallable.createPagedVariant(settings.listTracesSettings(), this.channel, this.executor);
136-
this.getTraceCallable =
137-
ApiCallable.create(settings.getTraceSettings(), this.channel, this.executor);
138-
this.patchTracesCallable =
139-
ApiCallable.create(settings.patchTracesSettings(), this.channel, this.executor);
140140

141141
if (settings.getChannelProvider().shouldAutoClose()) {
142142
closeables.add(
@@ -160,101 +160,84 @@ public void close() throws IOException {
160160

161161
// AUTO-GENERATED DOCUMENTATION AND METHOD
162162
/**
163-
* Returns of a list of traces that match the specified filter conditions.
163+
* Sends new traces to Cloud Trace or updates existing traces. If the ID of
164+
* a trace that you send matches that of an existing trace, any fields
165+
* in the existing trace and its spans are overwritten by the provided values,
166+
* and any new fields provided are merged with the existing trace data. If the
167+
* ID does not match, a new trace is created.
164168
*
165169
* Sample code:
166170
* <pre><code>
167171
* try (TraceServiceApi traceServiceApi = TraceServiceApi.create()) {
168172
* String projectId = "";
169-
* for (Trace element : traceServiceApi.listTraces(projectId)) {
170-
* // doThingsWith(element);
171-
* }
173+
* Traces traces = Traces.newBuilder().build();
174+
* traceServiceApi.patchTraces(projectId, traces);
172175
* }
173176
* </code></pre>
174177
*
175178
* @param projectId ID of the Cloud project where the trace data is stored.
179+
* @param traces The body of the message.
176180
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
177181
*/
178-
public final PageAccessor<Trace> listTraces(String projectId) {
179-
ListTracesRequest request = ListTracesRequest.newBuilder().setProjectId(projectId).build();
180-
return listTraces(request);
182+
public final void patchTraces(String projectId, Traces traces) {
183+
PatchTracesRequest request =
184+
PatchTracesRequest.newBuilder().setProjectId(projectId).setTraces(traces).build();
185+
patchTraces(request);
181186
}
182187

183188
// AUTO-GENERATED DOCUMENTATION AND METHOD
184189
/**
185-
* Returns of a list of traces that match the specified filter conditions.
190+
* Sends new traces to Cloud Trace or updates existing traces. If the ID of
191+
* a trace that you send matches that of an existing trace, any fields
192+
* in the existing trace and its spans are overwritten by the provided values,
193+
* and any new fields provided are merged with the existing trace data. If the
194+
* ID does not match, a new trace is created.
186195
*
187196
* Sample code:
188197
* <pre><code>
189198
* try (TraceServiceApi traceServiceApi = TraceServiceApi.create()) {
190199
* String projectId = "";
191-
* ListTracesRequest request = ListTracesRequest.newBuilder()
200+
* Traces traces = Traces.newBuilder().build();
201+
* PatchTracesRequest request = PatchTracesRequest.newBuilder()
192202
* .setProjectId(projectId)
203+
* .setTraces(traces)
193204
* .build();
194-
* for (Trace element : traceServiceApi.listTraces(request)) {
195-
* // doThingsWith(element);
196-
* }
205+
* traceServiceApi.patchTraces(request);
197206
* }
198207
* </code></pre>
199208
*
200209
* @param request The request object containing all of the parameters for the API call.
201210
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
202211
*/
203-
public final PageAccessor<Trace> listTraces(ListTracesRequest request) {
204-
return listTracesPagedCallable().call(request);
212+
public final void patchTraces(PatchTracesRequest request) {
213+
patchTracesCallable().call(request);
205214
}
206215

207216
// AUTO-GENERATED DOCUMENTATION AND METHOD
208217
/**
209-
* Returns of a list of traces that match the specified filter conditions.
218+
* Sends new traces to Cloud Trace or updates existing traces. If the ID of
219+
* a trace that you send matches that of an existing trace, any fields
220+
* in the existing trace and its spans are overwritten by the provided values,
221+
* and any new fields provided are merged with the existing trace data. If the
222+
* ID does not match, a new trace is created.
210223
*
211224
* Sample code:
212225
* <pre><code>
213226
* try (TraceServiceApi traceServiceApi = TraceServiceApi.create()) {
214227
* String projectId = "";
215-
* ListTracesRequest request = ListTracesRequest.newBuilder()
228+
* Traces traces = Traces.newBuilder().build();
229+
* PatchTracesRequest request = PatchTracesRequest.newBuilder()
216230
* .setProjectId(projectId)
231+
* .setTraces(traces)
217232
* .build();
218-
* ListenableFuture&lt;PageAccessor&lt;Trace&gt;&gt; future = traceServiceApi.listTracesPagedCallable().futureCall(request);
233+
* ListenableFuture&lt;Void&gt; future = traceServiceApi.patchTracesCallable().futureCall(request);
219234
* // Do something
220-
* for (Trace element : future.get()) {
221-
* // doThingsWith(element);
222-
* }
223-
* }
224-
* </code></pre>
225-
*/
226-
public final ApiCallable<ListTracesRequest, PageAccessor<Trace>> listTracesPagedCallable() {
227-
return listTracesPagedCallable;
228-
}
229-
230-
// AUTO-GENERATED DOCUMENTATION AND METHOD
231-
/**
232-
* Returns of a list of traces that match the specified filter conditions.
233-
*
234-
* Sample code:
235-
* <pre><code>
236-
* try (TraceServiceApi traceServiceApi = TraceServiceApi.create()) {
237-
* String projectId = "";
238-
* ListTracesRequest request = ListTracesRequest.newBuilder()
239-
* .setProjectId(projectId)
240-
* .build();
241-
* while (true) {
242-
* ListTracesResponse response = traceServiceApi.listTracesCallable().call(request);
243-
* for (Trace element : response.getTracesList()) {
244-
* // doThingsWith(element);
245-
* }
246-
* String nextPageToken = response.getNextPageToken();
247-
* if (!Strings.isNullOrEmpty(nextPageToken)) {
248-
* request = request.toBuilder().setPageToken(nextPageToken).build();
249-
* } else {
250-
* break;
251-
* }
252-
* }
235+
* future.get();
253236
* }
254237
* </code></pre>
255238
*/
256-
public final ApiCallable<ListTracesRequest, ListTracesResponse> listTracesCallable() {
257-
return listTracesCallable;
239+
public final ApiCallable<PatchTracesRequest, Empty> patchTracesCallable() {
240+
return patchTracesCallable;
258241
}
259242

260243
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -329,84 +312,101 @@ public final ApiCallable<GetTraceRequest, Trace> getTraceCallable() {
329312

330313
// AUTO-GENERATED DOCUMENTATION AND METHOD
331314
/**
332-
* Sends new traces to Cloud Trace or updates existing traces. If the ID of
333-
* a trace that you send matches that of an existing trace, any fields
334-
* in the existing trace and its spans are overwritten by the provided values,
335-
* and any new fields provided are merged with the existing trace data. If the
336-
* ID does not match, a new trace is created.
315+
* Returns of a list of traces that match the specified filter conditions.
337316
*
338317
* Sample code:
339318
* <pre><code>
340319
* try (TraceServiceApi traceServiceApi = TraceServiceApi.create()) {
341320
* String projectId = "";
342-
* Traces traces = Traces.newBuilder().build();
343-
* traceServiceApi.patchTraces(projectId, traces);
321+
* for (Trace element : traceServiceApi.listTraces(projectId)) {
322+
* // doThingsWith(element);
323+
* }
344324
* }
345325
* </code></pre>
346326
*
347327
* @param projectId ID of the Cloud project where the trace data is stored.
348-
* @param traces The body of the message.
349328
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
350329
*/
351-
public final void patchTraces(String projectId, Traces traces) {
352-
PatchTracesRequest request =
353-
PatchTracesRequest.newBuilder().setProjectId(projectId).setTraces(traces).build();
354-
patchTraces(request);
330+
public final PageAccessor<Trace> listTraces(String projectId) {
331+
ListTracesRequest request = ListTracesRequest.newBuilder().setProjectId(projectId).build();
332+
return listTraces(request);
355333
}
356334

357335
// AUTO-GENERATED DOCUMENTATION AND METHOD
358336
/**
359-
* Sends new traces to Cloud Trace or updates existing traces. If the ID of
360-
* a trace that you send matches that of an existing trace, any fields
361-
* in the existing trace and its spans are overwritten by the provided values,
362-
* and any new fields provided are merged with the existing trace data. If the
363-
* ID does not match, a new trace is created.
337+
* Returns of a list of traces that match the specified filter conditions.
364338
*
365339
* Sample code:
366340
* <pre><code>
367341
* try (TraceServiceApi traceServiceApi = TraceServiceApi.create()) {
368342
* String projectId = "";
369-
* Traces traces = Traces.newBuilder().build();
370-
* PatchTracesRequest request = PatchTracesRequest.newBuilder()
343+
* ListTracesRequest request = ListTracesRequest.newBuilder()
371344
* .setProjectId(projectId)
372-
* .setTraces(traces)
373345
* .build();
374-
* traceServiceApi.patchTraces(request);
346+
* for (Trace element : traceServiceApi.listTraces(request)) {
347+
* // doThingsWith(element);
348+
* }
375349
* }
376350
* </code></pre>
377351
*
378352
* @param request The request object containing all of the parameters for the API call.
379353
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
380354
*/
381-
public final void patchTraces(PatchTracesRequest request) {
382-
patchTracesCallable().call(request);
355+
public final PageAccessor<Trace> listTraces(ListTracesRequest request) {
356+
return listTracesPagedCallable().call(request);
383357
}
384358

385359
// AUTO-GENERATED DOCUMENTATION AND METHOD
386360
/**
387-
* Sends new traces to Cloud Trace or updates existing traces. If the ID of
388-
* a trace that you send matches that of an existing trace, any fields
389-
* in the existing trace and its spans are overwritten by the provided values,
390-
* and any new fields provided are merged with the existing trace data. If the
391-
* ID does not match, a new trace is created.
361+
* Returns of a list of traces that match the specified filter conditions.
392362
*
393363
* Sample code:
394364
* <pre><code>
395365
* try (TraceServiceApi traceServiceApi = TraceServiceApi.create()) {
396366
* String projectId = "";
397-
* Traces traces = Traces.newBuilder().build();
398-
* PatchTracesRequest request = PatchTracesRequest.newBuilder()
367+
* ListTracesRequest request = ListTracesRequest.newBuilder()
399368
* .setProjectId(projectId)
400-
* .setTraces(traces)
401369
* .build();
402-
* ListenableFuture&lt;Void&gt; future = traceServiceApi.patchTracesCallable().futureCall(request);
370+
* ListenableFuture&lt;PageAccessor&lt;Trace&gt;&gt; future = traceServiceApi.listTracesPagedCallable().futureCall(request);
403371
* // Do something
404-
* future.get();
372+
* for (Trace element : future.get()) {
373+
* // doThingsWith(element);
374+
* }
405375
* }
406376
* </code></pre>
407377
*/
408-
public final ApiCallable<PatchTracesRequest, Empty> patchTracesCallable() {
409-
return patchTracesCallable;
378+
public final ApiCallable<ListTracesRequest, PageAccessor<Trace>> listTracesPagedCallable() {
379+
return listTracesPagedCallable;
380+
}
381+
382+
// AUTO-GENERATED DOCUMENTATION AND METHOD
383+
/**
384+
* Returns of a list of traces that match the specified filter conditions.
385+
*
386+
* Sample code:
387+
* <pre><code>
388+
* try (TraceServiceApi traceServiceApi = TraceServiceApi.create()) {
389+
* String projectId = "";
390+
* ListTracesRequest request = ListTracesRequest.newBuilder()
391+
* .setProjectId(projectId)
392+
* .build();
393+
* while (true) {
394+
* ListTracesResponse response = traceServiceApi.listTracesCallable().call(request);
395+
* for (Trace element : response.getTracesList()) {
396+
* // doThingsWith(element);
397+
* }
398+
* String nextPageToken = response.getNextPageToken();
399+
* if (!Strings.isNullOrEmpty(nextPageToken)) {
400+
* request = request.toBuilder().setPageToken(nextPageToken).build();
401+
* } else {
402+
* break;
403+
* }
404+
* }
405+
* }
406+
* </code></pre>
407+
*/
408+
public final ApiCallable<ListTracesRequest, ListTracesResponse> listTracesCallable() {
409+
return listTracesCallable;
410410
}
411411

412412
/**

0 commit comments

Comments
 (0)