openstack_keystone_core/api/v3/
group.rs1use axum::{
16 Json,
17 http::StatusCode,
18 response::{IntoResponse, Response},
19};
20
21pub use openstack_keystone_api_types::v3::group::*;
22
23use crate::identity::types;
24
25impl From<types::Group> for Group {
26 fn from(value: types::Group) -> Self {
27 Self {
28 id: value.id,
29 domain_id: value.domain_id,
30 name: value.name,
31 description: value.description,
32 extra: value.extra,
33 }
34 }
35}
36
37impl From<GroupCreateRequest> for types::GroupCreate {
38 fn from(value: GroupCreateRequest) -> Self {
39 let group = value.group;
40 Self {
41 id: None,
42 name: group.name,
43 domain_id: group.domain_id,
44 extra: group.extra,
45 description: group.description,
46 }
47 }
48}
49
50impl IntoResponse for types::Group {
51 fn into_response(self) -> Response {
52 (
53 StatusCode::OK,
54 Json(GroupResponse {
55 group: Group::from(self),
56 }),
57 )
58 .into_response()
59 }
60}
61
62impl From<GroupListParameters> for types::GroupListParameters {
63 fn from(value: GroupListParameters) -> Self {
64 Self {
65 domain_id: value.domain_id,
66 name: value.name,
67 }
68 }
69}