Skip to content

Commit 902156d

Browse files
feat: v1 client generation (#64)
1 parent 0ac340c commit 902156d

File tree

54 files changed

+20644
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+20644
-10
lines changed

google-cloud-bigquerystorage-bom/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
<artifactId>proto-google-cloud-bigquerystorage-v1beta2</artifactId>
7676
<version>0.87.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1beta2:current} -->
7777
</dependency>
78+
<dependency>
79+
<groupId>com.google.api.grpc</groupId>
80+
<artifactId>proto-google-cloud-bigquerystorage-v1</artifactId>
81+
<version>0.87.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-bigquerystorage-v1:current} -->
82+
</dependency>
83+
7884
<dependency>
7985
<groupId>com.google.api.grpc</groupId>
8086
<artifactId>grpc-google-cloud-bigquerystorage-v1alpha2</artifactId>
@@ -90,6 +96,11 @@
9096
<artifactId>grpc-google-cloud-bigquerystorage-v1beta2</artifactId>
9197
<version>0.87.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1beta2:current} -->
9298
</dependency>
99+
<dependency>
100+
<groupId>com.google.api.grpc</groupId>
101+
<artifactId>grpc-google-cloud-bigquerystorage-v1</artifactId>
102+
<version>0.87.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-bigquerystorage-v1:current} -->
103+
</dependency>
93104
<dependency>
94105
<groupId>com.google.cloud</groupId>
95106
<artifactId>google-cloud-bigquerystorage</artifactId>

google-cloud-bigquerystorage/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
<groupId>com.google.api.grpc</groupId>
5555
<artifactId>proto-google-cloud-bigquerystorage-v1beta2</artifactId>
5656
</dependency>
57+
<dependency>
58+
<groupId>com.google.api.grpc</groupId>
59+
<artifactId>proto-google-cloud-bigquerystorage-v1</artifactId>
60+
</dependency>
5761
<dependency>
5862
<groupId>com.google.guava</groupId>
5963
<artifactId>guava</artifactId>
@@ -137,6 +141,11 @@
137141
<artifactId>grpc-google-cloud-bigquerystorage-v1beta2</artifactId>
138142
<scope>test</scope>
139143
</dependency>
144+
<dependency>
145+
<groupId>com.google.api.grpc</groupId>
146+
<artifactId>grpc-google-cloud-bigquerystorage-v1</artifactId>
147+
<scope>test</scope>
148+
</dependency>
140149
<!-- Need testing utility classes for generated gRPC clients tests -->
141150
<dependency>
142151
<groupId>com.google.api</groupId>

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadClient.java

