19 #include "google/cloud/spanner/admin/internal/database_admin_auth_decorator.h"
20 #include <google/spanner/admin/database/v1/spanner_database_admin.grpc.pb.h>
29 std::shared_ptr<
google::
cloud::internal::GrpcAuthenticationStrategy> auth,
31 : auth_(std::move(auth)), child_(std::move(child)) {}
33 StatusOr<
google::spanner::admin::database::v1::ListDatabasesResponse>
35 grpc::ClientContext& context,
36 google::spanner::admin::database::v1::ListDatabasesRequest
const& request) {
37 auto status = auth_->ConfigureContext(context);
38 if (!status
.ok())
return status;
45 std::unique_ptr<grpc::ClientContext> context,
46 google::spanner::admin::database::v1::CreateDatabaseRequest
const&
48 using ReturnType = StatusOr<
google::longrunning::Operation>;
50 return auth_->AsyncConfigureContext(std::move(context))
52 request](
future<StatusOr<std::unique_ptr<grpc::ClientContext>>>
62 StatusOr<
google::spanner::admin::database::v1::Database>
64 grpc::ClientContext& context,
65 google::spanner::admin::database::v1::GetDatabaseRequest
const& request) {
66 auto status = auth_->ConfigureContext(context);
67 if (!status
.ok())
return status;
74 std::unique_ptr<grpc::ClientContext> context,
75 google::spanner::admin::database::v1::UpdateDatabaseDdlRequest
const&
77 using ReturnType = StatusOr<
google::longrunning::Operation>;
79 return auth_->AsyncConfigureContext(std::move(context))
81 request](
future<StatusOr<std::unique_ptr<grpc::ClientContext>>>
92 grpc::ClientContext& context,
93 google::spanner::admin::database::v1::DropDatabaseRequest
const& request) {
94 auto status = auth_->ConfigureContext(context);
95 if (!status
.ok())
return status;
99 StatusOr<
google::spanner::admin::database::v1::GetDatabaseDdlResponse>
101 grpc::ClientContext& context,
102 google::spanner::admin::database::v1::GetDatabaseDdlRequest
const&
104 auto status = auth_->ConfigureContext(context);
105 if (!status
.ok())
return status;
110 grpc::ClientContext& context,
111 google::iam::v1::SetIamPolicyRequest
const& request) {
112 auto status = auth_->ConfigureContext(context);
113 if (!status
.ok())
return status;
118 grpc::ClientContext& context,
119 google::iam::v1::GetIamPolicyRequest
const& request) {
120 auto status = auth_->ConfigureContext(context);
121 if (!status
.ok())
return status;
125 StatusOr<
google::iam::v1::TestIamPermissionsResponse>
127 grpc::ClientContext& context,
128 google::iam::v1::TestIamPermissionsRequest
const& request) {
129 auto status = auth_->ConfigureContext(context);
130 if (!status
.ok())
return status;
137 std::unique_ptr<grpc::ClientContext> context,
138 google::spanner::admin::database::v1::CreateBackupRequest
const& request) {
139 using ReturnType = StatusOr<
google::longrunning::Operation>;
141 return auth_->AsyncConfigureContext(std::move(context))
143 request](
future<StatusOr<std::unique_ptr<grpc::ClientContext>>>
153 StatusOr<
google::spanner::admin::database::v1::Backup>
155 grpc::ClientContext& context,
156 google::spanner::admin::database::v1::GetBackupRequest
const& request) {
157 auto status = auth_->ConfigureContext(context);
158 if (!status
.ok())
return status;
162 StatusOr<
google::spanner::admin::database::v1::Backup>
164 grpc::ClientContext& context,
165 google::spanner::admin::database::v1::UpdateBackupRequest
const& request) {
166 auto status = auth_->ConfigureContext(context);
167 if (!status
.ok())
return status;
172 grpc::ClientContext& context,
173 google::spanner::admin::database::v1::DeleteBackupRequest
const& request) {
174 auto status = auth_->ConfigureContext(context);
175 if (!status
.ok())
return status;
179 StatusOr<
google::spanner::admin::database::v1::ListBackupsResponse>
181 grpc::ClientContext& context,
182 google::spanner::admin::database::v1::ListBackupsRequest
const& request) {
183 auto status = auth_->ConfigureContext(context);
184 if (!status
.ok())
return status;
191 std::unique_ptr<grpc::ClientContext> context,
192 google::spanner::admin::database::v1::RestoreDatabaseRequest
const&
194 using ReturnType = StatusOr<
google::longrunning::Operation>;
196 return auth_->AsyncConfigureContext(std::move(context))
198 request](
future<StatusOr<std::unique_ptr<grpc::ClientContext>>>
208 StatusOr<
google::spanner::admin::database::v1::ListDatabaseOperationsResponse>
210 grpc::ClientContext& context,
211 google::spanner::admin::database::v1::ListDatabaseOperationsRequest
const&
213 auto status = auth_->ConfigureContext(context);
214 if (!status
.ok())
return status;
218 StatusOr<
google::spanner::admin::database::v1::ListBackupOperationsResponse>
220 grpc::ClientContext& context,
221 google::spanner::admin::database::v1::ListBackupOperationsRequest
const&
223 auto status = auth_->ConfigureContext(context);
224 if (!status
.ok())
return status;
231 std::unique_ptr<grpc::ClientContext> context,
232 google::longrunning::GetOperationRequest
const& request) {
233 using ReturnType = StatusOr<
google::longrunning::Operation>;
235 return auth_->AsyncConfigureContext(std::move(context))
237 request](
future<StatusOr<std::unique_ptr<grpc::ClientContext>>>
249 std::unique_ptr<grpc::ClientContext> context,
250 google::longrunning::CancelOperationRequest
const& request) {
252 return auth_->AsyncConfigureContext(std::move(context))
254 request](
future<StatusOr<std::unique_ptr<grpc::ClientContext>>>