19 #include "google/cloud/spanner/admin/database_admin_client.h"
20 #include "google/cloud/spanner/admin/database_admin_options.h"
21 #include "google/cloud/spanner/admin/internal/database_admin_option_defaults.h"
32 : connection_(std::move(connection)) {}
35 StreamRange<
google::spanner::admin::database::v1::Database>
37 google::spanner::admin::database::v1::ListDatabasesRequest request;
38 request.set_parent(parent);
42 future<StatusOr<
google::spanner::admin::database::v1::Database>>
44 std::string
const& create_statement) {
45 google::spanner::admin::database::v1::CreateDatabaseRequest request;
46 request.set_parent(parent);
47 request.set_create_statement(create_statement);
51 StatusOr<
google::spanner::admin::database::v1::Database>
53 google::spanner::admin::database::v1::GetDatabaseRequest request;
54 request.set_name(name);
59 StatusOr<
google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>>
61 std::string
const& database, std::vector<std::string>
const& statements) {
62 google::spanner::admin::database::v1::UpdateDatabaseDdlRequest request;
63 request.set_database(database);
64 *request.mutable_statements() = {statements.begin(), statements.end()};
69 google::spanner::admin::database::v1::DropDatabaseRequest request;
70 request.set_database(database);
74 StatusOr<
google::spanner::admin::database::v1::GetDatabaseDdlResponse>
76 google::spanner::admin::database::v1::GetDatabaseDdlRequest request;
77 request.set_database(database);
82 std::string
const& resource,
google::iam::v1::Policy
const& policy) {
83 google::iam::v1::SetIamPolicyRequest request;
84 request.set_resource(resource);
85 *request.mutable_policy() = policy;
90 std::string
const& resource, IamUpdater
const& updater,
Options options) {
102 auto policy = updater(
*std::move(recent));
110 std::this_thread::sleep_for(backoff_policy->OnCompletion());
115 std::string
const& resource) {
116 google::iam::v1::GetIamPolicyRequest request;
117 request.set_resource(resource);
121 StatusOr<
google::iam::v1::TestIamPermissionsResponse>
123 std::string
const& resource, std::vector<std::string>
const& permissions) {
124 google::iam::v1::TestIamPermissionsRequest request;
125 request.set_resource(resource);
126 *request.mutable_permissions() = {permissions.begin(), permissions.end()};
130 future<StatusOr<
google::spanner::admin::database::v1::Backup>>
132 std::string
const& parent,
133 google::spanner::admin::database::v1::Backup
const& backup,
134 std::string
const& backup_id) {
135 google::spanner::admin::database::v1::CreateBackupRequest request;
136 request.set_parent(parent);
137 *request.mutable_backup() = backup;
138 request.set_backup_id(backup_id);
142 StatusOr<
google::spanner::admin::database::v1::Backup>
144 google::spanner::admin::database::v1::GetBackupRequest request;
145 request.set_name(name);
149 StatusOr<
google::spanner::admin::database::v1::Backup>
151 google::spanner::admin::database::v1::Backup
const& backup,
152 google::protobuf::FieldMask
const& update_mask) {
153 google::spanner::admin::database::v1::UpdateBackupRequest request;
154 *request.mutable_backup() = backup;
155 *request.mutable_update_mask() = update_mask;
160 google::spanner::admin::database::v1::DeleteBackupRequest request;
161 request.set_name(name);
165 StreamRange<
google::spanner::admin::database::v1::Backup>
167 google::spanner::admin::database::v1::ListBackupsRequest request;
168 request.set_parent(parent);
172 future<StatusOr<
google::spanner::admin::database::v1::Database>>
174 std::string
const& database_id,
175 std::string
const& backup) {
176 google::spanner::admin::database::v1::RestoreDatabaseRequest request;
177 request.set_parent(parent);
178 request.set_database_id(database_id);
179 request.set_backup(backup);
183 StreamRange<
google::longrunning::Operation>
185 google::spanner::admin::database::v1::ListDatabaseOperationsRequest request;
186 request.set_parent(parent);
190 StreamRange<
google::longrunning::Operation>
192 google::spanner::admin::database::v1::ListBackupOperationsRequest request;
193 request.set_parent(parent);
197 StreamRange<
google::spanner::admin::database::v1::Database>
199 google::spanner::admin::database::v1::ListDatabasesRequest request) {
203 future<StatusOr<
google::spanner::admin::database::v1::Database>>
205 google::spanner::admin::database::v1::CreateDatabaseRequest
const&
210 StatusOr<
google::spanner::admin::database::v1::Database>
212 google::spanner::admin::database::v1::GetDatabaseRequest
const& request) {
217 StatusOr<
google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>>
219 google::spanner::admin::database::v1::UpdateDatabaseDdlRequest
const&
225 google::spanner::admin::database::v1::DropDatabaseRequest
const& request) {
229 StatusOr<
google::spanner::admin::database::v1::GetDatabaseDdlResponse>
231 google::spanner::admin::database::v1::GetDatabaseDdlRequest
const&
237 google::iam::v1::SetIamPolicyRequest
const& request) {
242 google::iam::v1::GetIamPolicyRequest
const& request) {
246 StatusOr<
google::iam::v1::TestIamPermissionsResponse>
248 google::iam::v1::TestIamPermissionsRequest
const& request) {
252 future<StatusOr<
google::spanner::admin::database::v1::Backup>>
254 google::spanner::admin::database::v1::CreateBackupRequest
const& request) {
258 StatusOr<
google::spanner::admin::database::v1::Backup>
260 google::spanner::admin::database::v1::GetBackupRequest
const& request) {
264 StatusOr<
google::spanner::admin::database::v1::Backup>
266 google::spanner::admin::database::v1::UpdateBackupRequest
const& request) {
271 google::spanner::admin::database::v1::DeleteBackupRequest
const& request) {
275 StreamRange<
google::spanner::admin::database::v1::Backup>
277 google::spanner::admin::database::v1::ListBackupsRequest request) {
281 future<StatusOr<
google::spanner::admin::database::v1::Database>>
283 google::spanner::admin::database::v1::RestoreDatabaseRequest
const&
288 StreamRange<
google::longrunning::Operation>
290 google::spanner::admin::database::v1::ListDatabaseOperationsRequest
295 StreamRange<
google::longrunning::Operation>
297 google::spanner::admin::database::v1::ListBackupOperationsRequest request) {