google_cloud_shell_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::CloudShellService].
33///
34/// Application developers may need to implement this trait to mock
35/// `client::CloudShellService`.  In other use-cases, application developers only
36/// use `client::CloudShellService` 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 CloudShellService: std::fmt::Debug + Send + Sync {
44    /// Implements [super::client::CloudShellService::get_environment].
45    fn get_environment(
46        &self,
47        _req: crate::model::GetEnvironmentRequest,
48        _options: gax::options::RequestOptions,
49    ) -> impl std::future::Future<
50        Output = crate::Result<gax::response::Response<crate::model::Environment>>,
51    > + Send {
52        std::future::ready::<crate::Result<gax::response::Response<crate::model::Environment>>>(
53            Err(Error::other("unimplemented")),
54        )
55    }
56
57    /// Implements [super::client::CloudShellService::start_environment].
58    fn start_environment(
59        &self,
60        _req: crate::model::StartEnvironmentRequest,
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::CloudShellService::authorize_environment].
71    fn authorize_environment(
72        &self,
73        _req: crate::model::AuthorizeEnvironmentRequest,
74        _options: gax::options::RequestOptions,
75    ) -> impl std::future::Future<
76        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
77    > + Send {
78        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
79            Err(Error::other("unimplemented")),
80        )
81    }
82
83    /// Implements [super::client::CloudShellService::add_public_key].
84    fn add_public_key(
85        &self,
86        _req: crate::model::AddPublicKeyRequest,
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::CloudShellService::remove_public_key].
97    fn remove_public_key(
98        &self,
99        _req: crate::model::RemovePublicKeyRequest,
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::CloudShellService::get_operation].
110    fn get_operation(
111        &self,
112        _req: longrunning::model::GetOperationRequest,
113        _options: gax::options::RequestOptions,
114    ) -> impl std::future::Future<
115        Output = crate::Result<gax::response::Response<longrunning::model::Operation>>,
116    > + Send {
117        std::future::ready::<crate::Result<gax::response::Response<longrunning::model::Operation>>>(
118            Err(Error::other("unimplemented")),
119        )
120    }
121
122    /// Returns the polling error policy.
123    ///
124    /// When mocking, this method is typically irrelevant. Do not try to verify
125    /// it is called by your mocks.
126    fn get_polling_error_policy(
127        &self,
128        _options: &gax::options::RequestOptions,
129    ) -> Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
130        Arc::new(gax::polling_error_policy::Aip194Strict)
131    }
132
133    /// Returns the polling backoff policy.
134    ///
135    /// When mocking, this method is typically irrelevant. Do not try to verify
136    /// it is called by your mocks.
137    fn get_polling_backoff_policy(
138        &self,
139        _options: &gax::options::RequestOptions,
140    ) -> Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
141        Arc::new(gax::exponential_backoff::ExponentialBackoff::default())
142    }
143}