google_cloud_build_v2/
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;
28
29pub(crate) mod dynamic;
30
31/// Defines the trait used to implement [super::client::RepositoryManager].
32///
33/// Application developers may need to implement this trait to mock
34/// `client::RepositoryManager`.  In other use-cases, application developers only
35/// use `client::RepositoryManager` and need not be concerned with this trait or
36/// its implementations.
37///
38/// Services gain new RPCs routinely. Consequently, this trait gains new methods
39/// too. To avoid breaking applications the trait provides a default
40/// implementation of each method. Most of these implementations just return an
41/// error.
42pub trait RepositoryManager: std::fmt::Debug + Send + Sync {
43    /// Implements [super::client::RepositoryManager::create_connection].
44    fn create_connection(
45        &self,
46        _req: crate::model::CreateConnectionRequest,
47        _options: gax::options::RequestOptions,
48    ) -> impl std::future::Future<
49        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
50    > + Send {
51        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
52            Err(Error::other("unimplemented")),
53        )
54    }
55
56    /// Implements [super::client::RepositoryManager::get_connection].
57    fn get_connection(
58        &self,
59        _req: crate::model::GetConnectionRequest,
60        _options: gax::options::RequestOptions,
61    ) -> impl std::future::Future<
62        Output = crate::Result<gax::response::Response<crate::model::Connection>>,
63    > + Send {
64        std::future::ready::<crate::Result<gax::response::Response<crate::model::Connection>>>(Err(
65            Error::other("unimplemented"),
66        ))
67    }
68
69    /// Implements [super::client::RepositoryManager::list_connections].
70    fn list_connections(
71        &self,
72        _req: crate::model::ListConnectionsRequest,
73        _options: gax::options::RequestOptions,
74    ) -> impl std::future::Future<
75        Output = crate::Result<gax::response::Response<crate::model::ListConnectionsResponse>>,
76    > + Send {
77        std::future::ready::<
78            crate::Result<gax::response::Response<crate::model::ListConnectionsResponse>>,
79        >(Err(Error::other("unimplemented")))
80    }
81
82    /// Implements [super::client::RepositoryManager::update_connection].
83    fn update_connection(
84        &self,
85        _req: crate::model::UpdateConnectionRequest,
86        _options: gax::options::RequestOptions,
87    ) -> impl std::future::Future<
88        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
89    > + Send {
90        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
91            Err(Error::other("unimplemented")),
92        )
93    }
94
95    /// Implements [super::client::RepositoryManager::delete_connection].
96    fn delete_connection(
97        &self,
98        _req: crate::model::DeleteConnectionRequest,
99        _options: gax::options::RequestOptions,
100    ) -> impl std::future::Future<
101        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
102    > + Send {
103        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
104            Err(Error::other("unimplemented")),
105        )
106    }
107
108    /// Implements [super::client::RepositoryManager::create_repository].
109    fn create_repository(
110        &self,
111        _req: crate::model::CreateRepositoryRequest,
112        _options: gax::options::RequestOptions,
113    ) -> impl std::future::Future<
114        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
115    > + Send {
116        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
117            Err(Error::other("unimplemented")),
118        )
119    }
120
121    /// Implements [super::client::RepositoryManager::batch_create_repositories].
122    fn batch_create_repositories(
123        &self,
124        _req: crate::model::BatchCreateRepositoriesRequest,
125        _options: gax::options::RequestOptions,
126    ) -> impl std::future::Future<
127        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
128    > + Send {
129        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
130            Err(Error::other("unimplemented")),
131        )
132    }
133
134    /// Implements [super::client::RepositoryManager::get_repository].
135    fn get_repository(
136        &self,
137        _req: crate::model::GetRepositoryRequest,
138        _options: gax::options::RequestOptions,
139    ) -> impl std::future::Future<
140        Output = crate::Result<gax::response::Response<crate::model::Repository>>,
141    > + Send {
142        std::future::ready::<crate::Result<gax::response::Response<crate::model::Repository>>>(Err(
143            Error::other("unimplemented"),
144        ))
145    }
146
147    /// Implements [super::client::RepositoryManager::list_repositories].
148    fn list_repositories(
149        &self,
150        _req: crate::model::ListRepositoriesRequest,
151        _options: gax::options::RequestOptions,
152    ) -> impl std::future::Future<
153        Output = crate::Result<gax::response::Response<crate::model::ListRepositoriesResponse>>,
154    > + Send {
155        std::future::ready::<
156            crate::Result<gax::response::Response<crate::model::ListRepositoriesResponse>>,
157        >(Err(Error::other("unimplemented")))
158    }
159
160    /// Implements [super::client::RepositoryManager::delete_repository].
161    fn delete_repository(
162        &self,
163        _req: crate::model::DeleteRepositoryRequest,
164        _options: gax::options::RequestOptions,
165    ) -> impl std::future::Future<
166        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
167    > + Send {
168        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
169            Err(Error::other("unimplemented")),
170        )
171    }
172
173    /// Implements [super::client::RepositoryManager::fetch_read_write_token].
174    fn fetch_read_write_token(
175        &self,
176        _req: crate::model::FetchReadWriteTokenRequest,
177        _options: gax::options::RequestOptions,
178    ) -> impl std::future::Future<
179        Output = crate::Result<gax::response::Response<crate::model::FetchReadWriteTokenResponse>>,
180    > + Send {
181        std::future::ready::<
182            crate::Result<gax::response::Response<crate::model::FetchReadWriteTokenResponse>>,
183        >(Err(Error::other("unimplemented")))
184    }
185
186    /// Implements [super::client::RepositoryManager::fetch_read_token].
187    fn fetch_read_token(
188        &self,
189        _req: crate::model::FetchReadTokenRequest,
190        _options: gax::options::RequestOptions,
191    ) -> impl std::future::Future<
192        Output = crate::Result<gax::response::Response<crate::model::FetchReadTokenResponse>>,
193    > + Send {
194        std::future::ready::<
195            crate::Result<gax::response::Response<crate::model::FetchReadTokenResponse>>,
196        >(Err(Error::other("unimplemented")))
197    }
198
199    /// Implements [super::client::RepositoryManager::fetch_linkable_repositories].
200    fn fetch_linkable_repositories(
201        &self,
202        _req: crate::model::FetchLinkableRepositoriesRequest,
203        _options: gax::options::RequestOptions,
204    ) -> impl std::future::Future<
205        Output = crate::Result<
206            gax::response::Response<crate::model::FetchLinkableRepositoriesResponse>,
207        >,
208    > + Send {
209        std::future::ready::<
210            crate::Result<gax::response::Response<crate::model::FetchLinkableRepositoriesResponse>>,
211        >(Err(Error::other("unimplemented")))
212    }
213
214    /// Implements [super::client::RepositoryManager::fetch_git_refs].
215    fn fetch_git_refs(
216        &self,
217        _req: crate::model::FetchGitRefsRequest,
218        _options: gax::options::RequestOptions,
219    ) -> impl std::future::Future<
220        Output = crate::Result<gax::response::Response<crate::model::FetchGitRefsResponse>>,
221    > + Send {
222        std::future::ready::<
223            crate::Result<gax::response::Response<crate::model::FetchGitRefsResponse>>,
224        >(Err(Error::other("unimplemented")))
225    }
226
227    /// Implements [super::client::RepositoryManager::set_iam_policy].
228    fn set_iam_policy(
229        &self,
230        _req: iam_v1::model::SetIamPolicyRequest,
231        _options: gax::options::RequestOptions,
232    ) -> impl std::future::Future<
233        Output = crate::Result<gax::response::Response<iam_v1::model::Policy>>,
234    > + Send {
235        std::future::ready::<crate::Result<gax::response::Response<iam_v1::model::Policy>>>(Err(
236            Error::other("unimplemented"),
237        ))
238    }
239
240    /// Implements [super::client::RepositoryManager::get_iam_policy].
241    fn get_iam_policy(
242        &self,
243        _req: iam_v1::model::GetIamPolicyRequest,
244        _options: gax::options::RequestOptions,
245    ) -> impl std::future::Future<
246        Output = crate::Result<gax::response::Response<iam_v1::model::Policy>>,
247    > + Send {
248        std::future::ready::<crate::Result<gax::response::Response<iam_v1::model::Policy>>>(Err(
249            Error::other("unimplemented"),
250        ))
251    }
252
253    /// Implements [super::client::RepositoryManager::test_iam_permissions].
254    fn test_iam_permissions(
255        &self,
256        _req: iam_v1::model::TestIamPermissionsRequest,
257        _options: gax::options::RequestOptions,
258    ) -> impl std::future::Future<
259        Output = crate::Result<gax::response::Response<iam_v1::model::TestIamPermissionsResponse>>,
260    > + Send {
261        std::future::ready::<
262            crate::Result<gax::response::Response<iam_v1::model::TestIamPermissionsResponse>>,
263        >(Err(Error::other("unimplemented")))
264    }
265
266    /// Implements [super::client::RepositoryManager::get_operation].
267    fn get_operation(
268        &self,
269        _req: longrunning::model::GetOperationRequest,
270        _options: gax::options::RequestOptions,
271    ) -> impl std::future::Future<
272        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
273    > + Send {
274        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
275            Err(Error::other("unimplemented")),
276        )
277    }
278
279    /// Implements [super::client::RepositoryManager::cancel_operation].
280    fn cancel_operation(
281        &self,
282        _req: longrunning::model::CancelOperationRequest,
283        _options: gax::options::RequestOptions,
284    ) -> impl std::future::Future<Output = crate::Result<gax::response::Response<()>>> + Send {
285        std::future::ready::<crate::Result<gax::response::Response<()>>>(Err(Error::other(
286            "unimplemented",
287        )))
288    }
289
290    /// Returns the polling error policy.
291    ///
292    /// When mocking, this method is typically irrelevant. Do not try to verify
293    /// it is called by your mocks.
294    fn get_polling_error_policy(
295        &self,
296        _options: &gax::options::RequestOptions,
297    ) -> std::sync::Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
298        std::sync::Arc::new(gax::polling_error_policy::Aip194Strict)
299    }
300
301    /// Returns the polling backoff policy.
302    ///
303    /// When mocking, this method is typically irrelevant. Do not try to verify
304    /// it is called by your mocks.
305    fn get_polling_backoff_policy(
306        &self,
307        _options: &gax::options::RequestOptions,
308    ) -> std::sync::Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
309        std::sync::Arc::new(gax::exponential_backoff::ExponentialBackoff::default())
310    }
311}