use aa_proto::assembly::policy::v1::policy_service_client::PolicyServiceClient;
use aa_proto::assembly::policy::v1::{CheckActionRequest, CheckActionResponse};
use tonic::transport::Channel;
pub struct GatewayClient {
client: PolicyServiceClient<Channel>,
}
impl GatewayClient {
pub async fn connect(endpoint: &str) -> Result<Self, tonic::transport::Error> {
let client = PolicyServiceClient::connect(endpoint.to_string()).await?;
Ok(Self { client })
}
pub async fn check_action(&mut self, req: CheckActionRequest) -> Result<CheckActionResponse, tonic::Status> {
let resp = self.client.check_action(req).await?;
Ok(resp.into_inner())
}
}