#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#[derive(Clone, Debug)]
pub struct Lustre {
inner: std::sync::Arc<dyn super::stub::dynamic::Lustre>,
}
impl Lustre {
pub fn builder() -> super::builder::lustre::ClientBuilder {
crate::new_client_builder(super::builder::lustre::client::Factory)
}
pub fn from_stub<T>(stub: T) -> Self
where
T: super::stub::Lustre + '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::Lustre>> {
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::Lustre> {
super::transport::Lustre::new(conf).await
}
async fn build_with_tracing(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::Lustre> {
Self::build_transport(conf)
.await
.map(super::tracing::Lustre::new)
}
pub fn list_instances(&self) -> super::builder::lustre::ListInstances {
super::builder::lustre::ListInstances::new(self.inner.clone())
}
pub fn get_instance(&self) -> super::builder::lustre::GetInstance {
super::builder::lustre::GetInstance::new(self.inner.clone())
}
pub fn create_instance(&self) -> super::builder::lustre::CreateInstance {
super::builder::lustre::CreateInstance::new(self.inner.clone())
}
pub fn update_instance(&self) -> super::builder::lustre::UpdateInstance {
super::builder::lustre::UpdateInstance::new(self.inner.clone())
}
pub fn delete_instance(&self) -> super::builder::lustre::DeleteInstance {
super::builder::lustre::DeleteInstance::new(self.inner.clone())
}
pub fn import_data(&self) -> super::builder::lustre::ImportData {
super::builder::lustre::ImportData::new(self.inner.clone())
}
pub fn export_data(&self) -> super::builder::lustre::ExportData {
super::builder::lustre::ExportData::new(self.inner.clone())
}
pub fn list_locations(&self) -> super::builder::lustre::ListLocations {
super::builder::lustre::ListLocations::new(self.inner.clone())
}
pub fn get_location(&self) -> super::builder::lustre::GetLocation {
super::builder::lustre::GetLocation::new(self.inner.clone())
}
pub fn list_operations(&self) -> super::builder::lustre::ListOperations {
super::builder::lustre::ListOperations::new(self.inner.clone())
}
pub fn get_operation(&self) -> super::builder::lustre::GetOperation {
super::builder::lustre::GetOperation::new(self.inner.clone())
}
pub fn delete_operation(&self) -> super::builder::lustre::DeleteOperation {
super::builder::lustre::DeleteOperation::new(self.inner.clone())
}
pub fn cancel_operation(&self) -> super::builder::lustre::CancelOperation {
super::builder::lustre::CancelOperation::new(self.inner.clone())
}
}