Google Cloud Spanner C++ Client 2.13.0
A C++ Client Library for Google Cloud Spanner
Loading...
Searching...
No Matches
database_admin_client.h
1// Copyright 2019 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#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_DATABASE_ADMIN_CLIENT_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_DATABASE_ADMIN_CLIENT_H
17
18#include "google/cloud/spanner/backup.h"
19#include "google/cloud/spanner/connection_options.h"
20#include "google/cloud/spanner/database.h"
21#include "google/cloud/spanner/database_admin_connection.h"
22#include "google/cloud/spanner/encryption_config.h"
23#include "google/cloud/spanner/iam_updater.h"
24#include "google/cloud/spanner/instance.h"
25#include "google/cloud/spanner/timestamp.h"
26#include "google/cloud/spanner/version.h"
27#include "google/cloud/future.h"
28#include "google/cloud/status_or.h"
29#include "absl/types/optional.h"
30#include <chrono>
31#include <string>
32#include <vector>
33
34namespace google {
35namespace cloud {
36namespace spanner {
37GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
38
39/**
40 * Performs database administration operations on Spanner.
41 *
42 * @deprecated Please use #google::cloud::spanner_admin::InstanceAdminClient
43 * instead.
44 *
45 * Applications use this class to perform administrative operations on spanner
46 * [Databases][database-doc-link].
47 *
48 * @par Performance
49 *
50 * Creating a new `DatabaseAdminClient` is a relatively expensive operation, new
51 * objects establish new connections to the service. In contrast, copying or
52 * moving an existing `DatabaseAdminClient` object is a relatively cheap
53 * operation. Copied clients share the underlying resources.
54 *
55 * @par Thread Safety
56 *
57 * Instances of this class created via copy-construction or copy-assignment
58 * share the underlying pool of connections. Access to these copies via multiple
59 * threads is guaranteed to work. Two threads operating on the same instance of
60 * this class is not guaranteed to work.
61 *
62 * @par Error Handling
63 *
64 * This class uses `StatusOr<T>` to report errors. When an operation fails to
65 * perform its work the returned `StatusOr<T>` contains the error details. If
66 * the `ok()` member function in the `StatusOr<T>` returns `true` then it
67 * contains the expected result. For more information, see the
68 * [Error Handling Guide](#spanner-error-handling).
69 *
70 * @code
71 * namespace spanner = ::google::cloud::spanner;
72 * using ::google::cloud::StatusOr;
73 * spanner::DatabaseAdminClient client = ...;
74 * StatusOr<google::spanner::admin::database::v1::Database> db =
75 * client.CreateDatabase(...).get();
76 *
77 * if (!db) {
78 * std::cerr << "Error in CreateDatabase: " << db.status() << "\n";
79 * return;
80 * }
81 *
82 * // Use `db` as a smart pointer here, e.g.:
83 * std::cout << "The database fully qualified name is: " << db->name() << "\n";
84 * @endcode
85 *
86 * @par Long running operations
87 *
88 * Some operations in this class can take minutes to complete. In this case the
89 * class returns a `google::cloud::future<StatusOr<T>>`, the application can
90 * then poll the `future` or associate a callback to be invoked when the
91 * operation completes:
92 *
93 * @code
94 * namespace spanner = ::google::cloud::spanner;
95 * spanner::DatabaseAdminClient client = ...;
96 * // Make example less verbose.
97 * using ::google::cloud::future;
98 * using ::google::cloud::StatusOr;
99 * using std::chrono::chrono_literals; // C++14
100 *
101 * auto database = client.CreateDatabase(...);
102 * if (database.wait_for(5m) == std::future_state::ready) {
103 * std::cout << "Database created in under 5 minutes, yay!\n";
104 * return;
105 * }
106 * // Too slow, setup a callback instead:
107 * database.then([](auto f) {
108 * StatusOr<google::spanner::admin::database::v1::Database> db = f.get();
109 * if (!db) {
110 * std::cout << "Failed creating a database!\n";
111 * return;
112 * }
113 * std::cout << "Database created!\n";
114 * });
115 * @endcode
116 *
117 * [database-doc-link]:
118 * https://cloud.google.com/spanner/docs/schema-and-data-model
119 */
120class GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("DatabaseAdminClient")
122 public:
123 explicit DatabaseAdminClient(
124 ConnectionOptions const& options = ConnectionOptions());
125
126 /**
127 * Creates a new Cloud Spanner database in the given project and instance.
128 *
129 * This function creates a database (using the "CREATE DATABASE" DDL
130 * statement) in the given Google Cloud Project and Cloud Spanner instance.
131 * The application can provide an optional list of additional DDL statements
132 * to atomically create tables and indices as well as the new database.
133 *
134 * Note that the database id must be between 2 and 30 characters long, it must
135 * start with a lowercase letter (`[a-z]`), it must end with a lowercase
136 * letter or a number (`[a-z0-9]`) and any characters between the beginning
137 * and ending characters must be lower case letters, numbers, underscore (`_`)
138 * or dashes (`-`), that is, they must belong to the `[a-z0-9_-]` character
139 * set.
140 *
141 * @p encryption_config How to encrypt the database.
142 *
143 * @return A `google::cloud::future` that becomes satisfied when the operation
144 * completes on the service. Note that this can take minutes in some cases.
145 *
146 * @par Example
147 * @snippet samples.cc create-database
148 *
149 * @see https://cloud.google.com/spanner/docs/data-definition-language for a
150 * full list of the DDL operations
151 *
152 * @see
153 * https://cloud.google.com/spanner/docs/data-definition-language#create_database
154 * for the regular expression that must be satisfied by the database id.
155 */
156 future<StatusOr<google::spanner::admin::database::v1::Database>>
157 CreateDatabase(Database db, std::vector<std::string> extra_statements = {},
158 EncryptionConfig encryption_config = DefaultEncryption());
159
160 /**
161 * Retrieve metadata information about a database.
162 *
163 * @par Idempotency
164 * This is a read-only operation and therefore always idempotent. Transient
165 * failures are automatically retried.
166 *
167 * @par Example
168 * @snippet samples.cc get-database
169 */
170 StatusOr<google::spanner::admin::database::v1::Database> GetDatabase(
171 Database db);
172
173 /**
174 * Retrieve a database schema.
175 *
176 * @par Idempotency
177 * This is a read-only operation and therefore always idempotent. Transient
178 * failures are automatically retried.
179 *
180 * @par Example
181 * @snippet samples.cc get-database-ddl
182 */
183 StatusOr<google::spanner::admin::database::v1::GetDatabaseDdlResponse>
185
186 /**
187 * Updates the database using a series of DDL statements.
188 *
189 * This function schedules a series of updates to the database using a
190 * sequence of DDL statements.
191 *
192 * @return A `google::cloud::future` that becomes satisfied when all the
193 * statements complete. Note that Cloud Spanner may fail to execute some of
194 * the statements.
195 *
196 * @par Example
197 * @snippet samples.cc add-column
198 *
199 * @see https://cloud.google.com/spanner/docs/data-definition-language for a
200 * full list of the DDL operations
201 */
202 future<
203 StatusOr<google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>>
204 UpdateDatabase(Database db, std::vector<std::string> statements);
205
206 /**
207 * Drops (deletes) an existing Cloud Spanner database.
208 *
209 * @warning Dropping a database deletes all the tables and other data in the
210 * database. This is an unrecoverable operation.
211 *
212 * @par Example
213 * @snippet samples.cc drop-database
214 */
216
217 /**
218 * List all the databases in a give project and instance.
219 *
220 * @par Idempotency
221 * This operation is read-only and therefore always idempotent.
222 *
223 * @par Example
224 * @snippet samples.cc list-databases
225 */
226 ListDatabaseRange ListDatabases(Instance in);
227
228 /**
229 * Create a new database by restoring from a completed backup.
230 *
231 * @par Idempotency
232 * This is not an idempotent operation. Transient failures are not retried.
233 *
234 * The new database must be in the same project and in an instance with the
235 * same instance configuration as the instance containing the backup.
236 *
237 * @p encryption_config How to encrypt the database.
238 *
239 * @return A `google::cloud::future` that becomes satisfied when the operation
240 * completes on the service. Note that this can take minutes in some cases.
241 *
242 * @par Example
243 * @snippet samples.cc restore-database
244 */
245 future<StatusOr<google::spanner::admin::database::v1::Database>>
246 RestoreDatabase(Database db, Backup const& backup,
247 EncryptionConfig encryption_config = DefaultEncryption());
248
249 /**
250 * Create a new database by restoring from a completed backup.
251 *
252 * @par Idempotency
253 * This is not an idempotent operation. Transient failures are not retried.
254 *
255 * The new database must be in the same project and in an instance with the
256 * same instance configuration as the instance containing the backup.
257 *
258 * @p encryption_config How to encrypt the database.
259 *
260 * @return A `google::cloud::future` that becomes satisfied when the operation
261 * completes on the service. Note that this can take minutes in some cases.
262 */
263 future<StatusOr<google::spanner::admin::database::v1::Database>>
265 google::spanner::admin::database::v1::Backup const& backup,
266 EncryptionConfig encryption_config = DefaultEncryption());
267
268 /**
269 * Gets the IAM policy for a database.
270 *
271 * @par Idempotency
272 * This operation is read-only and therefore always idempotent.
273 *
274 * @par Example
275 * @snippet samples.cc database-get-iam-policy
276 */
277 StatusOr<google::iam::v1::Policy> GetIamPolicy(Database db);
278
279 /**
280 * Set the IAM policy for the given database.
281 *
282 * This function changes the IAM policy configured in the given database to
283 * the value of @p policy.
284 *
285 * @par Idempotency
286 * This function is only idempotent if the `etag` field in @p policy is set.
287 * Therefore, the underlying RPCs are only retried if the field is set, and
288 * the function returns the first RPC error in any other case.
289 *
290 * @see The [Cloud Spanner
291 * documentation](https://cloud.google.com/spanner/docs/iam) for a
292 * description of the roles and permissions supported by Cloud Spanner.
293 * @see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions)
294 * for an introduction to Identity and Access Management in Google Cloud
295 * Platform.
296 */
297 StatusOr<google::iam::v1::Policy> SetIamPolicy(
298 Database db, google::iam::v1::Policy policy);
299
300 /**
301 * Updates the IAM policy for an instance using an optimistic concurrency
302 * control loop.
303 *
304 * This function repeatedly reads the current IAM policy in @p db, and then
305 * calls the @p updater with the this policy. The @p updater returns an empty
306 * optional if no changes are required, or it returns the new desired value
307 * for the IAM policy. This function then updates the policy.
308 *
309 * Updating an IAM policy can fail with retryable errors or can be aborted
310 * because there were simultaneous changes the to IAM policy. In these cases
311 * this function reruns the loop until it succeeds.
312 *
313 * The function returns the final IAM policy, or an error if the rerun policy
314 * for the underlying connection has expired.
315 *
316 * @par Idempotency
317 * This function always sets the `etag` field on the policy, so the underlying
318 * RPCs are retried automatically.
319 *
320 * @par Example
321 * @snippet samples.cc add-database-reader-on-database
322 *
323 * @param db the identifier for the database where you want to change the IAM
324 * policy.
325 * @param updater a callback to modify the policy. Return an unset optional
326 * to indicate that no changes to the policy are needed.
327 */
328 StatusOr<google::iam::v1::Policy> SetIamPolicy(Database const& db,
329 IamUpdater const& updater);
330
331 /**
332 * @copydoc SetIamPolicy(Database const&,IamUpdater const&)
333 *
334 * @param rerun_policy controls for how long (or how many times) the updater
335 * will be rerun after the IAM policy update aborts.
336 * @param backoff_policy controls how long `SetIamPolicy` waits between
337 * reruns.
338 */
339 StatusOr<google::iam::v1::Policy> SetIamPolicy(
340 Database const& db, IamUpdater const& updater,
341 std::unique_ptr<TransactionRerunPolicy> rerun_policy,
342 std::unique_ptr<BackoffPolicy> backoff_policy);
343
344 /**
345 * Get the subset of the permissions the caller has on the given database.
346 *
347 * This function compares the given list of permissions against those
348 * permissions granted to the caller, and returns the subset of the list that
349 * the caller actually holds.
350 *
351 * @note Permission wildcards, such as `spanner.*` are not allowed.
352 *
353 * @par Idempotency
354 * This operation is read-only and therefore always idempotent.
355 *
356 * @par Example
357 * @snippet samples.cc database-test-iam-permissions
358 *
359 * @see The [Cloud Spanner
360 * documentation](https://cloud.google.com/spanner/docs/iam) for a description
361 * of the roles and permissions supported by Cloud Spanner.
362 * @see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions)
363 * for an introduction to Identity and Access Management in Google Cloud
364 * Platform.
365 */
366 StatusOr<google::iam::v1::TestIamPermissionsResponse> TestIamPermissions(
367 Database db, std::vector<std::string> permissions);
368
369 /**
370 * Creates a new Cloud Spanner backup for the given database.
371 *
372 * @par Idempotency
373 * This is not an idempotent operation. Transient failures are not retried.
374 *
375 * This function creates a database backup for the given Google Cloud Spanner
376 * database.
377 *
378 * Note that the @p backup_id must be unique within the same instance, it must
379 * be between 2 and 60 characters long, it must start with a lowercase letter
380 * (`[a-z]`), it must end with a lowercase letter or a number (`[a-z0-9]`) and
381 * any characters between the beginning and ending characters must be lower
382 * case letters, numbers, underscore (`_`) or dashes (`-`), that is, they must
383 * belong to the `[a-z0-9_-]` character set.
384 *
385 * The @p expire_time must be at least 6 hours and at most 366 days from the
386 * time the `CreateBackup()` request is processed.
387 *
388 * The backup will contain an externally consistent copy of the database
389 * at @p version_time, if set. Otherwise, the version_time will be the
390 * create_time of the backup.
391 *
392 * @p encryption_config How to encrypt the backup.
393 *
394 * @return A `google::cloud::future` that becomes satisfied when the operation
395 * completes on the service. Note that this can take minutes in some cases.
396 *
397 * @par Example
398 * @snippet samples.cc create-backup
399 */
400 future<StatusOr<google::spanner::admin::database::v1::Backup>> CreateBackup(
401 Database db, std::string backup_id, Timestamp expire_time,
402 absl::optional<Timestamp> version_time = absl::nullopt,
403 EncryptionConfig encryption_config = DefaultEncryption());
404
405 /**
406 * Creates a new Cloud Spanner backup for the given database.
407 *
408 * @deprecated this overload is deprecated; use the `Timestamp` overload
409 * instead.
410 *
411 * @par Idempotency
412 * This is not an idempotent operation. Transient failures are not retried.
413 *
414 * This function creates a database backup for the given Google Cloud Spanner
415 * database.
416 *
417 * Note that the @p backup_id must be unique within the same instance, it must
418 * be between 2 and 60 characters long, it must start with a lowercase letter
419 * (`[a-z]`), it must end with a lowercase letter or a number (`[a-z0-9]`) and
420 * any characters between the beginning and ending characters must be lower
421 * case letters, numbers, underscore (`_`) or dashes (`-`), that is, they must
422 * belong to the `[a-z0-9_-]` character set.
423 *
424 * The @p expire_time must be at least 6 hours and at most 366 days from the
425 * time the `CreateBackup()` request is processed.
426 *
427 * @return A `google::cloud::future` that becomes satisfied when the operation
428 * completes on the service. Note that this can take minutes in some cases.
429 */
430 future<StatusOr<google::spanner::admin::database::v1::Backup>> CreateBackup(
431 Database db, std::string backup_id,
432 std::chrono::system_clock::time_point expire_time);
433
434 /**
435 * Retrieve metadata information about a Backup.
436 *
437 * @par Idempotency
438 * This is a read-only operation and therefore always idempotent. Transient
439 * failures are automatically retried.
440 *
441 * @par Example
442 * @snippet samples.cc get-backup
443 */
444 StatusOr<google::spanner::admin::database::v1::Backup> GetBackup(
445 Backup const& backup);
446
447 /**
448 * Deletes a pending or completed Backup.
449 *
450 * @par Idempotency
451 * We treat this operation as idempotent. Transient failures are automatically
452 * retried.
453 */
455 google::spanner::admin::database::v1::Backup const& backup);
456
457 /**
458 * Deletes a pending or completed Backup.
459 *
460 * @par Idempotency
461 * We treat this operation as idempotent. Transient failures are automatically
462 * retried.
463 *
464 * @par Example
465 * @snippet samples.cc delete-backup
466 */
467 Status DeleteBackup(Backup const& backup);
468
469 /**
470 * List all the backups in a given project and instance that match
471 * the filter.
472 *
473 * @par Idempotency
474 * This operation is read-only and therefore always idempotent.
475 *
476 * @param in An instance where the backup operations belong to.
477 * @param filter A filter expression that filters backups listed in the
478 * response. See [this documentation][spanner-api-reference-link] for the
479 * syntax of the filter expression.
480 *
481 * @par Example
482 * @snippet samples.cc list-backups
483 *
484 * [spanner-api-reference-link]:
485 * https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.ListBackupsRequest
486 */
487 ListBackupsRange ListBackups(Instance in, std::string filter = {});
488
489 /**
490 * Update backup's @p expire_time.
491 *
492 * @par Idempotency
493 * This operation is idempotent as its result does not depend on the previous
494 * state of the backup. Note that, as is the case with all operations, it is
495 * subject to race conditions if multiple tasks are attempting to change the
496 * expire time in the same backup.
497 */
498 StatusOr<google::spanner::admin::database::v1::Backup> UpdateBackupExpireTime(
499 google::spanner::admin::database::v1::Backup const& backup,
500 Timestamp expire_time);
501
502 /**
503 * Update backup's @p expire_time.
504 *
505 * @par Idempotency
506 * This operation is idempotent as its result does not depend on the previous
507 * state of the backup. Note that, as is the case with all operations, it is
508 * subject to race conditions if multiple tasks are attempting to change the
509 * expire time in the same backup.
510 *
511 * @par Example
512 * @snippet samples.cc update-backup
513 */
514 StatusOr<google::spanner::admin::database::v1::Backup> UpdateBackupExpireTime(
515 Backup const& backup, Timestamp expire_time);
516
517 /**
518 * Update backup's @p expire_time.
519 *
520 * @deprecated this overload is deprecated; use the `Timestamp` overload
521 * instead.
522 *
523 * @par Idempotency
524 * This operation is idempotent as its result does not depend on the previous
525 * state of the backup. Note that, as is the case with all operations, it is
526 * subject to race conditions if multiple tasks are attempting to change the
527 * expire time in the same backup.
528 */
529 StatusOr<google::spanner::admin::database::v1::Backup> UpdateBackupExpireTime(
530 google::spanner::admin::database::v1::Backup const& backup,
531 std::chrono::system_clock::time_point const& expire_time);
532
533 /**
534 * Update backup's @p expire_time.
535 *
536 * @deprecated this overload is deprecated; use the `Timestamp` overload
537 * instead.
538 *
539 * @par Idempotency
540 * This operation is idempotent as its result does not depend on the previous
541 * state of the backup. Note that, as is the case with all operations, it is
542 * subject to race conditions if multiple tasks are attempting to change the
543 * expire time in the same backup.
544 */
545 StatusOr<google::spanner::admin::database::v1::Backup> UpdateBackupExpireTime(
546 Backup const& backup,
547 std::chrono::system_clock::time_point const& expire_time);
548
549 /**
550 * List all the backup operations in a given project and instance that match
551 * the filter.
552 *
553 * @par Idempotency
554 * This operation is read-only and therefore always idempotent.
555 *
556 * @param in An instance where the backup operations belong to.
557 * @param filter A filter expression that filters what operations are returned
558 * in the response. See [this documentation][spanner-api-reference-link] for
559 * the syntax of the filter expression.
560 *
561 * @par Example
562 * @snippet samples.cc list-backup-operations
563 *
564 * [spanner-api-reference-link]:
565 * https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.ListBackupOperationsRequest
566 */
567 ListBackupOperationsRange ListBackupOperations(Instance in,
568 std::string filter = {});
569
570 /**
571 * List all the database operations in a given project and instance that match
572 * the filter.
573 *
574 * @par Idempotency
575 * This operation is read-only and therefore always idempotent.
576 *
577 * @param in An instance where the database operations belong to.
578 * @param filter A filter expression that filters what operations are returned
579 * in the response. See [this documentation][spanner-api-reference-link] for
580 * the syntax of the filter expression.
581 *
582 * @par Example
583 * @snippet samples.cc list-database-operations
584 *
585 * [spanner-api-reference-link]:
586 * https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.ListDatabaseOperationsRequest
587 */
588 ListDatabaseOperationsRange ListDatabaseOperations(Instance in,
589 std::string filter = {});
590
591 /// Create a new client with the given stub. For testing only.
592 explicit DatabaseAdminClient(std::shared_ptr<DatabaseAdminConnection> c)
593 : conn_(std::move(c)) {}
594
595 private:
596 std::shared_ptr<DatabaseAdminConnection> conn_;
597};
598
599GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
600} // namespace spanner
601} // namespace cloud
602} // namespace google
603
604#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_DATABASE_ADMIN_CLIENT_H
friend friend class future
This class identifies a Cloud Spanner Backup.
Definition: backup.h:39
Performs database administration operations on Spanner.
Definition: database_admin_client.h:121
StatusOr< google::spanner::admin::database::v1::Backup > UpdateBackupExpireTime(google::spanner::admin::database::v1::Backup const &backup, std::chrono::system_clock::time_point const &expire_time)
Update backup's expire_time.
Status DeleteBackup(google::spanner::admin::database::v1::Backup const &backup)
Deletes a pending or completed Backup.
ListDatabaseRange ListDatabases(Instance in)
List all the databases in a give project and instance.
future< StatusOr< google::spanner::admin::database::v1::Backup > > CreateBackup(Database db, std::string backup_id, std::chrono::system_clock::time_point expire_time)
Creates a new Cloud Spanner backup for the given database.
DatabaseAdminClient(ConnectionOptions const &options=ConnectionOptions())
StatusOr< google::spanner::admin::database::v1::Backup > UpdateBackupExpireTime(google::spanner::admin::database::v1::Backup const &backup, Timestamp expire_time)
Update backup's expire_time.
Status DropDatabase(Database db)
Drops (deletes) an existing Cloud Spanner database.
StatusOr< google::spanner::admin::database::v1::GetDatabaseDdlResponse > GetDatabaseDdl(Database db)
Retrieve a database schema.
StatusOr< google::spanner::admin::database::v1::Backup > UpdateBackupExpireTime(Backup const &backup, Timestamp expire_time)
Update backup's expire_time.
StatusOr< google::spanner::admin::database::v1::Backup > UpdateBackupExpireTime(Backup const &backup, std::chrono::system_clock::time_point const &expire_time)
Update backup's expire_time.
StatusOr< google::iam::v1::Policy > SetIamPolicy(Database const &db, IamUpdater const &updater, std::unique_ptr< TransactionRerunPolicy > rerun_policy, std::unique_ptr< BackoffPolicy > backoff_policy)
Updates the IAM policy for an instance using an optimistic concurrency control loop.
ListBackupsRange ListBackups(Instance in, std::string filter={})
List all the backups in a given project and instance that match the filter.
ListDatabaseOperationsRange ListDatabaseOperations(Instance in, std::string filter={})
List all the database operations in a given project and instance that match the filter.
future< StatusOr< google::spanner::admin::database::v1::Backup > > CreateBackup(Database db, std::string backup_id, Timestamp expire_time, absl::optional< Timestamp > version_time=absl::nullopt, EncryptionConfig encryption_config=DefaultEncryption())
Creates a new Cloud Spanner backup for the given database.
StatusOr< google::iam::v1::Policy > GetIamPolicy(Database db)
Gets the IAM policy for a database.
future< StatusOr< google::spanner::admin::database::v1::Database > > RestoreDatabase(Database db, google::spanner::admin::database::v1::Backup const &backup, EncryptionConfig encryption_config=DefaultEncryption())
Create a new database by restoring from a completed backup.
StatusOr< google::iam::v1::TestIamPermissionsResponse > TestIamPermissions(Database db, std::vector< std::string > permissions)
Get the subset of the permissions the caller has on the given database.
Status DeleteBackup(Backup const &backup)
Deletes a pending or completed Backup.
future< StatusOr< google::spanner::admin::database::v1::Database > > RestoreDatabase(Database db, Backup const &backup, EncryptionConfig encryption_config=DefaultEncryption())
Create a new database by restoring from a completed backup.
StatusOr< google::iam::v1::Policy > SetIamPolicy(Database const &db, IamUpdater const &updater)
Updates the IAM policy for an instance using an optimistic concurrency control loop.
StatusOr< google::spanner::admin::database::v1::Database > GetDatabase(Database db)
Retrieve metadata information about a database.
StatusOr< google::iam::v1::Policy > SetIamPolicy(Database db, google::iam::v1::Policy policy)
Set the IAM policy for the given database.
future< StatusOr< google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata > > UpdateDatabase(Database db, std::vector< std::string > statements)
Updates the database using a series of DDL statements.
ListBackupOperationsRange ListBackupOperations(Instance in, std::string filter={})
List all the backup operations in a given project and instance that match the filter.
future< StatusOr< google::spanner::admin::database::v1::Database > > CreateDatabase(Database db, std::vector< std::string > extra_statements={}, EncryptionConfig encryption_config=DefaultEncryption())
Creates a new Cloud Spanner database in the given project and instance.
StatusOr< google::spanner::admin::database::v1::Backup > GetBackup(Backup const &backup)
Retrieve metadata information about a Backup.
DatabaseAdminClient(std::shared_ptr< DatabaseAdminConnection > c)
Create a new client with the given stub. For testing only.
Definition: database_admin_client.h:592
A connection to the Cloud Spanner instance administration service.
Definition: database_admin_connection.h:105
This class identifies a Cloud Spanner Database.
Definition: database.h:43
Use the per-operation default encryption:
Definition: encryption_config.h:33
This class identifies a Cloud Spanner Instance.
Definition: instance.h:42
A representation of the Spanner TIMESTAMP type: An instant in time.
Definition: timestamp.h:54
Contains all the Cloud Spanner C++ client types and functions.
Definition: backoff_policy.h:23
#define GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED(name)
Definition: version.h:23