use crate::Result;
#[derive(Clone, Debug)]
pub struct Grafeas<T>
where
T: super::stub::Grafeas + std::fmt::Debug + Send + Sync,
{
inner: T,
duration: gaxi::observability::DurationMetric,
}
impl<T> Grafeas<T>
where
T: super::stub::Grafeas + 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::Grafeas for Grafeas<T>
where
T: super::stub::Grafeas + std::fmt::Debug + Send + Sync,
{
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn get_occurrence(
&self,
req: crate::model::GetOccurrenceRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::Occurrence>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::get_occurrence",
self.inner.get_occurrence(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_occurrences(
&self,
req: crate::model::ListOccurrencesRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::ListOccurrencesResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::list_occurrences",
self.inner.list_occurrences(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn delete_occurrence(
&self,
req: crate::model::DeleteOccurrenceRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<()>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::delete_occurrence",
self.inner.delete_occurrence(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn create_occurrence(
&self,
req: crate::model::CreateOccurrenceRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::Occurrence>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::create_occurrence",
self.inner.create_occurrence(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn batch_create_occurrences(
&self,
req: crate::model::BatchCreateOccurrencesRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::BatchCreateOccurrencesResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::batch_create_occurrences",
self.inner.batch_create_occurrences(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn update_occurrence(
&self,
req: crate::model::UpdateOccurrenceRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::Occurrence>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::update_occurrence",
self.inner.update_occurrence(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn get_occurrence_note(
&self,
req: crate::model::GetOccurrenceNoteRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::Note>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::get_occurrence_note",
self.inner.get_occurrence_note(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn get_note(
&self,
req: crate::model::GetNoteRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::Note>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::get_note",
self.inner.get_note(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_notes(
&self,
req: crate::model::ListNotesRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::ListNotesResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::list_notes",
self.inner.list_notes(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn delete_note(
&self,
req: crate::model::DeleteNoteRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<()>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::delete_note",
self.inner.delete_note(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn create_note(
&self,
req: crate::model::CreateNoteRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::Note>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::create_note",
self.inner.create_note(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn batch_create_notes(
&self,
req: crate::model::BatchCreateNotesRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::BatchCreateNotesResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::batch_create_notes",
self.inner.batch_create_notes(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn update_note(
&self,
req: crate::model::UpdateNoteRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::Note>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::update_note",
self.inner.update_note(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_note_occurrences(
&self,
req: crate::model::ListNoteOccurrencesRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::ListNoteOccurrencesResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::Grafeas::list_note_occurrences",
self.inner.list_note_occurrences(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 = "containeranalysis";
info.client_version = VERSION;
info.client_artifact = NAME;
info.default_host = "containeranalysis";
info
});
}