com.google.cloud.notebooks.v1beta1.stub.GrpcNotebookServiceStub Maven / Gradle / Ivy
Show all versions of google-cloud-notebooks Show documentation
/*
* 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.notebooks.v1beta1.stub;
import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListEnvironmentsPagedResponse;
import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListInstancesPagedResponse;
import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListLocationsPagedResponse;
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.notebooks.v1beta1.CreateEnvironmentRequest;
import com.google.cloud.notebooks.v1beta1.CreateInstanceRequest;
import com.google.cloud.notebooks.v1beta1.DeleteEnvironmentRequest;
import com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest;
import com.google.cloud.notebooks.v1beta1.Environment;
import com.google.cloud.notebooks.v1beta1.GetEnvironmentRequest;
import com.google.cloud.notebooks.v1beta1.GetInstanceRequest;
import com.google.cloud.notebooks.v1beta1.Instance;
import com.google.cloud.notebooks.v1beta1.IsInstanceUpgradeableRequest;
import com.google.cloud.notebooks.v1beta1.IsInstanceUpgradeableResponse;
import com.google.cloud.notebooks.v1beta1.ListEnvironmentsRequest;
import com.google.cloud.notebooks.v1beta1.ListEnvironmentsResponse;
import com.google.cloud.notebooks.v1beta1.ListInstancesRequest;
import com.google.cloud.notebooks.v1beta1.ListInstancesResponse;
import com.google.cloud.notebooks.v1beta1.OperationMetadata;
import com.google.cloud.notebooks.v1beta1.RegisterInstanceRequest;
import com.google.cloud.notebooks.v1beta1.ReportInstanceInfoRequest;
import com.google.cloud.notebooks.v1beta1.ResetInstanceRequest;
import com.google.cloud.notebooks.v1beta1.SetInstanceAcceleratorRequest;
import com.google.cloud.notebooks.v1beta1.SetInstanceLabelsRequest;
import com.google.cloud.notebooks.v1beta1.SetInstanceMachineTypeRequest;
import com.google.cloud.notebooks.v1beta1.StartInstanceRequest;
import com.google.cloud.notebooks.v1beta1.StopInstanceRequest;
import com.google.cloud.notebooks.v1beta1.UpgradeInstanceInternalRequest;
import com.google.cloud.notebooks.v1beta1.UpgradeInstanceRequest;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
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 NotebookService service API.
*
* This class is for advanced usage and reflects the underlying API directly.
*/
@BetaApi
@Generated("by gapic-generator-java")
public class GrpcNotebookServiceStub extends NotebookServiceStub {
private static final MethodDescriptor
listInstancesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/ListInstances")
.setRequestMarshaller(
ProtoUtils.marshaller(ListInstancesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListInstancesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor getInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/GetInstance")
.setRequestMarshaller(ProtoUtils.marshaller(GetInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Instance.getDefaultInstance()))
.build();
private static final MethodDescriptor
createInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/CreateInstance")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
registerInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/RegisterInstance")
.setRequestMarshaller(
ProtoUtils.marshaller(RegisterInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
setInstanceAcceleratorMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.notebooks.v1beta1.NotebookService/SetInstanceAccelerator")
.setRequestMarshaller(
ProtoUtils.marshaller(SetInstanceAcceleratorRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
setInstanceMachineTypeMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.notebooks.v1beta1.NotebookService/SetInstanceMachineType")
.setRequestMarshaller(
ProtoUtils.marshaller(SetInstanceMachineTypeRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
setInstanceLabelsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/SetInstanceLabels")
.setRequestMarshaller(
ProtoUtils.marshaller(SetInstanceLabelsRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/DeleteInstance")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
startInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/StartInstance")
.setRequestMarshaller(
ProtoUtils.marshaller(StartInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
stopInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/StopInstance")
.setRequestMarshaller(ProtoUtils.marshaller(StopInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
resetInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/ResetInstance")
.setRequestMarshaller(
ProtoUtils.marshaller(ResetInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
reportInstanceInfoMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.notebooks.v1beta1.NotebookService/ReportInstanceInfo")
.setRequestMarshaller(
ProtoUtils.marshaller(ReportInstanceInfoRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
isInstanceUpgradeableMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.notebooks.v1beta1.NotebookService/IsInstanceUpgradeable")
.setRequestMarshaller(
ProtoUtils.marshaller(IsInstanceUpgradeableRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(IsInstanceUpgradeableResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
upgradeInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/UpgradeInstance")
.setRequestMarshaller(
ProtoUtils.marshaller(UpgradeInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
upgradeInstanceInternalMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.notebooks.v1beta1.NotebookService/UpgradeInstanceInternal")
.setRequestMarshaller(
ProtoUtils.marshaller(UpgradeInstanceInternalRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
listEnvironmentsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/ListEnvironments")
.setRequestMarshaller(
ProtoUtils.marshaller(ListEnvironmentsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListEnvironmentsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
getEnvironmentMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/GetEnvironment")
.setRequestMarshaller(
ProtoUtils.marshaller(GetEnvironmentRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Environment.getDefaultInstance()))
.build();
private static final MethodDescriptor
createEnvironmentMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/CreateEnvironment")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateEnvironmentRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteEnvironmentMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.notebooks.v1beta1.NotebookService/DeleteEnvironment")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteEnvironmentRequest.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 static final MethodDescriptor setIamPolicyMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy")
.setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance()))
.build();
private static final MethodDescriptor getIamPolicyMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy")
.setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance()))
.build();
private static final MethodDescriptor
testIamPermissionsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions")
.setRequestMarshaller(
ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance()))
.build();
private final UnaryCallable listInstancesCallable;
private final UnaryCallable
listInstancesPagedCallable;
private final UnaryCallable getInstanceCallable;
private final UnaryCallable createInstanceCallable;
private final OperationCallable
createInstanceOperationCallable;
private final UnaryCallable registerInstanceCallable;
private final OperationCallable
registerInstanceOperationCallable;
private final UnaryCallable
setInstanceAcceleratorCallable;
private final OperationCallable
setInstanceAcceleratorOperationCallable;
private final UnaryCallable
setInstanceMachineTypeCallable;
private final OperationCallable
setInstanceMachineTypeOperationCallable;
private final UnaryCallable setInstanceLabelsCallable;
private final OperationCallable
setInstanceLabelsOperationCallable;
private final UnaryCallable deleteInstanceCallable;
private final OperationCallable
deleteInstanceOperationCallable;
private final UnaryCallable startInstanceCallable;
private final OperationCallable
startInstanceOperationCallable;
private final UnaryCallable stopInstanceCallable;
private final OperationCallable
stopInstanceOperationCallable;
private final UnaryCallable resetInstanceCallable;
private final OperationCallable
resetInstanceOperationCallable;
private final UnaryCallable reportInstanceInfoCallable;
private final OperationCallable
reportInstanceInfoOperationCallable;
private final UnaryCallable
isInstanceUpgradeableCallable;
private final UnaryCallable upgradeInstanceCallable;
private final OperationCallable
upgradeInstanceOperationCallable;
private final UnaryCallable
upgradeInstanceInternalCallable;
private final OperationCallable
upgradeInstanceInternalOperationCallable;
private final UnaryCallable
listEnvironmentsCallable;
private final UnaryCallable
listEnvironmentsPagedCallable;
private final UnaryCallable getEnvironmentCallable;
private final UnaryCallable createEnvironmentCallable;
private final OperationCallable
createEnvironmentOperationCallable;
private final UnaryCallable deleteEnvironmentCallable;
private final OperationCallable
deleteEnvironmentOperationCallable;
private final UnaryCallable listLocationsCallable;
private final UnaryCallable
listLocationsPagedCallable;
private final UnaryCallable getLocationCallable;
private final UnaryCallable setIamPolicyCallable;
private final UnaryCallable getIamPolicyCallable;
private final UnaryCallable
testIamPermissionsCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcNotebookServiceStub create(NotebookServiceStubSettings settings)
throws IOException {
return new GrpcNotebookServiceStub(settings, ClientContext.create(settings));
}
public static final GrpcNotebookServiceStub create(ClientContext clientContext)
throws IOException {
return new GrpcNotebookServiceStub(
NotebookServiceStubSettings.newBuilder().build(), clientContext);
}
public static final GrpcNotebookServiceStub create(
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
return new GrpcNotebookServiceStub(
NotebookServiceStubSettings.newBuilder().build(), clientContext, callableFactory);
}
/**
* Constructs an instance of GrpcNotebookServiceStub, 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 GrpcNotebookServiceStub(
NotebookServiceStubSettings settings, ClientContext clientContext) throws IOException {
this(settings, clientContext, new GrpcNotebookServiceCallableFactory());
}
/**
* Constructs an instance of GrpcNotebookServiceStub, 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 GrpcNotebookServiceStub(
NotebookServiceStubSettings settings,
ClientContext clientContext,
GrpcStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
GrpcCallSettings listInstancesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listInstancesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings getInstanceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getInstanceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings createInstanceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createInstanceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings registerInstanceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(registerInstanceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
setInstanceAcceleratorTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(setInstanceAcceleratorMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
setInstanceMachineTypeTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(setInstanceMachineTypeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings setInstanceLabelsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(setInstanceLabelsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings deleteInstanceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteInstanceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings startInstanceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(startInstanceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings stopInstanceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(stopInstanceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings resetInstanceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(resetInstanceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings reportInstanceInfoTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(reportInstanceInfoMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
isInstanceUpgradeableTransportSettings =
GrpcCallSettings
.newBuilder()
.setMethodDescriptor(isInstanceUpgradeableMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add(
"notebook_instance", String.valueOf(request.getNotebookInstance()));
return builder.build();
})
.build();
GrpcCallSettings upgradeInstanceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(upgradeInstanceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
upgradeInstanceInternalTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(upgradeInstanceInternalMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
listEnvironmentsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listEnvironmentsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings getEnvironmentTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getEnvironmentMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings createEnvironmentTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createEnvironmentMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings deleteEnvironmentTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteEnvironmentMethodDescriptor)
.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();
GrpcCallSettings setIamPolicyTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(setIamPolicyMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
GrpcCallSettings getIamPolicyTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getIamPolicyMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
GrpcCallSettings
testIamPermissionsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(testIamPermissionsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
this.listInstancesCallable =
callableFactory.createUnaryCallable(
listInstancesTransportSettings, settings.listInstancesSettings(), clientContext);
this.listInstancesPagedCallable =
callableFactory.createPagedCallable(
listInstancesTransportSettings, settings.listInstancesSettings(), clientContext);
this.getInstanceCallable =
callableFactory.createUnaryCallable(
getInstanceTransportSettings, settings.getInstanceSettings(), clientContext);
this.createInstanceCallable =
callableFactory.createUnaryCallable(
createInstanceTransportSettings, settings.createInstanceSettings(), clientContext);
this.createInstanceOperationCallable =
callableFactory.createOperationCallable(
createInstanceTransportSettings,
settings.createInstanceOperationSettings(),
clientContext,
operationsStub);
this.registerInstanceCallable =
callableFactory.createUnaryCallable(
registerInstanceTransportSettings, settings.registerInstanceSettings(), clientContext);
this.registerInstanceOperationCallable =
callableFactory.createOperationCallable(
registerInstanceTransportSettings,
settings.registerInstanceOperationSettings(),
clientContext,
operationsStub);
this.setInstanceAcceleratorCallable =
callableFactory.createUnaryCallable(
setInstanceAcceleratorTransportSettings,
settings.setInstanceAcceleratorSettings(),
clientContext);
this.setInstanceAcceleratorOperationCallable =
callableFactory.createOperationCallable(
setInstanceAcceleratorTransportSettings,
settings.setInstanceAcceleratorOperationSettings(),
clientContext,
operationsStub);
this.setInstanceMachineTypeCallable =
callableFactory.createUnaryCallable(
setInstanceMachineTypeTransportSettings,
settings.setInstanceMachineTypeSettings(),
clientContext);
this.setInstanceMachineTypeOperationCallable =
callableFactory.createOperationCallable(
setInstanceMachineTypeTransportSettings,
settings.setInstanceMachineTypeOperationSettings(),
clientContext,
operationsStub);
this.setInstanceLabelsCallable =
callableFactory.createUnaryCallable(
setInstanceLabelsTransportSettings,
settings.setInstanceLabelsSettings(),
clientContext);
this.setInstanceLabelsOperationCallable =
callableFactory.createOperationCallable(
setInstanceLabelsTransportSettings,
settings.setInstanceLabelsOperationSettings(),
clientContext,
operationsStub);
this.deleteInstanceCallable =
callableFactory.createUnaryCallable(
deleteInstanceTransportSettings, settings.deleteInstanceSettings(), clientContext);
this.deleteInstanceOperationCallable =
callableFactory.createOperationCallable(
deleteInstanceTransportSettings,
settings.deleteInstanceOperationSettings(),
clientContext,
operationsStub);
this.startInstanceCallable =
callableFactory.createUnaryCallable(
startInstanceTransportSettings, settings.startInstanceSettings(), clientContext);
this.startInstanceOperationCallable =
callableFactory.createOperationCallable(
startInstanceTransportSettings,
settings.startInstanceOperationSettings(),
clientContext,
operationsStub);
this.stopInstanceCallable =
callableFactory.createUnaryCallable(
stopInstanceTransportSettings, settings.stopInstanceSettings(), clientContext);
this.stopInstanceOperationCallable =
callableFactory.createOperationCallable(
stopInstanceTransportSettings,
settings.stopInstanceOperationSettings(),
clientContext,
operationsStub);
this.resetInstanceCallable =
callableFactory.createUnaryCallable(
resetInstanceTransportSettings, settings.resetInstanceSettings(), clientContext);
this.resetInstanceOperationCallable =
callableFactory.createOperationCallable(
resetInstanceTransportSettings,
settings.resetInstanceOperationSettings(),
clientContext,
operationsStub);
this.reportInstanceInfoCallable =
callableFactory.createUnaryCallable(
reportInstanceInfoTransportSettings,
settings.reportInstanceInfoSettings(),
clientContext);
this.reportInstanceInfoOperationCallable =
callableFactory.createOperationCallable(
reportInstanceInfoTransportSettings,
settings.reportInstanceInfoOperationSettings(),
clientContext,
operationsStub);
this.isInstanceUpgradeableCallable =
callableFactory.createUnaryCallable(
isInstanceUpgradeableTransportSettings,
settings.isInstanceUpgradeableSettings(),
clientContext);
this.upgradeInstanceCallable =
callableFactory.createUnaryCallable(
upgradeInstanceTransportSettings, settings.upgradeInstanceSettings(), clientContext);
this.upgradeInstanceOperationCallable =
callableFactory.createOperationCallable(
upgradeInstanceTransportSettings,
settings.upgradeInstanceOperationSettings(),
clientContext,
operationsStub);
this.upgradeInstanceInternalCallable =
callableFactory.createUnaryCallable(
upgradeInstanceInternalTransportSettings,
settings.upgradeInstanceInternalSettings(),
clientContext);
this.upgradeInstanceInternalOperationCallable =
callableFactory.createOperationCallable(
upgradeInstanceInternalTransportSettings,
settings.upgradeInstanceInternalOperationSettings(),
clientContext,
operationsStub);
this.listEnvironmentsCallable =
callableFactory.createUnaryCallable(
listEnvironmentsTransportSettings, settings.listEnvironmentsSettings(), clientContext);
this.listEnvironmentsPagedCallable =
callableFactory.createPagedCallable(
listEnvironmentsTransportSettings, settings.listEnvironmentsSettings(), clientContext);
this.getEnvironmentCallable =
callableFactory.createUnaryCallable(
getEnvironmentTransportSettings, settings.getEnvironmentSettings(), clientContext);
this.createEnvironmentCallable =
callableFactory.createUnaryCallable(
createEnvironmentTransportSettings,
settings.createEnvironmentSettings(),
clientContext);
this.createEnvironmentOperationCallable =
callableFactory.createOperationCallable(
createEnvironmentTransportSettings,
settings.createEnvironmentOperationSettings(),
clientContext,
operationsStub);
this.deleteEnvironmentCallable =
callableFactory.createUnaryCallable(
deleteEnvironmentTransportSettings,
settings.deleteEnvironmentSettings(),
clientContext);
this.deleteEnvironmentOperationCallable =
callableFactory.createOperationCallable(
deleteEnvironmentTransportSettings,
settings.deleteEnvironmentOperationSettings(),
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.setIamPolicyCallable =
callableFactory.createUnaryCallable(
setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext);
this.getIamPolicyCallable =
callableFactory.createUnaryCallable(
getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext);
this.testIamPermissionsCallable =
callableFactory.createUnaryCallable(
testIamPermissionsTransportSettings,
settings.testIamPermissionsSettings(),
clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
@Override
public UnaryCallable listInstancesCallable() {
return listInstancesCallable;
}
@Override
public UnaryCallable
listInstancesPagedCallable() {
return listInstancesPagedCallable;
}
@Override
public UnaryCallable getInstanceCallable() {
return getInstanceCallable;
}
@Override
public UnaryCallable createInstanceCallable() {
return createInstanceCallable;
}
@Override
public OperationCallable
createInstanceOperationCallable() {
return createInstanceOperationCallable;
}
@Override
public UnaryCallable registerInstanceCallable() {
return registerInstanceCallable;
}
@Override
public OperationCallable
registerInstanceOperationCallable() {
return registerInstanceOperationCallable;
}
@Override
public UnaryCallable setInstanceAcceleratorCallable() {
return setInstanceAcceleratorCallable;
}
@Override
public OperationCallable
setInstanceAcceleratorOperationCallable() {
return setInstanceAcceleratorOperationCallable;
}
@Override
public UnaryCallable setInstanceMachineTypeCallable() {
return setInstanceMachineTypeCallable;
}
@Override
public OperationCallable
setInstanceMachineTypeOperationCallable() {
return setInstanceMachineTypeOperationCallable;
}
@Override
public UnaryCallable setInstanceLabelsCallable() {
return setInstanceLabelsCallable;
}
@Override
public OperationCallable
setInstanceLabelsOperationCallable() {
return setInstanceLabelsOperationCallable;
}
@Override
public UnaryCallable deleteInstanceCallable() {
return deleteInstanceCallable;
}
@Override
public OperationCallable
deleteInstanceOperationCallable() {
return deleteInstanceOperationCallable;
}
@Override
public UnaryCallable startInstanceCallable() {
return startInstanceCallable;
}
@Override
public OperationCallable
startInstanceOperationCallable() {
return startInstanceOperationCallable;
}
@Override
public UnaryCallable stopInstanceCallable() {
return stopInstanceCallable;
}
@Override
public OperationCallable
stopInstanceOperationCallable() {
return stopInstanceOperationCallable;
}
@Override
public UnaryCallable resetInstanceCallable() {
return resetInstanceCallable;
}
@Override
public OperationCallable
resetInstanceOperationCallable() {
return resetInstanceOperationCallable;
}
@Override
public UnaryCallable reportInstanceInfoCallable() {
return reportInstanceInfoCallable;
}
@Override
public OperationCallable
reportInstanceInfoOperationCallable() {
return reportInstanceInfoOperationCallable;
}
@Override
public UnaryCallable
isInstanceUpgradeableCallable() {
return isInstanceUpgradeableCallable;
}
@Override
public UnaryCallable upgradeInstanceCallable() {
return upgradeInstanceCallable;
}
@Override
public OperationCallable
upgradeInstanceOperationCallable() {
return upgradeInstanceOperationCallable;
}
@Override
public UnaryCallable
upgradeInstanceInternalCallable() {
return upgradeInstanceInternalCallable;
}
@Override
public OperationCallable
upgradeInstanceInternalOperationCallable() {
return upgradeInstanceInternalOperationCallable;
}
@Override
public UnaryCallable
listEnvironmentsCallable() {
return listEnvironmentsCallable;
}
@Override
public UnaryCallable
listEnvironmentsPagedCallable() {
return listEnvironmentsPagedCallable;
}
@Override
public UnaryCallable getEnvironmentCallable() {
return getEnvironmentCallable;
}
@Override
public UnaryCallable createEnvironmentCallable() {
return createEnvironmentCallable;
}
@Override
public OperationCallable
createEnvironmentOperationCallable() {
return createEnvironmentOperationCallable;
}
@Override
public UnaryCallable deleteEnvironmentCallable() {
return deleteEnvironmentCallable;
}
@Override
public OperationCallable
deleteEnvironmentOperationCallable() {
return deleteEnvironmentOperationCallable;
}
@Override
public UnaryCallable listLocationsCallable() {
return listLocationsCallable;
}
@Override
public UnaryCallable
listLocationsPagedCallable() {
return listLocationsPagedCallable;
}
@Override
public UnaryCallable getLocationCallable() {
return getLocationCallable;
}
@Override
public UnaryCallable setIamPolicyCallable() {
return setIamPolicyCallable;
}
@Override
public UnaryCallable getIamPolicyCallable() {
return getIamPolicyCallable;
}
@Override
public UnaryCallable
testIamPermissionsCallable() {
return testIamPermissionsCallable;
}
@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);
}
}