1mod audit;
2mod health;
3mod lease;
4mod mounts;
5mod namespaces;
6mod plugins;
7mod policy;
8mod quotas;
9mod raft;
10mod rekey;
11mod seal;
12mod wrapping;
13
14use std::collections::HashMap;
15
16use secrecy::SecretString;
17use serde::de::DeserializeOwned;
18
19use crate::VaultClient;
20use crate::api::traits::SysOperations;
21use crate::types::error::VaultError;
22use crate::types::response::WrapInfo;
23use crate::types::sys::*;
24
25#[derive(Debug)]
26pub struct SysHandler<'a> {
27 pub(crate) client: &'a VaultClient,
28}
29
30impl SysOperations for SysHandler<'_> {
33 async fn health(&self) -> Result<HealthResponse, VaultError> {
34 self.health().await
35 }
36 async fn leader(&self) -> Result<LeaderResponse, VaultError> {
37 self.leader().await
38 }
39 async fn seal_status(&self) -> Result<SealStatus, VaultError> {
40 self.seal_status().await
41 }
42 async fn seal(&self) -> Result<(), VaultError> {
43 self.seal().await
44 }
45 async fn unseal(&self, key: &SecretString) -> Result<SealStatus, VaultError> {
46 self.unseal(key).await
47 }
48 async fn init(&self, params: &InitParams) -> Result<InitResponse, VaultError> {
49 self.init(params).await
50 }
51 async fn step_down(&self) -> Result<(), VaultError> {
52 self.step_down().await
53 }
54 async fn list_mounts(&self) -> Result<HashMap<String, MountInfo>, VaultError> {
55 self.list_mounts().await
56 }
57 async fn mount(&self, path: &str, params: &MountParams) -> Result<(), VaultError> {
58 self.mount(path, params).await
59 }
60 async fn unmount(&self, path: &str) -> Result<(), VaultError> {
61 self.unmount(path).await
62 }
63 async fn tune_mount(&self, path: &str, params: &MountTuneParams) -> Result<(), VaultError> {
64 self.tune_mount(path, params).await
65 }
66 async fn read_mount_tune(&self, path: &str) -> Result<MountConfig, VaultError> {
67 self.read_mount_tune(path).await
68 }
69 async fn list_auth_mounts(&self) -> Result<HashMap<String, AuthMountInfo>, VaultError> {
70 self.list_auth_mounts().await
71 }
72 async fn enable_auth(&self, path: &str, params: &AuthMountParams) -> Result<(), VaultError> {
73 self.enable_auth(path, params).await
74 }
75 async fn disable_auth(&self, path: &str) -> Result<(), VaultError> {
76 self.disable_auth(path).await
77 }
78 async fn read_auth_tune(&self, path: &str) -> Result<MountConfig, VaultError> {
79 self.read_auth_tune(path).await
80 }
81 async fn list_policies(&self) -> Result<Vec<String>, VaultError> {
82 self.list_policies().await
83 }
84 async fn read_policy(&self, name: &str) -> Result<PolicyInfo, VaultError> {
85 self.read_policy(name).await
86 }
87 async fn write_policy(&self, name: &str, rules: &str) -> Result<(), VaultError> {
88 self.write_policy(name, rules).await
89 }
90 async fn delete_policy(&self, name: &str) -> Result<(), VaultError> {
91 self.delete_policy(name).await
92 }
93 async fn read_lease(&self, lease_id: &str) -> Result<LeaseInfo, VaultError> {
94 self.read_lease(lease_id).await
95 }
96 async fn renew_lease(
97 &self,
98 lease_id: &str,
99 increment: Option<&str>,
100 ) -> Result<LeaseRenewal, VaultError> {
101 self.renew_lease(lease_id, increment).await
102 }
103 async fn revoke_lease(&self, lease_id: &str) -> Result<(), VaultError> {
104 self.revoke_lease(lease_id).await
105 }
106 async fn revoke_prefix(&self, prefix: &str) -> Result<(), VaultError> {
107 self.revoke_prefix(prefix).await
108 }
109 async fn list_audit_devices(&self) -> Result<HashMap<String, AuditDevice>, VaultError> {
110 self.list_audit_devices().await
111 }
112 async fn enable_audit(&self, path: &str, params: &AuditParams) -> Result<(), VaultError> {
113 self.enable_audit(path, params).await
114 }
115 async fn disable_audit(&self, path: &str) -> Result<(), VaultError> {
116 self.disable_audit(path).await
117 }
118 async fn unwrap<T: DeserializeOwned + Send>(
119 &self,
120 token: &SecretString,
121 ) -> Result<T, VaultError> {
122 self.unwrap(token).await
123 }
124 async fn wrap_lookup(&self, token: &SecretString) -> Result<WrapInfo, VaultError> {
125 self.wrap_lookup(token).await
126 }
127 async fn capabilities(
128 &self,
129 token: &SecretString,
130 paths: &[&str],
131 ) -> Result<HashMap<String, Vec<String>>, VaultError> {
132 self.capabilities(token, paths).await
133 }
134 async fn capabilities_self(
135 &self,
136 paths: &[&str],
137 ) -> Result<HashMap<String, Vec<String>>, VaultError> {
138 self.capabilities_self(paths).await
139 }
140 async fn key_status(&self) -> Result<KeyStatus, VaultError> {
141 self.key_status().await
142 }
143 async fn rotate_encryption_key(&self) -> Result<(), VaultError> {
144 self.rotate_encryption_key().await
145 }
146
147 async fn list_plugins(&self, plugin_type: &str) -> Result<Vec<String>, VaultError> {
149 self.list_plugins(plugin_type).await
150 }
151 async fn read_plugin(&self, plugin_type: &str, name: &str) -> Result<PluginInfo, VaultError> {
152 self.read_plugin(plugin_type, name).await
153 }
154 async fn register_plugin(&self, params: &RegisterPluginRequest) -> Result<(), VaultError> {
155 self.register_plugin(params).await
156 }
157 async fn deregister_plugin(&self, plugin_type: &str, name: &str) -> Result<(), VaultError> {
158 self.deregister_plugin(plugin_type, name).await
159 }
160 async fn reload_plugin(&self, plugin: &str) -> Result<(), VaultError> {
161 self.reload_plugin(plugin).await
162 }
163
164 async fn raft_config(&self) -> Result<RaftConfig, VaultError> {
166 self.raft_config().await
167 }
168 async fn raft_autopilot_state(&self) -> Result<AutopilotState, VaultError> {
169 self.raft_autopilot_state().await
170 }
171 async fn raft_remove_peer(&self, server_id: &str) -> Result<(), VaultError> {
172 self.raft_remove_peer(server_id).await
173 }
174 async fn raft_snapshot(&self) -> Result<Vec<u8>, VaultError> {
175 self.raft_snapshot().await
176 }
177 async fn raft_snapshot_restore(&self, snapshot: &[u8]) -> Result<(), VaultError> {
178 self.raft_snapshot_restore(snapshot).await
179 }
180
181 async fn in_flight_requests(&self) -> Result<HashMap<String, InFlightRequest>, VaultError> {
183 self.in_flight_requests().await
184 }
185
186 async fn list_namespaces(&self) -> Result<Vec<String>, VaultError> {
188 self.list_namespaces().await
189 }
190 async fn create_namespace(&self, path: &str) -> Result<NamespaceInfo, VaultError> {
191 self.create_namespace(path).await
192 }
193 async fn delete_namespace(&self, path: &str) -> Result<(), VaultError> {
194 self.delete_namespace(path).await
195 }
196
197 async fn list_rate_limit_quotas(&self) -> Result<Vec<String>, VaultError> {
199 self.list_rate_limit_quotas().await
200 }
201 async fn read_rate_limit_quota(&self, name: &str) -> Result<RateLimitQuota, VaultError> {
202 self.read_rate_limit_quota(name).await
203 }
204 async fn write_rate_limit_quota(
205 &self,
206 name: &str,
207 params: &RateLimitQuotaRequest,
208 ) -> Result<(), VaultError> {
209 self.write_rate_limit_quota(name, params).await
210 }
211 async fn delete_rate_limit_quota(&self, name: &str) -> Result<(), VaultError> {
212 self.delete_rate_limit_quota(name).await
213 }
214
215 async fn rekey_init(&self, params: &RekeyInitRequest) -> Result<RekeyStatus, VaultError> {
217 self.rekey_init(params).await
218 }
219 async fn rekey_status(&self) -> Result<RekeyStatus, VaultError> {
220 self.rekey_status().await
221 }
222 async fn rekey_cancel(&self) -> Result<(), VaultError> {
223 self.rekey_cancel().await
224 }
225 async fn rekey_update(
226 &self,
227 key: &SecretString,
228 nonce: &str,
229 ) -> Result<RekeyStatus, VaultError> {
230 self.rekey_update(key, nonce).await
231 }
232
233 async fn generate_root_init(
235 &self,
236 params: &GenerateRootInitRequest,
237 ) -> Result<GenerateRootStatus, VaultError> {
238 self.generate_root_init(params).await
239 }
240 async fn generate_root_status(&self) -> Result<GenerateRootStatus, VaultError> {
241 self.generate_root_status().await
242 }
243 async fn generate_root_cancel(&self) -> Result<(), VaultError> {
244 self.generate_root_cancel().await
245 }
246 async fn generate_root_update(
247 &self,
248 key: &SecretString,
249 nonce: &str,
250 ) -> Result<GenerateRootStatus, VaultError> {
251 self.generate_root_update(key, nonce).await
252 }
253
254 async fn remount(&self, from: &str, to: &str) -> Result<RemountStatus, VaultError> {
256 self.remount(from, to).await
257 }
258
259 async fn metrics_json(&self) -> Result<serde_json::Value, VaultError> {
261 self.metrics_json().await
262 }
263 async fn host_info(&self) -> Result<HostInfo, VaultError> {
264 self.host_info().await
265 }
266 async fn internal_counters_activity(&self) -> Result<serde_json::Value, VaultError> {
267 self.internal_counters_activity().await
268 }
269 async fn version_history(&self) -> Result<Vec<VersionHistoryEntry>, VaultError> {
270 self.version_history().await
271 }
272
273 async fn rewrap(&self, token: &SecretString) -> Result<WrapInfo, VaultError> {
275 self.rewrap(token).await
276 }
277}