#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#[derive(Clone, Debug)]
pub struct Executions {
inner: std::sync::Arc<dyn super::stub::dynamic::Executions>,
}
impl Executions {
pub fn builder() -> super::builder::executions::ClientBuilder {
crate::new_client_builder(super::builder::executions::client::Factory)
}
pub fn from_stub<T>(stub: T) -> Self
where
T: super::stub::Executions + '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::Executions>> {
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::Executions> {
super::transport::Executions::new(conf).await
}
async fn build_with_tracing(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::Executions> {
Self::build_transport(conf)
.await
.map(super::tracing::Executions::new)
}
pub fn list_executions(&self) -> super::builder::executions::ListExecutions {
super::builder::executions::ListExecutions::new(self.inner.clone())
}
pub fn create_execution(&self) -> super::builder::executions::CreateExecution {
super::builder::executions::CreateExecution::new(self.inner.clone())
}
pub fn get_execution(&self) -> super::builder::executions::GetExecution {
super::builder::executions::GetExecution::new(self.inner.clone())
}
pub fn cancel_execution(&self) -> super::builder::executions::CancelExecution {
super::builder::executions::CancelExecution::new(self.inner.clone())
}
}