#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::invalid_html_tags)]
#![allow(rustdoc::redundant_explicit_links)]
#[derive(Clone, Debug)]
pub struct BlockchainNodeEngine {
inner: std::sync::Arc<dyn super::stub::dynamic::BlockchainNodeEngine>,
}
impl BlockchainNodeEngine {
pub fn builder() -> super::builder::blockchain_node_engine::ClientBuilder {
crate::new_client_builder(super::builder::blockchain_node_engine::client::Factory)
}
pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
where
T: super::stub::BlockchainNodeEngine + 'static,
{
Self { inner: stub.into() }
}
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::BlockchainNodeEngine>>
{
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::BlockchainNodeEngine> {
super::transport::BlockchainNodeEngine::new(conf).await
}
async fn build_with_tracing(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::BlockchainNodeEngine> {
Self::build_transport(conf)
.await
.map(super::tracing::BlockchainNodeEngine::new)
}
pub fn list_blockchain_nodes(
&self,
) -> super::builder::blockchain_node_engine::ListBlockchainNodes {
super::builder::blockchain_node_engine::ListBlockchainNodes::new(self.inner.clone())
}
pub fn get_blockchain_node(&self) -> super::builder::blockchain_node_engine::GetBlockchainNode {
super::builder::blockchain_node_engine::GetBlockchainNode::new(self.inner.clone())
}
pub fn create_blockchain_node(
&self,
) -> super::builder::blockchain_node_engine::CreateBlockchainNode {
super::builder::blockchain_node_engine::CreateBlockchainNode::new(self.inner.clone())
}
pub fn update_blockchain_node(
&self,
) -> super::builder::blockchain_node_engine::UpdateBlockchainNode {
super::builder::blockchain_node_engine::UpdateBlockchainNode::new(self.inner.clone())
}
pub fn delete_blockchain_node(
&self,
) -> super::builder::blockchain_node_engine::DeleteBlockchainNode {
super::builder::blockchain_node_engine::DeleteBlockchainNode::new(self.inner.clone())
}
pub fn list_locations(&self) -> super::builder::blockchain_node_engine::ListLocations {
super::builder::blockchain_node_engine::ListLocations::new(self.inner.clone())
}
pub fn get_location(&self) -> super::builder::blockchain_node_engine::GetLocation {
super::builder::blockchain_node_engine::GetLocation::new(self.inner.clone())
}
pub fn list_operations(&self) -> super::builder::blockchain_node_engine::ListOperations {
super::builder::blockchain_node_engine::ListOperations::new(self.inner.clone())
}
pub fn get_operation(&self) -> super::builder::blockchain_node_engine::GetOperation {
super::builder::blockchain_node_engine::GetOperation::new(self.inner.clone())
}
pub fn delete_operation(&self) -> super::builder::blockchain_node_engine::DeleteOperation {
super::builder::blockchain_node_engine::DeleteOperation::new(self.inner.clone())
}
pub fn cancel_operation(&self) -> super::builder::blockchain_node_engine::CancelOperation {
super::builder::blockchain_node_engine::CancelOperation::new(self.inner.clone())
}
}