use crate::Result;
#[derive(Clone, Debug)]
pub struct SecurityPosture<T>
where
T: super::stub::SecurityPosture + std::fmt::Debug + Send + Sync,
{
inner: T,
duration: gaxi::observability::DurationMetric,
}
impl<T> SecurityPosture<T>
where
T: super::stub::SecurityPosture + 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::SecurityPosture for SecurityPosture<T>
where
T: super::stub::SecurityPosture + std::fmt::Debug + Send + Sync,
{
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_postures(
&self,
req: crate::model::ListPosturesRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::ListPosturesResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::list_postures",
self.inner.list_postures(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_posture_revisions(
&self,
req: crate::model::ListPostureRevisionsRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::ListPostureRevisionsResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::list_posture_revisions",
self.inner.list_posture_revisions(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn get_posture(
&self,
req: crate::model::GetPostureRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::Posture>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::get_posture",
self.inner.get_posture(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn create_posture(
&self,
req: crate::model::CreatePostureRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_longrunning::model::Operation>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::create_posture",
self.inner.create_posture(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn update_posture(
&self,
req: crate::model::UpdatePostureRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_longrunning::model::Operation>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::update_posture",
self.inner.update_posture(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn delete_posture(
&self,
req: crate::model::DeletePostureRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_longrunning::model::Operation>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::delete_posture",
self.inner.delete_posture(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn extract_posture(
&self,
req: crate::model::ExtractPostureRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_longrunning::model::Operation>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::extract_posture",
self.inner.extract_posture(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_posture_deployments(
&self,
req: crate::model::ListPostureDeploymentsRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::ListPostureDeploymentsResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::list_posture_deployments",
self.inner.list_posture_deployments(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn get_posture_deployment(
&self,
req: crate::model::GetPostureDeploymentRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::PostureDeployment>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::get_posture_deployment",
self.inner.get_posture_deployment(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn create_posture_deployment(
&self,
req: crate::model::CreatePostureDeploymentRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_longrunning::model::Operation>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::create_posture_deployment",
self.inner.create_posture_deployment(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn update_posture_deployment(
&self,
req: crate::model::UpdatePostureDeploymentRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_longrunning::model::Operation>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::update_posture_deployment",
self.inner.update_posture_deployment(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn delete_posture_deployment(
&self,
req: crate::model::DeletePostureDeploymentRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_longrunning::model::Operation>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::delete_posture_deployment",
self.inner.delete_posture_deployment(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_posture_templates(
&self,
req: crate::model::ListPostureTemplatesRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::ListPostureTemplatesResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::list_posture_templates",
self.inner.list_posture_templates(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn get_posture_template(
&self,
req: crate::model::GetPostureTemplateRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::PostureTemplate>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::get_posture_template",
self.inner.get_posture_template(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::SecurityPosture::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::SecurityPosture::get_location",
self.inner.get_location(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn list_operations(
&self,
req: google_cloud_longrunning::model::ListOperationsRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_longrunning::model::ListOperationsResponse>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::list_operations",
self.inner.list_operations(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn get_operation(
&self,
req: google_cloud_longrunning::model::GetOperationRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<google_cloud_longrunning::model::Operation>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::get_operation",
self.inner.get_operation(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn delete_operation(
&self,
req: google_cloud_longrunning::model::DeleteOperationRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<()>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::delete_operation",
self.inner.delete_operation(req, options));
pending.await
}
#[tracing::instrument(level = tracing::Level::DEBUG, ret)]
async fn cancel_operation(
&self,
req: google_cloud_longrunning::model::CancelOperationRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<()>> {
let (_span, pending) = gaxi::client_request_signals!(
metric: self.duration.clone(),
info: *info::INSTRUMENTATION_CLIENT_INFO,
method: "client::SecurityPosture::cancel_operation",
self.inner.cancel_operation(req, options));
pending.await
}
fn get_polling_error_policy(
&self,
options: &crate::RequestOptions,
) -> std::sync::Arc<dyn google_cloud_gax::polling_error_policy::PollingErrorPolicy> {
self.inner.get_polling_error_policy(options)
}
fn get_polling_backoff_policy(
&self,
options: &crate::RequestOptions,
) -> std::sync::Arc<dyn google_cloud_gax::polling_backoff_policy::PollingBackoffPolicy> {
self.inner.get_polling_backoff_policy(options)
}
}
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 = "securityposture";
info.client_version = VERSION;
info.client_artifact = NAME;
info.default_host = "securityposture";
info
});
}