19 #include "google/cloud/spanner/admin/internal/database_admin_stub.h"
20 #include "google/cloud/grpc_error_delegate.h"
21 #include "google/cloud/status_or.h"
22 #include <google/longrunning/operations.grpc.pb.h>
23 #include <google/spanner/admin/database/v1/spanner_database_admin.grpc.pb.h>
33 StatusOr<
google::spanner::admin::database::v1::ListDatabasesResponse>
35 grpc::ClientContext& client_context,
36 google::spanner::admin::database::v1::ListDatabasesRequest
const& request) {
37 google::spanner::admin::database::v1::ListDatabasesResponse response;
38 auto status = grpc_stub_->ListDatabases(&client_context, request, &response);
48 std::unique_ptr<grpc::ClientContext> context,
49 google::spanner::admin::database::v1::CreateDatabaseRequest
const&
52 [
this](grpc::ClientContext* context,
53 google::spanner::admin::database::v1::CreateDatabaseRequest
const&
55 grpc::CompletionQueue* cq) {
56 return grpc_stub_->AsyncCreateDatabase(context, request, cq);
58 request
, std::move(context)
);
61 StatusOr<
google::spanner::admin::database::v1::Database>
63 grpc::ClientContext& client_context,
64 google::spanner::admin::database::v1::GetDatabaseRequest
const& request) {
65 google::spanner::admin::database::v1::Database response;
66 auto status = grpc_stub_->GetDatabase(&client_context, request, &response);
76 std::unique_ptr<grpc::ClientContext> context,
77 google::spanner::admin::database::v1::UpdateDatabaseDdlRequest
const&
81 grpc::ClientContext* context,
82 google::spanner::admin::database::v1::UpdateDatabaseDdlRequest
const&
84 grpc::CompletionQueue* cq) {
85 return grpc_stub_->AsyncUpdateDatabaseDdl(context, request, cq);
87 request
, std::move(context)
);
91 grpc::ClientContext& client_context,
92 google::spanner::admin::database::v1::DropDatabaseRequest
const& request) {
93 google::protobuf::Empty response;
94 auto status = grpc_stub_->DropDatabase(&client_context, request, &response);
101 StatusOr<
google::spanner::admin::database::v1::GetDatabaseDdlResponse>
103 grpc::ClientContext& client_context,
104 google::spanner::admin::database::v1::GetDatabaseDdlRequest
const&
106 google::spanner::admin::database::v1::GetDatabaseDdlResponse response;
107 auto status = grpc_stub_->GetDatabaseDdl(&client_context, request, &response);
115 grpc::ClientContext& client_context,
116 google::iam::v1::SetIamPolicyRequest
const& request) {
117 google::iam::v1::Policy response;
118 auto status = grpc_stub_->SetIamPolicy(&client_context, request, &response);
126 grpc::ClientContext& client_context,
127 google::iam::v1::GetIamPolicyRequest
const& request) {
128 google::iam::v1::Policy response;
129 auto status = grpc_stub_->GetIamPolicy(&client_context, request, &response);
136 StatusOr<
google::iam::v1::TestIamPermissionsResponse>
138 grpc::ClientContext& client_context,
139 google::iam::v1::TestIamPermissionsRequest
const& request) {
140 google::iam::v1::TestIamPermissionsResponse response;
142 grpc_stub_->TestIamPermissions(&client_context, request, &response);
152 std::unique_ptr<grpc::ClientContext> context,
153 google::spanner::admin::database::v1::CreateBackupRequest
const& request) {
155 [
this](grpc::ClientContext* context,
156 google::spanner::admin::database::v1::CreateBackupRequest
const&
158 grpc::CompletionQueue* cq) {
159 return grpc_stub_->AsyncCreateBackup(context, request, cq);
161 request
, std::move(context)
);
164 StatusOr<
google::spanner::admin::database::v1::Backup>
166 grpc::ClientContext& client_context,
167 google::spanner::admin::database::v1::GetBackupRequest
const& request) {
168 google::spanner::admin::database::v1::Backup response;
169 auto status = grpc_stub_->GetBackup(&client_context, request, &response);
176 StatusOr<
google::spanner::admin::database::v1::Backup>
178 grpc::ClientContext& client_context,
179 google::spanner::admin::database::v1::UpdateBackupRequest
const& request) {
180 google::spanner::admin::database::v1::Backup response;
181 auto status = grpc_stub_->UpdateBackup(&client_context, request, &response);
189 grpc::ClientContext& client_context,
190 google::spanner::admin::database::v1::DeleteBackupRequest
const& request) {
191 google::protobuf::Empty response;
192 auto status = grpc_stub_->DeleteBackup(&client_context, request, &response);
199 StatusOr<
google::spanner::admin::database::v1::ListBackupsResponse>
201 grpc::ClientContext& client_context,
202 google::spanner::admin::database::v1::ListBackupsRequest
const& request) {
203 google::spanner::admin::database::v1::ListBackupsResponse response;
204 auto status = grpc_stub_->ListBackups(&client_context, request, &response);
214 std::unique_ptr<grpc::ClientContext> context,
215 google::spanner::admin::database::v1::RestoreDatabaseRequest
const&
218 [
this](grpc::ClientContext* context,
219 google::spanner::admin::database::v1::RestoreDatabaseRequest
const&
221 grpc::CompletionQueue* cq) {
222 return grpc_stub_->AsyncRestoreDatabase(context, request, cq);
224 request
, std::move(context)
);
227 StatusOr<
google::spanner::admin::database::v1::ListDatabaseOperationsResponse>
229 grpc::ClientContext& client_context,
230 google::spanner::admin::database::v1::ListDatabaseOperationsRequest
const&
232 google::spanner::admin::database::v1::ListDatabaseOperationsResponse response;
234 grpc_stub_->ListDatabaseOperations(&client_context, request, &response);
241 StatusOr<
google::spanner::admin::database::v1::ListBackupOperationsResponse>
243 grpc::ClientContext& client_context,
244 google::spanner::admin::database::v1::ListBackupOperationsRequest
const&
246 google::spanner::admin::database::v1::ListBackupOperationsResponse response;
248 grpc_stub_->ListBackupOperations(&client_context, request, &response);
258 std::unique_ptr<grpc::ClientContext> context,
259 google::longrunning::GetOperationRequest
const& request) {
261 [
this](grpc::ClientContext* context,
262 google::longrunning::GetOperationRequest
const& request,
263 grpc::CompletionQueue* cq) {
264 return operations_->AsyncGetOperation(context, request, cq);
266 request
, std::move(context)
);
271 std::unique_ptr<grpc::ClientContext> context,
272 google::longrunning::CancelOperationRequest
const& request) {
275 [
this](grpc::ClientContext* context,
276 google::longrunning::CancelOperationRequest
const& request,
277 grpc::CompletionQueue* cq) {
278 return operations_->AsyncCancelOperation(context, request, cq);
280 request
, std::move(context)
)