Google Cloud Spanner C++ Client  2.4.0
A C++ Client Library for Google Cloud Spanner
database_admin_connection.h
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 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_ADMIN_DATABASE_ADMIN_CONNECTION_H
20 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_ADMIN_DATABASE_ADMIN_CONNECTION_H
21 
22 #include "google/cloud/spanner/admin/database_admin_connection_idempotency_policy.h"
23 #include "google/cloud/spanner/admin/internal/database_admin_retry_traits.h"
24 #include "google/cloud/spanner/admin/internal/database_admin_stub.h"
25 #include "google/cloud/backoff_policy.h"
26 #include "google/cloud/future.h"
27 #include "google/cloud/options.h"
28 #include "google/cloud/polling_policy.h"
29 #include "google/cloud/status_or.h"
30 #include "google/cloud/stream_range.h"
31 #include "google/cloud/version.h"
32 #include <google/longrunning/operations.grpc.pb.h>
33 #include <memory>
34 
35 namespace google {
36 namespace cloud {
37 namespace spanner_admin {
39 
40 using DatabaseAdminRetryPolicy =
41  ::google::cloud::internal::TraitBasedRetryPolicy<
42  spanner_admin_internal::DatabaseAdminRetryTraits>;
43 
44 using DatabaseAdminLimitedTimeRetryPolicy =
45  ::google::cloud::internal::LimitedTimeRetryPolicy<
46  spanner_admin_internal::DatabaseAdminRetryTraits>;
47 
48 using DatabaseAdminLimitedErrorCountRetryPolicy =
49  ::google::cloud::internal::LimitedErrorCountRetryPolicy<
50  spanner_admin_internal::DatabaseAdminRetryTraits>;
51 
52 /**
53  * The `DatabaseAdminConnection` object for `DatabaseAdminClient`.
54  *
55  * This interface defines virtual methods for each of the user-facing overload
56  * sets in `DatabaseAdminClient`. This allows users to inject custom behavior
57  * (e.g., with a Google Mock object) when writing tests that use objects of type
58  * `DatabaseAdminClient`.
59  *
60  * To create a concrete instance, see `MakeDatabaseAdminConnection()`.
61  *
62  * For mocking, see `spanner_admin_mocks::MockDatabaseAdminConnection`.
63  */
65  public:
66  virtual ~DatabaseAdminConnection() = 0;
67 
68  virtual Options options() { return Options{}; }
69 
70  virtual StreamRange<google::spanner::admin::database::v1::Database>
72  google::spanner::admin::database::v1::ListDatabasesRequest request);
73 
74  virtual future<StatusOr<google::spanner::admin::database::v1::Database>>
76  google::spanner::admin::database::v1::CreateDatabaseRequest const&
77  request);
78 
79  virtual StatusOr<google::spanner::admin::database::v1::Database> GetDatabase(
80  google::spanner::admin::database::v1::GetDatabaseRequest const& request);
81 
82  virtual future<
83  StatusOr<google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>>
85  google::spanner::admin::database::v1::UpdateDatabaseDdlRequest const&
86  request);
87 
89  google::spanner::admin::database::v1::DropDatabaseRequest const& request);
90 
91  virtual StatusOr<google::spanner::admin::database::v1::GetDatabaseDdlResponse>
93  google::spanner::admin::database::v1::GetDatabaseDdlRequest const&
94  request);
95 
96  virtual StatusOr<google::iam::v1::Policy> SetIamPolicy(
97  google::iam::v1::SetIamPolicyRequest const& request);
98 
99  virtual StatusOr<google::iam::v1::Policy> GetIamPolicy(
100  google::iam::v1::GetIamPolicyRequest const& request);
101 
102  virtual StatusOr<google::iam::v1::TestIamPermissionsResponse>
103  TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const& request);
104 
105  virtual future<StatusOr<google::spanner::admin::database::v1::Backup>>
107  google::spanner::admin::database::v1::CreateBackupRequest const& request);
108 
109  virtual future<StatusOr<google::spanner::admin::database::v1::Backup>>
111  google::spanner::admin::database::v1::CopyBackupRequest const& request);
112 
113  virtual StatusOr<google::spanner::admin::database::v1::Backup> GetBackup(
114  google::spanner::admin::database::v1::GetBackupRequest const& request);
115 
116  virtual StatusOr<google::spanner::admin::database::v1::Backup> UpdateBackup(
117  google::spanner::admin::database::v1::UpdateBackupRequest const& request);
118 
120  google::spanner::admin::database::v1::DeleteBackupRequest const& request);
121 
122  virtual StreamRange<google::spanner::admin::database::v1::Backup> ListBackups(
123  google::spanner::admin::database::v1::ListBackupsRequest request);
124 
125  virtual future<StatusOr<google::spanner::admin::database::v1::Database>>
127  google::spanner::admin::database::v1::RestoreDatabaseRequest const&
128  request);
129 
130  virtual StreamRange<google::longrunning::Operation> ListDatabaseOperations(
131  google::spanner::admin::database::v1::ListDatabaseOperationsRequest
132  request);
133 
134  virtual StreamRange<google::longrunning::Operation> ListBackupOperations(
135  google::spanner::admin::database::v1::ListBackupOperationsRequest
136  request);
137 
138  virtual StreamRange<google::spanner::admin::database::v1::DatabaseRole>
140  google::spanner::admin::database::v1::ListDatabaseRolesRequest request);
141 };
142 
143 /**
144  * A factory function to construct an object of type `DatabaseAdminConnection`.
145  *
146  * The returned connection object should not be used directly; instead it
147  * should be passed as an argument to the constructor of DatabaseAdminClient.
148  *
149  * The optional @p options argument may be used to configure aspects of the
150  * returned `DatabaseAdminConnection`. Expected options are any of the types in
151  * the following option lists:
152  *
153  * - `google::cloud::CommonOptionList`
154  * - `google::cloud::GrpcOptionList`
155  * - `google::cloud::UnifiedCredentialsOptionList`
156  * - `google::cloud::spanner_admin::DatabaseAdminPolicyOptionList`
157  *
158  * @note Unexpected options will be ignored. To log unexpected options instead,
159  * set `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment.
160  *
161  * @param options (optional) Configure the `DatabaseAdminConnection` created by
162  * this function.
163  */
165  Options options = {});
166 
168 namespace gcpcxxV1 = GOOGLE_CLOUD_CPP_NS; // NOLINT(misc-unused-alias-decls)
169 } // namespace spanner_admin
170 } // namespace cloud
171 } // namespace google
172 
173 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_ADMIN_DATABASE_ADMIN_CONNECTION_H