1use std::sync::Arc;
2
3pub use covert_types::methods::system::{
4 CreatePolicyParams, CreatePolicyResponse, ListPolicyResponse, RemovePolicyResponse,
5};
6
7use crate::base::BaseClient;
8
9pub struct Client {
10 client: Arc<BaseClient>,
11}
12
13impl Client {
14 pub(crate) fn new(client: Arc<BaseClient>) -> Self {
15 Self { client }
16 }
17
18 pub async fn create(
19 &self,
20 params: &CreatePolicyParams,
21 ) -> Result<CreatePolicyResponse, String> {
22 self.client.post("/sys/policies".into(), params).await
23 }
24
25 pub async fn list(&self) -> Result<ListPolicyResponse, String> {
26 self.client.get("/sys/policies".into()).await
27 }
28
29 pub async fn remove(&self, name: &str) -> Result<RemovePolicyResponse, String> {
30 self.client.delete(format!("/sys/policies/{name}")).await
31 }
32}