1use super::responses::{
2 ListSecretsResponse, ReadConfigurationResponse, ReadSecretMetadataResponse, ReadSecretResponse,
3 SecretVersionMetadata,
4};
5use rustify_derive::Endpoint;
6use serde_json::Value;
7use std::collections::HashMap;
8use std::fmt::Debug;
9
10#[derive(Builder, Debug, Default, Endpoint)]
19#[endpoint(path = "{self.mount}/config", method = "POST", builder = "true")]
20#[builder(setter(into, strip_option), default)]
21pub struct SetConfigurationRequest {
22 #[endpoint(skip)]
23 pub mount: String,
24 pub delete_version_after: Option<String>,
25 pub cas_required: Option<bool>,
26 pub max_versions: Option<u64>,
27}
28
29#[derive(Builder, Debug, Default, Endpoint)]
38#[endpoint(
39 path = "{self.mount}/config",
40 response = "ReadConfigurationResponse",
41 builder = "true"
42)]
43#[builder(setter(into, strip_option), default)]
44pub struct ReadConfigurationRequest {
45 #[endpoint(skip)]
46 pub mount: String,
47}
48
49#[derive(Builder, Debug, Endpoint)]
57#[endpoint(
58 path = "{self.mount}/data/{self.path}",
59 response = "ReadSecretResponse",
60 builder = "true"
61)]
62#[builder(setter(into))]
63pub struct ReadSecretRequest {
64 #[endpoint(skip)]
65 pub mount: String,
66 #[endpoint(skip)]
67 pub path: String,
68 #[builder(default = "None")]
69 #[endpoint(query)]
70 pub version: Option<u64>,
71}
72
73#[derive(Builder, Debug, Endpoint)]
81#[endpoint(
82 path = "{self.mount}/data/{self.path}",
83 response = "SecretVersionMetadata",
84 method = "POST",
85 builder = "true"
86)]
87#[builder(setter(into))]
88pub struct SetSecretRequest {
89 #[endpoint(skip)]
90 pub mount: String,
91 #[endpoint(skip)]
92 pub path: String,
93 pub data: Value,
94 #[builder(setter(strip_option), default)]
95 pub options: Option<SetSecretRequestOptions>,
96}
97
98#[derive(Builder, Clone, Debug, serde::Serialize)]
99#[builder(setter(into))]
100pub struct SetSecretRequestOptions {
101 pub cas: u32,
102}
103
104#[derive(Builder, Debug, Endpoint)]
113#[endpoint(
114 path = "{self.mount}/data/{self.path}",
115 method = "DELETE",
116 builder = "true"
117)]
118#[builder(setter(into))]
119pub struct DeleteLatestSecretVersionRequest {
120 #[endpoint(skip)]
121 pub mount: String,
122 #[endpoint(skip)]
123 pub path: String,
124}
125
126#[derive(Builder, Debug, Endpoint)]
134#[endpoint(
135 path = "{self.mount}/delete/{self.path}",
136 method = "POST",
137 builder = "true"
138)]
139#[builder(setter(into))]
140pub struct DeleteSecretVersionsRequest {
141 #[endpoint(skip)]
142 pub mount: String,
143 #[endpoint(skip)]
144 pub path: String,
145 pub versions: Vec<u64>,
146}
147
148#[derive(Builder, Debug, Endpoint)]
156#[endpoint(
157 path = "{self.mount}/undelete/{self.path}",
158 method = "POST",
159 builder = "true"
160)]
161#[builder(setter(into))]
162pub struct UndeleteSecretVersionsRequest {
163 #[endpoint(skip)]
164 pub mount: String,
165 #[endpoint(skip)]
166 pub path: String,
167 pub versions: Vec<u64>,
168}
169
170#[derive(Builder, Debug, Endpoint)]
179#[endpoint(
180 path = "{self.mount}/destroy/{self.path}",
181 method = "POST",
182 builder = "true"
183)]
184#[builder(setter(into))]
185pub struct DestroySecretVersionsRequest {
186 #[endpoint(skip)]
187 pub mount: String,
188 #[endpoint(skip)]
189 pub path: String,
190 pub versions: Vec<u64>,
191}
192
193#[derive(Builder, Debug, Endpoint)]
201#[endpoint(
202 path = "{self.mount}/metadata/{self.path}",
203 response = "ListSecretsResponse",
204 method = "LIST",
205 builder = "true"
206)]
207#[builder(setter(into))]
208pub struct ListSecretsRequest {
209 #[endpoint(skip)]
210 pub mount: String,
211 #[endpoint(skip)]
212 pub path: String,
213}
214
215#[derive(Builder, Debug, Endpoint)]
224#[endpoint(
225 path = "{self.mount}/metadata/{self.path}",
226 response = "ReadSecretMetadataResponse",
227 builder = "true"
228)]
229#[builder(setter(into))]
230pub struct ReadSecretMetadataRequest {
231 #[endpoint(skip)]
232 pub mount: String,
233 #[endpoint(skip)]
234 pub path: String,
235}
236
237#[derive(Builder, Debug, Default, Endpoint)]
246#[endpoint(
247 path = "{self.mount}/metadata/{self.path}",
248 method = "POST",
249 builder = "true"
250)]
251#[builder(setter(into, strip_option), default)]
252pub struct SetSecretMetadataRequest {
253 #[endpoint(skip)]
254 pub mount: String,
255 #[endpoint(skip)]
256 pub path: String,
257 pub max_versions: Option<u64>,
258 pub cas_required: Option<bool>,
259 pub delete_version_after: Option<String>,
260 pub custom_metadata: Option<HashMap<String, String>>,
261}
262
263#[derive(Builder, Debug, Default, Endpoint)]
272#[endpoint(
273 path = "{self.mount}/metadata/{self.path}",
274 method = "DELETE",
275 builder = "true"
276)]
277#[builder(setter(into, strip_option), default)]
278pub struct DeleteSecretMetadataRequest {
279 #[endpoint(skip)]
280 pub mount: String,
281 #[endpoint(skip)]
282 pub path: String,
283}