Skip to content
This repository was archived by the owner on Sep 25, 2023. It is now read-only.

Commit 5870423

Browse files
feat: Enable REST transport for most of Java and Go clients (#22)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 456641589 Source-Link: googleapis/googleapis@8a251f5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9
1 parent 44df043 commit 5870423

File tree

149 files changed

+11773
-25
lines changed

Some content is hidden

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

149 files changed

+11773
-25
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ If you are using Maven, add this to your pom.xml file:
2222
<dependency>
2323
<groupId>com.google.cloud</groupId>
2424
<artifactId>google-cloud-gke-multi-cloud</artifactId>
25-
<version>0.1.0</version>
25+
<version>0.1.1</version>
2626
</dependency>
2727
```
2828

2929
If you are using Gradle without BOM, add this to your dependencies
3030

3131
```Groovy
32-
implementation 'com.google.cloud:google-cloud-gke-multi-cloud:0.1.0'
32+
implementation 'com.google.cloud:google-cloud-gke-multi-cloud:0.1.1'
3333
```
3434

3535
If you are using SBT, add this to your dependencies
3636

3737
```Scala
38-
libraryDependencies += "com.google.cloud" % "google-cloud-gke-multi-cloud" % "0.1.0"
38+
libraryDependencies += "com.google.cloud" % "google-cloud-gke-multi-cloud" % "0.1.1"
3939
```
4040

4141
## Authentication

google-cloud-gke-multi-cloud/pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
<groupId>com.google.api</groupId>
5959
<artifactId>gax-grpc</artifactId>
6060
</dependency>
61+
<dependency>
62+
<groupId>com.google.api</groupId>
63+
<artifactId>gax-httpjson</artifactId>
64+
</dependency>
6165
<dependency>
6266
<groupId>org.threeten</groupId>
6367
<artifactId>threetenbp</artifactId>
@@ -77,12 +81,24 @@
7781
<scope>test</scope>
7882
</dependency>
7983
<!-- Need testing utility classes for generated gRPC clients tests -->
84+
<dependency>
85+
<groupId>com.google.api</groupId>
86+
<artifactId>gax</artifactId>
87+
<classifier>testlib</classifier>
88+
<scope>test</scope>
89+
</dependency>
8090
<dependency>
8191
<groupId>com.google.api</groupId>
8292
<artifactId>gax-grpc</artifactId>
8393
<classifier>testlib</classifier>
8494
<scope>test</scope>
8595
</dependency>
96+
<dependency>
97+
<groupId>com.google.api</groupId>
98+
<artifactId>gax-httpjson</artifactId>
99+
<classifier>testlib</classifier>
100+
<scope>test</scope>
101+
</dependency>
86102
</dependencies>
87103

88104
<profiles>

google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersClient.java

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.api.core.ApiFuture;
2020
import com.google.api.core.ApiFutures;
2121
import com.google.api.gax.core.BackgroundResource;
22+
import com.google.api.gax.httpjson.longrunning.OperationsClient;
2223
import com.google.api.gax.longrunning.OperationFuture;
2324
import com.google.api.gax.paging.AbstractFixedSizeCollection;
2425
import com.google.api.gax.paging.AbstractPage;
@@ -30,7 +31,6 @@
3031
import com.google.cloud.gkemulticloud.v1.stub.AwsClustersStubSettings;
3132
import com.google.common.util.concurrent.MoreExecutors;
3233
import com.google.longrunning.Operation;
33-
import com.google.longrunning.OperationsClient;
3434
import com.google.protobuf.Empty;
3535
import com.google.protobuf.FieldMask;
3636
import java.io.IOException;
@@ -103,13 +103,28 @@
103103
* AwsClustersClient awsClustersClient = AwsClustersClient.create(awsClustersSettings);
104104
* }</pre>
105105
*
106+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
107+
* the wire:
108+
*
109+
* <pre>{@code
110+
* // This snippet has been automatically generated for illustrative purposes only.
111+
* // It may require modifications to work in your environment.
112+
* AwsClustersSettings awsClustersSettings =
113+
* AwsClustersSettings.newBuilder()
114+
* .setTransportChannelProvider(
115+
* AwsClustersSettings.defaultHttpJsonTransportProviderBuilder().build())
116+
* .build();
117+
* AwsClustersClient awsClustersClient = AwsClustersClient.create(awsClustersSettings);
118+
* }</pre>
119+
*
106120
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
107121
*/
108122
@Generated("by gapic-generator-java")
109123
public class AwsClustersClient implements BackgroundResource {
110124
private final AwsClustersSettings settings;
111125
private final AwsClustersStub stub;
112-
private final OperationsClient operationsClient;
126+
private final OperationsClient httpJsonOperationsClient;
127+
private final com.google.longrunning.OperationsClient operationsClient;
113128

114129
/** Constructs an instance of AwsClustersClient with default settings. */
115130
public static final AwsClustersClient create() throws IOException {
@@ -140,13 +155,17 @@ public static final AwsClustersClient create(AwsClustersStub stub) {
140155
protected AwsClustersClient(AwsClustersSettings settings) throws IOException {
141156
this.settings = settings;
142157
this.stub = ((AwsClustersStubSettings) settings.getStubSettings()).createStub();
143-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
158+
this.operationsClient =
159+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
160+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
144161
}
145162

146163
protected AwsClustersClient(AwsClustersStub stub) {
147164
this.settings = null;
148165
this.stub = stub;
149-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
166+
this.operationsClient =
167+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
168+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
150169
}
151170

152171
public final AwsClustersSettings getSettings() {
@@ -161,10 +180,18 @@ public AwsClustersStub getStub() {
161180
* Returns the OperationsClient that can be used to query the status of a long-running operation
162181
* returned by another API method call.
163182
*/
164-
public final OperationsClient getOperationsClient() {
183+
public final com.google.longrunning.OperationsClient getOperationsClient() {
165184
return operationsClient;
166185
}
167186

187+
/**
188+
* Returns the OperationsClient that can be used to query the status of a long-running operation
189+
* returned by another API method call.
190+
*/
191+
public final OperationsClient getHttpJsonOperationsClient() {
192+
return httpJsonOperationsClient;
193+
}
194+
168195
// AUTO-GENERATED DOCUMENTATION AND METHOD.
169196
/**
170197
* Creates a new [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource on a given GCP

google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersSettings.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.google.api.gax.core.GoogleCredentialsProvider;
2525
import com.google.api.gax.core.InstantiatingExecutorProvider;
2626
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
27+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
2728
import com.google.api.gax.rpc.ApiClientHeaderProvider;
2829
import com.google.api.gax.rpc.ClientContext;
2930
import com.google.api.gax.rpc.ClientSettings;
@@ -200,11 +201,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
200201
return AwsClustersStubSettings.defaultCredentialsProviderBuilder();
201202
}
202203

203-
/** Returns a builder for the default ChannelProvider for this service. */
204+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
204205
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
205206
return AwsClustersStubSettings.defaultGrpcTransportProviderBuilder();
206207
}
207208

209+
/** Returns a builder for the default REST ChannelProvider for this service. */
210+
@BetaApi
211+
public static InstantiatingHttpJsonChannelProvider.Builder
212+
defaultHttpJsonTransportProviderBuilder() {
213+
return AwsClustersStubSettings.defaultHttpJsonTransportProviderBuilder();
214+
}
215+
208216
public static TransportChannelProvider defaultTransportChannelProvider() {
209217
return AwsClustersStubSettings.defaultTransportChannelProvider();
210218
}
@@ -214,11 +222,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
214222
return AwsClustersStubSettings.defaultApiClientHeaderProviderBuilder();
215223
}
216224

217-
/** Returns a new builder for this class. */
225+
/** Returns a new gRPC builder for this class. */
218226
public static Builder newBuilder() {
219227
return Builder.createDefault();
220228
}
221229

230+
/** Returns a new REST builder for this class. */
231+
@BetaApi
232+
public static Builder newHttpJsonBuilder() {
233+
return Builder.createHttpJsonDefault();
234+
}
235+
222236
/** Returns a new builder for this class. */
223237
public static Builder newBuilder(ClientContext clientContext) {
224238
return new Builder(clientContext);
@@ -256,6 +270,11 @@ private static Builder createDefault() {
256270
return new Builder(AwsClustersStubSettings.newBuilder());
257271
}
258272

273+
@BetaApi
274+
private static Builder createHttpJsonDefault() {
275+
return new Builder(AwsClustersStubSettings.newHttpJsonBuilder());
276+
}
277+
259278
public AwsClustersStubSettings.Builder getStubSettingsBuilder() {
260279
return ((AwsClustersStubSettings.Builder) getStubSettings());
261280
}

google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersClient.java

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.api.core.ApiFuture;
2020
import com.google.api.core.ApiFutures;
2121
import com.google.api.gax.core.BackgroundResource;
22+
import com.google.api.gax.httpjson.longrunning.OperationsClient;
2223
import com.google.api.gax.longrunning.OperationFuture;
2324
import com.google.api.gax.paging.AbstractFixedSizeCollection;
2425
import com.google.api.gax.paging.AbstractPage;
@@ -30,7 +31,6 @@
3031
import com.google.cloud.gkemulticloud.v1.stub.AzureClustersStubSettings;
3132
import com.google.common.util.concurrent.MoreExecutors;
3233
import com.google.longrunning.Operation;
33-
import com.google.longrunning.OperationsClient;
3434
import com.google.protobuf.Empty;
3535
import com.google.protobuf.FieldMask;
3636
import java.io.IOException;
@@ -103,13 +103,28 @@
103103
* AzureClustersClient azureClustersClient = AzureClustersClient.create(azureClustersSettings);
104104
* }</pre>
105105
*
106+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
107+
* the wire:
108+
*
109+
* <pre>{@code
110+
* // This snippet has been automatically generated for illustrative purposes only.
111+
* // It may require modifications to work in your environment.
112+
* AzureClustersSettings azureClustersSettings =
113+
* AzureClustersSettings.newBuilder()
114+
* .setTransportChannelProvider(
115+
* AzureClustersSettings.defaultHttpJsonTransportProviderBuilder().build())
116+
* .build();
117+
* AzureClustersClient azureClustersClient = AzureClustersClient.create(azureClustersSettings);
118+
* }</pre>
119+
*
106120
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
107121
*/
108122
@Generated("by gapic-generator-java")
109123
public class AzureClustersClient implements BackgroundResource {
110124
private final AzureClustersSettings settings;
111125
private final AzureClustersStub stub;
112-
private final OperationsClient operationsClient;
126+
private final OperationsClient httpJsonOperationsClient;
127+
private final com.google.longrunning.OperationsClient operationsClient;
113128

114129
/** Constructs an instance of AzureClustersClient with default settings. */
115130
public static final AzureClustersClient create() throws IOException {
@@ -141,13 +156,17 @@ public static final AzureClustersClient create(AzureClustersStub stub) {
141156
protected AzureClustersClient(AzureClustersSettings settings) throws IOException {
142157
this.settings = settings;
143158
this.stub = ((AzureClustersStubSettings) settings.getStubSettings()).createStub();
144-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
159+
this.operationsClient =
160+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
161+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
145162
}
146163

147164
protected AzureClustersClient(AzureClustersStub stub) {
148165
this.settings = null;
149166
this.stub = stub;
150-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
167+
this.operationsClient =
168+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
169+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
151170
}
152171

153172
public final AzureClustersSettings getSettings() {
@@ -162,10 +181,18 @@ public AzureClustersStub getStub() {
162181
* Returns the OperationsClient that can be used to query the status of a long-running operation
163182
* returned by another API method call.
164183
*/
165-
public final OperationsClient getOperationsClient() {
184+
public final com.google.longrunning.OperationsClient getOperationsClient() {
166185
return operationsClient;
167186
}
168187

188+
/**
189+
* Returns the OperationsClient that can be used to query the status of a long-running operation
190+
* returned by another API method call.
191+
*/
192+
public final OperationsClient getHttpJsonOperationsClient() {
193+
return httpJsonOperationsClient;
194+
}
195+
169196
// AUTO-GENERATED DOCUMENTATION AND METHOD.
170197
/**
171198
* Creates a new [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource on a given

google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersSettings.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.google.api.gax.core.GoogleCredentialsProvider;
2626
import com.google.api.gax.core.InstantiatingExecutorProvider;
2727
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
28+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
2829
import com.google.api.gax.rpc.ApiClientHeaderProvider;
2930
import com.google.api.gax.rpc.ClientContext;
3031
import com.google.api.gax.rpc.ClientSettings;
@@ -236,11 +237,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
236237
return AzureClustersStubSettings.defaultCredentialsProviderBuilder();
237238
}
238239

239-
/** Returns a builder for the default ChannelProvider for this service. */
240+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
240241
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
241242
return AzureClustersStubSettings.defaultGrpcTransportProviderBuilder();
242243
}
243244

245+
/** Returns a builder for the default REST ChannelProvider for this service. */
246+
@BetaApi
247+
public static InstantiatingHttpJsonChannelProvider.Builder
248+
defaultHttpJsonTransportProviderBuilder() {
249+
return AzureClustersStubSettings.defaultHttpJsonTransportProviderBuilder();
250+
}
251+
244252
public static TransportChannelProvider defaultTransportChannelProvider() {
245253
return AzureClustersStubSettings.defaultTransportChannelProvider();
246254
}
@@ -250,11 +258,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
250258
return AzureClustersStubSettings.defaultApiClientHeaderProviderBuilder();
251259
}
252260

253-
/** Returns a new builder for this class. */
261+
/** Returns a new gRPC builder for this class. */
254262
public static Builder newBuilder() {
255263
return Builder.createDefault();
256264
}
257265

266+
/** Returns a new REST builder for this class. */
267+
@BetaApi
268+
public static Builder newHttpJsonBuilder() {
269+
return Builder.createHttpJsonDefault();
270+
}
271+
258272
/** Returns a new builder for this class. */
259273
public static Builder newBuilder(ClientContext clientContext) {
260274
return new Builder(clientContext);
@@ -292,6 +306,11 @@ private static Builder createDefault() {
292306
return new Builder(AzureClustersStubSettings.newBuilder());
293307
}
294308

309+
@BetaApi
310+
private static Builder createHttpJsonDefault() {
311+
return new Builder(AzureClustersStubSettings.newHttpJsonBuilder());
312+
}
313+
295314
public AzureClustersStubSettings.Builder getStubSettingsBuilder() {
296315
return ((AzureClustersStubSettings.Builder) getStubSettings());
297316
}

google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStub.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@
5656
public abstract class AwsClustersStub implements BackgroundResource {
5757

5858
public OperationsStub getOperationsStub() {
59-
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
59+
return null;
60+
}
61+
62+
public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
63+
return null;
6064
}
6165

6266
public OperationCallable<CreateAwsClusterRequest, AwsCluster, OperationMetadata>

0 commit comments

Comments
 (0)