Skip to content

Commit 3552df4

Browse files
Refresh Google Cloud Java with latest toolkit (#3069)
* Refresh Google Cloud Java with latest toolkit * Add missing packages
1 parent bdcdf59 commit 3552df4

129 files changed

Lines changed: 8365 additions & 550 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.cloud.bigquery.datatransfer.v1.stub;
17+
18+
import com.google.api.core.BetaApi;
19+
import com.google.api.gax.grpc.GrpcCallSettings;
20+
import com.google.api.gax.grpc.GrpcCallableFactory;
21+
import com.google.api.gax.grpc.GrpcStubCallableFactory;
22+
import com.google.api.gax.rpc.BatchingCallSettings;
23+
import com.google.api.gax.rpc.BidiStreamingCallable;
24+
import com.google.api.gax.rpc.ClientContext;
25+
import com.google.api.gax.rpc.ClientStreamingCallable;
26+
import com.google.api.gax.rpc.OperationCallSettings;
27+
import com.google.api.gax.rpc.OperationCallable;
28+
import com.google.api.gax.rpc.PagedCallSettings;
29+
import com.google.api.gax.rpc.ServerStreamingCallSettings;
30+
import com.google.api.gax.rpc.ServerStreamingCallable;
31+
import com.google.api.gax.rpc.StreamingCallSettings;
32+
import com.google.api.gax.rpc.UnaryCallSettings;
33+
import com.google.api.gax.rpc.UnaryCallable;
34+
import com.google.longrunning.Operation;
35+
import com.google.longrunning.stub.OperationsStub;
36+
import javax.annotation.Generated;
37+
38+
// AUTO-GENERATED DOCUMENTATION AND CLASS
39+
/**
40+
* gRPC callable factory implementation for BigQuery Data Transfer API.
41+
*
42+
* <p>This class is for advanced usage.
43+
*/
44+
@Generated("by GAPIC v0.0.5")
45+
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
46+
public class GrpcDataTransferServiceCallableFactory implements GrpcStubCallableFactory {
47+
@Override
48+
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable(
49+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
50+
UnaryCallSettings<RequestT, ResponseT> callSettings,
51+
ClientContext clientContext) {
52+
return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext);
53+
}
54+
55+
@Override
56+
public <RequestT, ResponseT, PagedListResponseT>
57+
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
58+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
59+
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> pagedCallSettings,
60+
ClientContext clientContext) {
61+
return GrpcCallableFactory.createPagedCallable(
62+
grpcCallSettings, pagedCallSettings, clientContext);
63+
}
64+
65+
@Override
66+
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable(
67+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
68+
BatchingCallSettings<RequestT, ResponseT> batchingCallSettings,
69+
ClientContext clientContext) {
70+
return GrpcCallableFactory.createBatchingCallable(
71+
grpcCallSettings, batchingCallSettings, clientContext);
72+
}
73+
74+
@Override
75+
public <RequestT, ResponseT, MetadataT>
76+
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
77+
GrpcCallSettings<RequestT, com.google.longrunning.Operation> grpcCallSettings,
78+
OperationCallSettings<RequestT, ResponseT, MetadataT> operationCallSettings,
79+
ClientContext clientContext,
80+
OperationsStub operationsStub) {
81+
return GrpcCallableFactory.createOperationCallable(
82+
grpcCallSettings, operationCallSettings, clientContext, operationsStub);
83+
}
84+
85+
@Override
86+
public <RequestT, ResponseT>
87+
BidiStreamingCallable<RequestT, ResponseT> createBidiStreamingCallable(
88+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
89+
StreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
90+
ClientContext clientContext) {
91+
return GrpcCallableFactory.createBidiStreamingCallable(
92+
grpcCallSettings, streamingCallSettings, clientContext);
93+
}
94+
95+
@Override
96+
public <RequestT, ResponseT>
97+
ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable(
98+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
99+
ServerStreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
100+
ClientContext clientContext) {
101+
return GrpcCallableFactory.createServerStreamingCallable(
102+
grpcCallSettings, streamingCallSettings, clientContext);
103+
}
104+
105+
@Override
106+
public <RequestT, ResponseT>
107+
ClientStreamingCallable<RequestT, ResponseT> createClientStreamingCallable(
108+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
109+
StreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
110+
ClientContext clientContext) {
111+
return GrpcCallableFactory.createClientStreamingCallable(
112+
grpcCallSettings, streamingCallSettings, clientContext);
113+
}
114+
}

