diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/GkeHubClient.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/GkeHubClient.java
index fb06978d..6b12b47f 100644
--- a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/GkeHubClient.java
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/GkeHubClient.java
@@ -18,8 +18,8 @@
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
-import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
@@ -31,7 +31,6 @@
import com.google.cloud.gkehub.v1.stub.GkeHubStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
-import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
@@ -116,13 +115,28 @@
* GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
* }
*
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * GkeHubSettings gkeHubSettings =
+ * GkeHubSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * GkeHubSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class GkeHubClient implements BackgroundResource {
private final GkeHubSettings settings;
private final GkeHubStub stub;
- private final OperationsClient operationsClient;
+ private final OperationsClient httpJsonOperationsClient;
+ private final com.google.longrunning.OperationsClient operationsClient;
/** Constructs an instance of GkeHubClient with default settings. */
public static final GkeHubClient create() throws IOException {
@@ -141,7 +155,6 @@ public static final GkeHubClient create(GkeHubSettings settings) throws IOExcept
* Constructs an instance of GkeHubClient, using the given stub for making calls. This is for
* advanced usage - prefer using create(GkeHubSettings).
*/
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final GkeHubClient create(GkeHubStub stub) {
return new GkeHubClient(stub);
}
@@ -153,21 +166,23 @@ public static final GkeHubClient create(GkeHubStub stub) {
protected GkeHubClient(GkeHubSettings settings) throws IOException {
this.settings = settings;
this.stub = ((GkeHubStubSettings) settings.getStubSettings()).createStub();
- this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected GkeHubClient(GkeHubStub stub) {
this.settings = null;
this.stub = stub;
- this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
public final GkeHubSettings getSettings() {
return settings;
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public GkeHubStub getStub() {
return stub;
}
@@ -176,10 +191,18 @@ public GkeHubStub getStub() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
- public final OperationsClient getOperationsClient() {
+ public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ public final OperationsClient getHttpJsonOperationsClient() {
+ return httpJsonOperationsClient;
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Memberships in a given project and location.
@@ -318,7 +341,7 @@ public final ListMembershipsPagedResponse listMemberships(ListMembershipsRequest
* .build();
* while (true) {
* ListMembershipsResponse response = gkeHubClient.listMembershipsCallable().call(request);
- * for (Membership element : response.getResponsesList()) {
+ * for (Membership element : response.getResourcesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
@@ -473,7 +496,7 @@ public final ListFeaturesPagedResponse listFeatures(ListFeaturesRequest request)
* .build();
* while (true) {
* ListFeaturesResponse response = gkeHubClient.listFeaturesCallable().call(request);
- * for (Feature element : response.getResponsesList()) {
+ * for (Feature element : response.getResourcesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/GkeHubSettings.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/GkeHubSettings.java
index 1448b584..910a50a2 100644
--- a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/GkeHubSettings.java
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/GkeHubSettings.java
@@ -24,6 +24,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -193,11 +194,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return GkeHubStubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return GkeHubStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return GkeHubStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return GkeHubStubSettings.defaultTransportChannelProvider();
}
@@ -207,11 +215,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return GkeHubStubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -249,6 +263,11 @@ private static Builder createDefault() {
return new Builder(GkeHubStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(GkeHubStubSettings.newHttpJsonBuilder());
+ }
+
public GkeHubStubSettings.Builder getStubSettingsBuilder() {
return ((GkeHubStubSettings.Builder) getStubSettings());
}
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/GkeHubStub.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/GkeHubStub.java
index 26978737..5fa3adbd 100644
--- a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/GkeHubStub.java
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/GkeHubStub.java
@@ -54,7 +54,11 @@
public abstract class GkeHubStub implements BackgroundResource {
public OperationsStub getOperationsStub() {
- throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ return null;
+ }
+
+ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
+ return null;
}
public UnaryCallable
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/GkeHubStubSettings.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/GkeHubStubSettings.java
index 078f67d3..41aee7c3 100644
--- a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/GkeHubStubSettings.java
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/GkeHubStubSettings.java
@@ -29,6 +29,9 @@
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.grpc.ProtoOperationTransformers;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
@@ -345,13 +348,17 @@ public UnaryCallSettings updateFeatureSettings(
return generateConnectManifestSettings;
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public GkeHubStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcGkeHubStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonGkeHubStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -384,29 +391,54 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(GkeHubStubSettings.class))
.setTransportToken(
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(GkeHubStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return GkeHubStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -597,6 +629,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.listMembershipsSettings()
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/HttpJsonGkeHubCallableFactory.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/HttpJsonGkeHubCallableFactory.java
new file mode 100644
index 00000000..03eb3f33
--- /dev/null
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/HttpJsonGkeHubCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.gkehub.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the GkeHub service API.
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonGkeHubCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/HttpJsonGkeHubStub.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/HttpJsonGkeHubStub.java
new file mode 100644
index 00000000..554fb30e
--- /dev/null
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/HttpJsonGkeHubStub.java
@@ -0,0 +1,877 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.gkehub.v1.stub;
+
+import static com.google.cloud.gkehub.v1.GkeHubClient.ListFeaturesPagedResponse;
+import static com.google.cloud.gkehub.v1.GkeHubClient.ListMembershipsPagedResponse;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshot;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.gkehub.v1.CreateFeatureRequest;
+import com.google.cloud.gkehub.v1.CreateMembershipRequest;
+import com.google.cloud.gkehub.v1.DeleteFeatureRequest;
+import com.google.cloud.gkehub.v1.DeleteMembershipRequest;
+import com.google.cloud.gkehub.v1.Feature;
+import com.google.cloud.gkehub.v1.GenerateConnectManifestRequest;
+import com.google.cloud.gkehub.v1.GenerateConnectManifestResponse;
+import com.google.cloud.gkehub.v1.GetFeatureRequest;
+import com.google.cloud.gkehub.v1.GetMembershipRequest;
+import com.google.cloud.gkehub.v1.ListFeaturesRequest;
+import com.google.cloud.gkehub.v1.ListFeaturesResponse;
+import com.google.cloud.gkehub.v1.ListMembershipsRequest;
+import com.google.cloud.gkehub.v1.ListMembershipsResponse;
+import com.google.cloud.gkehub.v1.Membership;
+import com.google.cloud.gkehub.v1.OperationMetadata;
+import com.google.cloud.gkehub.v1.UpdateFeatureRequest;
+import com.google.cloud.gkehub.v1.UpdateMembershipRequest;
+import com.google.longrunning.Operation;
+import com.google.protobuf.Empty;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the GkeHub service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonGkeHubStub extends GkeHubStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(Empty.getDescriptor())
+ .add(OperationMetadata.getDescriptor())
+ .add(Feature.getDescriptor())
+ .add(Membership.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listMembershipsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/ListMemberships")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/memberships",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "filter", request.getFilter());
+ serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListMembershipsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listFeaturesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/ListFeatures")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/features",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "filter", request.getFilter());
+ serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListFeaturesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ getMembershipMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/GetMembership")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/memberships/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Membership.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getFeatureMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/GetFeature")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/features/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Feature.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createMembershipMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/CreateMembership")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/memberships",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "membershipId", request.getMembershipId());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("resource", request.getResource()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (CreateMembershipRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ createFeatureMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/CreateFeature")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/features",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "featureId", request.getFeatureId());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("resource", request.getResource()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (CreateFeatureRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteMembershipMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/DeleteMembership")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/memberships/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (DeleteMembershipRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteFeatureMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/DeleteFeature")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/features/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "force", request.getForce());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (DeleteFeatureRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateMembershipMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/UpdateMembership")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/memberships/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("resource", request.getResource()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (UpdateMembershipRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateFeatureMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/UpdateFeature")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/features/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("resource", request.getResource()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (UpdateFeatureRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor<
+ GenerateConnectManifestRequest, GenerateConnectManifestResponse>
+ generateConnectManifestMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1.GkeHub/GenerateConnectManifest")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/memberships/*}:generateConnectManifest",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields,
+ "imagePullSecretContent",
+ request.getImagePullSecretContent());
+ serializer.putQueryParam(fields, "isUpgrade", request.getIsUpgrade());
+ serializer.putQueryParam(fields, "namespace", request.getNamespace());
+ serializer.putQueryParam(fields, "proxy", request.getProxy());
+ serializer.putQueryParam(fields, "registry", request.getRegistry());
+ serializer.putQueryParam(fields, "version", request.getVersion());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(GenerateConnectManifestResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable
+ listMembershipsCallable;
+ private final UnaryCallable
+ listMembershipsPagedCallable;
+ private final UnaryCallable listFeaturesCallable;
+ private final UnaryCallable
+ listFeaturesPagedCallable;
+ private final UnaryCallable getMembershipCallable;
+ private final UnaryCallable getFeatureCallable;
+ private final UnaryCallable createMembershipCallable;
+ private final OperationCallable
+ createMembershipOperationCallable;
+ private final UnaryCallable createFeatureCallable;
+ private final OperationCallable
+ createFeatureOperationCallable;
+ private final UnaryCallable deleteMembershipCallable;
+ private final OperationCallable
+ deleteMembershipOperationCallable;
+ private final UnaryCallable deleteFeatureCallable;
+ private final OperationCallable
+ deleteFeatureOperationCallable;
+ private final UnaryCallable updateMembershipCallable;
+ private final OperationCallable
+ updateMembershipOperationCallable;
+ private final UnaryCallable updateFeatureCallable;
+ private final OperationCallable
+ updateFeatureOperationCallable;
+ private final UnaryCallable
+ generateConnectManifestCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonOperationsStub httpJsonOperationsStub;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonGkeHubStub create(GkeHubStubSettings settings) throws IOException {
+ return new HttpJsonGkeHubStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonGkeHubStub create(ClientContext clientContext) throws IOException {
+ return new HttpJsonGkeHubStub(GkeHubStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonGkeHubStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonGkeHubStub(
+ GkeHubStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonGkeHubStub, using the given settings. This is protected so
+ * that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected HttpJsonGkeHubStub(GkeHubStubSettings settings, ClientContext clientContext)
+ throws IOException {
+ this(settings, clientContext, new HttpJsonGkeHubCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonGkeHubStub, using the given settings. This is protected so
+ * that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected HttpJsonGkeHubStub(
+ GkeHubStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+ this.httpJsonOperationsStub =
+ HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
+
+ HttpJsonCallSettings
+ listMembershipsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listMembershipsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listFeaturesTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listFeaturesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getMembershipTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getMembershipMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getFeatureTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getFeatureMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createMembershipTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createMembershipMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createFeatureTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createFeatureMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteMembershipTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteMembershipMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteFeatureTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteFeatureMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings updateMembershipTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateMembershipMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings updateFeatureTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateFeatureMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ generateConnectManifestTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(generateConnectManifestMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.listMembershipsCallable =
+ callableFactory.createUnaryCallable(
+ listMembershipsTransportSettings, settings.listMembershipsSettings(), clientContext);
+ this.listMembershipsPagedCallable =
+ callableFactory.createPagedCallable(
+ listMembershipsTransportSettings, settings.listMembershipsSettings(), clientContext);
+ this.listFeaturesCallable =
+ callableFactory.createUnaryCallable(
+ listFeaturesTransportSettings, settings.listFeaturesSettings(), clientContext);
+ this.listFeaturesPagedCallable =
+ callableFactory.createPagedCallable(
+ listFeaturesTransportSettings, settings.listFeaturesSettings(), clientContext);
+ this.getMembershipCallable =
+ callableFactory.createUnaryCallable(
+ getMembershipTransportSettings, settings.getMembershipSettings(), clientContext);
+ this.getFeatureCallable =
+ callableFactory.createUnaryCallable(
+ getFeatureTransportSettings, settings.getFeatureSettings(), clientContext);
+ this.createMembershipCallable =
+ callableFactory.createUnaryCallable(
+ createMembershipTransportSettings, settings.createMembershipSettings(), clientContext);
+ this.createMembershipOperationCallable =
+ callableFactory.createOperationCallable(
+ createMembershipTransportSettings,
+ settings.createMembershipOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.createFeatureCallable =
+ callableFactory.createUnaryCallable(
+ createFeatureTransportSettings, settings.createFeatureSettings(), clientContext);
+ this.createFeatureOperationCallable =
+ callableFactory.createOperationCallable(
+ createFeatureTransportSettings,
+ settings.createFeatureOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.deleteMembershipCallable =
+ callableFactory.createUnaryCallable(
+ deleteMembershipTransportSettings, settings.deleteMembershipSettings(), clientContext);
+ this.deleteMembershipOperationCallable =
+ callableFactory.createOperationCallable(
+ deleteMembershipTransportSettings,
+ settings.deleteMembershipOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.deleteFeatureCallable =
+ callableFactory.createUnaryCallable(
+ deleteFeatureTransportSettings, settings.deleteFeatureSettings(), clientContext);
+ this.deleteFeatureOperationCallable =
+ callableFactory.createOperationCallable(
+ deleteFeatureTransportSettings,
+ settings.deleteFeatureOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.updateMembershipCallable =
+ callableFactory.createUnaryCallable(
+ updateMembershipTransportSettings, settings.updateMembershipSettings(), clientContext);
+ this.updateMembershipOperationCallable =
+ callableFactory.createOperationCallable(
+ updateMembershipTransportSettings,
+ settings.updateMembershipOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.updateFeatureCallable =
+ callableFactory.createUnaryCallable(
+ updateFeatureTransportSettings, settings.updateFeatureSettings(), clientContext);
+ this.updateFeatureOperationCallable =
+ callableFactory.createOperationCallable(
+ updateFeatureTransportSettings,
+ settings.updateFeatureOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.generateConnectManifestCallable =
+ callableFactory.createUnaryCallable(
+ generateConnectManifestTransportSettings,
+ settings.generateConnectManifestSettings(),
+ clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(listMembershipsMethodDescriptor);
+ methodDescriptors.add(listFeaturesMethodDescriptor);
+ methodDescriptors.add(getMembershipMethodDescriptor);
+ methodDescriptors.add(getFeatureMethodDescriptor);
+ methodDescriptors.add(createMembershipMethodDescriptor);
+ methodDescriptors.add(createFeatureMethodDescriptor);
+ methodDescriptors.add(deleteMembershipMethodDescriptor);
+ methodDescriptors.add(deleteFeatureMethodDescriptor);
+ methodDescriptors.add(updateMembershipMethodDescriptor);
+ methodDescriptors.add(updateFeatureMethodDescriptor);
+ methodDescriptors.add(generateConnectManifestMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ public HttpJsonOperationsStub getHttpJsonOperationsStub() {
+ return httpJsonOperationsStub;
+ }
+
+ @Override
+ public UnaryCallable listMembershipsCallable() {
+ return listMembershipsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listMembershipsPagedCallable() {
+ return listMembershipsPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable listFeaturesCallable() {
+ return listFeaturesCallable;
+ }
+
+ @Override
+ public UnaryCallable listFeaturesPagedCallable() {
+ return listFeaturesPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable getMembershipCallable() {
+ return getMembershipCallable;
+ }
+
+ @Override
+ public UnaryCallable getFeatureCallable() {
+ return getFeatureCallable;
+ }
+
+ @Override
+ public UnaryCallable createMembershipCallable() {
+ return createMembershipCallable;
+ }
+
+ @Override
+ public OperationCallable
+ createMembershipOperationCallable() {
+ return createMembershipOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable createFeatureCallable() {
+ return createFeatureCallable;
+ }
+
+ @Override
+ public OperationCallable
+ createFeatureOperationCallable() {
+ return createFeatureOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteMembershipCallable() {
+ return deleteMembershipCallable;
+ }
+
+ @Override
+ public OperationCallable
+ deleteMembershipOperationCallable() {
+ return deleteMembershipOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteFeatureCallable() {
+ return deleteFeatureCallable;
+ }
+
+ @Override
+ public OperationCallable
+ deleteFeatureOperationCallable() {
+ return deleteFeatureOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable updateMembershipCallable() {
+ return updateMembershipCallable;
+ }
+
+ @Override
+ public OperationCallable
+ updateMembershipOperationCallable() {
+ return updateMembershipOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable updateFeatureCallable() {
+ return updateFeatureCallable;
+ }
+
+ @Override
+ public OperationCallable
+ updateFeatureOperationCallable() {
+ return updateFeatureOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ generateConnectManifestCallable() {
+ return generateConnectManifestCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/GkeHubClient.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/GkeHubClient.java
index b7e965fa..35bcdfe6 100644
--- a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/GkeHubClient.java
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/GkeHubClient.java
@@ -20,6 +20,7 @@
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
@@ -31,7 +32,6 @@
import com.google.cloud.gkehub.v1alpha.stub.GkeHubStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
-import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
@@ -116,6 +116,20 @@
* GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
* }
*
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * GkeHubSettings gkeHubSettings =
+ * GkeHubSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * GkeHubSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
@@ -123,7 +137,8 @@
public class GkeHubClient implements BackgroundResource {
private final GkeHubSettings settings;
private final GkeHubStub stub;
- private final OperationsClient operationsClient;
+ private final OperationsClient httpJsonOperationsClient;
+ private final com.google.longrunning.OperationsClient operationsClient;
/** Constructs an instance of GkeHubClient with default settings. */
public static final GkeHubClient create() throws IOException {
@@ -142,7 +157,6 @@ public static final GkeHubClient create(GkeHubSettings settings) throws IOExcept
* Constructs an instance of GkeHubClient, using the given stub for making calls. This is for
* advanced usage - prefer using create(GkeHubSettings).
*/
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final GkeHubClient create(GkeHubStub stub) {
return new GkeHubClient(stub);
}
@@ -154,21 +168,23 @@ public static final GkeHubClient create(GkeHubStub stub) {
protected GkeHubClient(GkeHubSettings settings) throws IOException {
this.settings = settings;
this.stub = ((GkeHubStubSettings) settings.getStubSettings()).createStub();
- this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected GkeHubClient(GkeHubStub stub) {
this.settings = null;
this.stub = stub;
- this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
public final GkeHubSettings getSettings() {
return settings;
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public GkeHubStub getStub() {
return stub;
}
@@ -177,10 +193,18 @@ public GkeHubStub getStub() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
- public final OperationsClient getOperationsClient() {
+ public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ public final OperationsClient getHttpJsonOperationsClient() {
+ return httpJsonOperationsClient;
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Features in a given project and location.
@@ -289,7 +313,7 @@ public final ListFeaturesPagedResponse listFeatures(ListFeaturesRequest request)
* .build();
* while (true) {
* ListFeaturesResponse response = gkeHubClient.listFeaturesCallable().call(request);
- * for (Feature element : response.getResponsesList()) {
+ * for (Feature element : response.getResourcesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/GkeHubSettings.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/GkeHubSettings.java
index a65f1086..efbea95d 100644
--- a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/GkeHubSettings.java
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/GkeHubSettings.java
@@ -23,6 +23,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -142,11 +143,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return GkeHubStubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return GkeHubStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return GkeHubStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return GkeHubStubSettings.defaultTransportChannelProvider();
}
@@ -156,11 +164,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return GkeHubStubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -198,6 +212,11 @@ private static Builder createDefault() {
return new Builder(GkeHubStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(GkeHubStubSettings.newHttpJsonBuilder());
+ }
+
public GkeHubStubSettings.Builder getStubSettingsBuilder() {
return ((GkeHubStubSettings.Builder) getStubSettings());
}
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/GkeHubStub.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/GkeHubStub.java
index f8998d46..cd085b59 100644
--- a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/GkeHubStub.java
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/GkeHubStub.java
@@ -46,7 +46,11 @@
public abstract class GkeHubStub implements BackgroundResource {
public OperationsStub getOperationsStub() {
- throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ return null;
+ }
+
+ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
+ return null;
}
public UnaryCallable listFeaturesPagedCallable() {
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/GkeHubStubSettings.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/GkeHubStubSettings.java
index db154ac4..5c40370b 100644
--- a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/GkeHubStubSettings.java
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/GkeHubStubSettings.java
@@ -28,6 +28,9 @@
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.grpc.ProtoOperationTransformers;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
@@ -214,13 +217,17 @@ public UnaryCallSettings updateFeatureSettings(
return updateFeatureOperationSettings;
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public GkeHubStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcGkeHubStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonGkeHubStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -253,29 +260,54 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(GkeHubStubSettings.class))
.setTransportToken(
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(GkeHubStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return GkeHubStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -406,6 +438,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.listFeaturesSettings()
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/HttpJsonGkeHubCallableFactory.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/HttpJsonGkeHubCallableFactory.java
new file mode 100644
index 00000000..5aa9b1f8
--- /dev/null
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/HttpJsonGkeHubCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.gkehub.v1alpha.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the GkeHub service API.
+ *
+ * This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonGkeHubCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/HttpJsonGkeHubStub.java b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/HttpJsonGkeHubStub.java
new file mode 100644
index 00000000..649174aa
--- /dev/null
+++ b/google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1alpha/stub/HttpJsonGkeHubStub.java
@@ -0,0 +1,481 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.gkehub.v1alpha.stub;
+
+import static com.google.cloud.gkehub.v1alpha.GkeHubClient.ListFeaturesPagedResponse;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshot;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.gkehub.v1alpha.CreateFeatureRequest;
+import com.google.cloud.gkehub.v1alpha.DeleteFeatureRequest;
+import com.google.cloud.gkehub.v1alpha.Feature;
+import com.google.cloud.gkehub.v1alpha.GetFeatureRequest;
+import com.google.cloud.gkehub.v1alpha.ListFeaturesRequest;
+import com.google.cloud.gkehub.v1alpha.ListFeaturesResponse;
+import com.google.cloud.gkehub.v1alpha.OperationMetadata;
+import com.google.cloud.gkehub.v1alpha.UpdateFeatureRequest;
+import com.google.longrunning.Operation;
+import com.google.protobuf.Empty;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the GkeHub service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonGkeHubStub extends GkeHubStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(OperationMetadata.getDescriptor())
+ .add(Empty.getDescriptor())
+ .add(Feature.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listFeaturesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/ListFeatures")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{parent=projects/*/locations/*}/features",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "filter", request.getFilter());
+ serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListFeaturesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getFeatureMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/GetFeature")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{name=projects/*/locations/*/features/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Feature.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createFeatureMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/CreateFeature")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{parent=projects/*/locations/*}/features",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "featureId", request.getFeatureId());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("resource", request.getResource()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (CreateFeatureRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteFeatureMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/DeleteFeature")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{name=projects/*/locations/*/features/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "force", request.getForce());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (DeleteFeatureRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateFeatureMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/UpdateFeature")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{name=projects/*/locations/*/features/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("resource", request.getResource()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (UpdateFeatureRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private final UnaryCallable listFeaturesCallable;
+ private final UnaryCallable
+ listFeaturesPagedCallable;
+ private final UnaryCallable getFeatureCallable;
+ private final UnaryCallable createFeatureCallable;
+ private final OperationCallable
+ createFeatureOperationCallable;
+ private final UnaryCallable deleteFeatureCallable;
+ private final OperationCallable