manta_server/backend_dispatcher/
group.rs1use std::collections::HashMap;
4
5use manta_backend_dispatcher::{
6 error::Error, interfaces::hsm::group::GroupTrait, types::Group,
7};
8
9use StaticBackendDispatcher::*;
10
11use serde_json::Value;
12
13use crate::manta_backend_dispatcher::StaticBackendDispatcher;
14
15impl GroupTrait for StaticBackendDispatcher {
16 async fn get_group_available(
17 &self,
18 auth_token: &str,
19 ) -> Result<Vec<Group>, Error> {
20 dispatch!(self, get_group_available, auth_token)
21 }
22
23 async fn get_group_name_available(
24 &self,
25 jwt_token: &str,
26 ) -> Result<Vec<String>, Error> {
27 dispatch!(self, get_group_name_available, jwt_token)
28 }
29
30 async fn add_group(
31 &self,
32 auth_token: &str,
33 hsm_group: Group,
34 ) -> Result<Group, Error> {
35 dispatch!(self, add_group, auth_token, hsm_group)
36 }
37
38 async fn get_member_vec_from_group_name_vec(
40 &self,
41 auth_token: &str,
42 hsm_group_name_vec: &[String],
43 ) -> Result<Vec<String>, Error> {
44 dispatch!(
45 self,
46 get_member_vec_from_group_name_vec,
47 auth_token,
48 hsm_group_name_vec
49 )
50 }
51
52 async fn get_group_map_and_filter_by_group_vec(
53 &self,
54 auth_token: &str,
55 hsm_name_vec: &[&str],
56 ) -> Result<HashMap<String, Vec<String>>, Error> {
57 dispatch!(
58 self,
59 get_group_map_and_filter_by_group_vec,
60 auth_token,
61 hsm_name_vec
62 )
63 }
64
65 async fn get_group_map_and_filter_by_member_vec(
66 &self,
67 auth_token: &str,
68 member_vec: &[&str],
69 ) -> Result<HashMap<String, Vec<String>>, Error> {
70 dispatch!(
71 self,
72 get_group_map_and_filter_by_member_vec,
73 auth_token,
74 member_vec
75 )
76 }
77
78 async fn get_all_groups(
79 &self,
80 auth_token: &str,
81 ) -> Result<Vec<Group>, Error> {
82 dispatch!(self, get_all_groups, auth_token)
83 }
84
85 async fn get_group(
86 &self,
87 auth_token: &str,
88 hsm_name: &str,
89 ) -> Result<Group, Error> {
90 dispatch!(self, get_group, auth_token, hsm_name)
91 }
92
93 async fn get_groups(
94 &self,
95 auth_token: &str,
96 hsm_name_vec: Option<&[String]>,
97 ) -> Result<Vec<Group>, Error> {
98 dispatch!(self, get_groups, auth_token, hsm_name_vec)
99 }
100
101 async fn delete_group(
102 &self,
103 auth_token: &str,
104 hsm_group_label: &str,
105 ) -> Result<Value, Error> {
106 dispatch!(self, delete_group, auth_token, hsm_group_label)
107 }
108
109 async fn get_hsm_map_and_filter_by_hsm_name_vec(
110 &self,
111 auth_token: &str,
112 hsm_name_vec: &[&str],
113 ) -> Result<HashMap<String, Vec<String>>, Error> {
114 dispatch!(
115 self,
116 get_hsm_map_and_filter_by_hsm_name_vec,
117 auth_token,
118 hsm_name_vec
119 )
120 }
121
122 async fn post_member(
123 &self,
124 auth_token: &str,
125 group_label: &str,
126 xname: &str,
127 ) -> Result<Value, Error> {
128 dispatch!(self, post_member, auth_token, group_label, xname)
129 }
130
131 async fn add_members_to_group(
134 &self,
135 auth_token: &str,
136 group_label: &str,
137 xnames: &[&str],
138 ) -> Result<Vec<String>, Error> {
139 dispatch!(self, add_members_to_group, auth_token, group_label, xnames)
140 }
141
142 async fn delete_member_from_group(
143 &self,
144 auth_token: &str,
145 group_label: &str,
146 xname: &str,
147 ) -> Result<(), Error> {
148 dispatch!(
149 self,
150 delete_member_from_group,
151 auth_token,
152 group_label,
153 xname
154 )
155 }
156
157 async fn migrate_group_members(
159 &self,
160 auth_token: &str,
161 target_hsm_group_name: &str,
162 parent_hsm_group_name: &str,
163 new_target_hsm_members: &[&str],
164 dryrun: bool,
165 ) -> Result<(Vec<String>, Vec<String>), Error> {
166 dispatch!(
167 self,
168 migrate_group_members,
169 auth_token,
170 target_hsm_group_name,
171 parent_hsm_group_name,
172 new_target_hsm_members,
173 dryrun
174 )
175 }
176
177 async fn update_group_members(
179 &self,
180 auth_token: &str,
181 group_name: &str,
182 members_to_remove: &[&str],
183 members_to_add: &[&str],
184 ) -> Result<(), Error> {
185 dispatch!(
186 self,
187 update_group_members,
188 auth_token,
189 group_name,
190 members_to_remove,
191 members_to_add
192 )
193 }
194}