#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#[derive(Clone, Debug)]
pub struct Ids {
inner: std::sync::Arc<dyn super::stub::dynamic::Ids>,
}
impl Ids {
pub fn builder() -> super::builder::ids::ClientBuilder {
crate::new_client_builder(super::builder::ids::client::Factory)
}
pub fn from_stub<T>(stub: T) -> Self
where
T: super::stub::Ids + '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::Ids>> {
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::Ids> {
super::transport::Ids::new(conf).await
}
async fn build_with_tracing(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::Ids> {
Self::build_transport(conf)
.await
.map(super::tracing::Ids::new)
}
pub fn list_endpoints(&self) -> super::builder::ids::ListEndpoints {
super::builder::ids::ListEndpoints::new(self.inner.clone())
}
pub fn get_endpoint(&self) -> super::builder::ids::GetEndpoint {
super::builder::ids::GetEndpoint::new(self.inner.clone())
}
pub fn create_endpoint(&self) -> super::builder::ids::CreateEndpoint {
super::builder::ids::CreateEndpoint::new(self.inner.clone())
}
pub fn delete_endpoint(&self) -> super::builder::ids::DeleteEndpoint {
super::builder::ids::DeleteEndpoint::new(self.inner.clone())
}
pub fn list_operations(&self) -> super::builder::ids::ListOperations {
super::builder::ids::ListOperations::new(self.inner.clone())
}
pub fn get_operation(&self) -> super::builder::ids::GetOperation {
super::builder::ids::GetOperation::new(self.inner.clone())
}
pub fn delete_operation(&self) -> super::builder::ids::DeleteOperation {
super::builder::ids::DeleteOperation::new(self.inner.clone())
}
pub fn cancel_operation(&self) -> super::builder::ids::CancelOperation {
super::builder::ids::CancelOperation::new(self.inner.clone())
}
}