google-cloud-bigquerydatatransfer/src/main/java/com/google/cloud/bigquery/datatransfer/v1/stub/GrpcDataTransferServiceStub.java

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import com.google.api.gax.core.BackgroundResource;
2525
import com.google.api.gax.core.BackgroundResourceAggregation;
2626
import com.google.api.gax.grpc.GrpcCallSettings;
27-
import com.google.api.gax.grpc.GrpcCallableFactory;
27+
import com.google.api.gax.grpc.GrpcStubCallableFactory;
2828
import com.google.api.gax.rpc.ClientContext;
2929
import com.google.api.gax.rpc.UnaryCallable;
3030
import com.google.cloud.bigquery.datatransfer.v1.CheckValidCredsRequest;
@@ -235,6 +235,8 @@ public class GrpcDataTransferServiceStub extends DataTransferServiceStub {
235235
private final UnaryCallable<CheckValidCredsRequest, CheckValidCredsResponse>
236236
checkValidCredsCallable;
237237

238+
private final GrpcStubCallableFactory callableFactory;
239+
238240
public static final GrpcDataTransferServiceStub create(DataTransferServiceStubSettings settings)
239241
throws IOException {
240242
return new GrpcDataTransferServiceStub(settings, ClientContext.create(settings));
@@ -246,13 +248,33 @@ public static final GrpcDataTransferServiceStub create(ClientContext clientConte
246248
DataTransferServiceStubSettings.newBuilder().build(), clientContext);
247249
}
248250

251+
public static final GrpcDataTransferServiceStub create(
252+
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
253+
return new GrpcDataTransferServiceStub(
254+
DataTransferServiceStubSettings.newBuilder().build(), clientContext, callableFactory);
255+
}
256+
249257
/**
250258
* Constructs an instance of GrpcDataTransferServiceStub, using the given settings. This is
251259
* protected so that it is easy to make a subclass, but otherwise, the static factory methods
252260
* should be preferred.
253261
*/
254262
protected GrpcDataTransferServiceStub(
255263
DataTransferServiceStubSettings settings, ClientContext clientContext) throws IOException {
264+
this(settings, clientContext, new GrpcDataTransferServiceCallableFactory());
265+
}
266+
267+
/**
268+
* Constructs an instance of GrpcDataTransferServiceStub, using the given settings. This is
269+
* protected so that it is easy to make a subclass, but otherwise, the static factory methods
270+
* should be preferred.
271+
*/
272+
protected GrpcDataTransferServiceStub(
273+
DataTransferServiceStubSettings settings,
274+
ClientContext clientContext,
275+
GrpcStubCallableFactory callableFactory)
276+
throws IOException {
277+
this.callableFactory = callableFactory;
256278

257279
GrpcCallSettings<GetDataSourceRequest, DataSource> getDataSourceTransportSettings =
258280
GrpcCallSettings.<GetDataSourceRequest, DataSource>newBuilder()
@@ -316,71 +338,71 @@ protected GrpcDataTransferServiceStub(
316338
.build();
317339

318340
this.getDataSourceCallable =
319-
GrpcCallableFactory.createUnaryCallable(
341+
callableFactory.createUnaryCallable(
320342
getDataSourceTransportSettings, settings.getDataSourceSettings(), clientContext);
321343
this.listDataSourcesCallable =
322-
GrpcCallableFactory.createUnaryCallable(
344+
callableFactory.createUnaryCallable(
323345
listDataSourcesTransportSettings, settings.listDataSourcesSettings(), clientContext);
324346
this.listDataSourcesPagedCallable =
325-
GrpcCallableFactory.createPagedCallable(
347+
callableFactory.createPagedCallable(
326348
listDataSourcesTransportSettings, settings.listDataSourcesSettings(), clientContext);
327349
this.createTransferConfigCallable =
328-
GrpcCallableFactory.createUnaryCallable(
350+
callableFactory.createUnaryCallable(
329351
createTransferConfigTransportSettings,
330352
settings.createTransferConfigSettings(),
331353
clientContext);
332354
this.updateTransferConfigCallable =
333-
GrpcCallableFactory.createUnaryCallable(
355+
callableFactory.createUnaryCallable(
334356
updateTransferConfigTransportSettings,
335357
settings.updateTransferConfigSettings(),
336358
clientContext);
337359
this.deleteTransferConfigCallable =
338-
GrpcCallableFactory.createUnaryCallable(
360+
callableFactory.createUnaryCallable(
339361
deleteTransferConfigTransportSettings,
340362
settings.deleteTransferConfigSettings(),
341363
clientContext);
342364
this.getTransferConfigCallable =
343-
GrpcCallableFactory.createUnaryCallable(
365+
callableFactory.createUnaryCallable(
344366
getTransferConfigTransportSettings,
345367
settings.getTransferConfigSettings(),
346368
clientContext);
347369
this.listTransferConfigsCallable =
348-
GrpcCallableFactory.createUnaryCallable(
370+
callableFactory.createUnaryCallable(
349371
listTransferConfigsTransportSettings,
350372
settings.listTransferConfigsSettings(),
351373
clientContext);
352374
this.listTransferConfigsPagedCallable =
353-
GrpcCallableFactory.createPagedCallable(
375+
callableFactory.createPagedCallable(
354376
listTransferConfigsTransportSettings,
355377
settings.listTransferConfigsSettings(),
356378
clientContext);
357379
this.scheduleTransferRunsCallable =
358-
GrpcCallableFactory.createUnaryCallable(
380+
callableFactory.createUnaryCallable(
359381
scheduleTransferRunsTransportSettings,
360382
settings.scheduleTransferRunsSettings(),
361383
clientContext);
362384
this.getTransferRunCallable =
363-
GrpcCallableFactory.createUnaryCallable(
385+
callableFactory.createUnaryCallable(
364386
getTransferRunTransportSettings, settings.getTransferRunSettings(), clientContext);
365387
this.deleteTransferRunCallable =
366-
GrpcCallableFactory.createUnaryCallable(
388+
callableFactory.createUnaryCallable(
367389
deleteTransferRunTransportSettings,
368390
settings.deleteTransferRunSettings(),
369391
clientContext);
370392
this.listTransferRunsCallable =
371-
GrpcCallableFactory.createUnaryCallable(
393+
callableFactory.createUnaryCallable(
372394
listTransferRunsTransportSettings, settings.listTransferRunsSettings(), clientContext);
373395
this.listTransferRunsPagedCallable =
374-
GrpcCallableFactory.createPagedCallable(
396+
callableFactory.createPagedCallable(
375397
listTransferRunsTransportSettings, settings.listTransferRunsSettings(), clientContext);
376398
this.listTransferLogsCallable =
377-
GrpcCallableFactory.createUnaryCallable(
399+
callableFactory.createUnaryCallable(
378400
listTransferLogsTransportSettings, settings.listTransferLogsSettings(), clientContext);
379401
this.listTransferLogsPagedCallable =
380-
GrpcCallableFactory.createPagedCallable(
402+
callableFactory.createPagedCallable(
381403
listTransferLogsTransportSettings, settings.listTransferLogsSettings(), clientContext);
382404
this.checkValidCredsCallable =
383-
GrpcCallableFactory.createUnaryCallable(
405+
callableFactory.createUnaryCallable(
384406
checkValidCredsTransportSettings, settings.checkValidCredsSettings(), clientContext);
385407

386408
backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.cloud.bigquery.datatransfer.v1;
17+
18+
import static com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListDataSourcesPagedResponse;
19+
20+
import com.google.common.base.Preconditions;
21+
import java.util.logging.Level;
22+
import java.util.logging.Logger;
23+
24+
@javax.annotation.Generated("by GAPIC")
25+
public class DataTransferServiceSmokeTest {
26+
private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT";
27+
private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT";
28+
29+
public static void main(String args[]) {
30+
Logger.getLogger("").setLevel(Level.WARNING);
31+
try {
32+
executeNoCatch(getProjectId());
33+
System.out.println("OK");
34+
} catch (Exception e) {
35+
System.err.println("Failed with exception:");
36+
e.printStackTrace(System.err);
37+
System.exit(1);
38+
}
39+
}
40+
41+
public static void executeNoCatch(String projectId) throws Exception {
42+
try (DataTransferServiceClient client = DataTransferServiceClient.create()) {
43+
ParentName parent = ProjectName.of(projectId);
44+
45+
ListDataSourcesPagedResponse pagedResponse = client.listDataSources(parent);
46+
}
47+
}
48+
49+
private static String getProjectId() {
50+
String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME));
51+
if (projectId == null) {
52+
projectId =
53+
System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME));
54+
}
55+
Preconditions.checkArgument(projectId != null, "A project ID is required.");
56+
return projectId;
57+
}
58+
}

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
* <code>
8787
* BigtableInstanceAdminSettings.Builder bigtableInstanceAdminSettingsBuilder =
8888
* BigtableInstanceAdminSettings.newBuilder();
89-
* bigtableInstanceAdminSettingsBuilder.getInstanceSettings().getRetrySettingsBuilder()
89+
* bigtableInstanceAdminSettingsBuilder.getInstanceSettings().getRetrySettings().toBuilder()
9090
* .setTotalTimeout(Duration.ofSeconds(30));
9191
* BigtableInstanceAdminSettings bigtableInstanceAdminSettings = bigtableInstanceAdminSettingsBuilder.build();
9292
* </code>

0 commit comments

Comments
 (0)