use crate::Result;
#[derive(Clone, Debug)]
pub struct CloudLocationFinder<T>
where
T: super::stub::CloudLocationFinder + std::fmt::Debug + Send + Sync,
{
inner: T,
duration: gaxi::observability::DurationMetric,
}
impl<T> CloudLocationFinder<T>
where
T: super::stub::CloudLocationFinder + std::fmt::Debug + Send + Sync,
{
pub fn new(inner: T) -> Self {
Self {
inner,
duration: gaxi::observability::DurationMetric::new(&info::INSTRUMENTATION_CLIENT_INFO),
}
}
}
impl<T> super::stub::CloudLocationFinder for CloudLocationFinder<T>
where
T: super::stub::CloudLocationFinder + std::fmt::Debug + Send + Sync,
{
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_cloud_locations(
&self,
req: crate::model::ListCloudLocationsRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::ListCloudLocationsResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::CloudLocationFinder::list_cloud_locations",
self.inner.list_cloud_locations(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn get_cloud_location(
&self,
req: crate::model::GetCloudLocationRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::CloudLocation>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::CloudLocationFinder::get_cloud_location",
self.inner.get_cloud_location(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn search_cloud_locations(
&self,
req: crate::model::SearchCloudLocationsRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::SearchCloudLocationsResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::CloudLocationFinder::search_cloud_locations",
self.inner.search_cloud_locations(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_locations(
&self,
req: google_cloud_location::model::ListLocationsRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_location::model::ListLocationsResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::CloudLocationFinder::list_locations",
self.inner.list_locations(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn get_location(
&self,
req: google_cloud_location::model::GetLocationRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_location::model::Location>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::CloudLocationFinder::get_location",
self.inner.get_location(req, options));
pending.await
}
}
pub(crate) mod info {
const NAME: &str = env!("CARGO_PKG_NAME");
const VERSION: &str = env!("CARGO_PKG_VERSION");
pub(crate) static INSTRUMENTATION_CLIENT_INFO: std::sync::LazyLock<
gaxi::options::InstrumentationClientInfo,
> = std::sync::LazyLock::new(|| {
let mut info = gaxi::options::InstrumentationClientInfo::default();
info.service_name = "cloudlocationfinder";
info.client_version = VERSION;
info.client_artifact = NAME;
info.default_host = "cloudlocationfinder";
info
});
}