#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#[derive(Clone, Debug)]
pub struct CloudShellService {
inner: std::sync::Arc<dyn super::stub::dynamic::CloudShellService>,
}
impl CloudShellService {
pub fn builder() -> super::builder::cloud_shell_service::ClientBuilder {
crate::new_client_builder(super::builder::cloud_shell_service::client::Factory)
}
pub fn from_stub<T>(stub: T) -> Self
where
T: super::stub::CloudShellService + 'static,
{
Self {
inner: std::sync::Arc::new(stub),
}
}
pub(crate) async fn new(
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self> {
let inner = Self::build_inner(config).await?;
Ok(Self { inner })
}
async fn build_inner(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CloudShellService>>
{
if gaxi::options::tracing_enabled(&conf) {
return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
}
Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
}
async fn build_transport(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::CloudShellService> {
super::transport::CloudShellService::new(conf).await
}
async fn build_with_tracing(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::CloudShellService> {
Self::build_transport(conf)
.await
.map(super::tracing::CloudShellService::new)
}
pub fn get_environment(&self) -> super::builder::cloud_shell_service::GetEnvironment {
super::builder::cloud_shell_service::GetEnvironment::new(self.inner.clone())
}
pub fn start_environment(&self) -> super::builder::cloud_shell_service::StartEnvironment {
super::builder::cloud_shell_service::StartEnvironment::new(self.inner.clone())
}
pub fn authorize_environment(
&self,
) -> super::builder::cloud_shell_service::AuthorizeEnvironment {
super::builder::cloud_shell_service::AuthorizeEnvironment::new(self.inner.clone())
}
pub fn add_public_key(&self) -> super::builder::cloud_shell_service::AddPublicKey {
super::builder::cloud_shell_service::AddPublicKey::new(self.inner.clone())
}
pub fn remove_public_key(&self) -> super::builder::cloud_shell_service::RemovePublicKey {
super::builder::cloud_shell_service::RemovePublicKey::new(self.inner.clone())
}
pub fn get_operation(&self) -> super::builder::cloud_shell_service::GetOperation {
super::builder::cloud_shell_service::GetOperation::new(self.inner.clone())
}
}