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

com.google.cloud.alloydb.v1beta.stub.HttpJsonAlloyDBAdminStub Maven / Gradle / Ivy

Go to download

AlloyDB AlloyDB is a fully managed, PostgreSQL-compatible database service with industry-leading performance, availability, and scale.

There is a newer version: 0.43.0
Show newest version
/*
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.alloydb.v1beta.stub;

import static com.google.cloud.alloydb.v1beta.AlloyDBAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.alloydb.v1beta.AlloyDBAdminClient.ListClustersPagedResponse;
import static com.google.cloud.alloydb.v1beta.AlloyDBAdminClient.ListDatabasesPagedResponse;
import static com.google.cloud.alloydb.v1beta.AlloyDBAdminClient.ListInstancesPagedResponse;
import static com.google.cloud.alloydb.v1beta.AlloyDBAdminClient.ListLocationsPagedResponse;
import static com.google.cloud.alloydb.v1beta.AlloyDBAdminClient.ListSupportedDatabaseFlagsPagedResponse;
import static com.google.cloud.alloydb.v1beta.AlloyDBAdminClient.ListUsersPagedResponse;

import com.google.api.HttpRule;
import com.google.api.core.BetaApi;
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.cloud.alloydb.v1beta.Backup;
import com.google.cloud.alloydb.v1beta.BatchCreateInstancesRequest;
import com.google.cloud.alloydb.v1beta.BatchCreateInstancesResponse;
import com.google.cloud.alloydb.v1beta.Cluster;
import com.google.cloud.alloydb.v1beta.ConnectionInfo;
import com.google.cloud.alloydb.v1beta.CreateBackupRequest;
import com.google.cloud.alloydb.v1beta.CreateClusterRequest;
import com.google.cloud.alloydb.v1beta.CreateInstanceRequest;
import com.google.cloud.alloydb.v1beta.CreateSecondaryClusterRequest;
import com.google.cloud.alloydb.v1beta.CreateSecondaryInstanceRequest;
import com.google.cloud.alloydb.v1beta.CreateUserRequest;
import com.google.cloud.alloydb.v1beta.DeleteBackupRequest;
import com.google.cloud.alloydb.v1beta.DeleteClusterRequest;
import com.google.cloud.alloydb.v1beta.DeleteInstanceRequest;
import com.google.cloud.alloydb.v1beta.DeleteUserRequest;
import com.google.cloud.alloydb.v1beta.FailoverInstanceRequest;
import com.google.cloud.alloydb.v1beta.GenerateClientCertificateRequest;
import com.google.cloud.alloydb.v1beta.GenerateClientCertificateResponse;
import com.google.cloud.alloydb.v1beta.GetBackupRequest;
import com.google.cloud.alloydb.v1beta.GetClusterRequest;
import com.google.cloud.alloydb.v1beta.GetConnectionInfoRequest;
import com.google.cloud.alloydb.v1beta.GetInstanceRequest;
import com.google.cloud.alloydb.v1beta.GetUserRequest;
import com.google.cloud.alloydb.v1beta.InjectFaultRequest;
import com.google.cloud.alloydb.v1beta.Instance;
import com.google.cloud.alloydb.v1beta.ListBackupsRequest;
import com.google.cloud.alloydb.v1beta.ListBackupsResponse;
import com.google.cloud.alloydb.v1beta.ListClustersRequest;
import com.google.cloud.alloydb.v1beta.ListClustersResponse;
import com.google.cloud.alloydb.v1beta.ListDatabasesRequest;
import com.google.cloud.alloydb.v1beta.ListDatabasesResponse;
import com.google.cloud.alloydb.v1beta.ListInstancesRequest;
import com.google.cloud.alloydb.v1beta.ListInstancesResponse;
import com.google.cloud.alloydb.v1beta.ListSupportedDatabaseFlagsRequest;
import com.google.cloud.alloydb.v1beta.ListSupportedDatabaseFlagsResponse;
import com.google.cloud.alloydb.v1beta.ListUsersRequest;
import com.google.cloud.alloydb.v1beta.ListUsersResponse;
import com.google.cloud.alloydb.v1beta.OperationMetadata;
import com.google.cloud.alloydb.v1beta.PromoteClusterRequest;
import com.google.cloud.alloydb.v1beta.RestartInstanceRequest;
import com.google.cloud.alloydb.v1beta.RestoreClusterRequest;
import com.google.cloud.alloydb.v1beta.UpdateBackupRequest;
import com.google.cloud.alloydb.v1beta.UpdateClusterRequest;
import com.google.cloud.alloydb.v1beta.UpdateInstanceRequest;
import com.google.cloud.alloydb.v1beta.UpdateUserRequest;
import com.google.cloud.alloydb.v1beta.User;
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.common.collect.ImmutableMap;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.protobuf.TypeRegistry;
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 AlloyDBAdmin service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @BetaApi @Generated("by gapic-generator-java") public class HttpJsonAlloyDBAdminStub extends AlloyDBAdminStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder() .add(Backup.getDescriptor()) .add(Empty.getDescriptor()) .add(OperationMetadata.getDescriptor()) .add(Cluster.getDescriptor()) .add(BatchCreateInstancesResponse.getDescriptor()) .add(Instance.getDescriptor()) .build(); private static final ApiMethodDescriptor listClustersMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/ListClusters") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*}/clusters", 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, "orderBy", request.getOrderBy()); 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(ListClustersResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getClusterMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/GetCluster") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*}", 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, "view", request.getViewValue()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Cluster.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createClusterMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/CreateCluster") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*}/clusters", 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, "clusterId", request.getClusterId()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("cluster", request.getCluster(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateClusterRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateClusterMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/UpdateCluster") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{cluster.name=projects/*/locations/*/clusters/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "cluster.name", request.getCluster().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "allowMissing", request.getAllowMissing()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("cluster", request.getCluster(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateClusterRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor deleteClusterMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/DeleteCluster") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*}", 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, "force", request.getForce()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteClusterRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor promoteClusterMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/PromoteCluster") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*}:promote", 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 -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (PromoteClusterRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor restoreClusterMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/RestoreCluster") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*}/clusters:restore", 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( (RestoreClusterRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor createSecondaryClusterMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/CreateSecondaryCluster") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*}/clusters:createsecondary", 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, "clusterId", request.getClusterId()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("cluster", request.getCluster(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateSecondaryClusterRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor listInstancesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/ListInstances") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*/clusters/*}/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, "orderBy", request.getOrderBy()); 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 getInstanceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/GetInstance") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*/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, "view", request.getViewValue()); 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.cloud.alloydb.v1beta.AlloyDBAdmin/CreateInstance") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*/clusters/*}/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, "instanceId", request.getInstanceId()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("instance", request.getInstance(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateInstanceRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor createSecondaryInstanceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/CreateSecondaryInstance") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*/clusters/*}/instances:createsecondary", 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, "instanceId", request.getInstanceId()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("instance", request.getInstance(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateSecondaryInstanceRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor batchCreateInstancesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/BatchCreateInstances") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*/clusters/*}/instances:batchCreate", 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, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("requests", request.getRequests(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (BatchCreateInstancesRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateInstanceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/UpdateInstance") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{instance.name=projects/*/locations/*/clusters/*/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, "allowMissing", request.getAllowMissing()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("instance", request.getInstance(), 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.cloud.alloydb.v1beta.AlloyDBAdmin/DeleteInstance") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*/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, "etag", request.getEtag()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteInstanceRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor failoverInstanceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/FailoverInstance") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*/instances/*}:failover", 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 -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (FailoverInstanceRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor injectFaultMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/InjectFault") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*/instances/*}:injectFault", 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 -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (InjectFaultRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor restartInstanceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/RestartInstance") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*/instances/*}:restart", 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 -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (RestartInstanceRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor listBackupsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/ListBackups") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*}/backups", 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, "orderBy", request.getOrderBy()); 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(ListBackupsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getBackupMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/GetBackup") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/backups/*}", 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(Backup.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createBackupMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/CreateBackup") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*}/backups", 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, "backupId", request.getBackupId()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("backup", request.getBackup(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateBackupRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateBackupMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/UpdateBackup") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{backup.name=projects/*/locations/*/backups/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "backup.name", request.getBackup().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "allowMissing", request.getAllowMissing()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("backup", request.getBackup(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateBackupRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor deleteBackupMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/DeleteBackup") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/backups/*}", 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, "requestId", request.getRequestId()); serializer.putQueryParam( fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteBackupRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor< ListSupportedDatabaseFlagsRequest, ListSupportedDatabaseFlagsResponse> listSupportedDatabaseFlagsMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName( "google.cloud.alloydb.v1beta.AlloyDBAdmin/ListSupportedDatabaseFlags") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*}/supportedDatabaseFlags", 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(ListSupportedDatabaseFlagsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor< GenerateClientCertificateRequest, GenerateClientCertificateResponse> generateClientCertificateMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName( "google.cloud.alloydb.v1beta.AlloyDBAdmin/GenerateClientCertificate") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*/clusters/*}:generateClientCertificate", 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(GenerateClientCertificateResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getConnectionInfoMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/GetConnectionInfo") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*/clusters/*/instances/*}/connectionInfo", 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, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ConnectionInfo.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listUsersMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/ListUsers") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*/clusters/*}/users", 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, "orderBy", request.getOrderBy()); 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(ListUsersResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getUserMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/GetUser") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*/users/*}", 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(User.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createUserMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/CreateUser") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*/clusters/*}/users", 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, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "userId", request.getUserId()); serializer.putQueryParam(fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create().toBody("user", request.getUser(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(User.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor updateUserMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/UpdateUser") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{user.name=projects/*/locations/*/clusters/*/users/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "user.name", request.getUser().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "allowMissing", request.getAllowMissing()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam(fields, "validateOnly", request.getValidateOnly()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create().toBody("user", request.getUser(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(User.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deleteUserMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/DeleteUser") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*/clusters/*/users/*}", 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, "requestId", request.getRequestId()); 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 listDatabasesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.alloydb.v1beta.AlloyDBAdmin/ListDatabases") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{parent=projects/*/locations/*/clusters/*}/databases", 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(ListDatabasesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listLocationsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.location.Locations/ListLocations") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*}/locations", 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(ListLocationsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getLocationMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.location.Locations/GetLocation") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta/{name=projects/*/locations/*}", 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(Location.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private final UnaryCallable listClustersCallable; private final UnaryCallable listClustersPagedCallable; private final UnaryCallable getClusterCallable; private final UnaryCallable createClusterCallable; private final OperationCallable createClusterOperationCallable; private final UnaryCallable updateClusterCallable; private final OperationCallable updateClusterOperationCallable; private final UnaryCallable deleteClusterCallable; private final OperationCallable deleteClusterOperationCallable; private final UnaryCallable promoteClusterCallable; private final OperationCallable promoteClusterOperationCallable; private final UnaryCallable restoreClusterCallable; private final OperationCallable restoreClusterOperationCallable; private final UnaryCallable createSecondaryClusterCallable; private final OperationCallable createSecondaryClusterOperationCallable; private final UnaryCallable listInstancesCallable; private final UnaryCallable listInstancesPagedCallable; private final UnaryCallable getInstanceCallable; private final UnaryCallable createInstanceCallable; private final OperationCallable createInstanceOperationCallable; private final UnaryCallable createSecondaryInstanceCallable; private final OperationCallable createSecondaryInstanceOperationCallable; private final UnaryCallable batchCreateInstancesCallable; private final OperationCallable< BatchCreateInstancesRequest, BatchCreateInstancesResponse, OperationMetadata> batchCreateInstancesOperationCallable; private final UnaryCallable updateInstanceCallable; private final OperationCallable updateInstanceOperationCallable; private final UnaryCallable deleteInstanceCallable; private final OperationCallable deleteInstanceOperationCallable; private final UnaryCallable failoverInstanceCallable; private final OperationCallable failoverInstanceOperationCallable; private final UnaryCallable injectFaultCallable; private final OperationCallable injectFaultOperationCallable; private final UnaryCallable restartInstanceCallable; private final OperationCallable restartInstanceOperationCallable; private final UnaryCallable listBackupsCallable; private final UnaryCallable listBackupsPagedCallable; private final UnaryCallable getBackupCallable; private final UnaryCallable createBackupCallable; private final OperationCallable createBackupOperationCallable; private final UnaryCallable updateBackupCallable; private final OperationCallable updateBackupOperationCallable; private final UnaryCallable deleteBackupCallable; private final OperationCallable deleteBackupOperationCallable; private final UnaryCallable listSupportedDatabaseFlagsCallable; private final UnaryCallable< ListSupportedDatabaseFlagsRequest, ListSupportedDatabaseFlagsPagedResponse> listSupportedDatabaseFlagsPagedCallable; private final UnaryCallable generateClientCertificateCallable; private final UnaryCallable getConnectionInfoCallable; private final UnaryCallable listUsersCallable; private final UnaryCallable listUsersPagedCallable; private final UnaryCallable getUserCallable; private final UnaryCallable createUserCallable; private final UnaryCallable updateUserCallable; private final UnaryCallable deleteUserCallable; private final UnaryCallable listDatabasesCallable; private final UnaryCallable listDatabasesPagedCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable listLocationsPagedCallable; private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; private final HttpJsonStubCallableFactory callableFactory; public static final HttpJsonAlloyDBAdminStub create(AlloyDBAdminStubSettings settings) throws IOException { return new HttpJsonAlloyDBAdminStub(settings, ClientContext.create(settings)); } public static final HttpJsonAlloyDBAdminStub create(ClientContext clientContext) throws IOException { return new HttpJsonAlloyDBAdminStub( AlloyDBAdminStubSettings.newHttpJsonBuilder().build(), clientContext); } public static final HttpJsonAlloyDBAdminStub create( ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { return new HttpJsonAlloyDBAdminStub( AlloyDBAdminStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of HttpJsonAlloyDBAdminStub, 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 HttpJsonAlloyDBAdminStub(AlloyDBAdminStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new HttpJsonAlloyDBAdminCallableFactory()); } /** * Constructs an instance of HttpJsonAlloyDBAdminStub, 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 HttpJsonAlloyDBAdminStub( AlloyDBAdminStubSettings 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("/v1beta/{name=projects/*/locations/*/operations/*}:cancel") .build()) .put( "google.longrunning.Operations.DeleteOperation", HttpRule.newBuilder() .setDelete("/v1beta/{name=projects/*/locations/*/operations/*}") .build()) .put( "google.longrunning.Operations.GetOperation", HttpRule.newBuilder() .setGet("/v1beta/{name=projects/*/locations/*/operations/*}") .build()) .put( "google.longrunning.Operations.ListOperations", HttpRule.newBuilder() .setGet("/v1beta/{name=projects/*/locations/*}/operations") .build()) .build()); HttpJsonCallSettings listClustersTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listClustersMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getClusterTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getClusterMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createClusterTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createClusterMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateClusterTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateClusterMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("cluster.name", String.valueOf(request.getCluster().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteClusterTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteClusterMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings promoteClusterTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(promoteClusterMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings restoreClusterTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(restoreClusterMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings createSecondaryClusterTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createSecondaryClusterMethodDescriptor) .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 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 createSecondaryInstanceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createSecondaryInstanceMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings batchCreateInstancesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(batchCreateInstancesMethodDescriptor) .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 failoverInstanceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(failoverInstanceMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings injectFaultTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(injectFaultMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings restartInstanceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(restartInstanceMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listBackupsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listBackupsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getBackupTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getBackupMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createBackupTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createBackupMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateBackupTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateBackupMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("backup.name", String.valueOf(request.getBackup().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteBackupTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteBackupMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listSupportedDatabaseFlagsTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(listSupportedDatabaseFlagsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings generateClientCertificateTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(generateClientCertificateMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getConnectionInfoTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getConnectionInfoMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listUsersTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listUsersMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getUserTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getUserMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createUserTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createUserMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateUserTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateUserMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("user.name", String.valueOf(request.getUser().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteUserTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteUserMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listDatabasesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listDatabasesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listLocationsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listLocationsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getLocationTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getLocationMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); this.listClustersCallable = callableFactory.createUnaryCallable( listClustersTransportSettings, settings.listClustersSettings(), clientContext); this.listClustersPagedCallable = callableFactory.createPagedCallable( listClustersTransportSettings, settings.listClustersSettings(), clientContext); this.getClusterCallable = callableFactory.createUnaryCallable( getClusterTransportSettings, settings.getClusterSettings(), clientContext); this.createClusterCallable = callableFactory.createUnaryCallable( createClusterTransportSettings, settings.createClusterSettings(), clientContext); this.createClusterOperationCallable = callableFactory.createOperationCallable( createClusterTransportSettings, settings.createClusterOperationSettings(), clientContext, httpJsonOperationsStub); this.updateClusterCallable = callableFactory.createUnaryCallable( updateClusterTransportSettings, settings.updateClusterSettings(), clientContext); this.updateClusterOperationCallable = callableFactory.createOperationCallable( updateClusterTransportSettings, settings.updateClusterOperationSettings(), clientContext, httpJsonOperationsStub); this.deleteClusterCallable = callableFactory.createUnaryCallable( deleteClusterTransportSettings, settings.deleteClusterSettings(), clientContext); this.deleteClusterOperationCallable = callableFactory.createOperationCallable( deleteClusterTransportSettings, settings.deleteClusterOperationSettings(), clientContext, httpJsonOperationsStub); this.promoteClusterCallable = callableFactory.createUnaryCallable( promoteClusterTransportSettings, settings.promoteClusterSettings(), clientContext); this.promoteClusterOperationCallable = callableFactory.createOperationCallable( promoteClusterTransportSettings, settings.promoteClusterOperationSettings(), clientContext, httpJsonOperationsStub); this.restoreClusterCallable = callableFactory.createUnaryCallable( restoreClusterTransportSettings, settings.restoreClusterSettings(), clientContext); this.restoreClusterOperationCallable = callableFactory.createOperationCallable( restoreClusterTransportSettings, settings.restoreClusterOperationSettings(), clientContext, httpJsonOperationsStub); this.createSecondaryClusterCallable = callableFactory.createUnaryCallable( createSecondaryClusterTransportSettings, settings.createSecondaryClusterSettings(), clientContext); this.createSecondaryClusterOperationCallable = callableFactory.createOperationCallable( createSecondaryClusterTransportSettings, settings.createSecondaryClusterOperationSettings(), clientContext, httpJsonOperationsStub); 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, httpJsonOperationsStub); this.createSecondaryInstanceCallable = callableFactory.createUnaryCallable( createSecondaryInstanceTransportSettings, settings.createSecondaryInstanceSettings(), clientContext); this.createSecondaryInstanceOperationCallable = callableFactory.createOperationCallable( createSecondaryInstanceTransportSettings, settings.createSecondaryInstanceOperationSettings(), clientContext, httpJsonOperationsStub); this.batchCreateInstancesCallable = callableFactory.createUnaryCallable( batchCreateInstancesTransportSettings, settings.batchCreateInstancesSettings(), clientContext); this.batchCreateInstancesOperationCallable = callableFactory.createOperationCallable( batchCreateInstancesTransportSettings, settings.batchCreateInstancesOperationSettings(), 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.deleteInstanceOperationCallable = callableFactory.createOperationCallable( deleteInstanceTransportSettings, settings.deleteInstanceOperationSettings(), clientContext, httpJsonOperationsStub); this.failoverInstanceCallable = callableFactory.createUnaryCallable( failoverInstanceTransportSettings, settings.failoverInstanceSettings(), clientContext); this.failoverInstanceOperationCallable = callableFactory.createOperationCallable( failoverInstanceTransportSettings, settings.failoverInstanceOperationSettings(), clientContext, httpJsonOperationsStub); this.injectFaultCallable = callableFactory.createUnaryCallable( injectFaultTransportSettings, settings.injectFaultSettings(), clientContext); this.injectFaultOperationCallable = callableFactory.createOperationCallable( injectFaultTransportSettings, settings.injectFaultOperationSettings(), clientContext, httpJsonOperationsStub); this.restartInstanceCallable = callableFactory.createUnaryCallable( restartInstanceTransportSettings, settings.restartInstanceSettings(), clientContext); this.restartInstanceOperationCallable = callableFactory.createOperationCallable( restartInstanceTransportSettings, settings.restartInstanceOperationSettings(), clientContext, httpJsonOperationsStub); this.listBackupsCallable = callableFactory.createUnaryCallable( listBackupsTransportSettings, settings.listBackupsSettings(), clientContext); this.listBackupsPagedCallable = callableFactory.createPagedCallable( listBackupsTransportSettings, settings.listBackupsSettings(), clientContext); this.getBackupCallable = callableFactory.createUnaryCallable( getBackupTransportSettings, settings.getBackupSettings(), clientContext); this.createBackupCallable = callableFactory.createUnaryCallable( createBackupTransportSettings, settings.createBackupSettings(), clientContext); this.createBackupOperationCallable = callableFactory.createOperationCallable( createBackupTransportSettings, settings.createBackupOperationSettings(), clientContext, httpJsonOperationsStub); this.updateBackupCallable = callableFactory.createUnaryCallable( updateBackupTransportSettings, settings.updateBackupSettings(), clientContext); this.updateBackupOperationCallable = callableFactory.createOperationCallable( updateBackupTransportSettings, settings.updateBackupOperationSettings(), clientContext, httpJsonOperationsStub); this.deleteBackupCallable = callableFactory.createUnaryCallable( deleteBackupTransportSettings, settings.deleteBackupSettings(), clientContext); this.deleteBackupOperationCallable = callableFactory.createOperationCallable( deleteBackupTransportSettings, settings.deleteBackupOperationSettings(), clientContext, httpJsonOperationsStub); this.listSupportedDatabaseFlagsCallable = callableFactory.createUnaryCallable( listSupportedDatabaseFlagsTransportSettings, settings.listSupportedDatabaseFlagsSettings(), clientContext); this.listSupportedDatabaseFlagsPagedCallable = callableFactory.createPagedCallable( listSupportedDatabaseFlagsTransportSettings, settings.listSupportedDatabaseFlagsSettings(), clientContext); this.generateClientCertificateCallable = callableFactory.createUnaryCallable( generateClientCertificateTransportSettings, settings.generateClientCertificateSettings(), clientContext); this.getConnectionInfoCallable = callableFactory.createUnaryCallable( getConnectionInfoTransportSettings, settings.getConnectionInfoSettings(), clientContext); this.listUsersCallable = callableFactory.createUnaryCallable( listUsersTransportSettings, settings.listUsersSettings(), clientContext); this.listUsersPagedCallable = callableFactory.createPagedCallable( listUsersTransportSettings, settings.listUsersSettings(), clientContext); this.getUserCallable = callableFactory.createUnaryCallable( getUserTransportSettings, settings.getUserSettings(), clientContext); this.createUserCallable = callableFactory.createUnaryCallable( createUserTransportSettings, settings.createUserSettings(), clientContext); this.updateUserCallable = callableFactory.createUnaryCallable( updateUserTransportSettings, settings.updateUserSettings(), clientContext); this.deleteUserCallable = callableFactory.createUnaryCallable( deleteUserTransportSettings, settings.deleteUserSettings(), clientContext); this.listDatabasesCallable = callableFactory.createUnaryCallable( listDatabasesTransportSettings, settings.listDatabasesSettings(), clientContext); this.listDatabasesPagedCallable = callableFactory.createPagedCallable( listDatabasesTransportSettings, settings.listDatabasesSettings(), clientContext); this.listLocationsCallable = callableFactory.createUnaryCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.listLocationsPagedCallable = callableFactory.createPagedCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.getLocationCallable = callableFactory.createUnaryCallable( getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @InternalApi public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(listClustersMethodDescriptor); methodDescriptors.add(getClusterMethodDescriptor); methodDescriptors.add(createClusterMethodDescriptor); methodDescriptors.add(updateClusterMethodDescriptor); methodDescriptors.add(deleteClusterMethodDescriptor); methodDescriptors.add(promoteClusterMethodDescriptor); methodDescriptors.add(restoreClusterMethodDescriptor); methodDescriptors.add(createSecondaryClusterMethodDescriptor); methodDescriptors.add(listInstancesMethodDescriptor); methodDescriptors.add(getInstanceMethodDescriptor); methodDescriptors.add(createInstanceMethodDescriptor); methodDescriptors.add(createSecondaryInstanceMethodDescriptor); methodDescriptors.add(batchCreateInstancesMethodDescriptor); methodDescriptors.add(updateInstanceMethodDescriptor); methodDescriptors.add(deleteInstanceMethodDescriptor); methodDescriptors.add(failoverInstanceMethodDescriptor); methodDescriptors.add(injectFaultMethodDescriptor); methodDescriptors.add(restartInstanceMethodDescriptor); methodDescriptors.add(listBackupsMethodDescriptor); methodDescriptors.add(getBackupMethodDescriptor); methodDescriptors.add(createBackupMethodDescriptor); methodDescriptors.add(updateBackupMethodDescriptor); methodDescriptors.add(deleteBackupMethodDescriptor); methodDescriptors.add(listSupportedDatabaseFlagsMethodDescriptor); methodDescriptors.add(generateClientCertificateMethodDescriptor); methodDescriptors.add(getConnectionInfoMethodDescriptor); methodDescriptors.add(listUsersMethodDescriptor); methodDescriptors.add(getUserMethodDescriptor); methodDescriptors.add(createUserMethodDescriptor); methodDescriptors.add(updateUserMethodDescriptor); methodDescriptors.add(deleteUserMethodDescriptor); methodDescriptors.add(listDatabasesMethodDescriptor); methodDescriptors.add(listLocationsMethodDescriptor); methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } public HttpJsonOperationsStub getHttpJsonOperationsStub() { return httpJsonOperationsStub; } @Override public UnaryCallable listClustersCallable() { return listClustersCallable; } @Override public UnaryCallable listClustersPagedCallable() { return listClustersPagedCallable; } @Override public UnaryCallable getClusterCallable() { return getClusterCallable; } @Override public UnaryCallable createClusterCallable() { return createClusterCallable; } @Override public OperationCallable createClusterOperationCallable() { return createClusterOperationCallable; } @Override public UnaryCallable updateClusterCallable() { return updateClusterCallable; } @Override public OperationCallable updateClusterOperationCallable() { return updateClusterOperationCallable; } @Override public UnaryCallable deleteClusterCallable() { return deleteClusterCallable; } @Override public OperationCallable deleteClusterOperationCallable() { return deleteClusterOperationCallable; } @Override public UnaryCallable promoteClusterCallable() { return promoteClusterCallable; } @Override public OperationCallable promoteClusterOperationCallable() { return promoteClusterOperationCallable; } @Override public UnaryCallable restoreClusterCallable() { return restoreClusterCallable; } @Override public OperationCallable restoreClusterOperationCallable() { return restoreClusterOperationCallable; } @Override public UnaryCallable createSecondaryClusterCallable() { return createSecondaryClusterCallable; } @Override public OperationCallable createSecondaryClusterOperationCallable() { return createSecondaryClusterOperationCallable; } @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 createSecondaryInstanceCallable() { return createSecondaryInstanceCallable; } @Override public OperationCallable createSecondaryInstanceOperationCallable() { return createSecondaryInstanceOperationCallable; } @Override public UnaryCallable batchCreateInstancesCallable() { return batchCreateInstancesCallable; } @Override public OperationCallable< BatchCreateInstancesRequest, BatchCreateInstancesResponse, OperationMetadata> batchCreateInstancesOperationCallable() { return batchCreateInstancesOperationCallable; } @Override public UnaryCallable updateInstanceCallable() { return updateInstanceCallable; } @Override public OperationCallable updateInstanceOperationCallable() { return updateInstanceOperationCallable; } @Override public UnaryCallable deleteInstanceCallable() { return deleteInstanceCallable; } @Override public OperationCallable deleteInstanceOperationCallable() { return deleteInstanceOperationCallable; } @Override public UnaryCallable failoverInstanceCallable() { return failoverInstanceCallable; } @Override public OperationCallable failoverInstanceOperationCallable() { return failoverInstanceOperationCallable; } @Override public UnaryCallable injectFaultCallable() { return injectFaultCallable; } @Override public OperationCallable injectFaultOperationCallable() { return injectFaultOperationCallable; } @Override public UnaryCallable restartInstanceCallable() { return restartInstanceCallable; } @Override public OperationCallable restartInstanceOperationCallable() { return restartInstanceOperationCallable; } @Override public UnaryCallable listBackupsCallable() { return listBackupsCallable; } @Override public UnaryCallable listBackupsPagedCallable() { return listBackupsPagedCallable; } @Override public UnaryCallable getBackupCallable() { return getBackupCallable; } @Override public UnaryCallable createBackupCallable() { return createBackupCallable; } @Override public OperationCallable createBackupOperationCallable() { return createBackupOperationCallable; } @Override public UnaryCallable updateBackupCallable() { return updateBackupCallable; } @Override public OperationCallable updateBackupOperationCallable() { return updateBackupOperationCallable; } @Override public UnaryCallable deleteBackupCallable() { return deleteBackupCallable; } @Override public OperationCallable deleteBackupOperationCallable() { return deleteBackupOperationCallable; } @Override public UnaryCallable listSupportedDatabaseFlagsCallable() { return listSupportedDatabaseFlagsCallable; } @Override public UnaryCallable listSupportedDatabaseFlagsPagedCallable() { return listSupportedDatabaseFlagsPagedCallable; } @Override public UnaryCallable generateClientCertificateCallable() { return generateClientCertificateCallable; } @Override public UnaryCallable getConnectionInfoCallable() { return getConnectionInfoCallable; } @Override public UnaryCallable listUsersCallable() { return listUsersCallable; } @Override public UnaryCallable listUsersPagedCallable() { return listUsersPagedCallable; } @Override public UnaryCallable getUserCallable() { return getUserCallable; } @Override public UnaryCallable createUserCallable() { return createUserCallable; } @Override public UnaryCallable updateUserCallable() { return updateUserCallable; } @Override public UnaryCallable deleteUserCallable() { return deleteUserCallable; } @Override public UnaryCallable listDatabasesCallable() { return listDatabasesCallable; } @Override public UnaryCallable listDatabasesPagedCallable() { return listDatabasesPagedCallable; } @Override public UnaryCallable listLocationsCallable() { return listLocationsCallable; } @Override public UnaryCallable listLocationsPagedCallable() { return listLocationsPagedCallable; } @Override public UnaryCallable getLocationCallable() { return getLocationCallable; } @Override public final void close() { try { backgroundResources.close(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Failed to close resource", e); } } @Override public void shutdown() { backgroundResources.shutdown(); } @Override public boolean isShutdown() { return backgroundResources.isShutdown(); } @Override public boolean isTerminated() { return backgroundResources.isTerminated(); } @Override public void shutdownNow() { backgroundResources.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return backgroundResources.awaitTermination(duration, unit); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy