Google Cloud Spanner C++ Client  1.32.0
A C++ Client Library for Google Cloud Spanner
database_admin_connection.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/database_admin_connection.h"
20 #include "google/cloud/spanner/admin/database_admin_options.h"
21 #include "google/cloud/spanner/admin/internal/database_admin_option_defaults.h"
22 #include "google/cloud/spanner/admin/internal/database_admin_stub_factory.h"
23 #include "google/cloud/background_threads.h"
24 #include "google/cloud/grpc_options.h"
25 #include "google/cloud/internal/async_long_running_operation.h"
26 #include "google/cloud/internal/pagination_range.h"
27 #include "google/cloud/internal/retry_loop.h"
28 #include <memory>
29 
30 namespace google {
31 namespace cloud {
32 namespace spanner_admin {
33 inline namespace GOOGLE_CLOUD_CPP_GENERATED_NS {
34 
36 
37 StreamRange<google::spanner::admin::database::v1::Database>
39  google::spanner::admin::database::v1::ListDatabasesRequest request) {
40  return google::cloud::internal::MakePaginationRange<
41  StreamRange<google::spanner::admin::database::v1::Database>>(
42  std::move(request),
43  [](google::spanner::admin::database::v1::ListDatabasesRequest const&) {
44  return StatusOr<
45  google::spanner::admin::database::v1::ListDatabasesResponse>{};
46  },
47  [](google::spanner::admin::database::v1::ListDatabasesResponse const&) {
48  return std::vector<google::spanner::admin::database::v1::Database>();
49  });
50 }
51 
52 future<StatusOr<google::spanner::admin::database::v1::Database>>
54  google::spanner::admin::database::v1::CreateDatabaseRequest const&) {
56  StatusOr<google::spanner::admin::database::v1::Database>>(
57  Status(StatusCode::kUnimplemented, "not implemented"));
58 }
59 
60 StatusOr<google::spanner::admin::database::v1::Database>
62  google::spanner::admin::database::v1::GetDatabaseRequest const&) {
63  return Status(StatusCode::kUnimplemented, "not implemented");
64 }
65 
66 future<
67  StatusOr<google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>>
69  google::spanner::admin::database::v1::UpdateDatabaseDdlRequest const&) {
71  google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>>(
72  Status(StatusCode::kUnimplemented, "not implemented"));
73 }
74 
76  google::spanner::admin::database::v1::DropDatabaseRequest const&) {
77  return Status(StatusCode::kUnimplemented, "not implemented");
78 }
79 
80 StatusOr<google::spanner::admin::database::v1::GetDatabaseDdlResponse>
82  google::spanner::admin::database::v1::GetDatabaseDdlRequest const&) {
83  return Status(StatusCode::kUnimplemented, "not implemented");
84 }
85 
86 StatusOr<google::iam::v1::Policy> DatabaseAdminConnection::SetIamPolicy(
87  google::iam::v1::SetIamPolicyRequest const&) {
88  return Status(StatusCode::kUnimplemented, "not implemented");
89 }
90 
91 StatusOr<google::iam::v1::Policy> DatabaseAdminConnection::GetIamPolicy(
92  google::iam::v1::GetIamPolicyRequest const&) {
93  return Status(StatusCode::kUnimplemented, "not implemented");
94 }
95 
96 StatusOr<google::iam::v1::TestIamPermissionsResponse>
98  google::iam::v1::TestIamPermissionsRequest const&) {
99  return Status(StatusCode::kUnimplemented, "not implemented");
100 }
101 
102 future<StatusOr<google::spanner::admin::database::v1::Backup>>
104  google::spanner::admin::database::v1::CreateBackupRequest const&) {
106  StatusOr<google::spanner::admin::database::v1::Backup>>(
107  Status(StatusCode::kUnimplemented, "not implemented"));
108 }
109 
110 StatusOr<google::spanner::admin::database::v1::Backup>
112  google::spanner::admin::database::v1::GetBackupRequest const&) {
113  return Status(StatusCode::kUnimplemented, "not implemented");
114 }
115 
116 StatusOr<google::spanner::admin::database::v1::Backup>
118  google::spanner::admin::database::v1::UpdateBackupRequest const&) {
119  return Status(StatusCode::kUnimplemented, "not implemented");
120 }
121 
123  google::spanner::admin::database::v1::DeleteBackupRequest const&) {
124  return Status(StatusCode::kUnimplemented, "not implemented");
125 }
126 
127 StreamRange<google::spanner::admin::database::v1::Backup>
129  google::spanner::admin::database::v1::ListBackupsRequest request) {
130  return google::cloud::internal::MakePaginationRange<
131  StreamRange<google::spanner::admin::database::v1::Backup>>(
132  std::move(request),
133  [](google::spanner::admin::database::v1::ListBackupsRequest const&) {
134  return StatusOr<
135  google::spanner::admin::database::v1::ListBackupsResponse>{};
136  },
137  [](google::spanner::admin::database::v1::ListBackupsResponse const&) {
138  return std::vector<google::spanner::admin::database::v1::Backup>();
139  });
140 }
141 
142 future<StatusOr<google::spanner::admin::database::v1::Database>>
144  google::spanner::admin::database::v1::RestoreDatabaseRequest const&) {
146  StatusOr<google::spanner::admin::database::v1::Database>>(
147  Status(StatusCode::kUnimplemented, "not implemented"));
148 }
149 
150 StreamRange<google::longrunning::Operation>
152  google::spanner::admin::database::v1::ListDatabaseOperationsRequest
153  request) {
154  return google::cloud::internal::MakePaginationRange<
155  StreamRange<google::longrunning::Operation>>(
156  std::move(request),
157  [](google::spanner::admin::database::v1::
158  ListDatabaseOperationsRequest const&) {
159  return StatusOr<google::spanner::admin::database::v1::
160  ListDatabaseOperationsResponse>{};
161  },
162  [](google::spanner::admin::database::v1::
163  ListDatabaseOperationsResponse const&) {
164  return std::vector<google::longrunning::Operation>();
165  });
166 }
167 
168 StreamRange<google::longrunning::Operation>
170  google::spanner::admin::database::v1::ListBackupOperationsRequest request) {
171  return google::cloud::internal::MakePaginationRange<
172  StreamRange<google::longrunning::Operation>>(
173  std::move(request),
174  [](google::spanner::admin::database::v1::
175  ListBackupOperationsRequest const&) {
176  return StatusOr<google::spanner::admin::database::v1::
177  ListBackupOperationsResponse>{};
178  },
179  [](google::spanner::admin::database::v1::
180  ListBackupOperationsResponse const&) {
181  return std::vector<google::longrunning::Operation>();
182  });
183 }
184 
185 namespace {
186 class DatabaseAdminConnectionImpl : public DatabaseAdminConnection {
187  public:
188  DatabaseAdminConnectionImpl(
189  std::unique_ptr<google::cloud::BackgroundThreads> background,
190  std::shared_ptr<spanner_admin_internal::DatabaseAdminStub> stub,
191  Options const& options)
192  : background_(std::move(background)),
193  stub_(std::move(stub)),
194  retry_policy_prototype_(
196  backoff_policy_prototype_(
198  polling_policy_prototype_(
200  idempotency_policy_(
202  ->clone()) {}
203 
204  ~DatabaseAdminConnectionImpl() override = default;
205 
206  StreamRange<google::spanner::admin::database::v1::Database> ListDatabases(
207  google::spanner::admin::database::v1::ListDatabasesRequest request)
208  override {
209  request.clear_page_token();
210  auto stub = stub_;
211  auto retry = std::shared_ptr<DatabaseAdminRetryPolicy const>(
212  retry_policy_prototype_->clone());
213  auto backoff = std::shared_ptr<BackoffPolicy const>(
214  backoff_policy_prototype_->clone());
215  auto idempotency = idempotency_policy_->ListDatabases(request);
216  char const* function_name = __func__;
217  return google::cloud::internal::MakePaginationRange<
218  StreamRange<google::spanner::admin::database::v1::Database>>(
219  std::move(request),
220  [stub, retry, backoff, idempotency, function_name](
221  google::spanner::admin::database::v1::ListDatabasesRequest const&
222  r) {
223  return google::cloud::internal::RetryLoop(
224  retry->clone(), backoff->clone(), idempotency,
225  [stub](grpc::ClientContext& context,
226  google::spanner::admin::database::v1::
227  ListDatabasesRequest const& request) {
228  return stub->ListDatabases(context, request);
229  },
230  r, function_name);
231  },
232  [](google::spanner::admin::database::v1::ListDatabasesResponse r) {
233  std::vector<google::spanner::admin::database::v1::Database> result(
234  r.databases().size());
235  auto& messages = *r.mutable_databases();
236  std::move(messages.begin(), messages.end(), result.begin());
237  return result;
238  });
239  }
240 
241  future<StatusOr<google::spanner::admin::database::v1::Database>>
242  CreateDatabase(
243  google::spanner::admin::database::v1::CreateDatabaseRequest const&
244  request) override {
245  auto stub = stub_;
246  return google::cloud::internal::AsyncLongRunningOperation<
247  google::spanner::admin::database::v1::Database>(
248  background_->cq(), request,
249  [stub](
251  std::unique_ptr<grpc::ClientContext> context,
252  google::spanner::admin::database::v1::CreateDatabaseRequest const&
253  request) {
254  return stub->AsyncCreateDatabase(cq, std::move(context), request);
255  },
256  [stub](google::cloud::CompletionQueue& cq,
257  std::unique_ptr<grpc::ClientContext> context,
258  google::longrunning::GetOperationRequest const& request) {
259  return stub->AsyncGetOperation(cq, std::move(context), request);
260  },
261  [stub](google::cloud::CompletionQueue& cq,
262  std::unique_ptr<grpc::ClientContext> context,
263  google::longrunning::CancelOperationRequest const& request) {
264  return stub->AsyncCancelOperation(cq, std::move(context), request);
265  },
266  &google::cloud::internal::ExtractLongRunningResultResponse<
267  google::spanner::admin::database::v1::Database>,
268  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
269  idempotency_policy_->CreateDatabase(request),
270  polling_policy_prototype_->clone(), __func__);
271  }
272 
273  StatusOr<google::spanner::admin::database::v1::Database> GetDatabase(
274  google::spanner::admin::database::v1::GetDatabaseRequest const& request)
275  override {
276  return google::cloud::internal::RetryLoop(
277  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
278  idempotency_policy_->GetDatabase(request),
279  [this](grpc::ClientContext& context,
280  google::spanner::admin::database::v1::GetDatabaseRequest const&
281  request) { return stub_->GetDatabase(context, request); },
282  request, __func__);
283  }
284 
285  future<
286  StatusOr<google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>>
287  UpdateDatabaseDdl(
288  google::spanner::admin::database::v1::UpdateDatabaseDdlRequest const&
289  request) override {
290  auto stub = stub_;
291  return google::cloud::internal::AsyncLongRunningOperation<
292  google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>(
293  background_->cq(), request,
294  [stub](google::cloud::CompletionQueue& cq,
295  std::unique_ptr<grpc::ClientContext> context,
296  google::spanner::admin::database::v1::
297  UpdateDatabaseDdlRequest const& request) {
298  return stub->AsyncUpdateDatabaseDdl(cq, std::move(context), request);
299  },
300  [stub](google::cloud::CompletionQueue& cq,
301  std::unique_ptr<grpc::ClientContext> context,
302  google::longrunning::GetOperationRequest const& request) {
303  return stub->AsyncGetOperation(cq, std::move(context), request);
304  },
305  [stub](google::cloud::CompletionQueue& cq,
306  std::unique_ptr<grpc::ClientContext> context,
307  google::longrunning::CancelOperationRequest const& request) {
308  return stub->AsyncCancelOperation(cq, std::move(context), request);
309  },
310  &google::cloud::internal::ExtractLongRunningResultMetadata<
311  google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>,
312  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
313  idempotency_policy_->UpdateDatabaseDdl(request),
314  polling_policy_prototype_->clone(), __func__);
315  }
316 
317  Status DropDatabase(
318  google::spanner::admin::database::v1::DropDatabaseRequest const& request)
319  override {
320  return google::cloud::internal::RetryLoop(
321  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
322  idempotency_policy_->DropDatabase(request),
323  [this](grpc::ClientContext& context,
324  google::spanner::admin::database::v1::DropDatabaseRequest const&
325  request) { return stub_->DropDatabase(context, request); },
326  request, __func__);
327  }
328 
329  StatusOr<google::spanner::admin::database::v1::GetDatabaseDdlResponse>
330  GetDatabaseDdl(
331  google::spanner::admin::database::v1::GetDatabaseDdlRequest const&
332  request) override {
333  return google::cloud::internal::RetryLoop(
334  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
335  idempotency_policy_->GetDatabaseDdl(request),
336  [this](
337  grpc::ClientContext& context,
338  google::spanner::admin::database::v1::GetDatabaseDdlRequest const&
339  request) { return stub_->GetDatabaseDdl(context, request); },
340  request, __func__);
341  }
342 
343  StatusOr<google::iam::v1::Policy> SetIamPolicy(
344  google::iam::v1::SetIamPolicyRequest const& request) override {
345  return google::cloud::internal::RetryLoop(
346  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
347  idempotency_policy_->SetIamPolicy(request),
348  [this](grpc::ClientContext& context,
349  google::iam::v1::SetIamPolicyRequest const& request) {
350  return stub_->SetIamPolicy(context, request);
351  },
352  request, __func__);
353  }
354 
355  StatusOr<google::iam::v1::Policy> GetIamPolicy(
356  google::iam::v1::GetIamPolicyRequest const& request) override {
357  return google::cloud::internal::RetryLoop(
358  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
359  idempotency_policy_->GetIamPolicy(request),
360  [this](grpc::ClientContext& context,
361  google::iam::v1::GetIamPolicyRequest const& request) {
362  return stub_->GetIamPolicy(context, request);
363  },
364  request, __func__);
365  }
366 
367  StatusOr<google::iam::v1::TestIamPermissionsResponse> TestIamPermissions(
368  google::iam::v1::TestIamPermissionsRequest const& request) override {
369  return google::cloud::internal::RetryLoop(
370  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
371  idempotency_policy_->TestIamPermissions(request),
372  [this](grpc::ClientContext& context,
373  google::iam::v1::TestIamPermissionsRequest const& request) {
374  return stub_->TestIamPermissions(context, request);
375  },
376  request, __func__);
377  }
378 
379  future<StatusOr<google::spanner::admin::database::v1::Backup>> CreateBackup(
380  google::spanner::admin::database::v1::CreateBackupRequest const& request)
381  override {
382  auto stub = stub_;
383  return google::cloud::internal::AsyncLongRunningOperation<
384  google::spanner::admin::database::v1::Backup>(
385  background_->cq(), request,
386  [stub](google::cloud::CompletionQueue& cq,
387  std::unique_ptr<grpc::ClientContext> context,
388  google::spanner::admin::database::v1::CreateBackupRequest const&
389  request) {
390  return stub->AsyncCreateBackup(cq, std::move(context), request);
391  },
392  [stub](google::cloud::CompletionQueue& cq,
393  std::unique_ptr<grpc::ClientContext> context,
394  google::longrunning::GetOperationRequest const& request) {
395  return stub->AsyncGetOperation(cq, std::move(context), request);
396  },
397  [stub](google::cloud::CompletionQueue& cq,
398  std::unique_ptr<grpc::ClientContext> context,
399  google::longrunning::CancelOperationRequest const& request) {
400  return stub->AsyncCancelOperation(cq, std::move(context), request);
401  },
402  &google::cloud::internal::ExtractLongRunningResultResponse<
403  google::spanner::admin::database::v1::Backup>,
404  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
405  idempotency_policy_->CreateBackup(request),
406  polling_policy_prototype_->clone(), __func__);
407  }
408 
409  StatusOr<google::spanner::admin::database::v1::Backup> GetBackup(
410  google::spanner::admin::database::v1::GetBackupRequest const& request)
411  override {
412  return google::cloud::internal::RetryLoop(
413  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
414  idempotency_policy_->GetBackup(request),
415  [this](grpc::ClientContext& context,
416  google::spanner::admin::database::v1::GetBackupRequest const&
417  request) { return stub_->GetBackup(context, request); },
418  request, __func__);
419  }
420 
421  StatusOr<google::spanner::admin::database::v1::Backup> UpdateBackup(
422  google::spanner::admin::database::v1::UpdateBackupRequest const& request)
423  override {
424  return google::cloud::internal::RetryLoop(
425  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
426  idempotency_policy_->UpdateBackup(request),
427  [this](grpc::ClientContext& context,
428  google::spanner::admin::database::v1::UpdateBackupRequest const&
429  request) { return stub_->UpdateBackup(context, request); },
430  request, __func__);
431  }
432 
433  Status DeleteBackup(
434  google::spanner::admin::database::v1::DeleteBackupRequest const& request)
435  override {
436  return google::cloud::internal::RetryLoop(
437  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
438  idempotency_policy_->DeleteBackup(request),
439  [this](grpc::ClientContext& context,
440  google::spanner::admin::database::v1::DeleteBackupRequest const&
441  request) { return stub_->DeleteBackup(context, request); },
442  request, __func__);
443  }
444 
445  StreamRange<google::spanner::admin::database::v1::Backup> ListBackups(
446  google::spanner::admin::database::v1::ListBackupsRequest request)
447  override {
448  request.clear_page_token();
449  auto stub = stub_;
450  auto retry = std::shared_ptr<DatabaseAdminRetryPolicy const>(
451  retry_policy_prototype_->clone());
452  auto backoff = std::shared_ptr<BackoffPolicy const>(
453  backoff_policy_prototype_->clone());
454  auto idempotency = idempotency_policy_->ListBackups(request);
455  char const* function_name = __func__;
456  return google::cloud::internal::MakePaginationRange<
457  StreamRange<google::spanner::admin::database::v1::Backup>>(
458  std::move(request),
459  [stub, retry, backoff, idempotency, function_name](
460  google::spanner::admin::database::v1::ListBackupsRequest const& r) {
461  return google::cloud::internal::RetryLoop(
462  retry->clone(), backoff->clone(), idempotency,
463  [stub](grpc::ClientContext& context,
464  google::spanner::admin::database::v1::
465  ListBackupsRequest const& request) {
466  return stub->ListBackups(context, request);
467  },
468  r, function_name);
469  },
470  [](google::spanner::admin::database::v1::ListBackupsResponse r) {
471  std::vector<google::spanner::admin::database::v1::Backup> result(
472  r.backups().size());
473  auto& messages = *r.mutable_backups();
474  std::move(messages.begin(), messages.end(), result.begin());
475  return result;
476  });
477  }
478 
479  future<StatusOr<google::spanner::admin::database::v1::Database>>
480  RestoreDatabase(
481  google::spanner::admin::database::v1::RestoreDatabaseRequest const&
482  request) override {
483  auto stub = stub_;
484  return google::cloud::internal::AsyncLongRunningOperation<
485  google::spanner::admin::database::v1::Database>(
486  background_->cq(), request,
487  [stub](
489  std::unique_ptr<grpc::ClientContext> context,
490  google::spanner::admin::database::v1::RestoreDatabaseRequest const&
491  request) {
492  return stub->AsyncRestoreDatabase(cq, std::move(context), request);
493  },
494  [stub](google::cloud::CompletionQueue& cq,
495  std::unique_ptr<grpc::ClientContext> context,
496  google::longrunning::GetOperationRequest const& request) {
497  return stub->AsyncGetOperation(cq, std::move(context), request);
498  },
499  [stub](google::cloud::CompletionQueue& cq,
500  std::unique_ptr<grpc::ClientContext> context,
501  google::longrunning::CancelOperationRequest const& request) {
502  return stub->AsyncCancelOperation(cq, std::move(context), request);
503  },
504  &google::cloud::internal::ExtractLongRunningResultResponse<
505  google::spanner::admin::database::v1::Database>,
506  retry_policy_prototype_->clone(), backoff_policy_prototype_->clone(),
507  idempotency_policy_->RestoreDatabase(request),
508  polling_policy_prototype_->clone(), __func__);
509  }
510 
511  StreamRange<google::longrunning::Operation> ListDatabaseOperations(
512  google::spanner::admin::database::v1::ListDatabaseOperationsRequest
513  request) override {
514  request.clear_page_token();
515  auto stub = stub_;
516  auto retry = std::shared_ptr<DatabaseAdminRetryPolicy const>(
517  retry_policy_prototype_->clone());
518  auto backoff = std::shared_ptr<BackoffPolicy const>(
519  backoff_policy_prototype_->clone());
520  auto idempotency = idempotency_policy_->ListDatabaseOperations(request);
521  char const* function_name = __func__;
522  return google::cloud::internal::MakePaginationRange<
523  StreamRange<google::longrunning::Operation>>(
524  std::move(request),
525  [stub, retry, backoff, idempotency,
526  function_name](google::spanner::admin::database::v1::
527  ListDatabaseOperationsRequest const& r) {
528  return google::cloud::internal::RetryLoop(
529  retry->clone(), backoff->clone(), idempotency,
530  [stub](grpc::ClientContext& context,
531  google::spanner::admin::database::v1::
532  ListDatabaseOperationsRequest const& request) {
533  return stub->ListDatabaseOperations(context, request);
534  },
535  r, function_name);
536  },
537  [](google::spanner::admin::database::v1::ListDatabaseOperationsResponse
538  r) {
539  std::vector<google::longrunning::Operation> result(
540  r.operations().size());
541  auto& messages = *r.mutable_operations();
542  std::move(messages.begin(), messages.end(), result.begin());
543  return result;
544  });
545  }
546 
547  StreamRange<google::longrunning::Operation> ListBackupOperations(
548  google::spanner::admin::database::v1::ListBackupOperationsRequest request)
549  override {
550  request.clear_page_token();
551  auto stub = stub_;
552  auto retry = std::shared_ptr<DatabaseAdminRetryPolicy const>(
553  retry_policy_prototype_->clone());
554  auto backoff = std::shared_ptr<BackoffPolicy const>(
555  backoff_policy_prototype_->clone());
556  auto idempotency = idempotency_policy_->ListBackupOperations(request);
557  char const* function_name = __func__;
558  return google::cloud::internal::MakePaginationRange<
559  StreamRange<google::longrunning::Operation>>(
560  std::move(request),
561  [stub, retry, backoff, idempotency,
562  function_name](google::spanner::admin::database::v1::
563  ListBackupOperationsRequest const& r) {
564  return google::cloud::internal::RetryLoop(
565  retry->clone(), backoff->clone(), idempotency,
566  [stub](grpc::ClientContext& context,
567  google::spanner::admin::database::v1::
568  ListBackupOperationsRequest const& request) {
569  return stub->ListBackupOperations(context, request);
570  },
571  r, function_name);
572  },
573  [](google::spanner::admin::database::v1::ListBackupOperationsResponse
574  r) {
575  std::vector<google::longrunning::Operation> result(
576  r.operations().size());
577  auto& messages = *r.mutable_operations();
578  std::move(messages.begin(), messages.end(), result.begin());
579  return result;
580  });
581  }
582 
583  private:
584  std::unique_ptr<google::cloud::BackgroundThreads> background_;
585  std::shared_ptr<spanner_admin_internal::DatabaseAdminStub> stub_;
586  std::unique_ptr<DatabaseAdminRetryPolicy const> retry_policy_prototype_;
587  std::unique_ptr<BackoffPolicy const> backoff_policy_prototype_;
588  std::unique_ptr<PollingPolicy const> polling_policy_prototype_;
589  std::unique_ptr<DatabaseAdminConnectionIdempotencyPolicy> idempotency_policy_;
590 };
591 } // namespace
592 
594  Options options) {
595  options =
597  auto background = internal::MakeBackgroundThreadsFactory(options)();
599  background->cq(), options);
600  return std::make_shared<DatabaseAdminConnectionImpl>(
601  std::move(background), std::move(stub), options);
602 }
603 
604 } // namespace GOOGLE_CLOUD_CPP_GENERATED_NS
605 } // namespace spanner_admin
606 } // namespace cloud
607 } // namespace google
608 
609 namespace google {
610 namespace cloud {
611 namespace spanner_admin_internal {
612 inline namespace GOOGLE_CLOUD_CPP_GENERATED_NS {
613 
614 std::shared_ptr<spanner_admin::DatabaseAdminConnection>
616  Options options) {
617  options = DatabaseAdminDefaultOptions(std::move(options));
618  return std::make_shared<spanner_admin::DatabaseAdminConnectionImpl>(
619  internal::MakeBackgroundThreadsFactory(options)(), std::move(stub),
620  std::move(options));
621 }
622 
623 } // namespace GOOGLE_CLOUD_CPP_GENERATED_NS
624 } // namespace spanner_admin_internal
625 } // namespace cloud
626 } // namespace google