google_cloud_optimization_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::FleetRouting].
33///
34/// Application developers may need to implement this trait to mock
35/// `client::FleetRouting`. In other use-cases, application developers only
36/// use `client::FleetRouting` 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 FleetRouting: std::fmt::Debug + Send + Sync {
44 /// Implements [crate::client::FleetRouting::optimize_tours].
45 fn optimize_tours(
46 &self,
47 _req: crate::model::OptimizeToursRequest,
48 _options: gax::options::RequestOptions,
49 ) -> impl std::future::Future<Output = crate::Result<crate::model::OptimizeToursResponse>> + Send
50 {
51 std::future::ready::<crate::Result<crate::model::OptimizeToursResponse>>(Err(Error::other(
52 "unimplemented",
53 )))
54 }
55
56 /// Implements [crate::client::FleetRouting::batch_optimize_tours].
57 fn batch_optimize_tours(
58 &self,
59 _req: crate::model::BatchOptimizeToursRequest,
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::FleetRouting::get_operation].
69 fn get_operation(
70 &self,
71 _req: longrunning::model::GetOperationRequest,
72 _options: gax::options::RequestOptions,
73 ) -> impl std::future::Future<Output = crate::Result<longrunning::model::Operation>> + Send
74 {
75 std::future::ready::<crate::Result<longrunning::model::Operation>>(Err(Error::other(
76 "unimplemented",
77 )))
78 }
79
80 /// Returns the polling policy.
81 ///
82 /// When mocking, this method is typically irrelevant. Do not try to verify
83 /// it is called by your mocks.
84 fn get_polling_policy(
85 &self,
86 _options: &gax::options::RequestOptions,
87 ) -> Arc<dyn gax::polling_policy::PollingPolicy> {
88 Arc::new(gax::polling_policy::Aip194Strict)
89 }
90
91 /// Returns the polling backoff policy.
92 ///
93 /// When mocking, this method is typically irrelevant. Do not try to verify
94 /// it is called by your mocks.
95 fn get_polling_backoff_policy(
96 &self,
97 _options: &gax::options::RequestOptions,
98 ) -> Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
99 Arc::new(gax::exponential_backoff::ExponentialBackoff::default())
100 }
101}