vaultrs/api/identity/group_alias/requests.rs
1use super::responses::{
2 CreateGroupAliasResponse, ListGroupAliasesByIdResponse, ReadGroupAliasByIdResponse,
3};
4use rustify_derive::Endpoint;
5use serde::{Deserialize, Serialize};
6use std::fmt::Debug;
7
8/// ## Create a group alias
9///
10/// This endpoint creates or updates a group alias.
11///
12/// * Path: identity/group-alias
13/// * Method: POST
14/// * Response: [CreateGroupAliasResponse]
15/// * Reference: <https://developer.hashicorp.com/vault/api-docs/secret/identity/group-alias#create-a-group-alias>
16#[derive(Builder, Debug, Default, Endpoint, Deserialize, Serialize)]
17#[endpoint(
18 path = "identity/group-alias",
19 method = "POST",
20 builder = "true",
21 response = "CreateGroupAliasResponse"
22)]
23#[builder(setter(into, strip_option), default)]
24pub struct CreateGroupAliasRequest {
25 /// Name of the alias.
26 pub name: String,
27 /// ID of the group alias. If set, updates the corresponding group alias.
28 pub id: Option<String>,
29 /// Mount accessor which this alias belongs to.
30 pub mount_accessor: String,
31 /// ID of the group to which this is an alias.
32 pub canonical_id: Option<String>,
33}
34
35/// ## Update group alias by ID
36///
37/// This endpoint is used to update a existing group alias.
38///
39/// * Path: identity/group-alias/id/{self.id}
40/// * Method: POST
41/// * Reference: <https://developer.hashicorp.com/vault/api-docs/secret/identity/group-alias#update-group-alias-by-id>
42#[derive(Builder, Debug, Default, Endpoint)]
43#[endpoint(
44 path = "identity/group-alias/id/{self.id}",
45 method = "POST",
46 builder = "true"
47)]
48#[builder(setter(into, strip_option), default)]
49pub struct UpdateGroupAliasByIdRequest {
50 /// Identifier of the group alias.
51 #[endpoint(skip)]
52 pub id: String,
53 /// Name of the group alias.
54 pub name: Option<String>,
55 /// Mount accessor which this alias belongs to.
56 pub mount_accessor: String,
57 /// ID of the group to which this is an alias.
58 pub canonical_id: Option<String>,
59}
60
61/// ## Read group alias by ID
62///
63/// This endpoint queries the group alias by its identifier.
64///
65/// * Path: identity/group-alias/id/{self.id}
66/// * Method: GET
67/// * Response: [ReadGroupAliasByIdResponse]
68/// * Reference: <https://developer.hashicorp.com/vault/api-docs/secret/identity/group-alias#read-group-alias-by-id>
69#[derive(Builder, Debug, Endpoint)]
70#[endpoint(
71 path = "identity/group-alias/id/{self.id}",
72 method = "GET",
73 builder = "true",
74 response = "ReadGroupAliasByIdResponse"
75)]
76#[builder(setter(into))]
77pub struct ReadGroupAliasByIdRequest {
78 /// Identifier of the group alias.
79 #[endpoint(skip)]
80 pub id: String,
81}
82
83/// ## Delete group alias by ID
84///
85/// This endpoint deletes a group alias.
86///
87/// * Path: identity/group-alias/id/{self.id}
88/// * Method: DELETE
89/// * Reference: <https://developer.hashicorp.com/vault/api-docs/secret/identity/group-alias#delete-group-alias-by-id>
90#[derive(Builder, Debug, Default, Endpoint)]
91#[endpoint(
92 path = "identity/group-alias/id/{self.id}",
93 method = "DELETE",
94 builder = "true"
95)]
96#[builder(setter(into, strip_option), default)]
97pub struct DeleteGroupAliasByIdRequest {
98 /// ID of the group alias.
99 #[endpoint(skip)]
100 pub id: String,
101}
102
103/// ## List group alias by ID
104///
105/// This endpoint returns a list of available group aliases by their identifiers.
106///
107/// * Path: identity/group-alias/id
108/// * Method: LIST
109/// * Response: [ListGroupAliasesByIdResponse]
110/// * Reference: <https://developer.hashicorp.com/vault/api-docs/secret/identity/group-alias#list-group-alias-by-id>
111#[derive(Builder, Debug, Endpoint, Default)]
112#[endpoint(
113 path = "identity/group-alias/id",
114 method = "LIST",
115 builder = "true",
116 response = "ListGroupAliasesByIdResponse"
117)]
118#[builder(setter(into, strip_option), default)]
119pub struct ListGroupAliasesByIdRequest {}