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

com.google.cloud.spanner.admin.database.v1.stub.GrpcDatabaseAdminStub Maven / Gradle / Ivy

There is a newer version: 6.81.1
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.spanner.admin.database.v1.stub;

import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupOperationsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupSchedulesPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseOperationsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseRolesPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabasesPagedResponse;

import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
import com.google.spanner.admin.database.v1.BackupSchedule;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.GetBackupRequest;
import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseRolesRequest;
import com.google.spanner.admin.database.v1.ListDatabaseRolesResponse;
import com.google.spanner.admin.database.v1.ListDatabasesRequest;
import com.google.spanner.admin.database.v1.ListDatabasesResponse;
import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata;
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseRequest;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * gRPC stub implementation for the DatabaseAdmin service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") public class GrpcDatabaseAdminStub extends DatabaseAdminStub { private static final MethodDescriptor listDatabasesMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases") .setRequestMarshaller( ProtoUtils.marshaller(ListDatabasesRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListDatabasesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor createDatabaseMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/CreateDatabase") .setRequestMarshaller( ProtoUtils.marshaller(CreateDatabaseRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor getDatabaseMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase") .setRequestMarshaller(ProtoUtils.marshaller(GetDatabaseRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Database.getDefaultInstance())) .build(); private static final MethodDescriptor updateDatabaseMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabase") .setRequestMarshaller( ProtoUtils.marshaller(UpdateDatabaseRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor updateDatabaseDdlMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabaseDdl") .setRequestMarshaller( ProtoUtils.marshaller(UpdateDatabaseDdlRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor dropDatabaseMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/DropDatabase") .setRequestMarshaller(ProtoUtils.marshaller(DropDatabaseRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); private static final MethodDescriptor getDatabaseDdlMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/GetDatabaseDdl") .setRequestMarshaller( ProtoUtils.marshaller(GetDatabaseDdlRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(GetDatabaseDdlResponse.getDefaultInstance())) .build(); private static final MethodDescriptor setIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/SetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); private static final MethodDescriptor getIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); private static final MethodDescriptor testIamPermissionsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.spanner.admin.database.v1.DatabaseAdmin/TestIamPermissions") .setRequestMarshaller( ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor createBackupMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup") .setRequestMarshaller(ProtoUtils.marshaller(CreateBackupRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor copyBackupMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup") .setRequestMarshaller(ProtoUtils.marshaller(CopyBackupRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor getBackupMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/GetBackup") .setRequestMarshaller(ProtoUtils.marshaller(GetBackupRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Backup.getDefaultInstance())) .build(); private static final MethodDescriptor updateBackupMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackup") .setRequestMarshaller(ProtoUtils.marshaller(UpdateBackupRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Backup.getDefaultInstance())) .build(); private static final MethodDescriptor deleteBackupMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackup") .setRequestMarshaller(ProtoUtils.marshaller(DeleteBackupRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); private static final MethodDescriptor listBackupsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/ListBackups") .setRequestMarshaller(ProtoUtils.marshaller(ListBackupsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListBackupsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor restoreDatabaseMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase") .setRequestMarshaller( ProtoUtils.marshaller(RestoreDatabaseRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); private static final MethodDescriptor< ListDatabaseOperationsRequest, ListDatabaseOperationsResponse> listDatabaseOperationsMethodDescriptor = MethodDescriptor .newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseOperations") .setRequestMarshaller( ProtoUtils.marshaller(ListDatabaseOperationsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListDatabaseOperationsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor listBackupOperationsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.spanner.admin.database.v1.DatabaseAdmin/ListBackupOperations") .setRequestMarshaller( ProtoUtils.marshaller(ListBackupOperationsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListBackupOperationsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor listDatabaseRolesMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseRoles") .setRequestMarshaller( ProtoUtils.marshaller(ListDatabaseRolesRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListDatabaseRolesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor createBackupScheduleMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.spanner.admin.database.v1.DatabaseAdmin/CreateBackupSchedule") .setRequestMarshaller( ProtoUtils.marshaller(CreateBackupScheduleRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(BackupSchedule.getDefaultInstance())) .build(); private static final MethodDescriptor getBackupScheduleMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/GetBackupSchedule") .setRequestMarshaller( ProtoUtils.marshaller(GetBackupScheduleRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(BackupSchedule.getDefaultInstance())) .build(); private static final MethodDescriptor updateBackupScheduleMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackupSchedule") .setRequestMarshaller( ProtoUtils.marshaller(UpdateBackupScheduleRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(BackupSchedule.getDefaultInstance())) .build(); private static final MethodDescriptor deleteBackupScheduleMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackupSchedule") .setRequestMarshaller( ProtoUtils.marshaller(DeleteBackupScheduleRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); private static final MethodDescriptor listBackupSchedulesMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.spanner.admin.database.v1.DatabaseAdmin/ListBackupSchedules") .setRequestMarshaller( ProtoUtils.marshaller(ListBackupSchedulesRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListBackupSchedulesResponse.getDefaultInstance())) .build(); private final UnaryCallable listDatabasesCallable; private final UnaryCallable listDatabasesPagedCallable; private final UnaryCallable createDatabaseCallable; private final OperationCallable createDatabaseOperationCallable; private final UnaryCallable getDatabaseCallable; private final UnaryCallable updateDatabaseCallable; private final OperationCallable updateDatabaseOperationCallable; private final UnaryCallable updateDatabaseDdlCallable; private final OperationCallable updateDatabaseDdlOperationCallable; private final UnaryCallable dropDatabaseCallable; private final UnaryCallable getDatabaseDdlCallable; private final UnaryCallable setIamPolicyCallable; private final UnaryCallable getIamPolicyCallable; private final UnaryCallable testIamPermissionsCallable; private final UnaryCallable createBackupCallable; private final OperationCallable createBackupOperationCallable; private final UnaryCallable copyBackupCallable; private final OperationCallable copyBackupOperationCallable; private final UnaryCallable getBackupCallable; private final UnaryCallable updateBackupCallable; private final UnaryCallable deleteBackupCallable; private final UnaryCallable listBackupsCallable; private final UnaryCallable listBackupsPagedCallable; private final UnaryCallable restoreDatabaseCallable; private final OperationCallable restoreDatabaseOperationCallable; private final UnaryCallable listDatabaseOperationsCallable; private final UnaryCallable listDatabaseOperationsPagedCallable; private final UnaryCallable listBackupOperationsCallable; private final UnaryCallable listBackupOperationsPagedCallable; private final UnaryCallable listDatabaseRolesCallable; private final UnaryCallable listDatabaseRolesPagedCallable; private final UnaryCallable createBackupScheduleCallable; private final UnaryCallable getBackupScheduleCallable; private final UnaryCallable updateBackupScheduleCallable; private final UnaryCallable deleteBackupScheduleCallable; private final UnaryCallable listBackupSchedulesCallable; private final UnaryCallable listBackupSchedulesPagedCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcDatabaseAdminStub create(DatabaseAdminStubSettings settings) throws IOException { return new GrpcDatabaseAdminStub(settings, ClientContext.create(settings)); } public static final GrpcDatabaseAdminStub create(ClientContext clientContext) throws IOException { return new GrpcDatabaseAdminStub(DatabaseAdminStubSettings.newBuilder().build(), clientContext); } public static final GrpcDatabaseAdminStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcDatabaseAdminStub( DatabaseAdminStubSettings.newBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of GrpcDatabaseAdminStub, 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 GrpcDatabaseAdminStub(DatabaseAdminStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcDatabaseAdminCallableFactory()); } /** * Constructs an instance of GrpcDatabaseAdminStub, 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 GrpcDatabaseAdminStub( DatabaseAdminStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listDatabasesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listDatabasesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings createDatabaseTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createDatabaseMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getDatabaseTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getDatabaseMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateDatabaseTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateDatabaseMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("database.name", String.valueOf(request.getDatabase().getName())); return builder.build(); }) .build(); GrpcCallSettings updateDatabaseDdlTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateDatabaseDdlMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("database", String.valueOf(request.getDatabase())); return builder.build(); }) .build(); GrpcCallSettings dropDatabaseTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(dropDatabaseMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("database", String.valueOf(request.getDatabase())); return builder.build(); }) .build(); GrpcCallSettings getDatabaseDdlTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getDatabaseDdlMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("database", String.valueOf(request.getDatabase())); return builder.build(); }) .build(); GrpcCallSettings setIamPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(setIamPolicyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); GrpcCallSettings getIamPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getIamPolicyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); GrpcCallSettings testIamPermissionsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(testIamPermissionsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); GrpcCallSettings createBackupTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createBackupMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings copyBackupTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(copyBackupMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getBackupTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getBackupMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateBackupTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateBackupMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("backup.name", String.valueOf(request.getBackup().getName())); return builder.build(); }) .build(); GrpcCallSettings deleteBackupTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteBackupMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings listBackupsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listBackupsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings restoreDatabaseTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(restoreDatabaseMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings listDatabaseOperationsTransportSettings = GrpcCallSettings .newBuilder() .setMethodDescriptor(listDatabaseOperationsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings listBackupOperationsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listBackupOperationsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings listDatabaseRolesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listDatabaseRolesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings createBackupScheduleTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createBackupScheduleMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getBackupScheduleTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getBackupScheduleMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateBackupScheduleTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateBackupScheduleMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "backup_schedule.name", String.valueOf(request.getBackupSchedule().getName())); return builder.build(); }) .build(); GrpcCallSettings deleteBackupScheduleTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteBackupScheduleMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings listBackupSchedulesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listBackupSchedulesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); this.listDatabasesCallable = callableFactory.createUnaryCallable( listDatabasesTransportSettings, settings.listDatabasesSettings(), clientContext); this.listDatabasesPagedCallable = callableFactory.createPagedCallable( listDatabasesTransportSettings, settings.listDatabasesSettings(), clientContext); this.createDatabaseCallable = callableFactory.createUnaryCallable( createDatabaseTransportSettings, settings.createDatabaseSettings(), clientContext); this.createDatabaseOperationCallable = callableFactory.createOperationCallable( createDatabaseTransportSettings, settings.createDatabaseOperationSettings(), clientContext, operationsStub); this.getDatabaseCallable = callableFactory.createUnaryCallable( getDatabaseTransportSettings, settings.getDatabaseSettings(), clientContext); this.updateDatabaseCallable = callableFactory.createUnaryCallable( updateDatabaseTransportSettings, settings.updateDatabaseSettings(), clientContext); this.updateDatabaseOperationCallable = callableFactory.createOperationCallable( updateDatabaseTransportSettings, settings.updateDatabaseOperationSettings(), clientContext, operationsStub); this.updateDatabaseDdlCallable = callableFactory.createUnaryCallable( updateDatabaseDdlTransportSettings, settings.updateDatabaseDdlSettings(), clientContext); this.updateDatabaseDdlOperationCallable = callableFactory.createOperationCallable( updateDatabaseDdlTransportSettings, settings.updateDatabaseDdlOperationSettings(), clientContext, operationsStub); this.dropDatabaseCallable = callableFactory.createUnaryCallable( dropDatabaseTransportSettings, settings.dropDatabaseSettings(), clientContext); this.getDatabaseDdlCallable = callableFactory.createUnaryCallable( getDatabaseDdlTransportSettings, settings.getDatabaseDdlSettings(), 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.createBackupCallable = callableFactory.createUnaryCallable( createBackupTransportSettings, settings.createBackupSettings(), clientContext); this.createBackupOperationCallable = callableFactory.createOperationCallable( createBackupTransportSettings, settings.createBackupOperationSettings(), clientContext, operationsStub); this.copyBackupCallable = callableFactory.createUnaryCallable( copyBackupTransportSettings, settings.copyBackupSettings(), clientContext); this.copyBackupOperationCallable = callableFactory.createOperationCallable( copyBackupTransportSettings, settings.copyBackupOperationSettings(), clientContext, operationsStub); this.getBackupCallable = callableFactory.createUnaryCallable( getBackupTransportSettings, settings.getBackupSettings(), clientContext); this.updateBackupCallable = callableFactory.createUnaryCallable( updateBackupTransportSettings, settings.updateBackupSettings(), clientContext); this.deleteBackupCallable = callableFactory.createUnaryCallable( deleteBackupTransportSettings, settings.deleteBackupSettings(), clientContext); this.listBackupsCallable = callableFactory.createUnaryCallable( listBackupsTransportSettings, settings.listBackupsSettings(), clientContext); this.listBackupsPagedCallable = callableFactory.createPagedCallable( listBackupsTransportSettings, settings.listBackupsSettings(), clientContext); this.restoreDatabaseCallable = callableFactory.createUnaryCallable( restoreDatabaseTransportSettings, settings.restoreDatabaseSettings(), clientContext); this.restoreDatabaseOperationCallable = callableFactory.createOperationCallable( restoreDatabaseTransportSettings, settings.restoreDatabaseOperationSettings(), clientContext, operationsStub); this.listDatabaseOperationsCallable = callableFactory.createUnaryCallable( listDatabaseOperationsTransportSettings, settings.listDatabaseOperationsSettings(), clientContext); this.listDatabaseOperationsPagedCallable = callableFactory.createPagedCallable( listDatabaseOperationsTransportSettings, settings.listDatabaseOperationsSettings(), clientContext); this.listBackupOperationsCallable = callableFactory.createUnaryCallable( listBackupOperationsTransportSettings, settings.listBackupOperationsSettings(), clientContext); this.listBackupOperationsPagedCallable = callableFactory.createPagedCallable( listBackupOperationsTransportSettings, settings.listBackupOperationsSettings(), clientContext); this.listDatabaseRolesCallable = callableFactory.createUnaryCallable( listDatabaseRolesTransportSettings, settings.listDatabaseRolesSettings(), clientContext); this.listDatabaseRolesPagedCallable = callableFactory.createPagedCallable( listDatabaseRolesTransportSettings, settings.listDatabaseRolesSettings(), clientContext); this.createBackupScheduleCallable = callableFactory.createUnaryCallable( createBackupScheduleTransportSettings, settings.createBackupScheduleSettings(), clientContext); this.getBackupScheduleCallable = callableFactory.createUnaryCallable( getBackupScheduleTransportSettings, settings.getBackupScheduleSettings(), clientContext); this.updateBackupScheduleCallable = callableFactory.createUnaryCallable( updateBackupScheduleTransportSettings, settings.updateBackupScheduleSettings(), clientContext); this.deleteBackupScheduleCallable = callableFactory.createUnaryCallable( deleteBackupScheduleTransportSettings, settings.deleteBackupScheduleSettings(), clientContext); this.listBackupSchedulesCallable = callableFactory.createUnaryCallable( listBackupSchedulesTransportSettings, settings.listBackupSchedulesSettings(), clientContext); this.listBackupSchedulesPagedCallable = callableFactory.createPagedCallable( listBackupSchedulesTransportSettings, settings.listBackupSchedulesSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } public GrpcOperationsStub getOperationsStub() { return operationsStub; } @Override public UnaryCallable listDatabasesCallable() { return listDatabasesCallable; } @Override public UnaryCallable listDatabasesPagedCallable() { return listDatabasesPagedCallable; } @Override public UnaryCallable createDatabaseCallable() { return createDatabaseCallable; } @Override public OperationCallable createDatabaseOperationCallable() { return createDatabaseOperationCallable; } @Override public UnaryCallable getDatabaseCallable() { return getDatabaseCallable; } @Override public UnaryCallable updateDatabaseCallable() { return updateDatabaseCallable; } @Override public OperationCallable updateDatabaseOperationCallable() { return updateDatabaseOperationCallable; } @Override public UnaryCallable updateDatabaseDdlCallable() { return updateDatabaseDdlCallable; } @Override public OperationCallable updateDatabaseDdlOperationCallable() { return updateDatabaseDdlOperationCallable; } @Override public UnaryCallable dropDatabaseCallable() { return dropDatabaseCallable; } @Override public UnaryCallable getDatabaseDdlCallable() { return getDatabaseDdlCallable; } @Override public UnaryCallable setIamPolicyCallable() { return setIamPolicyCallable; } @Override public UnaryCallable getIamPolicyCallable() { return getIamPolicyCallable; } @Override public UnaryCallable testIamPermissionsCallable() { return testIamPermissionsCallable; } @Override public UnaryCallable createBackupCallable() { return createBackupCallable; } @Override public OperationCallable createBackupOperationCallable() { return createBackupOperationCallable; } @Override public UnaryCallable copyBackupCallable() { return copyBackupCallable; } @Override public OperationCallable copyBackupOperationCallable() { return copyBackupOperationCallable; } @Override public UnaryCallable getBackupCallable() { return getBackupCallable; } @Override public UnaryCallable updateBackupCallable() { return updateBackupCallable; } @Override public UnaryCallable deleteBackupCallable() { return deleteBackupCallable; } @Override public UnaryCallable listBackupsCallable() { return listBackupsCallable; } @Override public UnaryCallable listBackupsPagedCallable() { return listBackupsPagedCallable; } @Override public UnaryCallable restoreDatabaseCallable() { return restoreDatabaseCallable; } @Override public OperationCallable restoreDatabaseOperationCallable() { return restoreDatabaseOperationCallable; } @Override public UnaryCallable listDatabaseOperationsCallable() { return listDatabaseOperationsCallable; } @Override public UnaryCallable listDatabaseOperationsPagedCallable() { return listDatabaseOperationsPagedCallable; } @Override public UnaryCallable listBackupOperationsCallable() { return listBackupOperationsCallable; } @Override public UnaryCallable listBackupOperationsPagedCallable() { return listBackupOperationsPagedCallable; } @Override public UnaryCallable listDatabaseRolesCallable() { return listDatabaseRolesCallable; } @Override public UnaryCallable listDatabaseRolesPagedCallable() { return listDatabaseRolesPagedCallable; } @Override public UnaryCallable createBackupScheduleCallable() { return createBackupScheduleCallable; } @Override public UnaryCallable getBackupScheduleCallable() { return getBackupScheduleCallable; } @Override public UnaryCallable updateBackupScheduleCallable() { return updateBackupScheduleCallable; } @Override public UnaryCallable deleteBackupScheduleCallable() { return deleteBackupScheduleCallable; } @Override public UnaryCallable listBackupSchedulesCallable() { return listBackupSchedulesCallable; } @Override public UnaryCallable listBackupSchedulesPagedCallable() { return listBackupSchedulesPagedCallable; } @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