Skip to main content

vault_client_rs/types/
identity.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Serialize, Default, Clone)]
6pub struct EntityCreateRequest {
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub name: Option<String>,
9    #[serde(skip_serializing_if = "Option::is_none")]
10    pub metadata: Option<HashMap<String, String>>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub policies: Option<Vec<String>>,
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub disabled: Option<bool>,
15}
16
17#[derive(Debug, Deserialize, Clone)]
18#[non_exhaustive]
19pub struct Entity {
20    pub id: String,
21    pub name: String,
22    pub metadata: Option<HashMap<String, String>>,
23    #[serde(default)]
24    pub policies: Vec<String>,
25    pub disabled: bool,
26    #[serde(default)]
27    pub aliases: Vec<EntityAlias>,
28    pub creation_time: String,
29    pub last_update_time: String,
30}
31
32#[derive(Debug, Deserialize, Clone)]
33#[non_exhaustive]
34pub struct EntityAlias {
35    pub id: String,
36    pub canonical_id: String,
37    pub mount_accessor: String,
38    pub mount_type: String,
39    pub name: String,
40    pub metadata: Option<HashMap<String, String>>,
41}
42
43#[derive(Debug, Serialize, Default, Clone)]
44pub struct EntityAliasCreateRequest {
45    pub name: String,
46    pub canonical_id: String,
47    pub mount_accessor: String,
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub metadata: Option<HashMap<String, String>>,
50}
51
52#[derive(Debug, Deserialize, Clone)]
53#[non_exhaustive]
54pub struct EntityAliasResponse {
55    pub id: String,
56    pub canonical_id: String,
57    pub mount_accessor: String,
58    pub name: String,
59}
60
61#[derive(Debug, Serialize, Default, Clone)]
62pub struct GroupCreateRequest {
63    pub name: String,
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub policies: Option<Vec<String>>,
66    #[serde(skip_serializing_if = "Option::is_none")]
67    pub metadata: Option<HashMap<String, String>>,
68    #[serde(skip_serializing_if = "Option::is_none")]
69    pub member_entity_ids: Option<Vec<String>>,
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub member_group_ids: Option<Vec<String>>,
72    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
73    pub group_type: Option<String>,
74}
75
76#[derive(Debug, Deserialize, Clone)]
77#[non_exhaustive]
78pub struct Group {
79    pub id: String,
80    pub name: String,
81    #[serde(default)]
82    pub policies: Vec<String>,
83    pub metadata: Option<HashMap<String, String>>,
84    #[serde(default)]
85    pub member_entity_ids: Vec<String>,
86    #[serde(default)]
87    pub member_group_ids: Vec<String>,
88    #[serde(rename = "type")]
89    pub group_type: String,
90    pub creation_time: String,
91    pub last_update_time: String,
92    pub alias: Option<GroupAlias>,
93}
94
95#[derive(Debug, Deserialize, Clone)]
96#[non_exhaustive]
97pub struct GroupAlias {
98    pub id: String,
99    pub canonical_id: String,
100    pub mount_accessor: String,
101    pub mount_type: String,
102    pub name: String,
103}
104
105#[derive(Debug, Serialize, Default, Clone)]
106pub struct GroupAliasCreateRequest {
107    pub name: String,
108    pub mount_accessor: String,
109    pub canonical_id: String,
110}
111
112#[derive(Debug, Deserialize, Clone)]
113#[non_exhaustive]
114pub struct GroupAliasResponse {
115    pub id: String,
116    pub canonical_id: String,
117    pub mount_accessor: String,
118    pub name: String,
119}