manta_shared/types/wire/group.rs
1//! Wire types for `POST /api/v1/groups/{name}/members` and
2//! `DELETE /api/v1/groups/{name}/members`.
3
4use serde::{Deserialize, Serialize};
5use utoipa::ToSchema;
6
7/// Request body for `POST /api/v1/groups/{name}/members`.
8#[derive(Debug, Serialize, Deserialize, ToSchema)]
9pub struct AddNodesToGroupRequest {
10 /// Hostlist expression (xnames, NIDs, or hostlist notation)
11 /// identifying the new member set for the group.
12 pub hosts_expression: String,
13}
14
15/// Response body for `POST /api/v1/groups/{name}/members`.
16///
17/// The `removed` field name is retained for wire stability; its value
18/// is the final, sorted membership of the group after the update —
19/// **not** a list of removed nodes.
20#[derive(Debug, Serialize, Deserialize, ToSchema)]
21pub struct AddNodesToGroupResponse {
22 /// Xnames that were added to the group as part of this request.
23 pub added: Vec<String>,
24 /// Final, sorted membership of the group after the update.
25 pub final_members: Vec<String>,
26 /// Deprecated alias for [`Self::final_members`]. Carries the same
27 /// value so existing clients reading `removed` keep working for one
28 /// release; new clients should read `final_members`. Scheduled for
29 /// removal in the next major bump — at which point the
30 /// `#[serde(alias = "removed")]` on `final_members` keeps inbound
31 /// compatibility for anyone POSTing back the old name.
32 #[serde(default)]
33 pub removed: Vec<String>,
34}
35
36/// Request body for `DELETE /api/v1/groups/{name}/members`.
37#[derive(Debug, Serialize, Deserialize, ToSchema)]
38pub struct DeleteGroupMembersRequest {
39 /// Hosts expression (xnames, NIDs, or hostlist notation)
40 /// identifying nodes to remove.
41 pub xnames_expression: String,
42 /// When true, validate the request without modifying group
43 /// membership.
44 #[serde(default)]
45 pub dry_run: bool,
46}