google_cloud_spanner_admin_database_v1/
stub.rs

1// Copyright 2025 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// Code generated by sidekick. DO NOT EDIT.
16
17//! Traits to mock the clients in this library.
18//!
19//! Application developers may need to mock the clients in this library to test
20//! how their application works with different (and sometimes hard to trigger)
21//! client and service behavior. Such test can define mocks implementing the
22//! trait(s) defined in this module, initialize the client with an instance of
23//! this mock in their tests, and verify their application responds as expected.
24
25#![allow(rustdoc::broken_intra_doc_links)]
26
27use gax::error::Error;
28use std::sync::Arc;
29
30pub(crate) mod dynamic;
31
32/// Defines the trait used to implement [super::client::DatabaseAdmin].
33///
34/// Application developers may need to implement this trait to mock
35/// `client::DatabaseAdmin`.  In other use-cases, application developers only
36/// use `client::DatabaseAdmin` and need not be concerned with this trait or
37/// its implementations.
38///
39/// Services gain new RPCs routinely. Consequently, this trait gains new methods
40/// too. To avoid breaking applications the trait provides a default
41/// implementation of each method. Most of these implementations just return an
42/// error.
43pub trait DatabaseAdmin: std::fmt::Debug + Send + Sync {
44    /// Implements [super::client::DatabaseAdmin::list_databases].
45    fn list_databases(
46        &self,
47        _req: crate::model::ListDatabasesRequest,
48        _options: gax::options::RequestOptions,
49    ) -> impl std::future::Future<
50        Output = crate::Result<gax::response::Response<crate::model::ListDatabasesResponse>>,
51    > + Send {
52        std::future::ready::<
53            crate::Result<gax::response::Response<crate::model::ListDatabasesResponse>>,
54        >(Err(Error::other("unimplemented")))
55    }
56
57    /// Implements [super::client::DatabaseAdmin::create_database].
58    fn create_database(
59        &self,
60        _req: crate::model::CreateDatabaseRequest,
61        _options: gax::options::RequestOptions,
62    ) -> impl std::future::Future<
63        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
64    > + Send {
65        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
66            Err(Error::other("unimplemented")),
67        )
68    }
69
70    /// Implements [super::client::DatabaseAdmin::get_database].
71    fn get_database(
72        &self,
73        _req: crate::model::GetDatabaseRequest,
74        _options: gax::options::RequestOptions,
75    ) -> impl std::future::Future<
76        Output = crate::Result<gax::response::Response<crate::model::Database>>,
77    > + Send {
78        std::future::ready::<crate::Result<gax::response::Response<crate::model::Database>>>(Err(
79            Error::other("unimplemented"),
80        ))
81    }
82
83    /// Implements [super::client::DatabaseAdmin::update_database].
84    fn update_database(
85        &self,
86        _req: crate::model::UpdateDatabaseRequest,
87        _options: gax::options::RequestOptions,
88    ) -> impl std::future::Future<
89        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
90    > + Send {
91        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
92            Err(Error::other("unimplemented")),
93        )
94    }
95
96    /// Implements [super::client::DatabaseAdmin::update_database_ddl].
97    fn update_database_ddl(
98        &self,
99        _req: crate::model::UpdateDatabaseDdlRequest,
100        _options: gax::options::RequestOptions,
101    ) -> impl std::future::Future<
102        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
103    > + Send {
104        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
105            Err(Error::other("unimplemented")),
106        )
107    }
108
109    /// Implements [super::client::DatabaseAdmin::drop_database].
110    fn drop_database(
111        &self,
112        _req: crate::model::DropDatabaseRequest,
113        _options: gax::options::RequestOptions,
114    ) -> impl std::future::Future<Output = crate::Result<gax::response::Response<()>>> + Send {
115        std::future::ready::<crate::Result<gax::response::Response<()>>>(Err(Error::other(
116            "unimplemented",
117        )))
118    }
119
120    /// Implements [super::client::DatabaseAdmin::get_database_ddl].
121    fn get_database_ddl(
122        &self,
123        _req: crate::model::GetDatabaseDdlRequest,
124        _options: gax::options::RequestOptions,
125    ) -> impl std::future::Future<
126        Output = crate::Result<gax::response::Response<crate::model::GetDatabaseDdlResponse>>,
127    > + Send {
128        std::future::ready::<
129            crate::Result<gax::response::Response<crate::model::GetDatabaseDdlResponse>>,
130        >(Err(Error::other("unimplemented")))
131    }
132
133    /// Implements [super::client::DatabaseAdmin::set_iam_policy].
134    fn set_iam_policy(
135        &self,
136        _req: iam_v1::model::SetIamPolicyRequest,
137        _options: gax::options::RequestOptions,
138    ) -> impl std::future::Future<
139        Output = crate::Result<gax::response::Response<iam_v1::model::Policy>>,
140    > + Send {
141        std::future::ready::<crate::Result<gax::response::Response<iam_v1::model::Policy>>>(Err(
142            Error::other("unimplemented"),
143        ))
144    }
145
146    /// Implements [super::client::DatabaseAdmin::get_iam_policy].
147    fn get_iam_policy(
148        &self,
149        _req: iam_v1::model::GetIamPolicyRequest,
150        _options: gax::options::RequestOptions,
151    ) -> impl std::future::Future<
152        Output = crate::Result<gax::response::Response<iam_v1::model::Policy>>,
153    > + Send {
154        std::future::ready::<crate::Result<gax::response::Response<iam_v1::model::Policy>>>(Err(
155            Error::other("unimplemented"),
156        ))
157    }
158
159    /// Implements [super::client::DatabaseAdmin::test_iam_permissions].
160    fn test_iam_permissions(
161        &self,
162        _req: iam_v1::model::TestIamPermissionsRequest,
163        _options: gax::options::RequestOptions,
164    ) -> impl std::future::Future<
165        Output = crate::Result<gax::response::Response<iam_v1::model::TestIamPermissionsResponse>>,
166    > + Send {
167        std::future::ready::<
168            crate::Result<gax::response::Response<iam_v1::model::TestIamPermissionsResponse>>,
169        >(Err(Error::other("unimplemented")))
170    }
171
172    /// Implements [super::client::DatabaseAdmin::create_backup].
173    fn create_backup(
174        &self,
175        _req: crate::model::CreateBackupRequest,
176        _options: gax::options::RequestOptions,
177    ) -> impl std::future::Future<
178        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
179    > + Send {
180        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
181            Err(Error::other("unimplemented")),
182        )
183    }
184
185    /// Implements [super::client::DatabaseAdmin::copy_backup].
186    fn copy_backup(
187        &self,
188        _req: crate::model::CopyBackupRequest,
189        _options: gax::options::RequestOptions,
190    ) -> impl std::future::Future<
191        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
192    > + Send {
193        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
194            Err(Error::other("unimplemented")),
195        )
196    }
197
198    /// Implements [super::client::DatabaseAdmin::get_backup].
199    fn get_backup(
200        &self,
201        _req: crate::model::GetBackupRequest,
202        _options: gax::options::RequestOptions,
203    ) -> impl std::future::Future<
204        Output = crate::Result<gax::response::Response<crate::model::Backup>>,
205    > + Send {
206        std::future::ready::<crate::Result<gax::response::Response<crate::model::Backup>>>(Err(
207            Error::other("unimplemented"),
208        ))
209    }
210
211    /// Implements [super::client::DatabaseAdmin::update_backup].
212    fn update_backup(
213        &self,
214        _req: crate::model::UpdateBackupRequest,
215        _options: gax::options::RequestOptions,
216    ) -> impl std::future::Future<
217        Output = crate::Result<gax::response::Response<crate::model::Backup>>,
218    > + Send {
219        std::future::ready::<crate::Result<gax::response::Response<crate::model::Backup>>>(Err(
220            Error::other("unimplemented"),
221        ))
222    }
223
224    /// Implements [super::client::DatabaseAdmin::delete_backup].
225    fn delete_backup(
226        &self,
227        _req: crate::model::DeleteBackupRequest,
228        _options: gax::options::RequestOptions,
229    ) -> impl std::future::Future<Output = crate::Result<gax::response::Response<()>>> + Send {
230        std::future::ready::<crate::Result<gax::response::Response<()>>>(Err(Error::other(
231            "unimplemented",
232        )))
233    }
234
235    /// Implements [super::client::DatabaseAdmin::list_backups].
236    fn list_backups(
237        &self,
238        _req: crate::model::ListBackupsRequest,
239        _options: gax::options::RequestOptions,
240    ) -> impl std::future::Future<
241        Output = crate::Result<gax::response::Response<crate::model::ListBackupsResponse>>,
242    > + Send {
243        std::future::ready::<
244            crate::Result<gax::response::Response<crate::model::ListBackupsResponse>>,
245        >(Err(Error::other("unimplemented")))
246    }
247
248    /// Implements [super::client::DatabaseAdmin::restore_database].
249    fn restore_database(
250        &self,
251        _req: crate::model::RestoreDatabaseRequest,
252        _options: gax::options::RequestOptions,
253    ) -> impl std::future::Future<
254        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
255    > + Send {
256        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
257            Err(Error::other("unimplemented")),
258        )
259    }
260
261    /// Implements [super::client::DatabaseAdmin::list_database_operations].
262    fn list_database_operations(
263        &self,
264        _req: crate::model::ListDatabaseOperationsRequest,
265        _options: gax::options::RequestOptions,
266    ) -> impl std::future::Future<
267        Output = crate::Result<
268            gax::response::Response<crate::model::ListDatabaseOperationsResponse>,
269        >,
270    > + Send {
271        std::future::ready::<
272            crate::Result<gax::response::Response<crate::model::ListDatabaseOperationsResponse>>,
273        >(Err(Error::other("unimplemented")))
274    }
275
276    /// Implements [super::client::DatabaseAdmin::list_backup_operations].
277    fn list_backup_operations(
278        &self,
279        _req: crate::model::ListBackupOperationsRequest,
280        _options: gax::options::RequestOptions,
281    ) -> impl std::future::Future<
282        Output = crate::Result<gax::response::Response<crate::model::ListBackupOperationsResponse>>,
283    > + Send {
284        std::future::ready::<
285            crate::Result<gax::response::Response<crate::model::ListBackupOperationsResponse>>,
286        >(Err(Error::other("unimplemented")))
287    }
288
289    /// Implements [super::client::DatabaseAdmin::list_database_roles].
290    fn list_database_roles(
291        &self,
292        _req: crate::model::ListDatabaseRolesRequest,
293        _options: gax::options::RequestOptions,
294    ) -> impl std::future::Future<
295        Output = crate::Result<gax::response::Response<crate::model::ListDatabaseRolesResponse>>,
296    > + Send {
297        std::future::ready::<
298            crate::Result<gax::response::Response<crate::model::ListDatabaseRolesResponse>>,
299        >(Err(Error::other("unimplemented")))
300    }
301
302    /// Implements [super::client::DatabaseAdmin::add_split_points].
303    fn add_split_points(
304        &self,
305        _req: crate::model::AddSplitPointsRequest,
306        _options: gax::options::RequestOptions,
307    ) -> impl std::future::Future<
308        Output = crate::Result<gax::response::Response<crate::model::AddSplitPointsResponse>>,
309    > + Send {
310        std::future::ready::<
311            crate::Result<gax::response::Response<crate::model::AddSplitPointsResponse>>,
312        >(Err(Error::other("unimplemented")))
313    }
314
315    /// Implements [super::client::DatabaseAdmin::create_backup_schedule].
316    fn create_backup_schedule(
317        &self,
318        _req: crate::model::CreateBackupScheduleRequest,
319        _options: gax::options::RequestOptions,
320    ) -> impl std::future::Future<
321        Output = crate::Result<gax::response::Response<crate::model::BackupSchedule>>,
322    > + Send {
323        std::future::ready::<crate::Result<gax::response::Response<crate::model::BackupSchedule>>>(
324            Err(Error::other("unimplemented")),
325        )
326    }
327
328    /// Implements [super::client::DatabaseAdmin::get_backup_schedule].
329    fn get_backup_schedule(
330        &self,
331        _req: crate::model::GetBackupScheduleRequest,
332        _options: gax::options::RequestOptions,
333    ) -> impl std::future::Future<
334        Output = crate::Result<gax::response::Response<crate::model::BackupSchedule>>,
335    > + Send {
336        std::future::ready::<crate::Result<gax::response::Response<crate::model::BackupSchedule>>>(
337            Err(Error::other("unimplemented")),
338        )
339    }
340
341    /// Implements [super::client::DatabaseAdmin::update_backup_schedule].
342    fn update_backup_schedule(
343        &self,
344        _req: crate::model::UpdateBackupScheduleRequest,
345        _options: gax::options::RequestOptions,
346    ) -> impl std::future::Future<
347        Output = crate::Result<gax::response::Response<crate::model::BackupSchedule>>,
348    > + Send {
349        std::future::ready::<crate::Result<gax::response::Response<crate::model::BackupSchedule>>>(
350            Err(Error::other("unimplemented")),
351        )
352    }
353
354    /// Implements [super::client::DatabaseAdmin::delete_backup_schedule].
355    fn delete_backup_schedule(
356        &self,
357        _req: crate::model::DeleteBackupScheduleRequest,
358        _options: gax::options::RequestOptions,
359    ) -> impl std::future::Future<Output = crate::Result<gax::response::Response<()>>> + Send {
360        std::future::ready::<crate::Result<gax::response::Response<()>>>(Err(Error::other(
361            "unimplemented",
362        )))
363    }
364
365    /// Implements [super::client::DatabaseAdmin::list_backup_schedules].
366    fn list_backup_schedules(
367        &self,
368        _req: crate::model::ListBackupSchedulesRequest,
369        _options: gax::options::RequestOptions,
370    ) -> impl std::future::Future<
371        Output = crate::Result<gax::response::Response<crate::model::ListBackupSchedulesResponse>>,
372    > + Send {
373        std::future::ready::<
374            crate::Result<gax::response::Response<crate::model::ListBackupSchedulesResponse>>,
375        >(Err(Error::other("unimplemented")))
376    }
377
378    /// Implements [super::client::DatabaseAdmin::list_operations].
379    fn list_operations(
380        &self,
381        _req: longrunning::model::ListOperationsRequest,
382        _options: gax::options::RequestOptions,
383    ) -> impl std::future::Future<
384        Output = crate::Result<gax::response::Response<longrunning::model::ListOperationsResponse>>,
385    > + Send {
386        std::future::ready::<
387            crate::Result<gax::response::Response<longrunning::model::ListOperationsResponse>>,
388        >(Err(Error::other("unimplemented")))
389    }
390
391    /// Implements [super::client::DatabaseAdmin::get_operation].
392    fn get_operation(
393        &self,
394        _req: longrunning::model::GetOperationRequest,
395        _options: gax::options::RequestOptions,
396    ) -> impl std::future::Future<
397        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
398    > + Send {
399        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
400            Err(Error::other("unimplemented")),
401        )
402    }
403
404    /// Implements [super::client::DatabaseAdmin::delete_operation].
405    fn delete_operation(
406        &self,
407        _req: longrunning::model::DeleteOperationRequest,
408        _options: gax::options::RequestOptions,
409    ) -> impl std::future::Future<Output = crate::Result<gax::response::Response<()>>> + Send {
410        std::future::ready::<crate::Result<gax::response::Response<()>>>(Err(Error::other(
411            "unimplemented",
412        )))
413    }
414
415    /// Implements [super::client::DatabaseAdmin::cancel_operation].
416    fn cancel_operation(
417        &self,
418        _req: longrunning::model::CancelOperationRequest,
419        _options: gax::options::RequestOptions,
420    ) -> impl std::future::Future<Output = crate::Result<gax::response::Response<()>>> + Send {
421        std::future::ready::<crate::Result<gax::response::Response<()>>>(Err(Error::other(
422            "unimplemented",
423        )))
424    }
425
426    /// Returns the polling error policy.
427    ///
428    /// When mocking, this method is typically irrelevant. Do not try to verify
429    /// it is called by your mocks.
430    fn get_polling_error_policy(
431        &self,
432        _options: &gax::options::RequestOptions,
433    ) -> Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
434        Arc::new(gax::polling_error_policy::Aip194Strict)
435    }
436
437    /// Returns the polling backoff policy.
438    ///
439    /// When mocking, this method is typically irrelevant. Do not try to verify
440    /// it is called by your mocks.
441    fn get_polling_backoff_policy(
442        &self,
443        _options: &gax::options::RequestOptions,
444    ) -> Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
445        Arc::new(gax::exponential_backoff::ExponentialBackoff::default())
446    }
447}