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

com.google.cloud.tpu.v2alpha1.stub.GrpcTpuStub Maven / Gradle / Ivy

Go to download

Cloud TPU are Google's custom-developed application-specific integrated circuits (ASICs) used to accelerate machine learning workloads.

There is a newer version: 2.55.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.tpu.v2alpha1.stub;

import static com.google.cloud.tpu.v2alpha1.TpuClient.ListAcceleratorTypesPagedResponse;
import static com.google.cloud.tpu.v2alpha1.TpuClient.ListLocationsPagedResponse;
import static com.google.cloud.tpu.v2alpha1.TpuClient.ListNodesPagedResponse;
import static com.google.cloud.tpu.v2alpha1.TpuClient.ListQueuedResourcesPagedResponse;
import static com.google.cloud.tpu.v2alpha1.TpuClient.ListRuntimeVersionsPagedResponse;

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.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.cloud.tpu.v2alpha1.AcceleratorType;
import com.google.cloud.tpu.v2alpha1.CreateNodeRequest;
import com.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest;
import com.google.cloud.tpu.v2alpha1.DeleteNodeRequest;
import com.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest;
import com.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest;
import com.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse;
import com.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest;
import com.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest;
import com.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse;
import com.google.cloud.tpu.v2alpha1.GetNodeRequest;
import com.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest;
import com.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest;
import com.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest;
import com.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse;
import com.google.cloud.tpu.v2alpha1.ListNodesRequest;
import com.google.cloud.tpu.v2alpha1.ListNodesResponse;
import com.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest;
import com.google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse;
import com.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest;
import com.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse;
import com.google.cloud.tpu.v2alpha1.Node;
import com.google.cloud.tpu.v2alpha1.OperationMetadata;
import com.google.cloud.tpu.v2alpha1.QueuedResource;
import com.google.cloud.tpu.v2alpha1.ResetQueuedResourceRequest;
import com.google.cloud.tpu.v2alpha1.RuntimeVersion;
import com.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest;
import com.google.cloud.tpu.v2alpha1.StartNodeRequest;
import com.google.cloud.tpu.v2alpha1.StopNodeRequest;
import com.google.cloud.tpu.v2alpha1.UpdateNodeRequest;
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 Tpu service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @BetaApi @Generated("by gapic-generator-java") public class GrpcTpuStub extends TpuStub { private static final MethodDescriptor listNodesMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/ListNodes") .setRequestMarshaller(ProtoUtils.marshaller(ListNodesRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListNodesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getNodeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/GetNode") .setRequestMarshaller(ProtoUtils.marshaller(GetNodeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Node.getDefaultInstance())) .build(); private static final MethodDescriptor createNodeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/CreateNode") .setRequestMarshaller(ProtoUtils.marshaller(CreateNodeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor deleteNodeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/DeleteNode") .setRequestMarshaller(ProtoUtils.marshaller(DeleteNodeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor stopNodeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/StopNode") .setRequestMarshaller(ProtoUtils.marshaller(StopNodeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor startNodeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/StartNode") .setRequestMarshaller(ProtoUtils.marshaller(StartNodeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor updateNodeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/UpdateNode") .setRequestMarshaller(ProtoUtils.marshaller(UpdateNodeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor listQueuedResourcesMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/ListQueuedResources") .setRequestMarshaller( ProtoUtils.marshaller(ListQueuedResourcesRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListQueuedResourcesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getQueuedResourceMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/GetQueuedResource") .setRequestMarshaller( ProtoUtils.marshaller(GetQueuedResourceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(QueuedResource.getDefaultInstance())) .build(); private static final MethodDescriptor createQueuedResourceMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/CreateQueuedResource") .setRequestMarshaller( ProtoUtils.marshaller(CreateQueuedResourceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor deleteQueuedResourceMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/DeleteQueuedResource") .setRequestMarshaller( ProtoUtils.marshaller(DeleteQueuedResourceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor resetQueuedResourceMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/ResetQueuedResource") .setRequestMarshaller( ProtoUtils.marshaller(ResetQueuedResourceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor< GenerateServiceIdentityRequest, GenerateServiceIdentityResponse> generateServiceIdentityMethodDescriptor = MethodDescriptor .newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/GenerateServiceIdentity") .setRequestMarshaller( ProtoUtils.marshaller(GenerateServiceIdentityRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(GenerateServiceIdentityResponse.getDefaultInstance())) .build(); private static final MethodDescriptor listAcceleratorTypesMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/ListAcceleratorTypes") .setRequestMarshaller( ProtoUtils.marshaller(ListAcceleratorTypesRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListAcceleratorTypesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getAcceleratorTypeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/GetAcceleratorType") .setRequestMarshaller( ProtoUtils.marshaller(GetAcceleratorTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(AcceleratorType.getDefaultInstance())) .build(); private static final MethodDescriptor listRuntimeVersionsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/ListRuntimeVersions") .setRequestMarshaller( ProtoUtils.marshaller(ListRuntimeVersionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListRuntimeVersionsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getRuntimeVersionMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/GetRuntimeVersion") .setRequestMarshaller( ProtoUtils.marshaller(GetRuntimeVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(RuntimeVersion.getDefaultInstance())) .build(); private static final MethodDescriptor getGuestAttributesMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/GetGuestAttributes") .setRequestMarshaller( ProtoUtils.marshaller(GetGuestAttributesRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(GetGuestAttributesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor simulateMaintenanceEventMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.tpu.v2alpha1.Tpu/SimulateMaintenanceEvent") .setRequestMarshaller( ProtoUtils.marshaller(SimulateMaintenanceEventRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor listLocationsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.location.Locations/ListLocations") .setRequestMarshaller( ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getLocationMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.location.Locations/GetLocation") .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) .build(); private final UnaryCallable listNodesCallable; private final UnaryCallable listNodesPagedCallable; private final UnaryCallable getNodeCallable; private final UnaryCallable createNodeCallable; private final OperationCallable createNodeOperationCallable; private final UnaryCallable deleteNodeCallable; private final OperationCallable deleteNodeOperationCallable; private final UnaryCallable stopNodeCallable; private final OperationCallable stopNodeOperationCallable; private final UnaryCallable startNodeCallable; private final OperationCallable startNodeOperationCallable; private final UnaryCallable updateNodeCallable; private final OperationCallable updateNodeOperationCallable; private final UnaryCallable listQueuedResourcesCallable; private final UnaryCallable listQueuedResourcesPagedCallable; private final UnaryCallable getQueuedResourceCallable; private final UnaryCallable createQueuedResourceCallable; private final OperationCallable createQueuedResourceOperationCallable; private final UnaryCallable deleteQueuedResourceCallable; private final OperationCallable deleteQueuedResourceOperationCallable; private final UnaryCallable resetQueuedResourceCallable; private final OperationCallable resetQueuedResourceOperationCallable; private final UnaryCallable generateServiceIdentityCallable; private final UnaryCallable listAcceleratorTypesCallable; private final UnaryCallable listAcceleratorTypesPagedCallable; private final UnaryCallable getAcceleratorTypeCallable; private final UnaryCallable listRuntimeVersionsCallable; private final UnaryCallable listRuntimeVersionsPagedCallable; private final UnaryCallable getRuntimeVersionCallable; private final UnaryCallable getGuestAttributesCallable; private final UnaryCallable simulateMaintenanceEventCallable; private final OperationCallable simulateMaintenanceEventOperationCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable listLocationsPagedCallable; private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcTpuStub create(TpuStubSettings settings) throws IOException { return new GrpcTpuStub(settings, ClientContext.create(settings)); } public static final GrpcTpuStub create(ClientContext clientContext) throws IOException { return new GrpcTpuStub(TpuStubSettings.newBuilder().build(), clientContext); } public static final GrpcTpuStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcTpuStub(TpuStubSettings.newBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of GrpcTpuStub, 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 GrpcTpuStub(TpuStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcTpuCallableFactory()); } /** * Constructs an instance of GrpcTpuStub, 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 GrpcTpuStub( TpuStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listNodesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listNodesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getNodeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getNodeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings createNodeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createNodeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings deleteNodeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteNodeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings stopNodeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(stopNodeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings startNodeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(startNodeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateNodeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateNodeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("node.name", String.valueOf(request.getNode().getName())); return builder.build(); }) .build(); GrpcCallSettings listQueuedResourcesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listQueuedResourcesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getQueuedResourceTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getQueuedResourceMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings createQueuedResourceTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createQueuedResourceMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings deleteQueuedResourceTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteQueuedResourceMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings resetQueuedResourceTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(resetQueuedResourceMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings generateServiceIdentityTransportSettings = GrpcCallSettings .newBuilder() .setMethodDescriptor(generateServiceIdentityMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings listAcceleratorTypesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listAcceleratorTypesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getAcceleratorTypeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getAcceleratorTypeMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings listRuntimeVersionsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listRuntimeVersionsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getRuntimeVersionTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getRuntimeVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings getGuestAttributesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getGuestAttributesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings simulateMaintenanceEventTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(simulateMaintenanceEventMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings listLocationsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listLocationsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings getLocationTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getLocationMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); this.listNodesCallable = callableFactory.createUnaryCallable( listNodesTransportSettings, settings.listNodesSettings(), clientContext); this.listNodesPagedCallable = callableFactory.createPagedCallable( listNodesTransportSettings, settings.listNodesSettings(), clientContext); this.getNodeCallable = callableFactory.createUnaryCallable( getNodeTransportSettings, settings.getNodeSettings(), clientContext); this.createNodeCallable = callableFactory.createUnaryCallable( createNodeTransportSettings, settings.createNodeSettings(), clientContext); this.createNodeOperationCallable = callableFactory.createOperationCallable( createNodeTransportSettings, settings.createNodeOperationSettings(), clientContext, operationsStub); this.deleteNodeCallable = callableFactory.createUnaryCallable( deleteNodeTransportSettings, settings.deleteNodeSettings(), clientContext); this.deleteNodeOperationCallable = callableFactory.createOperationCallable( deleteNodeTransportSettings, settings.deleteNodeOperationSettings(), clientContext, operationsStub); this.stopNodeCallable = callableFactory.createUnaryCallable( stopNodeTransportSettings, settings.stopNodeSettings(), clientContext); this.stopNodeOperationCallable = callableFactory.createOperationCallable( stopNodeTransportSettings, settings.stopNodeOperationSettings(), clientContext, operationsStub); this.startNodeCallable = callableFactory.createUnaryCallable( startNodeTransportSettings, settings.startNodeSettings(), clientContext); this.startNodeOperationCallable = callableFactory.createOperationCallable( startNodeTransportSettings, settings.startNodeOperationSettings(), clientContext, operationsStub); this.updateNodeCallable = callableFactory.createUnaryCallable( updateNodeTransportSettings, settings.updateNodeSettings(), clientContext); this.updateNodeOperationCallable = callableFactory.createOperationCallable( updateNodeTransportSettings, settings.updateNodeOperationSettings(), clientContext, operationsStub); this.listQueuedResourcesCallable = callableFactory.createUnaryCallable( listQueuedResourcesTransportSettings, settings.listQueuedResourcesSettings(), clientContext); this.listQueuedResourcesPagedCallable = callableFactory.createPagedCallable( listQueuedResourcesTransportSettings, settings.listQueuedResourcesSettings(), clientContext); this.getQueuedResourceCallable = callableFactory.createUnaryCallable( getQueuedResourceTransportSettings, settings.getQueuedResourceSettings(), clientContext); this.createQueuedResourceCallable = callableFactory.createUnaryCallable( createQueuedResourceTransportSettings, settings.createQueuedResourceSettings(), clientContext); this.createQueuedResourceOperationCallable = callableFactory.createOperationCallable( createQueuedResourceTransportSettings, settings.createQueuedResourceOperationSettings(), clientContext, operationsStub); this.deleteQueuedResourceCallable = callableFactory.createUnaryCallable( deleteQueuedResourceTransportSettings, settings.deleteQueuedResourceSettings(), clientContext); this.deleteQueuedResourceOperationCallable = callableFactory.createOperationCallable( deleteQueuedResourceTransportSettings, settings.deleteQueuedResourceOperationSettings(), clientContext, operationsStub); this.resetQueuedResourceCallable = callableFactory.createUnaryCallable( resetQueuedResourceTransportSettings, settings.resetQueuedResourceSettings(), clientContext); this.resetQueuedResourceOperationCallable = callableFactory.createOperationCallable( resetQueuedResourceTransportSettings, settings.resetQueuedResourceOperationSettings(), clientContext, operationsStub); this.generateServiceIdentityCallable = callableFactory.createUnaryCallable( generateServiceIdentityTransportSettings, settings.generateServiceIdentitySettings(), clientContext); this.listAcceleratorTypesCallable = callableFactory.createUnaryCallable( listAcceleratorTypesTransportSettings, settings.listAcceleratorTypesSettings(), clientContext); this.listAcceleratorTypesPagedCallable = callableFactory.createPagedCallable( listAcceleratorTypesTransportSettings, settings.listAcceleratorTypesSettings(), clientContext); this.getAcceleratorTypeCallable = callableFactory.createUnaryCallable( getAcceleratorTypeTransportSettings, settings.getAcceleratorTypeSettings(), clientContext); this.listRuntimeVersionsCallable = callableFactory.createUnaryCallable( listRuntimeVersionsTransportSettings, settings.listRuntimeVersionsSettings(), clientContext); this.listRuntimeVersionsPagedCallable = callableFactory.createPagedCallable( listRuntimeVersionsTransportSettings, settings.listRuntimeVersionsSettings(), clientContext); this.getRuntimeVersionCallable = callableFactory.createUnaryCallable( getRuntimeVersionTransportSettings, settings.getRuntimeVersionSettings(), clientContext); this.getGuestAttributesCallable = callableFactory.createUnaryCallable( getGuestAttributesTransportSettings, settings.getGuestAttributesSettings(), clientContext); this.simulateMaintenanceEventCallable = callableFactory.createUnaryCallable( simulateMaintenanceEventTransportSettings, settings.simulateMaintenanceEventSettings(), clientContext); this.simulateMaintenanceEventOperationCallable = callableFactory.createOperationCallable( simulateMaintenanceEventTransportSettings, settings.simulateMaintenanceEventOperationSettings(), clientContext, operationsStub); this.listLocationsCallable = callableFactory.createUnaryCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.listLocationsPagedCallable = callableFactory.createPagedCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.getLocationCallable = callableFactory.createUnaryCallable( getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } public GrpcOperationsStub getOperationsStub() { return operationsStub; } @Override public UnaryCallable listNodesCallable() { return listNodesCallable; } @Override public UnaryCallable listNodesPagedCallable() { return listNodesPagedCallable; } @Override public UnaryCallable getNodeCallable() { return getNodeCallable; } @Override public UnaryCallable createNodeCallable() { return createNodeCallable; } @Override public OperationCallable createNodeOperationCallable() { return createNodeOperationCallable; } @Override public UnaryCallable deleteNodeCallable() { return deleteNodeCallable; } @Override public OperationCallable deleteNodeOperationCallable() { return deleteNodeOperationCallable; } @Override public UnaryCallable stopNodeCallable() { return stopNodeCallable; } @Override public OperationCallable stopNodeOperationCallable() { return stopNodeOperationCallable; } @Override public UnaryCallable startNodeCallable() { return startNodeCallable; } @Override public OperationCallable startNodeOperationCallable() { return startNodeOperationCallable; } @Override public UnaryCallable updateNodeCallable() { return updateNodeCallable; } @Override public OperationCallable updateNodeOperationCallable() { return updateNodeOperationCallable; } @Override public UnaryCallable listQueuedResourcesCallable() { return listQueuedResourcesCallable; } @Override public UnaryCallable listQueuedResourcesPagedCallable() { return listQueuedResourcesPagedCallable; } @Override public UnaryCallable getQueuedResourceCallable() { return getQueuedResourceCallable; } @Override public UnaryCallable createQueuedResourceCallable() { return createQueuedResourceCallable; } @Override public OperationCallable createQueuedResourceOperationCallable() { return createQueuedResourceOperationCallable; } @Override public UnaryCallable deleteQueuedResourceCallable() { return deleteQueuedResourceCallable; } @Override public OperationCallable deleteQueuedResourceOperationCallable() { return deleteQueuedResourceOperationCallable; } @Override public UnaryCallable resetQueuedResourceCallable() { return resetQueuedResourceCallable; } @Override public OperationCallable resetQueuedResourceOperationCallable() { return resetQueuedResourceOperationCallable; } @Override public UnaryCallable generateServiceIdentityCallable() { return generateServiceIdentityCallable; } @Override public UnaryCallable listAcceleratorTypesCallable() { return listAcceleratorTypesCallable; } @Override public UnaryCallable listAcceleratorTypesPagedCallable() { return listAcceleratorTypesPagedCallable; } @Override public UnaryCallable getAcceleratorTypeCallable() { return getAcceleratorTypeCallable; } @Override public UnaryCallable listRuntimeVersionsCallable() { return listRuntimeVersionsCallable; } @Override public UnaryCallable listRuntimeVersionsPagedCallable() { return listRuntimeVersionsPagedCallable; } @Override public UnaryCallable getRuntimeVersionCallable() { return getRuntimeVersionCallable; } @Override public UnaryCallable getGuestAttributesCallable() { return getGuestAttributesCallable; } @Override public UnaryCallable simulateMaintenanceEventCallable() { return simulateMaintenanceEventCallable; } @Override public OperationCallable simulateMaintenanceEventOperationCallable() { return simulateMaintenanceEventOperationCallable; } @Override public UnaryCallable listLocationsCallable() { return listLocationsCallable; } @Override public UnaryCallable listLocationsPagedCallable() { return listLocationsPagedCallable; } @Override public UnaryCallable getLocationCallable() { return getLocationCallable; } @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