com.google.cloud.spanner.admin.instance.v1.stub.HttpJsonInstanceAdminStub 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.HttpRule;
import com.google.api.core.InternalApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.httpjson.ApiMethodDescriptor;
import com.google.api.gax.httpjson.HttpJsonCallSettings;
import com.google.api.gax.httpjson.HttpJsonOperationSnapshot;
import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
import com.google.api.gax.httpjson.ProtoMessageResponseParser;
import com.google.api.gax.httpjson.ProtoRestSerializer;
import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub;
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.common.collect.ImmutableMap;
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.protobuf.Empty;
import com.google.protobuf.TypeRegistry;
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 java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* REST 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 HttpJsonInstanceAdminStub extends InstanceAdminStub {
private static final TypeRegistry typeRegistry =
TypeRegistry.newBuilder()
.add(InstanceConfig.getDescriptor())
.add(CreateInstancePartitionMetadata.getDescriptor())
.add(UpdateInstancePartitionMetadata.getDescriptor())
.add(Instance.getDescriptor())
.add(InstancePartition.getDescriptor())
.add(CreateInstanceConfigMetadata.getDescriptor())
.add(UpdateInstanceMetadata.getDescriptor())
.add(CreateInstanceMetadata.getDescriptor())
.add(UpdateInstanceConfigMetadata.getDescriptor())
.build();
private static final ApiMethodDescriptor
listInstanceConfigsMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigs")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{parent=projects/*}/instanceConfigs",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListInstanceConfigsResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
getInstanceConfigMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/GetInstanceConfig")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{name=projects/*/instanceConfigs/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(InstanceConfig.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
createInstanceConfigMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/CreateInstanceConfig")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{parent=projects/*}/instanceConfigs",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearParent().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(CreateInstanceConfigRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
updateInstanceConfigMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstanceConfig")
.setHttpMethod("PATCH")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{instanceConfig.name=projects/*/instanceConfigs/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(
fields,
"instanceConfig.name",
request.getInstanceConfig().getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(UpdateInstanceConfigRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
deleteInstanceConfigMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstanceConfig")
.setHttpMethod("DELETE")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{name=projects/*/instanceConfigs/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "etag", request.getEtag());
serializer.putQueryParam(
fields, "validateOnly", request.getValidateOnly());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Empty.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor<
ListInstanceConfigOperationsRequest, ListInstanceConfigOperationsResponse>
listInstanceConfigOperationsMethodDescriptor =
ApiMethodDescriptor
.
newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigOperations")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{parent=projects/*}/instanceConfigOperations",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "filter", request.getFilter());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListInstanceConfigOperationsResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
listInstancesMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/ListInstances")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{parent=projects/*}/instances",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "filter", request.getFilter());
serializer.putQueryParam(
fields, "instanceDeadline", request.getInstanceDeadline());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListInstancesResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor<
ListInstancePartitionsRequest, ListInstancePartitionsResponse>
listInstancePartitionsMethodDescriptor =
ApiMethodDescriptor
.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitions")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{parent=projects/*/instances/*}/instancePartitions",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(
fields,
"instancePartitionDeadline",
request.getInstancePartitionDeadline());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(ListInstancePartitionsResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
getInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/GetInstance")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{name=projects/*/instances/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "fieldMask", request.getFieldMask());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Instance.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
createInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/CreateInstance")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{parent=projects/*}/instances",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearParent().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(CreateInstanceRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
updateInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstance")
.setHttpMethod("PATCH")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{instance.name=projects/*/instances/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(
fields, "instance.name", request.getInstance().getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(UpdateInstanceRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
deleteInstanceMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstance")
.setHttpMethod("DELETE")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{name=projects/*/instances/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Empty.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
setIamPolicyMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/SetIamPolicy")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{resource=projects/*/instances/*}:setIamPolicy",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "resource", request.getResource());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearResource().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Policy.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
getIamPolicyMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName("google.spanner.admin.instance.v1.InstanceAdmin/GetIamPolicy")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{resource=projects/*/instances/*}:getIamPolicy",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "resource", request.getResource());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearResource().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Policy.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
testIamPermissionsMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/TestIamPermissions")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{resource=projects/*/instances/*}:testIamPermissions",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "resource", request.getResource());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearResource().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
getInstancePartitionMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/GetInstancePartition")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{name=projects/*/instances/*/instancePartitions/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(InstancePartition.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
createInstancePartitionMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/CreateInstancePartition")
.setHttpMethod("POST")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{parent=projects/*/instances/*}/instancePartitions",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearParent().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(CreateInstancePartitionRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor
deleteInstancePartitionMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstancePartition")
.setHttpMethod("DELETE")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{name=projects/*/instances/*/instancePartitions/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "name", request.getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "etag", request.getEtag());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Empty.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.build();
private static final ApiMethodDescriptor
updateInstancePartitionMethodDescriptor =
ApiMethodDescriptor.newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstancePartition")
.setHttpMethod("PATCH")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{instancePartition.name=projects/*/instances/*/instancePartitions/*}",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(
fields,
"instancePartition.name",
request.getInstancePartition().getName());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(Operation.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.setOperationSnapshotFactory(
(UpdateInstancePartitionRequest request, Operation response) ->
HttpJsonOperationSnapshot.create(response))
.build();
private static final ApiMethodDescriptor<
ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse>
listInstancePartitionOperationsMethodDescriptor =
ApiMethodDescriptor
.
newBuilder()
.setFullMethodName(
"google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitionOperations")
.setHttpMethod("GET")
.setType(ApiMethodDescriptor.MethodType.UNARY)
.setRequestFormatter(
ProtoMessageRequestFormatter.newBuilder()
.setPath(
"/v1/{parent=projects/*/instances/*}/instancePartitionOperations",
request -> {
Map fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "parent", request.getParent());
return fields;
})
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
ProtoRestSerializer serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "filter", request.getFilter());
serializer.putQueryParam(
fields,
"instancePartitionDeadline",
request.getInstancePartitionDeadline());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
.build())
.setResponseParser(
ProtoMessageResponseParser.newBuilder()
.setDefaultInstance(
ListInstancePartitionOperationsResponse.getDefaultInstance())
.setDefaultTypeRegistry(typeRegistry)
.build())
.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 HttpJsonOperationsStub httpJsonOperationsStub;
private final HttpJsonStubCallableFactory callableFactory;
public static final HttpJsonInstanceAdminStub create(InstanceAdminStubSettings settings)
throws IOException {
return new HttpJsonInstanceAdminStub(settings, ClientContext.create(settings));
}
public static final HttpJsonInstanceAdminStub create(ClientContext clientContext)
throws IOException {
return new HttpJsonInstanceAdminStub(
InstanceAdminStubSettings.newHttpJsonBuilder().build(), clientContext);
}
public static final HttpJsonInstanceAdminStub create(
ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
return new HttpJsonInstanceAdminStub(
InstanceAdminStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
}
/**
* Constructs an instance of HttpJsonInstanceAdminStub, 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 HttpJsonInstanceAdminStub(
InstanceAdminStubSettings settings, ClientContext clientContext) throws IOException {
this(settings, clientContext, new HttpJsonInstanceAdminCallableFactory());
}
/**
* Constructs an instance of HttpJsonInstanceAdminStub, 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 HttpJsonInstanceAdminStub(
InstanceAdminStubSettings settings,
ClientContext clientContext,
HttpJsonStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.httpJsonOperationsStub =
HttpJsonOperationsStub.create(
clientContext,
callableFactory,
typeRegistry,
ImmutableMap.builder()
.put(
"google.longrunning.Operations.CancelOperation",
HttpRule.newBuilder()
.setPost(
"/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel")
.addAdditionalBindings(
HttpRule.newBuilder()
.setPost("/v1/{name=projects/*/instances/*/operations/*}:cancel")
.build())
.build())
.put(
"google.longrunning.Operations.DeleteOperation",
HttpRule.newBuilder()
.setDelete("/v1/{name=projects/*/instances/*/databases/*/operations/*}")
.addAdditionalBindings(
HttpRule.newBuilder()
.setDelete("/v1/{name=projects/*/instances/*/operations/*}")
.build())
.build())
.put(
"google.longrunning.Operations.GetOperation",
HttpRule.newBuilder()
.setGet("/v1/{name=projects/*/instances/*/databases/*/operations/*}")
.addAdditionalBindings(
HttpRule.newBuilder()
.setGet("/v1/{name=projects/*/instances/*/operations/*}")
.build())
.build())
.put(
"google.longrunning.Operations.ListOperations",
HttpRule.newBuilder()
.setGet("/v1/{name=projects/*/instances/*/databases/*/operations}")
.addAdditionalBindings(
HttpRule.newBuilder()
.setGet("/v1/{name=projects/*/instances/*/operations}")
.build())
.build())
.build());
HttpJsonCallSettings
listInstanceConfigsTransportSettings =
HttpJsonCallSettings
.newBuilder()
.setMethodDescriptor(listInstanceConfigsMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
HttpJsonCallSettings
getInstanceConfigTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(getInstanceConfigMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
HttpJsonCallSettings
createInstanceConfigTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(createInstanceConfigMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
HttpJsonCallSettings
updateInstanceConfigTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(updateInstanceConfigMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add(
"instance_config.name",
String.valueOf(request.getInstanceConfig().getName()));
return builder.build();
})
.build();
HttpJsonCallSettings deleteInstanceConfigTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(deleteInstanceConfigMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
HttpJsonCallSettings
listInstanceConfigOperationsTransportSettings =
HttpJsonCallSettings
.
newBuilder()
.setMethodDescriptor(listInstanceConfigOperationsMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
HttpJsonCallSettings
listInstancesTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(listInstancesMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
HttpJsonCallSettings
listInstancePartitionsTransportSettings =
HttpJsonCallSettings
.newBuilder()
.setMethodDescriptor(listInstancePartitionsMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
HttpJsonCallSettings getInstanceTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(getInstanceMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
HttpJsonCallSettings createInstanceTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(createInstanceMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
HttpJsonCallSettings updateInstanceTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(updateInstanceMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("instance.name", String.valueOf(request.getInstance().getName()));
return builder.build();
})
.build();
HttpJsonCallSettings deleteInstanceTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(deleteInstanceMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
HttpJsonCallSettings setIamPolicyTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(setIamPolicyMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
HttpJsonCallSettings getIamPolicyTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(getIamPolicyMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
HttpJsonCallSettings
testIamPermissionsTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(testIamPermissionsMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
HttpJsonCallSettings
getInstancePartitionTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(getInstancePartitionMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
HttpJsonCallSettings
createInstancePartitionTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(createInstancePartitionMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
HttpJsonCallSettings
deleteInstancePartitionTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(deleteInstancePartitionMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
HttpJsonCallSettings
updateInstancePartitionTransportSettings =
HttpJsonCallSettings.newBuilder()
.setMethodDescriptor(updateInstancePartitionMethodDescriptor)
.setTypeRegistry(typeRegistry)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add(
"instance_partition.name",
String.valueOf(request.getInstancePartition().getName()));
return builder.build();
})
.build();
HttpJsonCallSettings<
ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse>
listInstancePartitionOperationsTransportSettings =
HttpJsonCallSettings
.
newBuilder()
.setMethodDescriptor(listInstancePartitionOperationsMethodDescriptor)
.setTypeRegistry(typeRegistry)
.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,
httpJsonOperationsStub);
this.updateInstanceConfigCallable =
callableFactory.createUnaryCallable(
updateInstanceConfigTransportSettings,
settings.updateInstanceConfigSettings(),
clientContext);
this.updateInstanceConfigOperationCallable =
callableFactory.createOperationCallable(
updateInstanceConfigTransportSettings,
settings.updateInstanceConfigOperationSettings(),
clientContext,
httpJsonOperationsStub);
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,
httpJsonOperationsStub);
this.updateInstanceCallable =
callableFactory.createUnaryCallable(
updateInstanceTransportSettings, settings.updateInstanceSettings(), clientContext);
this.updateInstanceOperationCallable =
callableFactory.createOperationCallable(
updateInstanceTransportSettings,
settings.updateInstanceOperationSettings(),
clientContext,
httpJsonOperationsStub);
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,
httpJsonOperationsStub);
this.deleteInstancePartitionCallable =
callableFactory.createUnaryCallable(
deleteInstancePartitionTransportSettings,
settings.deleteInstancePartitionSettings(),
clientContext);
this.updateInstancePartitionCallable =
callableFactory.createUnaryCallable(
updateInstancePartitionTransportSettings,
settings.updateInstancePartitionSettings(),
clientContext);
this.updateInstancePartitionOperationCallable =
callableFactory.createOperationCallable(
updateInstancePartitionTransportSettings,
settings.updateInstancePartitionOperationSettings(),
clientContext,
httpJsonOperationsStub);
this.listInstancePartitionOperationsCallable =
callableFactory.createUnaryCallable(
listInstancePartitionOperationsTransportSettings,
settings.listInstancePartitionOperationsSettings(),
clientContext);
this.listInstancePartitionOperationsPagedCallable =
callableFactory.createPagedCallable(
listInstancePartitionOperationsTransportSettings,
settings.listInstancePartitionOperationsSettings(),
clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
@InternalApi
public static List getMethodDescriptors() {
List methodDescriptors = new ArrayList<>();
methodDescriptors.add(listInstanceConfigsMethodDescriptor);
methodDescriptors.add(getInstanceConfigMethodDescriptor);
methodDescriptors.add(createInstanceConfigMethodDescriptor);
methodDescriptors.add(updateInstanceConfigMethodDescriptor);
methodDescriptors.add(deleteInstanceConfigMethodDescriptor);
methodDescriptors.add(listInstanceConfigOperationsMethodDescriptor);
methodDescriptors.add(listInstancesMethodDescriptor);
methodDescriptors.add(listInstancePartitionsMethodDescriptor);
methodDescriptors.add(getInstanceMethodDescriptor);
methodDescriptors.add(createInstanceMethodDescriptor);
methodDescriptors.add(updateInstanceMethodDescriptor);
methodDescriptors.add(deleteInstanceMethodDescriptor);
methodDescriptors.add(setIamPolicyMethodDescriptor);
methodDescriptors.add(getIamPolicyMethodDescriptor);
methodDescriptors.add(testIamPermissionsMethodDescriptor);
methodDescriptors.add(getInstancePartitionMethodDescriptor);
methodDescriptors.add(createInstancePartitionMethodDescriptor);
methodDescriptors.add(deleteInstancePartitionMethodDescriptor);
methodDescriptors.add(updateInstancePartitionMethodDescriptor);
methodDescriptors.add(listInstancePartitionOperationsMethodDescriptor);
return methodDescriptors;
}
public HttpJsonOperationsStub getHttpJsonOperationsStub() {
return httpJsonOperationsStub;
}
@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);
}
}