vaultrs/api/auth/approle/
requests.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
use super::responses::{
    CreateCustomSecretIDResponse, GenerateNewSecretIDResponse, ListRolesResponse,
    ListSecretIDResponse, ReadAppRoleResponse, ReadRoleIDResponse, ReadSecretIDResponse,
};
use rustify_derive::Endpoint;

/// ## Login with Approle
/// Issues a Vault token based on the presented credentials.
///
/// * Path: /auth/approle/login
/// * Method: POST
/// * Response: N/A
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#login-with-approle>
#[derive(Builder, Debug, Endpoint)]
#[endpoint(path = "/auth/{self.mount}/login", method = "POST", builder = "true")]
#[builder(setter(into))]
pub struct LoginWithApproleRequest {
    #[endpoint(skip)]
    pub mount: String,
    pub role_id: String,
    pub secret_id: String,
}

/// ## List Roles
/// This endpoint returns a list the existing AppRoles in the method.
///
/// * Path: /auth/{self.mount}/role
/// * Method: LIST
/// * Response: [ListRolesResponse]
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#list-roles>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role",
    method = "LIST",
    response = "ListRolesResponse",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ListRolesRequest {
    #[endpoint(skip)]
    pub mount: String,
}

/// ## Create/Update AppRole
/// Creates a new AppRole or updates an existing AppRole.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}
/// * Method: POST
/// * Response: N/A
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#create-update-approle>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}",
    method = "POST",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct SetAppRoleRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
    pub bind_secret_id: Option<bool>,
    pub secret_id_bound_cidrs: Option<Vec<String>>,
    pub secret_id_num_uses: Option<u64>,
    pub secret_id_ttl: Option<String>,
    pub enable_local_secret_ids: Option<bool>,
    pub token_ttl: Option<String>,
    pub token_max_ttl: Option<String>,
    pub token_policies: Option<Vec<String>>,
    pub token_bound_cidrs: Option<Vec<String>>,
    pub token_explicit_max_ttl: Option<String>,
    pub token_no_default_policy: Option<bool>,
    pub token_num_uses: Option<u64>,
    pub token_period: Option<String>,
    pub token_type: Option<String>,
}

/// ## Read AppRole
/// Reads the properties of an existing AppRole.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}
/// * Method: GET
/// * Response: [ReadAppRoleResponse]
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#read-approle>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}",
    response = "ReadAppRoleResponse",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ReadAppRoleRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
}

/// ## Delete AppRole
/// Deletes an existing AppRole.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}
/// * Method: DELETE
/// * Response: N/A
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#delete-approle>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}",
    method = "DELETE",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct DeleteAppRoleRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
}

/// ## Read AppRole RoleID
/// Reads the RoleID of an existing AppRole.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}/role-id
/// * Method: GET
/// * Response: [ReadRoleIDResponse]
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#read-approle-role-id>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}/role-id",
    response = "ReadRoleIDResponse",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ReadRoleIDRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
}

/// ## Update AppRole Role ID
/// Reads the RoleID of an existing AppRole.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}/role-id
/// * Method: POST
/// * Response: N/A
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#update-approle-role-id>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}/role-id",
    method = "POST",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct UpdateRoleIDRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
    pub role_id: String,
}

/// ## Generate New Secret ID
/// Generates and issues a new SecretID on an existing AppRole.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}/secret-id
/// * Method: POST
/// * Response: [GenerateNewSecretIDResponse]
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#generate-new-secret-id>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}/secret-id",
    method = "POST",
    response = "GenerateNewSecretIDResponse",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct GenerateNewSecretIDRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
    pub metadata: Option<String>,
    pub cidr_list: Option<Vec<String>>,
    pub token_bound_cidrs: Option<Vec<String>>,
}

/// ## List Secret ID Accessors
/// Lists the accessors of all the SecretIDs issued against the AppRole.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}/secret-id
/// * Method: LIST
/// * Response: [ListSecretIDResponse]
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#list-secret-id-accessors>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}/secret-id",
    method = "LIST",
    response = "ListSecretIDResponse",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ListSecretIDRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
}

/// ## Read AppRole Secret ID
/// Reads out the properties of a SecretID.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}/secret-id/lookup
/// * Method: POST
/// * Response: [ReadSecretIDResponse]
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#read-approle-secret-id>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}/secret-id/lookup",
    method = "POST",
    response = "ReadSecretIDResponse",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ReadSecretIDRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
    pub secret_id: String,
}

/// ## Destroy AppRole Secret ID
/// Destroy an AppRole secret ID.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}/secret-id/destroy
/// * Method: POST
/// * Response: N/A
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#destroy-approle-secret-id>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}/secret-id/destroy",
    method = "POST",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct DeleteSecretIDRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
    pub secret_id: String,
}

/// ## Read AppRole Secret ID Accessor
/// Reads out the properties of a SecretID.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}/secret-id-accessor/lookup
/// * Method: POST
/// * Response: [ReadSecretIDResponse]
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#read-approle-secret-id-accessor>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}/secret-id-accessor/lookup",
    method = "POST",
    response = "ReadSecretIDResponse",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ReadSecretIDAccessorRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
    pub secret_id_accessor: String,
}

/// ## Destroy AppRole Secret ID Accessor
/// Destroy an AppRole secret ID by its accessor.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}/secret-id-accessor/destroy
/// * Method: POST
/// * Response: N/A
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#destroy-approle-secret-id-accessor>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}/secret-id-accessor/destroy",
    method = "POST",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct DeleteSecretIDAccessorRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
    pub secret_id_accessor: String,
}

/// ## Create Custom AppRole Secret ID
/// Assigns a "custom" SecretID against an existing AppRole.
///
/// * Path: /auth/{self.mount}/role/{self.role_name}/custom-secret-id
/// * Method: POST
/// * Response: [CreateCustomSecretIDResponse]
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#create-custom-approle-secret-id>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/role/{self.role_name}/custom-secret-id",
    method = "POST",
    response = "CreateCustomSecretIDResponse",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct CreateCustomSecretIDRequest {
    #[endpoint(skip)]
    pub mount: String,
    #[endpoint(skip)]
    pub role_name: String,
    pub secret_id: String,
    pub metadata: Option<String>,
    pub cidr_list: Option<Vec<String>>,
    pub token_bound_cidrs: Option<Vec<String>>,
}

/// ## Tidy Tokens
/// Performs some maintenance tasks to clean up invalid entries that may remain
/// in the token store.
///
/// * Path: /auth/{self.mount}/tidy/secret-id
/// * Method: POST
/// * Response: N/A
/// * Reference: <https://developer.hashicorp.com/vault/api-docs/auth/approle#tidy-tokens>
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
    path = "/auth/{self.mount}/tidy/secret-id",
    method = "POST",
    builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct TidyRequest {
    #[endpoint(skip)]
    pub mount: String,
}