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

com.google.cloud.networkconnectivity.v1alpha1.stub.GrpcHubServiceStub Maven / Gradle / Ivy

Go to download

Google's suite of products that provide enterprise connectivity from your on-premises network or from another cloud provider to your Virtual Private Cloud (VPC) network

The 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.networkconnectivity.v1alpha1.stub;

import static com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient.ListHubsPagedResponse;
import static com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient.ListSpokesPagedResponse;

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.networkconnectivity.v1alpha1.CreateHubRequest;
import com.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest;
import com.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest;
import com.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest;
import com.google.cloud.networkconnectivity.v1alpha1.GetHubRequest;
import com.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest;
import com.google.cloud.networkconnectivity.v1alpha1.Hub;
import com.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest;
import com.google.cloud.networkconnectivity.v1alpha1.ListHubsResponse;
import com.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest;
import com.google.cloud.networkconnectivity.v1alpha1.ListSpokesResponse;
import com.google.cloud.networkconnectivity.v1alpha1.OperationMetadata;
import com.google.cloud.networkconnectivity.v1alpha1.Spoke;
import com.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest;
import com.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest;
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 HubService service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @BetaApi @Generated("by gapic-generator-java") public class GrpcHubServiceStub extends HubServiceStub { private static final MethodDescriptor listHubsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/ListHubs") .setRequestMarshaller(ProtoUtils.marshaller(ListHubsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListHubsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getHubMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/GetHub") .setRequestMarshaller(ProtoUtils.marshaller(GetHubRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Hub.getDefaultInstance())) .build(); private static final MethodDescriptor createHubMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/CreateHub") .setRequestMarshaller(ProtoUtils.marshaller(CreateHubRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor updateHubMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/UpdateHub") .setRequestMarshaller(ProtoUtils.marshaller(UpdateHubRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor deleteHubMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/DeleteHub") .setRequestMarshaller(ProtoUtils.marshaller(DeleteHubRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor listSpokesMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/ListSpokes") .setRequestMarshaller(ProtoUtils.marshaller(ListSpokesRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListSpokesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getSpokeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/GetSpoke") .setRequestMarshaller(ProtoUtils.marshaller(GetSpokeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Spoke.getDefaultInstance())) .build(); private static final MethodDescriptor createSpokeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/CreateSpoke") .setRequestMarshaller(ProtoUtils.marshaller(CreateSpokeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor updateSpokeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/UpdateSpoke") .setRequestMarshaller(ProtoUtils.marshaller(UpdateSpokeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor deleteSpokeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.networkconnectivity.v1alpha1.HubService/DeleteSpoke") .setRequestMarshaller(ProtoUtils.marshaller(DeleteSpokeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private final UnaryCallable listHubsCallable; private final UnaryCallable listHubsPagedCallable; private final UnaryCallable getHubCallable; private final UnaryCallable createHubCallable; private final OperationCallable createHubOperationCallable; private final UnaryCallable updateHubCallable; private final OperationCallable updateHubOperationCallable; private final UnaryCallable deleteHubCallable; private final OperationCallable deleteHubOperationCallable; private final UnaryCallable listSpokesCallable; private final UnaryCallable listSpokesPagedCallable; private final UnaryCallable getSpokeCallable; private final UnaryCallable createSpokeCallable; private final OperationCallable createSpokeOperationCallable; private final UnaryCallable updateSpokeCallable; private final OperationCallable updateSpokeOperationCallable; private final UnaryCallable deleteSpokeCallable; private final OperationCallable deleteSpokeOperationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcHubServiceStub create(HubServiceStubSettings settings) throws IOException { return new GrpcHubServiceStub(settings, ClientContext.create(settings)); } public static final GrpcHubServiceStub create(ClientContext clientContext) throws IOException { return new GrpcHubServiceStub(HubServiceStubSettings.newBuilder().build(), clientContext); } public static final GrpcHubServiceStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcHubServiceStub( HubServiceStubSettings.newBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of GrpcHubServiceStub, 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 GrpcHubServiceStub(HubServiceStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcHubServiceCallableFactory()); } /** * Constructs an instance of GrpcHubServiceStub, 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 GrpcHubServiceStub( HubServiceStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listHubsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listHubsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getHubTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getHubMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings createHubTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createHubMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings updateHubTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateHubMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("hub.name", String.valueOf(request.getHub().getName())); return builder.build(); }) .build(); GrpcCallSettings deleteHubTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteHubMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings listSpokesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listSpokesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getSpokeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getSpokeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings createSpokeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createSpokeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings updateSpokeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateSpokeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("spoke.name", String.valueOf(request.getSpoke().getName())); return builder.build(); }) .build(); GrpcCallSettings deleteSpokeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteSpokeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); this.listHubsCallable = callableFactory.createUnaryCallable( listHubsTransportSettings, settings.listHubsSettings(), clientContext); this.listHubsPagedCallable = callableFactory.createPagedCallable( listHubsTransportSettings, settings.listHubsSettings(), clientContext); this.getHubCallable = callableFactory.createUnaryCallable( getHubTransportSettings, settings.getHubSettings(), clientContext); this.createHubCallable = callableFactory.createUnaryCallable( createHubTransportSettings, settings.createHubSettings(), clientContext); this.createHubOperationCallable = callableFactory.createOperationCallable( createHubTransportSettings, settings.createHubOperationSettings(), clientContext, operationsStub); this.updateHubCallable = callableFactory.createUnaryCallable( updateHubTransportSettings, settings.updateHubSettings(), clientContext); this.updateHubOperationCallable = callableFactory.createOperationCallable( updateHubTransportSettings, settings.updateHubOperationSettings(), clientContext, operationsStub); this.deleteHubCallable = callableFactory.createUnaryCallable( deleteHubTransportSettings, settings.deleteHubSettings(), clientContext); this.deleteHubOperationCallable = callableFactory.createOperationCallable( deleteHubTransportSettings, settings.deleteHubOperationSettings(), clientContext, operationsStub); this.listSpokesCallable = callableFactory.createUnaryCallable( listSpokesTransportSettings, settings.listSpokesSettings(), clientContext); this.listSpokesPagedCallable = callableFactory.createPagedCallable( listSpokesTransportSettings, settings.listSpokesSettings(), clientContext); this.getSpokeCallable = callableFactory.createUnaryCallable( getSpokeTransportSettings, settings.getSpokeSettings(), clientContext); this.createSpokeCallable = callableFactory.createUnaryCallable( createSpokeTransportSettings, settings.createSpokeSettings(), clientContext); this.createSpokeOperationCallable = callableFactory.createOperationCallable( createSpokeTransportSettings, settings.createSpokeOperationSettings(), clientContext, operationsStub); this.updateSpokeCallable = callableFactory.createUnaryCallable( updateSpokeTransportSettings, settings.updateSpokeSettings(), clientContext); this.updateSpokeOperationCallable = callableFactory.createOperationCallable( updateSpokeTransportSettings, settings.updateSpokeOperationSettings(), clientContext, operationsStub); this.deleteSpokeCallable = callableFactory.createUnaryCallable( deleteSpokeTransportSettings, settings.deleteSpokeSettings(), clientContext); this.deleteSpokeOperationCallable = callableFactory.createOperationCallable( deleteSpokeTransportSettings, settings.deleteSpokeOperationSettings(), clientContext, operationsStub); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } public GrpcOperationsStub getOperationsStub() { return operationsStub; } @Override public UnaryCallable listHubsCallable() { return listHubsCallable; } @Override public UnaryCallable listHubsPagedCallable() { return listHubsPagedCallable; } @Override public UnaryCallable getHubCallable() { return getHubCallable; } @Override public UnaryCallable createHubCallable() { return createHubCallable; } @Override public OperationCallable createHubOperationCallable() { return createHubOperationCallable; } @Override public UnaryCallable updateHubCallable() { return updateHubCallable; } @Override public OperationCallable updateHubOperationCallable() { return updateHubOperationCallable; } @Override public UnaryCallable deleteHubCallable() { return deleteHubCallable; } @Override public OperationCallable deleteHubOperationCallable() { return deleteHubOperationCallable; } @Override public UnaryCallable listSpokesCallable() { return listSpokesCallable; } @Override public UnaryCallable listSpokesPagedCallable() { return listSpokesPagedCallable; } @Override public UnaryCallable getSpokeCallable() { return getSpokeCallable; } @Override public UnaryCallable createSpokeCallable() { return createSpokeCallable; } @Override public OperationCallable createSpokeOperationCallable() { return createSpokeOperationCallable; } @Override public UnaryCallable updateSpokeCallable() { return updateSpokeCallable; } @Override public OperationCallable updateSpokeOperationCallable() { return updateSpokeOperationCallable; } @Override public UnaryCallable deleteSpokeCallable() { return deleteSpokeCallable; } @Override public OperationCallable deleteSpokeOperationCallable() { return deleteSpokeOperationCallable; } @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 - 2024 Weber Informatics LLC | Privacy Policy