From 346e4222379ebb0f38b1d4134a066ffe438e045c Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 7 Mar 2022 07:41:03 +0100 Subject: [PATCH] cleanup: move BasicRealmInfo to pbs-api-types Signed-off-by: Dietmar Maurer --- pbs-api-types/src/lib.rs | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs index 754e7b22..2f51afd9 100644 --- a/pbs-api-types/src/lib.rs +++ b/pbs-api-types/src/lib.rs @@ -442,3 +442,44 @@ pub enum RRDTimeFrame { /// Decade (10 years) Decade, } + +#[api] +#[derive(Deserialize, Serialize, PartialEq, Eq)] +#[serde(rename_all = "lowercase")] +/// type of the realm +pub enum RealmType { + /// The PAM realm + Pam, + /// The PBS realm + Pbs, + /// An OpenID Connect realm + OpenId, +} + +#[api( + properties: { + realm: { + schema: REALM_ID_SCHEMA, + }, + "type": { + type: RealmType, + }, + comment: { + optional: true, + schema: SINGLE_LINE_COMMENT_SCHEMA, + }, + }, +)] +#[derive(Deserialize, Serialize)] +#[serde(rename_all = "kebab-case")] +/// Basic Information about a realm +pub struct BasicRealmInfo { + pub realm: String, + #[serde(rename = "type")] + pub ty: RealmType, + /// True if it is the default realm + #[serde(skip_serializing_if = "Option::is_none")] + pub default: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub comment: Option, +}