Google Cloud Spanner C++ Client  1.32.0
A C++ Client Library for Google Cloud Spanner
database_admin_stub.cc
Go to the documentation of this file.
1 // Copyright 2021 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 // Generated by the Codegen C++ plugin.
16 // If you make any local changes, they will be lost.
17 // source: google/spanner/admin/database/v1/spanner_database_admin.proto
18 
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>
24 #include <memory>
25 
26 namespace google {
27 namespace cloud {
28 namespace spanner_admin_internal {
29 inline namespace GOOGLE_CLOUD_CPP_GENERATED_NS {
30 
32 
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);
39  if (!status.ok()) {
41  }
42  return response;
43 }
44 
45 future<StatusOr<google::longrunning::Operation>>
48  std::unique_ptr<grpc::ClientContext> context,
49  google::spanner::admin::database::v1::CreateDatabaseRequest const&
50  request) {
51  return cq.MakeUnaryRpc(
52  [this](grpc::ClientContext* context,
53  google::spanner::admin::database::v1::CreateDatabaseRequest const&
54  request,
55  grpc::CompletionQueue* cq) {
56  return grpc_stub_->AsyncCreateDatabase(context, request, cq);
57  },
58  request, std::move(context));
59 }
60 
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);
67  if (!status.ok()) {
69  }
70  return response;
71 }
72 
73 future<StatusOr<google::longrunning::Operation>>
76  std::unique_ptr<grpc::ClientContext> context,
77  google::spanner::admin::database::v1::UpdateDatabaseDdlRequest const&
78  request) {
79  return cq.MakeUnaryRpc(
80  [this](
81  grpc::ClientContext* context,
82  google::spanner::admin::database::v1::UpdateDatabaseDdlRequest const&
83  request,
84  grpc::CompletionQueue* cq) {
85  return grpc_stub_->AsyncUpdateDatabaseDdl(context, request, cq);
86  },
87  request, std::move(context));
88 }
89 
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);
95  if (!status.ok()) {
97  }
99 }
100 
101 StatusOr<google::spanner::admin::database::v1::GetDatabaseDdlResponse>
103  grpc::ClientContext& client_context,
104  google::spanner::admin::database::v1::GetDatabaseDdlRequest const&
105  request) {
106  google::spanner::admin::database::v1::GetDatabaseDdlResponse response;
107  auto status = grpc_stub_->GetDatabaseDdl(&client_context, request, &response);
108  if (!status.ok()) {
110  }
111  return response;
112 }
113 
114 StatusOr<google::iam::v1::Policy> DefaultDatabaseAdminStub::SetIamPolicy(
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);
119  if (!status.ok()) {
121  }
122  return response;
123 }
124 
125 StatusOr<google::iam::v1::Policy> DefaultDatabaseAdminStub::GetIamPolicy(
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);
130  if (!status.ok()) {
132  }
133  return response;
134 }
135 
136 StatusOr<google::iam::v1::TestIamPermissionsResponse>
138  grpc::ClientContext& client_context,
139  google::iam::v1::TestIamPermissionsRequest const& request) {
140  google::iam::v1::TestIamPermissionsResponse response;
141  auto status =
142  grpc_stub_->TestIamPermissions(&client_context, request, &response);
143  if (!status.ok()) {
145  }
146  return response;
147 }
148 
149 future<StatusOr<google::longrunning::Operation>>
152  std::unique_ptr<grpc::ClientContext> context,
153  google::spanner::admin::database::v1::CreateBackupRequest const& request) {
154  return cq.MakeUnaryRpc(
155  [this](grpc::ClientContext* context,
156  google::spanner::admin::database::v1::CreateBackupRequest const&
157  request,
158  grpc::CompletionQueue* cq) {
159  return grpc_stub_->AsyncCreateBackup(context, request, cq);
160  },
161  request, std::move(context));
162 }
163 
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);
170  if (!status.ok()) {
172  }
173  return response;
174 }
175 
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);
182  if (!status.ok()) {
184  }
185  return response;
186 }
187 
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);
193  if (!status.ok()) {
195  }
197 }
198 
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);
205  if (!status.ok()) {
207  }
208  return response;
209 }
210 
211 future<StatusOr<google::longrunning::Operation>>
214  std::unique_ptr<grpc::ClientContext> context,
215  google::spanner::admin::database::v1::RestoreDatabaseRequest const&
216  request) {
217  return cq.MakeUnaryRpc(
218  [this](grpc::ClientContext* context,
219  google::spanner::admin::database::v1::RestoreDatabaseRequest const&
220  request,
221  grpc::CompletionQueue* cq) {
222  return grpc_stub_->AsyncRestoreDatabase(context, request, cq);
223  },
224  request, std::move(context));
225 }
226 
227 StatusOr<google::spanner::admin::database::v1::ListDatabaseOperationsResponse>
229  grpc::ClientContext& client_context,
230  google::spanner::admin::database::v1::ListDatabaseOperationsRequest const&
231  request) {
232  google::spanner::admin::database::v1::ListDatabaseOperationsResponse response;
233  auto status =
234  grpc_stub_->ListDatabaseOperations(&client_context, request, &response);
235  if (!status.ok()) {
237  }
238  return response;
239 }
240 
241 StatusOr<google::spanner::admin::database::v1::ListBackupOperationsResponse>
243  grpc::ClientContext& client_context,
244  google::spanner::admin::database::v1::ListBackupOperationsRequest const&
245  request) {
246  google::spanner::admin::database::v1::ListBackupOperationsResponse response;
247  auto status =
248  grpc_stub_->ListBackupOperations(&client_context, request, &response);
249  if (!status.ok()) {
251  }
252  return response;
253 }
254 
255 future<StatusOr<google::longrunning::Operation>>
258  std::unique_ptr<grpc::ClientContext> context,
259  google::longrunning::GetOperationRequest const& request) {
260  return cq.MakeUnaryRpc(
261  [this](grpc::ClientContext* context,
262  google::longrunning::GetOperationRequest const& request,
263  grpc::CompletionQueue* cq) {
264  return operations_->AsyncGetOperation(context, request, cq);
265  },
266  request, std::move(context));
267 }
268 
271  std::unique_ptr<grpc::ClientContext> context,
272  google::longrunning::CancelOperationRequest const& request) {
273  return cq
275  [this](grpc::ClientContext* context,
276  google::longrunning::CancelOperationRequest const& request,
277  grpc::CompletionQueue* cq) {
278  return operations_->AsyncCancelOperation(context, request, cq);
279  },
280  request, std::move(context))
281  .then([](future<StatusOr<google::protobuf::Empty>> f) {
282  return f.get().status();
283  });
284 }
285 
286 } // namespace GOOGLE_CLOUD_CPP_GENERATED_NS
287 } // namespace spanner_admin_internal
288 } // namespace cloud
289 } // namespace google