All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.gkehub.v1alpha.stub.GrpcGkeHubStub Maven / Gradle / Ivy

Go to download

provides a unified way to work with Kubernetes clusters as part of Anthos, extending GKE to work in multiple environments. You have consistent, unified, and secure infrastructure, cluster, and container management, whether you're using Anthos on Google Cloud (with traditional GKE), hybrid cloud, or multiple public clouds.

There is a newer version: 1.56.0
Show newest version
/*
 * Copyright 2024 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.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.RequestParamsBuilder;
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.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * gRPC 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 GrpcGkeHubStub extends GkeHubStub { private static final MethodDescriptor listFeaturesMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/ListFeatures") .setRequestMarshaller(ProtoUtils.marshaller(ListFeaturesRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListFeaturesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getFeatureMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/GetFeature") .setRequestMarshaller(ProtoUtils.marshaller(GetFeatureRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Feature.getDefaultInstance())) .build(); private static final MethodDescriptor createFeatureMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/CreateFeature") .setRequestMarshaller( ProtoUtils.marshaller(CreateFeatureRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor deleteFeatureMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/DeleteFeature") .setRequestMarshaller( ProtoUtils.marshaller(DeleteFeatureRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor updateFeatureMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.gkehub.v1alpha.GkeHub/UpdateFeature") .setRequestMarshaller( ProtoUtils.marshaller(UpdateFeatureRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .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 deleteFeatureOperationCallable; private final UnaryCallable updateFeatureCallable; private final OperationCallable updateFeatureOperationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcGkeHubStub create(GkeHubStubSettings settings) throws IOException { return new GrpcGkeHubStub(settings, ClientContext.create(settings)); } public static final GrpcGkeHubStub create(ClientContext clientContext) throws IOException { return new GrpcGkeHubStub(GkeHubStubSettings.newBuilder().build(), clientContext); } public static final GrpcGkeHubStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcGkeHubStub( GkeHubStubSettings.newBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of GrpcGkeHubStub, 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 GrpcGkeHubStub(GkeHubStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcGkeHubCallableFactory()); } /** * Constructs an instance of GrpcGkeHubStub, 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 GrpcGkeHubStub( GkeHubStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listFeaturesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listFeaturesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getFeatureTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getFeatureMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings createFeatureTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createFeatureMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings deleteFeatureTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteFeatureMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateFeatureTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateFeatureMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); this.listFeaturesCallable = callableFactory.createUnaryCallable( listFeaturesTransportSettings, settings.listFeaturesSettings(), clientContext); this.listFeaturesPagedCallable = callableFactory.createPagedCallable( listFeaturesTransportSettings, settings.listFeaturesSettings(), clientContext); this.getFeatureCallable = callableFactory.createUnaryCallable( getFeatureTransportSettings, settings.getFeatureSettings(), clientContext); this.createFeatureCallable = callableFactory.createUnaryCallable( createFeatureTransportSettings, settings.createFeatureSettings(), clientContext); this.createFeatureOperationCallable = callableFactory.createOperationCallable( createFeatureTransportSettings, settings.createFeatureOperationSettings(), clientContext, operationsStub); this.deleteFeatureCallable = callableFactory.createUnaryCallable( deleteFeatureTransportSettings, settings.deleteFeatureSettings(), clientContext); this.deleteFeatureOperationCallable = callableFactory.createOperationCallable( deleteFeatureTransportSettings, settings.deleteFeatureOperationSettings(), clientContext, operationsStub); this.updateFeatureCallable = callableFactory.createUnaryCallable( updateFeatureTransportSettings, settings.updateFeatureSettings(), clientContext); this.updateFeatureOperationCallable = callableFactory.createOperationCallable( updateFeatureTransportSettings, settings.updateFeatureOperationSettings(), clientContext, operationsStub); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } public GrpcOperationsStub getOperationsStub() { return operationsStub; } @Override public UnaryCallable listFeaturesCallable() { return listFeaturesCallable; } @Override public UnaryCallable listFeaturesPagedCallable() { return listFeaturesPagedCallable; } @Override public UnaryCallable getFeatureCallable() { return getFeatureCallable; } @Override public UnaryCallable createFeatureCallable() { return createFeatureCallable; } @Override public OperationCallable createFeatureOperationCallable() { return createFeatureOperationCallable; } @Override public UnaryCallable deleteFeatureCallable() { return deleteFeatureCallable; } @Override public OperationCallable deleteFeatureOperationCallable() { return deleteFeatureOperationCallable; } @Override public UnaryCallable updateFeatureCallable() { return updateFeatureCallable; } @Override public OperationCallable updateFeatureOperationCallable() { return updateFeatureOperationCallable; } @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); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy