#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#[derive(Clone, Debug)]
pub struct ConnectionService {
inner: std::sync::Arc<dyn super::stub::dynamic::ConnectionService>,
}
impl ConnectionService {
pub fn builder() -> super::builder::connection_service::ClientBuilder {
crate::new_client_builder(super::builder::connection_service::client::Factory)
}
pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
where
T: super::stub::ConnectionService + '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::ConnectionService>>
{
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::ConnectionService> {
super::transport::ConnectionService::new(conf).await
}
async fn build_with_tracing(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::ConnectionService> {
Self::build_transport(conf)
.await
.map(super::tracing::ConnectionService::new)
}
pub fn create_connection(&self) -> super::builder::connection_service::CreateConnection {
super::builder::connection_service::CreateConnection::new(self.inner.clone())
}
pub fn get_connection(&self) -> super::builder::connection_service::GetConnection {
super::builder::connection_service::GetConnection::new(self.inner.clone())
}
pub fn list_connections(&self) -> super::builder::connection_service::ListConnections {
super::builder::connection_service::ListConnections::new(self.inner.clone())
}
pub fn update_connection(&self) -> super::builder::connection_service::UpdateConnection {
super::builder::connection_service::UpdateConnection::new(self.inner.clone())
}
pub fn delete_connection(&self) -> super::builder::connection_service::DeleteConnection {
super::builder::connection_service::DeleteConnection::new(self.inner.clone())
}
pub fn get_iam_policy(&self) -> super::builder::connection_service::GetIamPolicy {
super::builder::connection_service::GetIamPolicy::new(self.inner.clone())
}
pub fn set_iam_policy(&self) -> super::builder::connection_service::SetIamPolicy {
super::builder::connection_service::SetIamPolicy::new(self.inner.clone())
}
pub fn test_iam_permissions(&self) -> super::builder::connection_service::TestIamPermissions {
super::builder::connection_service::TestIamPermissions::new(self.inner.clone())
}
}