use std::sync::Arc;
#[async_trait::async_trait]
pub trait ServiceUsage: std::fmt::Debug + Send + Sync {
async fn enable_service(
&self,
req: crate::model::EnableServiceRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::Operation>;
async fn disable_service(
&self,
req: crate::model::DisableServiceRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::Operation>;
async fn get_service(
&self,
req: crate::model::GetServiceRequest,
options: gax::options::RequestOptions,
) -> crate::Result<crate::model::Service>;
async fn list_services(
&self,
req: crate::model::ListServicesRequest,
options: gax::options::RequestOptions,
) -> crate::Result<crate::model::ListServicesResponse>;
async fn batch_enable_services(
&self,
req: crate::model::BatchEnableServicesRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::Operation>;
async fn batch_get_services(
&self,
req: crate::model::BatchGetServicesRequest,
options: gax::options::RequestOptions,
) -> crate::Result<crate::model::BatchGetServicesResponse>;
async fn list_operations(
&self,
req: longrunning::model::ListOperationsRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::ListOperationsResponse>;
async fn get_operation(
&self,
req: longrunning::model::GetOperationRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::Operation>;
fn get_polling_policy(
&self,
options: &gax::options::RequestOptions,
) -> Arc<dyn gax::polling_policy::PollingPolicy>;
fn get_polling_backoff_policy(
&self,
options: &gax::options::RequestOptions,
) -> Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy>;
}
#[async_trait::async_trait]
impl<T: crate::stubs::ServiceUsage> ServiceUsage for T {
async fn enable_service(
&self,
req: crate::model::EnableServiceRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::Operation> {
T::enable_service(self, req, options).await
}
async fn disable_service(
&self,
req: crate::model::DisableServiceRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::Operation> {
T::disable_service(self, req, options).await
}
async fn get_service(
&self,
req: crate::model::GetServiceRequest,
options: gax::options::RequestOptions,
) -> crate::Result<crate::model::Service> {
T::get_service(self, req, options).await
}
async fn list_services(
&self,
req: crate::model::ListServicesRequest,
options: gax::options::RequestOptions,
) -> crate::Result<crate::model::ListServicesResponse> {
T::list_services(self, req, options).await
}
async fn batch_enable_services(
&self,
req: crate::model::BatchEnableServicesRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::Operation> {
T::batch_enable_services(self, req, options).await
}
async fn batch_get_services(
&self,
req: crate::model::BatchGetServicesRequest,
options: gax::options::RequestOptions,
) -> crate::Result<crate::model::BatchGetServicesResponse> {
T::batch_get_services(self, req, options).await
}
async fn list_operations(
&self,
req: longrunning::model::ListOperationsRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::ListOperationsResponse> {
T::list_operations(self, req, options).await
}
async fn get_operation(
&self,
req: longrunning::model::GetOperationRequest,
options: gax::options::RequestOptions,
) -> crate::Result<longrunning::model::Operation> {
T::get_operation(self, req, options).await
}
fn get_polling_policy(
&self,
options: &gax::options::RequestOptions,
) -> Arc<dyn gax::polling_policy::PollingPolicy> {
T::get_polling_policy(self, options)
}
fn get_polling_backoff_policy(
&self,
options: &gax::options::RequestOptions,
) -> Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
T::get_polling_backoff_policy(self, options)
}
}