google_cloud_spanner_admin_database_v1/
stubs.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 [crate::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 [crate::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<Output = crate::Result<crate::model::ListDatabasesResponse>> + Send
50    {
51        std::future::ready::<crate::Result<crate::model::ListDatabasesResponse>>(Err(Error::other(
52            "unimplemented",
53        )))
54    }
55
56    /// Implements [crate::client::DatabaseAdmin::create_database].
57    fn create_database(
58        &self,
59        _req: crate::model::CreateDatabaseRequest,
60        _options: gax::options::RequestOptions,
61    ) -> impl std::future::Future<Output = crate::Result<longrunning::model::Operation>> + Send
62    {
63        std::future::ready::<crate::Result<longrunning::model::Operation>>(Err(Error::other(
64            "unimplemented",
65        )))
66    }
67
68    /// Implements [crate::client::DatabaseAdmin::get_database].
69    fn get_database(
70        &self,
71        _req: crate::model::GetDatabaseRequest,
72        _options: gax::options::RequestOptions,
73    ) -> impl std::future::Future<Output = crate::Result<crate::model::Database>> + Send {
74        std::future::ready::<crate::Result<crate::model::Database>>(Err(Error::other(
75            "unimplemented",
76        )))
77    }
78
79    /// Implements [crate::client::DatabaseAdmin::update_database].
80    fn update_database(
81        &self,
82        _req: crate::model::UpdateDatabaseRequest,
83        _options: gax::options::RequestOptions,
84    ) -> impl std::future::Future<Output = crate::Result<longrunning::model::Operation>> + Send
85    {
86        std::future::ready::<crate::Result<longrunning::model::Operation>>(Err(Error::other(
87            "unimplemented",
88        )))
89    }
90
91    /// Implements [crate::client::DatabaseAdmin::update_database_ddl].
92    fn update_database_ddl(
93        &self,
94        _req: crate::model::UpdateDatabaseDdlRequest,
95        _options: gax::options::RequestOptions,
96    ) -> impl std::future::Future<Output = crate::Result<longrunning::model::Operation>> + Send
97    {
98        std::future::ready::<crate::Result<longrunning::model::Operation>>(Err(Error::other(
99            "unimplemented",
100        )))
101    }
102
103    /// Implements [crate::client::DatabaseAdmin::drop_database].
104    fn drop_database(
105        &self,
106        _req: crate::model::DropDatabaseRequest,
107        _options: gax::options::RequestOptions,
108    ) -> impl std::future::Future<Output = crate::Result<wkt::Empty>> + Send {
109        std::future::ready::<crate::Result<wkt::Empty>>(Err(Error::other("unimplemented")))
110    }
111
112    /// Implements [crate::client::DatabaseAdmin::get_database_ddl].
113    fn get_database_ddl(
114        &self,
115        _req: crate::model::GetDatabaseDdlRequest,
116        _options: gax::options::RequestOptions,
117    ) -> impl std::future::Future<Output = crate::Result<crate::model::GetDatabaseDdlResponse>> + Send
118    {
119        std::future::ready::<crate::Result<crate::model::GetDatabaseDdlResponse>>(Err(
120            Error::other("unimplemented"),
121        ))
122    }
123
124    /// Implements [crate::client::DatabaseAdmin::set_iam_policy].
125    fn set_iam_policy(
126        &self,
127        _req: iam_v1::model::SetIamPolicyRequest,
128        _options: gax::options::RequestOptions,
129    ) -> impl std::future::Future<Output = crate::Result<iam_v1::model::Policy>> + Send {
130        std::future::ready::<crate::Result<iam_v1::model::Policy>>(Err(Error::other(
131            "unimplemented",
132        )))
133    }
134
135    /// Implements [crate::client::DatabaseAdmin::get_iam_policy].
136    fn get_iam_policy(
137        &self,
138        _req: iam_v1::model::GetIamPolicyRequest,
139        _options: gax::options::RequestOptions,
140    ) -> impl std::future::Future<Output = crate::Result<iam_v1::model::Policy>> + Send {
141        std::future::ready::<crate::Result<iam_v1::model::Policy>>(Err(Error::other(
142            "unimplemented",
143        )))
144    }
145
146    /// Implements [crate::client::DatabaseAdmin::test_iam_permissions].
147    fn test_iam_permissions(
148        &self,
149        _req: iam_v1::model::TestIamPermissionsRequest,
150        _options: gax::options::RequestOptions,
151    ) -> impl std::future::Future<Output = crate::Result<iam_v1::model::TestIamPermissionsResponse>> + Send
152    {
153        std::future::ready::<crate::Result<iam_v1::model::TestIamPermissionsResponse>>(Err(
154            Error::other("unimplemented"),
155        ))
156    }
157
158    /// Implements [crate::client::DatabaseAdmin::create_backup].
159    fn create_backup(
160        &self,
161        _req: crate::model::CreateBackupRequest,
162        _options: gax::options::RequestOptions,
163    ) -> impl std::future::Future<Output = crate::Result<longrunning::model::Operation>> + Send
164    {
165        std::future::ready::<crate::Result<longrunning::model::Operation>>(Err(Error::other(
166            "unimplemented",
167        )))
168    }
169
170    /// Implements [crate::client::DatabaseAdmin::copy_backup].
171    fn copy_backup(
172        &self,
173        _req: crate::model::CopyBackupRequest,
174        _options: gax::options::RequestOptions,
175    ) -> impl std::future::Future<Output = crate::Result<longrunning::model::Operation>> + Send
176    {
177        std::future::ready::<crate::Result<longrunning::model::Operation>>(Err(Error::other(
178            "unimplemented",
179        )))
180    }
181
182    /// Implements [crate::client::DatabaseAdmin::get_backup].
183    fn get_backup(
184        &self,
185        _req: crate::model::GetBackupRequest,
186        _options: gax::options::RequestOptions,
187    ) -> impl std::future::Future<Output = crate::Result<crate::model::Backup>> + Send {
188        std::future::ready::<crate::Result<crate::model::Backup>>(Err(Error::other(
189            "unimplemented",
190        )))
191    }
192
193    /// Implements [crate::client::DatabaseAdmin::update_backup].
194    fn update_backup(
195        &self,
196        _req: crate::model::UpdateBackupRequest,
197        _options: gax::options::RequestOptions,
198    ) -> impl std::future::Future<Output = crate::Result<crate::model::Backup>> + Send {
199        std::future::ready::<crate::Result<crate::model::Backup>>(Err(Error::other(
200            "unimplemented",
201        )))
202    }
203
204    /// Implements [crate::client::DatabaseAdmin::delete_backup].
205    fn delete_backup(
206        &self,
207        _req: crate::model::DeleteBackupRequest,
208        _options: gax::options::RequestOptions,
209    ) -> impl std::future::Future<Output = crate::Result<wkt::Empty>> + Send {
210        std::future::ready::<crate::Result<wkt::Empty>>(Err(Error::other("unimplemented")))
211    }
212
213    /// Implements [crate::client::DatabaseAdmin::list_backups].
214    fn list_backups(
215        &self,
216        _req: crate::model::ListBackupsRequest,
217        _options: gax::options::RequestOptions,
218    ) -> impl std::future::Future<Output = crate::Result<crate::model::ListBackupsResponse>> + Send
219    {
220        std::future::ready::<crate::Result<crate::model::ListBackupsResponse>>(Err(Error::other(
221            "unimplemented",
222        )))
223    }
224
225    /// Implements [crate::client::DatabaseAdmin::restore_database].
226    fn restore_database(
227        &self,
228        _req: crate::model::RestoreDatabaseRequest,
229        _options: gax::options::RequestOptions,
230    ) -> impl std::future::Future<Output = crate::Result<longrunning::model::Operation>> + Send
231    {
232        std::future::ready::<crate::Result<longrunning::model::Operation>>(Err(Error::other(
233            "unimplemented",
234        )))
235    }
236
237    /// Implements [crate::client::DatabaseAdmin::list_database_operations].
238    fn list_database_operations(
239        &self,
240        _req: crate::model::ListDatabaseOperationsRequest,
241        _options: gax::options::RequestOptions,
242    ) -> impl std::future::Future<Output = crate::Result<crate::model::ListDatabaseOperationsResponse>>
243           + Send {
244        std::future::ready::<crate::Result<crate::model::ListDatabaseOperationsResponse>>(Err(
245            Error::other("unimplemented"),
246        ))
247    }
248
249    /// Implements [crate::client::DatabaseAdmin::list_backup_operations].
250    fn list_backup_operations(
251        &self,
252        _req: crate::model::ListBackupOperationsRequest,
253        _options: gax::options::RequestOptions,
254    ) -> impl std::future::Future<Output = crate::Result<crate::model::ListBackupOperationsResponse>>
255           + Send {
256        std::future::ready::<crate::Result<crate::model::ListBackupOperationsResponse>>(Err(
257            Error::other("unimplemented"),
258        ))
259    }
260
261    /// Implements [crate::client::DatabaseAdmin::list_database_roles].
262    fn list_database_roles(
263        &self,
264        _req: crate::model::ListDatabaseRolesRequest,
265        _options: gax::options::RequestOptions,
266    ) -> impl std::future::Future<Output = crate::Result<crate::model::ListDatabaseRolesResponse>> + Send
267    {
268        std::future::ready::<crate::Result<crate::model::ListDatabaseRolesResponse>>(Err(
269            Error::other("unimplemented"),
270        ))
271    }
272
273    /// Implements [crate::client::DatabaseAdmin::add_split_points].
274    fn add_split_points(
275        &self,
276        _req: crate::model::AddSplitPointsRequest,
277        _options: gax::options::RequestOptions,
278    ) -> impl std::future::Future<Output = crate::Result<crate::model::AddSplitPointsResponse>> + Send
279    {
280        std::future::ready::<crate::Result<crate::model::AddSplitPointsResponse>>(Err(
281            Error::other("unimplemented"),
282        ))
283    }
284
285    /// Implements [crate::client::DatabaseAdmin::create_backup_schedule].
286    fn create_backup_schedule(
287        &self,
288        _req: crate::model::CreateBackupScheduleRequest,
289        _options: gax::options::RequestOptions,
290    ) -> impl std::future::Future<Output = crate::Result<crate::model::BackupSchedule>> + Send {
291        std::future::ready::<crate::Result<crate::model::BackupSchedule>>(Err(Error::other(
292            "unimplemented",
293        )))
294    }
295
296    /// Implements [crate::client::DatabaseAdmin::get_backup_schedule].
297    fn get_backup_schedule(
298        &self,
299        _req: crate::model::GetBackupScheduleRequest,
300        _options: gax::options::RequestOptions,
301    ) -> impl std::future::Future<Output = crate::Result<crate::model::BackupSchedule>> + Send {
302        std::future::ready::<crate::Result<crate::model::BackupSchedule>>(Err(Error::other(
303            "unimplemented",
304        )))
305    }
306
307    /// Implements [crate::client::DatabaseAdmin::update_backup_schedule].
308    fn update_backup_schedule(
309        &self,
310        _req: crate::model::UpdateBackupScheduleRequest,
311        _options: gax::options::RequestOptions,
312    ) -> impl std::future::Future<Output = crate::Result<crate::model::BackupSchedule>> + Send {
313        std::future::ready::<crate::Result<crate::model::BackupSchedule>>(Err(Error::other(
314            "unimplemented",
315        )))
316    }
317
318    /// Implements [crate::client::DatabaseAdmin::delete_backup_schedule].
319    fn delete_backup_schedule(
320        &self,
321        _req: crate::model::DeleteBackupScheduleRequest,
322        _options: gax::options::RequestOptions,
323    ) -> impl std::future::Future<Output = crate::Result<wkt::Empty>> + Send {
324        std::future::ready::<crate::Result<wkt::Empty>>(Err(Error::other("unimplemented")))
325    }
326
327    /// Implements [crate::client::DatabaseAdmin::list_backup_schedules].
328    fn list_backup_schedules(
329        &self,
330        _req: crate::model::ListBackupSchedulesRequest,
331        _options: gax::options::RequestOptions,
332    ) -> impl std::future::Future<Output = crate::Result<crate::model::ListBackupSchedulesResponse>> + Send
333    {
334        std::future::ready::<crate::Result<crate::model::ListBackupSchedulesResponse>>(Err(
335            Error::other("unimplemented"),
336        ))
337    }
338
339    /// Implements [crate::client::DatabaseAdmin::list_operations].
340    fn list_operations(
341        &self,
342        _req: longrunning::model::ListOperationsRequest,
343        _options: gax::options::RequestOptions,
344    ) -> impl std::future::Future<Output = crate::Result<longrunning::model::ListOperationsResponse>>
345           + Send {
346        std::future::ready::<crate::Result<longrunning::model::ListOperationsResponse>>(Err(
347            Error::other("unimplemented"),
348        ))
349    }
350
351    /// Implements [crate::client::DatabaseAdmin::get_operation].
352    fn get_operation(
353        &self,
354        _req: longrunning::model::GetOperationRequest,
355        _options: gax::options::RequestOptions,
356    ) -> impl std::future::Future<Output = crate::Result<longrunning::model::Operation>> + Send
357    {
358        std::future::ready::<crate::Result<longrunning::model::Operation>>(Err(Error::other(
359            "unimplemented",
360        )))
361    }
362
363    /// Implements [crate::client::DatabaseAdmin::delete_operation].
364    fn delete_operation(
365        &self,
366        _req: longrunning::model::DeleteOperationRequest,
367        _options: gax::options::RequestOptions,
368    ) -> impl std::future::Future<Output = crate::Result<wkt::Empty>> + Send {
369        std::future::ready::<crate::Result<wkt::Empty>>(Err(Error::other("unimplemented")))
370    }
371
372    /// Implements [crate::client::DatabaseAdmin::cancel_operation].
373    fn cancel_operation(
374        &self,
375        _req: longrunning::model::CancelOperationRequest,
376        _options: gax::options::RequestOptions,
377    ) -> impl std::future::Future<Output = crate::Result<wkt::Empty>> + Send {
378        std::future::ready::<crate::Result<wkt::Empty>>(Err(Error::other("unimplemented")))
379    }
380
381    /// Returns the polling policy.
382    ///
383    /// When mocking, this method is typically irrelevant. Do not try to verify
384    /// it is called by your mocks.
385    fn get_polling_policy(
386        &self,
387        _options: &gax::options::RequestOptions,
388    ) -> Arc<dyn gax::polling_policy::PollingPolicy> {
389        Arc::new(gax::polling_policy::Aip194Strict)
390    }
391
392    /// Returns the polling backoff policy.
393    ///
394    /// When mocking, this method is typically irrelevant. Do not try to verify
395    /// it is called by your mocks.
396    fn get_polling_backoff_policy(
397        &self,
398        _options: &gax::options::RequestOptions,
399    ) -> Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
400        Arc::new(gax::exponential_backoff::ExponentialBackoff::default())
401    }
402}