vault_client_rs/api/sys/
namespaces.rs1use reqwest::Method;
2
3use crate::client::encode_path;
4use crate::types::error::VaultError;
5use crate::types::sys::NamespaceInfo;
6
7use super::SysHandler;
8
9impl SysHandler<'_> {
10 pub async fn list_namespaces(&self) -> Result<Vec<String>, VaultError> {
11 self.client.exec_list("sys/namespaces").await
12 }
13
14 pub async fn create_namespace(&self, path: &str) -> Result<NamespaceInfo, VaultError> {
15 self.client
16 .exec_with_data(
17 Method::POST,
18 &format!("sys/namespaces/{}", encode_path(path)),
19 None,
20 )
21 .await
22 }
23
24 pub async fn delete_namespace(&self, path: &str) -> Result<(), VaultError> {
25 self.client
26 .exec_empty(
27 Method::DELETE,
28 &format!("sys/namespaces/{}", encode_path(path)),
29 None,
30 )
31 .await
32 }
33}