google_cloud_api_servicecontrol_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;
28
29pub(crate) mod dynamic;
30
31/// Defines the trait used to implement [crate::client::QuotaController].
32///
33/// Application developers may need to implement this trait to mock
34/// `client::QuotaController`.  In other use-cases, application developers only
35/// use `client::QuotaController` 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 QuotaController: std::fmt::Debug + Send + Sync {
43    /// Implements [crate::client::QuotaController::allocate_quota].
44    fn allocate_quota(
45        &self,
46        _req: crate::model::AllocateQuotaRequest,
47        _options: gax::options::RequestOptions,
48    ) -> impl std::future::Future<Output = crate::Result<crate::model::AllocateQuotaResponse>> + Send
49    {
50        std::future::ready::<crate::Result<crate::model::AllocateQuotaResponse>>(Err(Error::other(
51            "unimplemented",
52        )))
53    }
54}
55
56/// Defines the trait used to implement [crate::client::ServiceController].
57///
58/// Application developers may need to implement this trait to mock
59/// `client::ServiceController`.  In other use-cases, application developers only
60/// use `client::ServiceController` and need not be concerned with this trait or
61/// its implementations.
62///
63/// Services gain new RPCs routinely. Consequently, this trait gains new methods
64/// too. To avoid breaking applications the trait provides a default
65/// implementation of each method. Most of these implementations just return an
66/// error.
67pub trait ServiceController: std::fmt::Debug + Send + Sync {
68    /// Implements [crate::client::ServiceController::check].
69    fn check(
70        &self,
71        _req: crate::model::CheckRequest,
72        _options: gax::options::RequestOptions,
73    ) -> impl std::future::Future<Output = crate::Result<crate::model::CheckResponse>> + Send {
74        std::future::ready::<crate::Result<crate::model::CheckResponse>>(Err(Error::other(
75            "unimplemented",
76        )))
77    }
78
79    /// Implements [crate::client::ServiceController::report].
80    fn report(
81        &self,
82        _req: crate::model::ReportRequest,
83        _options: gax::options::RequestOptions,
84    ) -> impl std::future::Future<Output = crate::Result<crate::model::ReportResponse>> + Send {
85        std::future::ready::<crate::Result<crate::model::ReportResponse>>(Err(Error::other(
86            "unimplemented",
87        )))
88    }
89}