com.google.cloud.spanner.admin.instance.v1.stub.GrpcInstanceAdminStub Maven / Gradle / Ivy
Show all versions of google-cloud-spanner 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.spanner.admin.instance.v1.stub;
import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigOperationsPagedResponse;
import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigsPagedResponse;
import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionOperationsPagedResponse;
import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionsPagedResponse;
import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancesPagedResponse;
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.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 com.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata;
import com.google.spanner.admin.instance.v1.CreateInstanceConfigRequest;
import com.google.spanner.admin.instance.v1.CreateInstanceMetadata;
import com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata;
import com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest;
import com.google.spanner.admin.instance.v1.CreateInstanceRequest;
import com.google.spanner.admin.instance.v1.DeleteInstanceConfigRequest;
import com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest;
import com.google.spanner.admin.instance.v1.DeleteInstanceRequest;
import com.google.spanner.admin.instance.v1.GetInstanceConfigRequest;
import com.google.spanner.admin.instance.v1.GetInstancePartitionRequest;
import com.google.spanner.admin.instance.v1.GetInstanceRequest;
import com.google.spanner.admin.instance.v1.Instance;
import com.google.spanner.admin.instance.v1.InstanceConfig;
import com.google.spanner.admin.instance.v1.InstancePartition;
import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest;
import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse;
import com.google.spanner.admin.instance.v1.ListInstanceConfigsRequest;
import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse;
import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest;
import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse;
import com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest;
import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse;
import com.google.spanner.admin.instance.v1.ListInstancesRequest;
import com.google.spanner.admin.instance.v1.ListInstancesResponse;
import com.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata;
import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest;
import com.google.spanner.admin.instance.v1.UpdateInstanceMetadata;
import com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata;
import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest;
import com.google.spanner.admin.instance.v1.UpdateInstanceRequest;
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 InstanceAdmin service API.
*
* This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
public class GrpcInstanceAdminStub extends InstanceAdminStub {
private static final MethodDescriptor
listInstanceConfigsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigs")
.setRequestMarshaller(
ProtoUtils.marshaller(ListInstanceConfigsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListInstanceConfigsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
getInstanceConfigMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/GetInstanceConfig")
.setRequestMarshaller(
ProtoUtils.marshaller(GetInstanceConfigRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(InstanceConfig.getDefaultInstance()))
.build();
private static final MethodDescriptor
createInstanceConfigMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/CreateInstanceConfig")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateInstanceConfigRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
updateInstanceConfigMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstanceConfig")
.setRequestMarshaller(
ProtoUtils.marshaller(UpdateInstanceConfigRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteInstanceConfigMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstanceConfig")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteInstanceConfigRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor<
ListInstanceConfigOperationsRequest, ListInstanceConfigOperationsResponse>
listInstanceConfigOperationsMethodDescriptor =
MethodDescriptor
.
newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigOperations")
.setRequestMarshaller(
ProtoUtils.marshaller(ListInstanceConfigOperationsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListInstanceConfigOperationsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
listInstancesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/ListInstances")
.setRequestMarshaller(
ProtoUtils.marshaller(ListInstancesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListInstancesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor<
ListInstancePartitionsRequest, ListInstancePartitionsResponse>
listInstancePartitionsMethodDescriptor =
MethodDescriptor
.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitions")
.setRequestMarshaller(
ProtoUtils.marshaller(ListInstancePartitionsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListInstancePartitionsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor getInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/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.spanner.admin.instance.v1.InstanceAdmin/CreateInstance")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
updateInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstance")
.setRequestMarshaller(
ProtoUtils.marshaller(UpdateInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstance")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteInstanceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor setIamPolicyMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/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.spanner.admin.instance.v1.InstanceAdmin/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.spanner.admin.instance.v1.InstanceAdmin/TestIamPermissions")
.setRequestMarshaller(
ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
getInstancePartitionMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/GetInstancePartition")
.setRequestMarshaller(
ProtoUtils.marshaller(GetInstancePartitionRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(InstancePartition.getDefaultInstance()))
.build();
private static final MethodDescriptor
createInstancePartitionMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/CreateInstancePartition")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateInstancePartitionRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteInstancePartitionMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstancePartition")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteInstancePartitionRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor
updateInstancePartitionMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstancePartition")
.setRequestMarshaller(
ProtoUtils.marshaller(UpdateInstancePartitionRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor<
ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse>
listInstancePartitionOperationsMethodDescriptor =
MethodDescriptor
.
newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitionOperations")
.setRequestMarshaller(
ProtoUtils.marshaller(
ListInstancePartitionOperationsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(
ListInstancePartitionOperationsResponse.getDefaultInstance()))
.build();
private final UnaryCallable
listInstanceConfigsCallable;
private final UnaryCallable
listInstanceConfigsPagedCallable;
private final UnaryCallable getInstanceConfigCallable;
private final UnaryCallable createInstanceConfigCallable;
private final OperationCallable<
CreateInstanceConfigRequest, InstanceConfig, CreateInstanceConfigMetadata>
createInstanceConfigOperationCallable;
private final UnaryCallable updateInstanceConfigCallable;
private final OperationCallable<
UpdateInstanceConfigRequest, InstanceConfig, UpdateInstanceConfigMetadata>
updateInstanceConfigOperationCallable;
private final UnaryCallable deleteInstanceConfigCallable;
private final UnaryCallable<
ListInstanceConfigOperationsRequest, ListInstanceConfigOperationsResponse>
listInstanceConfigOperationsCallable;
private final UnaryCallable<
ListInstanceConfigOperationsRequest, ListInstanceConfigOperationsPagedResponse>
listInstanceConfigOperationsPagedCallable;
private final UnaryCallable listInstancesCallable;
private final UnaryCallable
listInstancesPagedCallable;
private final UnaryCallable
listInstancePartitionsCallable;
private final UnaryCallable
listInstancePartitionsPagedCallable;
private final UnaryCallable getInstanceCallable;
private final UnaryCallable createInstanceCallable;
private final OperationCallable
createInstanceOperationCallable;
private final UnaryCallable updateInstanceCallable;
private final OperationCallable
updateInstanceOperationCallable;
private final UnaryCallable deleteInstanceCallable;
private final UnaryCallable setIamPolicyCallable;
private final UnaryCallable getIamPolicyCallable;
private final UnaryCallable
testIamPermissionsCallable;
private final UnaryCallable
getInstancePartitionCallable;
private final UnaryCallable
createInstancePartitionCallable;
private final OperationCallable<
CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata>
createInstancePartitionOperationCallable;
private final UnaryCallable
deleteInstancePartitionCallable;
private final UnaryCallable
updateInstancePartitionCallable;
private final OperationCallable<
UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata>
updateInstancePartitionOperationCallable;
private final UnaryCallable<
ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse>
listInstancePartitionOperationsCallable;
private final UnaryCallable<
ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsPagedResponse>
listInstancePartitionOperationsPagedCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcInstanceAdminStub create(InstanceAdminStubSettings settings)
throws IOException {
return new GrpcInstanceAdminStub(settings, ClientContext.create(settings));
}
public static final GrpcInstanceAdminStub create(ClientContext clientContext) throws IOException {
return new GrpcInstanceAdminStub(InstanceAdminStubSettings.newBuilder().build(), clientContext);
}
public static final GrpcInstanceAdminStub create(
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
return new GrpcInstanceAdminStub(
InstanceAdminStubSettings.newBuilder().build(), clientContext, callableFactory);
}
/**
* Constructs an instance of GrpcInstanceAdminStub, 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 GrpcInstanceAdminStub(InstanceAdminStubSettings settings, ClientContext clientContext)
throws IOException {
this(settings, clientContext, new GrpcInstanceAdminCallableFactory());
}
/**
* Constructs an instance of GrpcInstanceAdminStub, 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 GrpcInstanceAdminStub(
InstanceAdminStubSettings settings,
ClientContext clientContext,
GrpcStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
GrpcCallSettings
listInstanceConfigsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listInstanceConfigsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings getInstanceConfigTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getInstanceConfigMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings createInstanceConfigTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createInstanceConfigMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings updateInstanceConfigTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateInstanceConfigMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add(
"instance_config.name",
String.valueOf(request.getInstanceConfig().getName()));
return builder.build();
})
.build();
GrpcCallSettings deleteInstanceConfigTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteInstanceConfigMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
listInstanceConfigOperationsTransportSettings =
GrpcCallSettings
.
newBuilder()
.setMethodDescriptor(listInstanceConfigOperationsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings listInstancesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listInstancesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
listInstancePartitionsTransportSettings =
GrpcCallSettings
.newBuilder()
.setMethodDescriptor(listInstancePartitionsMethodDescriptor)
.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 updateInstanceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateInstanceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("instance.name", String.valueOf(request.getInstance().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 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();
GrpcCallSettings
getInstancePartitionTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getInstancePartitionMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
createInstancePartitionTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createInstancePartitionMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
deleteInstancePartitionTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteInstancePartitionMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
updateInstancePartitionTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateInstancePartitionMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add(
"instance_partition.name",
String.valueOf(request.getInstancePartition().getName()));
return builder.build();
})
.build();
GrpcCallSettings<
ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse>
listInstancePartitionOperationsTransportSettings =
GrpcCallSettings
.
newBuilder()
.setMethodDescriptor(listInstancePartitionOperationsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
this.listInstanceConfigsCallable =
callableFactory.createUnaryCallable(
listInstanceConfigsTransportSettings,
settings.listInstanceConfigsSettings(),
clientContext);
this.listInstanceConfigsPagedCallable =
callableFactory.createPagedCallable(
listInstanceConfigsTransportSettings,
settings.listInstanceConfigsSettings(),
clientContext);
this.getInstanceConfigCallable =
callableFactory.createUnaryCallable(
getInstanceConfigTransportSettings,
settings.getInstanceConfigSettings(),
clientContext);
this.createInstanceConfigCallable =
callableFactory.createUnaryCallable(
createInstanceConfigTransportSettings,
settings.createInstanceConfigSettings(),
clientContext);
this.createInstanceConfigOperationCallable =
callableFactory.createOperationCallable(
createInstanceConfigTransportSettings,
settings.createInstanceConfigOperationSettings(),
clientContext,
operationsStub);
this.updateInstanceConfigCallable =
callableFactory.createUnaryCallable(
updateInstanceConfigTransportSettings,
settings.updateInstanceConfigSettings(),
clientContext);
this.updateInstanceConfigOperationCallable =
callableFactory.createOperationCallable(
updateInstanceConfigTransportSettings,
settings.updateInstanceConfigOperationSettings(),
clientContext,
operationsStub);
this.deleteInstanceConfigCallable =
callableFactory.createUnaryCallable(
deleteInstanceConfigTransportSettings,
settings.deleteInstanceConfigSettings(),
clientContext);
this.listInstanceConfigOperationsCallable =
callableFactory.createUnaryCallable(
listInstanceConfigOperationsTransportSettings,
settings.listInstanceConfigOperationsSettings(),
clientContext);
this.listInstanceConfigOperationsPagedCallable =
callableFactory.createPagedCallable(
listInstanceConfigOperationsTransportSettings,
settings.listInstanceConfigOperationsSettings(),
clientContext);
this.listInstancesCallable =
callableFactory.createUnaryCallable(
listInstancesTransportSettings, settings.listInstancesSettings(), clientContext);
this.listInstancesPagedCallable =
callableFactory.createPagedCallable(
listInstancesTransportSettings, settings.listInstancesSettings(), clientContext);
this.listInstancePartitionsCallable =
callableFactory.createUnaryCallable(
listInstancePartitionsTransportSettings,
settings.listInstancePartitionsSettings(),
clientContext);
this.listInstancePartitionsPagedCallable =
callableFactory.createPagedCallable(
listInstancePartitionsTransportSettings,
settings.listInstancePartitionsSettings(),
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.updateInstanceCallable =
callableFactory.createUnaryCallable(
updateInstanceTransportSettings, settings.updateInstanceSettings(), clientContext);
this.updateInstanceOperationCallable =
callableFactory.createOperationCallable(
updateInstanceTransportSettings,
settings.updateInstanceOperationSettings(),
clientContext,
operationsStub);
this.deleteInstanceCallable =
callableFactory.createUnaryCallable(
deleteInstanceTransportSettings, settings.deleteInstanceSettings(), 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.getInstancePartitionCallable =
callableFactory.createUnaryCallable(
getInstancePartitionTransportSettings,
settings.getInstancePartitionSettings(),
clientContext);
this.createInstancePartitionCallable =
callableFactory.createUnaryCallable(
createInstancePartitionTransportSettings,
settings.createInstancePartitionSettings(),
clientContext);
this.createInstancePartitionOperationCallable =
callableFactory.createOperationCallable(
createInstancePartitionTransportSettings,
settings.createInstancePartitionOperationSettings(),
clientContext,
operationsStub);
this.deleteInstancePartitionCallable =
callableFactory.createUnaryCallable(
deleteInstancePartitionTransportSettings,
settings.deleteInstancePartitionSettings(),
clientContext);
this.updateInstancePartitionCallable =
callableFactory.createUnaryCallable(
updateInstancePartitionTransportSettings,
settings.updateInstancePartitionSettings(),
clientContext);
this.updateInstancePartitionOperationCallable =
callableFactory.createOperationCallable(
updateInstancePartitionTransportSettings,
settings.updateInstancePartitionOperationSettings(),
clientContext,
operationsStub);
this.listInstancePartitionOperationsCallable =
callableFactory.createUnaryCallable(
listInstancePartitionOperationsTransportSettings,
settings.listInstancePartitionOperationsSettings(),
clientContext);
this.listInstancePartitionOperationsPagedCallable =
callableFactory.createPagedCallable(
listInstancePartitionOperationsTransportSettings,
settings.listInstancePartitionOperationsSettings(),
clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
@Override
public UnaryCallable
listInstanceConfigsCallable() {
return listInstanceConfigsCallable;
}
@Override
public UnaryCallable
listInstanceConfigsPagedCallable() {
return listInstanceConfigsPagedCallable;
}
@Override
public UnaryCallable getInstanceConfigCallable() {
return getInstanceConfigCallable;
}
@Override
public UnaryCallable createInstanceConfigCallable() {
return createInstanceConfigCallable;
}
@Override
public OperationCallable<
CreateInstanceConfigRequest, InstanceConfig, CreateInstanceConfigMetadata>
createInstanceConfigOperationCallable() {
return createInstanceConfigOperationCallable;
}
@Override
public UnaryCallable updateInstanceConfigCallable() {
return updateInstanceConfigCallable;
}
@Override
public OperationCallable<
UpdateInstanceConfigRequest, InstanceConfig, UpdateInstanceConfigMetadata>
updateInstanceConfigOperationCallable() {
return updateInstanceConfigOperationCallable;
}
@Override
public UnaryCallable deleteInstanceConfigCallable() {
return deleteInstanceConfigCallable;
}
@Override
public UnaryCallable
listInstanceConfigOperationsCallable() {
return listInstanceConfigOperationsCallable;
}
@Override
public UnaryCallable<
ListInstanceConfigOperationsRequest, ListInstanceConfigOperationsPagedResponse>
listInstanceConfigOperationsPagedCallable() {
return listInstanceConfigOperationsPagedCallable;
}
@Override
public UnaryCallable listInstancesCallable() {
return listInstancesCallable;
}
@Override
public UnaryCallable
listInstancesPagedCallable() {
return listInstancesPagedCallable;
}
@Override
public UnaryCallable
listInstancePartitionsCallable() {
return listInstancePartitionsCallable;
}
@Override
public UnaryCallable
listInstancePartitionsPagedCallable() {
return listInstancePartitionsPagedCallable;
}
@Override
public UnaryCallable getInstanceCallable() {
return getInstanceCallable;
}
@Override
public UnaryCallable createInstanceCallable() {
return createInstanceCallable;
}
@Override
public OperationCallable
createInstanceOperationCallable() {
return createInstanceOperationCallable;
}
@Override
public UnaryCallable updateInstanceCallable() {
return updateInstanceCallable;
}
@Override
public OperationCallable
updateInstanceOperationCallable() {
return updateInstanceOperationCallable;
}
@Override
public UnaryCallable deleteInstanceCallable() {
return deleteInstanceCallable;
}
@Override
public UnaryCallable setIamPolicyCallable() {
return setIamPolicyCallable;
}
@Override
public UnaryCallable getIamPolicyCallable() {
return getIamPolicyCallable;
}
@Override
public UnaryCallable
testIamPermissionsCallable() {
return testIamPermissionsCallable;
}
@Override
public UnaryCallable
getInstancePartitionCallable() {
return getInstancePartitionCallable;
}
@Override
public UnaryCallable
createInstancePartitionCallable() {
return createInstancePartitionCallable;
}
@Override
public OperationCallable<
CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata>
createInstancePartitionOperationCallable() {
return createInstancePartitionOperationCallable;
}
@Override
public UnaryCallable deleteInstancePartitionCallable() {
return deleteInstancePartitionCallable;
}
@Override
public UnaryCallable
updateInstancePartitionCallable() {
return updateInstancePartitionCallable;
}
@Override
public OperationCallable<
UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata>
updateInstancePartitionOperationCallable() {
return updateInstancePartitionOperationCallable;
}
@Override
public UnaryCallable<
ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse>
listInstancePartitionOperationsCallable() {
return listInstancePartitionOperationsCallable;
}
@Override
public UnaryCallable<
ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsPagedResponse>
listInstancePartitionOperationsPagedCallable() {
return listInstancePartitionOperationsPagedCallable;
}
@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);
}
}