Lines changed: 387 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
/*
2+
* Copyright 2020 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.storage.v1;
17+
18+
import com.google.api.core.ApiFunction;
19+
import com.google.api.core.BetaApi;
20+
import com.google.api.gax.core.GoogleCredentialsProvider;
21+
import com.google.api.gax.core.InstantiatingExecutorProvider;
22+
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
23+
import com.google.api.gax.rpc.ApiClientHeaderProvider;
24+
import com.google.api.gax.rpc.ClientContext;
25+
import com.google.api.gax.rpc.ClientSettings;
26+
import com.google.api.gax.rpc.ServerStreamingCallSettings;
27+
import com.google.api.gax.rpc.TransportChannelProvider;
28+
import com.google.api.gax.rpc.UnaryCallSettings;
29+
import com.google.cloud.bigquery.storage.v1.stub.BigQueryReadStubSettings;
30+
import java.io.IOException;
31+
import java.util.List;
32+
import javax.annotation.Generated;
33+
34+
// AUTO-GENERATED DOCUMENTATION AND CLASS
35+
/**
36+
* Settings class to configure an instance of {@link BaseBigQueryReadClient}.
37+
*
38+
* <p>The default instance has everything set to sensible defaults:
39+
*
40+
* <ul>
41+
* <li>The default service address (bigquerystorage.googleapis.com) and default port (443) are
42+
* used.
43+
* <li>Credentials are acquired automatically through Application Default Credentials.
44+
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
45+
* </ul>
46+
*
47+
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
48+
* build() is called, the tree of builders is called to create the complete settings object.
49+
*
50+
* <p>For example, to set the total timeout of createReadSession to 30 seconds:
51+
*
52+
* <pre>
53+
* <code>
54+
* BaseBigQueryReadSettings.Builder baseBigQueryReadSettingsBuilder =
55+
* BaseBigQueryReadSettings.newBuilder();
56+
* baseBigQueryReadSettingsBuilder.createReadSessionSettings().getRetrySettings().toBuilder()
57+
* .setTotalTimeout(Duration.ofSeconds(30));
58+
* BaseBigQueryReadSettings baseBigQueryReadSettings = baseBigQueryReadSettingsBuilder.build();
59+
* </code>
60+
* </pre>
61+
*/
62+
@Generated("by gapic-generator")
63+
@BetaApi
64+
public class BaseBigQueryReadSettings extends ClientSettings<BaseBigQueryReadSettings> {
65+
/** Returns the object with the settings used for calls to createReadSession. */
66+
public UnaryCallSettings<CreateReadSessionRequest, ReadSession> createReadSessionSettings() {
67+
return ((BigQueryReadStubSettings) getStubSettings()).createReadSessionSettings();
68+
}
69+
70+
/** Returns the object with the settings used for calls to readRows. */
71+
public ServerStreamingCallSettings<ReadRowsRequest, ReadRowsResponse> readRowsSettings() {
72+
return ((BigQueryReadStubSettings) getStubSettings()).readRowsSettings();
73+
}
74+
75+
/** Returns the object with the settings used for calls to splitReadStream. */
76+
public UnaryCallSettings<SplitReadStreamRequest, SplitReadStreamResponse>
77+
splitReadStreamSettings() {
78+
return ((BigQueryReadStubSettings) getStubSettings()).splitReadStreamSettings();
79+
}
80+
81+
public static final BaseBigQueryReadSettings create(BigQueryReadStubSettings stub)
82+
throws IOException {
83+
return new BaseBigQueryReadSettings.Builder(stub.toBuilder()).build();
84+
}
85+
86+
/** Returns a builder for the default ExecutorProvider for this service. */
87+
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
88+
return BigQueryReadStubSettings.defaultExecutorProviderBuilder();
89+
}
90+
91+
/** Returns the default service endpoint. */
92+
public static String getDefaultEndpoint() {
93+
return BigQueryReadStubSettings.getDefaultEndpoint();
94+
}
95+
96+
/** Returns the default service scopes. */
97+
public static List<String> getDefaultServiceScopes() {
98+
return BigQueryReadStubSettings.getDefaultServiceScopes();
99+
}
100+
101+
/** Returns a builder for the default credentials for this service. */
102+
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
103+
return BigQueryReadStubSettings.defaultCredentialsProviderBuilder();
104+
}
105+
106+
/** Returns a builder for the default ChannelProvider for this service. */
107+
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
108+
return BigQueryReadStubSettings.defaultGrpcTransportProviderBuilder();
109+
}
110+
111+
public static TransportChannelProvider defaultTransportChannelProvider() {
112+
return BigQueryReadStubSettings.defaultTransportChannelProvider();
113+
}
114+
115+
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
116+
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
117+
return BigQueryReadStubSettings.defaultApiClientHeaderProviderBuilder();
118+
}
119+
120+
/** Returns a new builder for this class. */
121+
public static Builder newBuilder() {
122+
return Builder.createDefault();
123+
}
124+
125+
/** Returns a new builder for this class. */
126+
public static Builder newBuilder(ClientContext clientContext) {
127+
return new Builder(clientContext);
128+
}
129+
130+
/** Returns a builder containing all the values of this settings class. */
131+
public Builder toBuilder() {
132+
return new Builder(this);
133+
}
134+
135+
protected BaseBigQueryReadSettings(Builder settingsBuilder) throws IOException {
136+
super(settingsBuilder);
137+
}
138+
139+
/** Builder for BaseBigQueryReadSettings. */
140+
public static class Builder extends ClientSettings.Builder<BaseBigQueryReadSettings, Builder> {
141+
protected Builder() throws IOException {
142+
this((ClientContext) null);
143+
}
144+
145+
protected Builder(ClientContext clientContext) {
146+
super(BigQueryReadStubSettings.newBuilder(clientContext));
147+
}
148+
149+
private static Builder createDefault() {
150+
return new Builder(BigQueryReadStubSettings.newBuilder());
151+
}
152+
153+
protected Builder(BaseBigQueryReadSettings settings) {
154+
super(settings.getStubSettings().toBuilder());
155+
}
156+
157+
protected Builder(BigQueryReadStubSettings.Builder stubSettings) {
158+
super(stubSettings);
159+
}
160+
161+
public BigQueryReadStubSettings.Builder getStubSettingsBuilder() {
162+
return ((BigQueryReadStubSettings.Builder) getStubSettings());
163+
}
164+
165+
// NEXT_MAJOR_VER: remove 'throws Exception'
166+
/**
167+
* Applies the given settings updater function to all of the unary API methods in this service.
168+
*
169+
* <p>Note: This method does not support applying settings to streaming methods.
170+
*/
171+
public Builder applyToAllUnaryMethods(
172+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
173+
super.applyToAllUnaryMethods(
174+
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
175+
return this;
176+
}
177+
178+
/** Returns the builder for the settings used for calls to createReadSession. */
179+
public UnaryCallSettings.Builder<CreateReadSessionRequest, ReadSession>
180+
createReadSessionSettings() {
181+
return getStubSettingsBuilder().createReadSessionSettings();
182+
}
183+
184+
/** Returns the builder for the settings used for calls to readRows. */
185+
public ServerStreamingCallSettings.Builder<ReadRowsRequest, ReadRowsResponse>
186+
readRowsSettings() {
187+
return getStubSettingsBuilder().readRowsSettings();
188+
}
189+
190+
/** Returns the builder for the settings used for calls to splitReadStream. */
191+
public UnaryCallSettings.Builder<SplitReadStreamRequest, SplitReadStreamResponse>
192+
splitReadStreamSettings() {
193+
return getStubSettingsBuilder().splitReadStreamSettings();
194+
}
195+
196+
@Override
197+
public BaseBigQueryReadSettings build() throws IOException {
198+
return new BaseBigQueryReadSettings(this);
199+
}
200+
}
201+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2020 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+
17+
/**
18+
* A client to BigQuery Storage API.
19+
*
20+
* <p>The interfaces provided are listed below, along with usage samples.
21+
*
22+
* <p>====================== BaseBigQueryReadClient ======================
23+
*
24+
* <p>Service Description: BigQuery Read API.
25+
*
26+
* <p>The Read API can be used to read data from BigQuery.
27+
*
28+
* <p>Sample for BaseBigQueryReadClient:
29+
*
30+
* <pre>
31+
* <code>
32+
* try (BaseBigQueryReadClient baseBigQueryReadClient = BaseBigQueryReadClient.create()) {
33+
* String parent = "";
34+
* ReadSession readSession = ReadSession.newBuilder().build();
35+
* int maxStreamCount = 0;
36+
* ReadSession response = baseBigQueryReadClient.createReadSession(parent, readSession, maxStreamCount);
37+
* }
38+
* </code>
39+
* </pre>
40+
*/
41+
@Generated("by gapic-generator")
42+
package com.google.cloud.bigquery.storage.v1;
43+
44+
import javax.annotation.Generated;
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2020 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.storage.v1.stub;
17+
18+
import com.google.api.core.BetaApi;
19+
import com.google.api.gax.core.BackgroundResource;
20+
import com.google.api.gax.rpc.ServerStreamingCallable;
21+
import com.google.api.gax.rpc.UnaryCallable;
22+
import com.google.cloud.bigquery.storage.v1.CreateReadSessionRequest;
23+
import com.google.cloud.bigquery.storage.v1.ReadRowsRequest;
24+
import com.google.cloud.bigquery.storage.v1.ReadRowsResponse;
25+
import com.google.cloud.bigquery.storage.v1.ReadSession;
26+
import com.google.cloud.bigquery.storage.v1.SplitReadStreamRequest;
27+
import com.google.cloud.bigquery.storage.v1.SplitReadStreamResponse;
28+
import javax.annotation.Generated;
29+
30+
// AUTO-GENERATED DOCUMENTATION AND CLASS
31+
/**
32+
* Base stub class for BigQuery Storage API.
33+
*
34+
* <p>This class is for advanced usage and reflects the underlying API directly.
35+
*/
36+
@Generated("by gapic-generator")
37+
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
38+
public abstract class BigQueryReadStub implements BackgroundResource {
39+
40+
public UnaryCallable<CreateReadSessionRequest, ReadSession> createReadSessionCallable() {
41+
throw new UnsupportedOperationException("Not implemented: createReadSessionCallable()");
42+
}
43+
44+
public ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> readRowsCallable() {
45+
throw new UnsupportedOperationException("Not implemented: readRowsCallable()");
46+
}
47+
48+
public UnaryCallable<SplitReadStreamRequest, SplitReadStreamResponse> splitReadStreamCallable() {
49+
throw new UnsupportedOperationException("Not implemented: splitReadStreamCallable()");
50+
}
51+
52+
@Override
53+
public abstract void close();
54+
}

0 commit comments

Comments
 (0)