#[derive(Debug, Clone)]
pub struct IdClient<T> {
client: T,
path: String,
}
impl<T> IdClient<T>
where
T: crate::client::Client,
{
pub fn new(client: T, parent_path: &str, id: &str) -> Self {
Self {
client,
path: format!("{}/{}", parent_path, id),
}
}
}
impl<T> IdClient<T>
where
T: crate::client::Client,
{
#[doc = "Delete realm-sync job definition."]
#[doc = ""]
#[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
pub async fn delete(&self) -> Result<(), T::Error> {
let path = self.path.to_string();
self.client.delete(&path, &()).await
}
}
impl<T> IdClient<T>
where
T: crate::client::Client,
{
#[doc = "Read realm-sync job definition."]
#[doc = ""]
#[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
pub async fn get(&self) -> Result<GetOutput, T::Error> {
let path = self.path.to_string();
self.client.get(&path, &()).await
}
}
impl<T> IdClient<T>
where
T: crate::client::Client,
{
#[doc = "Create new realm-sync job."]
#[doc = ""]
#[doc = "Permission check: and(perm(\"/access/realm/{realm}\", [\"Realm.AllocateUser\"]), perm(\"/access/groups\", [\"User.Modify\"]))"]
#[doc = "'Realm.AllocateUser' on '/access/realm/\\<realm\\>' and 'User.Modify' permissions to '/access/groups/'."]
pub async fn post(&self, params: PostParams) -> Result<(), T::Error> {
let path = self.path.to_string();
self.client.post(&path, ¶ms).await
}
}
impl<T> IdClient<T>
where
T: crate::client::Client,
{
#[doc = "Update realm-sync job definition."]
#[doc = ""]
#[doc = "Permission check: and(perm(\"/access/realm/{realm}\", [\"Realm.AllocateUser\"]), perm(\"/access/groups\", [\"User.Modify\"]))"]
#[doc = "'Realm.AllocateUser' on '/access/realm/\\<realm\\>' and 'User.Modify' permissions to '/access/groups/'."]
pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
let path = self.path.to_string();
self.client.put(&path, ¶ms).await
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
pub struct GetOutput {
#[serde(
flatten,
default,
skip_serializing_if = "::std::collections::HashMap::is_empty"
)]
pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
impl PostParams {
pub fn new(schedule: ScheduleStr) -> Self {
Self {
schedule,
comment: ::std::default::Default::default(),
enable_new: ::std::default::Default::default(),
enabled: ::std::default::Default::default(),
realm: ::std::default::Default::default(),
remove_vanished: ::std::default::Default::default(),
scope: ::std::default::Default::default(),
additional_properties: ::std::default::Default::default(),
}
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct PostParams {
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Description for the Job."]
#[doc = ""]
pub comment: Option<CommentStr>,
#[serde(rename = "enable-new")]
#[serde(
serialize_with = "crate::types::serialize_bool_optional",
deserialize_with = "crate::types::deserialize_bool_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Enable newly synced users immediately."]
#[doc = ""]
pub enable_new: Option<bool>,
#[serde(
serialize_with = "crate::types::serialize_bool_optional",
deserialize_with = "crate::types::deserialize_bool_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Determines if the job is enabled."]
#[doc = ""]
pub enabled: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Authentication domain ID"]
#[doc = ""]
pub realm: Option<RealmStr>,
#[serde(rename = "remove-vanished")]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "A semicolon-separated list of things to remove when they or the user vanishes during a sync. The following values are possible: 'entry' removes the user/group when not returned from the sync. 'properties' removes the set properties on existing user/group that do not appear in the source (even custom ones). 'acl' removes acls when the user/group is not returned from the sync. Instead of a list it also can be 'none' (the default)."]
#[doc = ""]
pub remove_vanished: Option<RemoveVanishedStr>,
#[doc = "Backup schedule. The format is a subset of `systemd` calendar events."]
#[doc = ""]
pub schedule: ScheduleStr,
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Select what to sync."]
#[doc = ""]
pub scope: Option<Scope>,
#[serde(
flatten,
default,
skip_serializing_if = "::std::collections::HashMap::is_empty"
)]
pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
impl PutParams {
pub fn new(schedule: ScheduleStr) -> Self {
Self {
schedule,
comment: ::std::default::Default::default(),
delete: ::std::default::Default::default(),
enable_new: ::std::default::Default::default(),
enabled: ::std::default::Default::default(),
remove_vanished: ::std::default::Default::default(),
scope: ::std::default::Default::default(),
additional_properties: ::std::default::Default::default(),
}
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct PutParams {
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Description for the Job."]
#[doc = ""]
pub comment: Option<CommentStr>,
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "A list of settings you want to delete."]
#[doc = ""]
pub delete: Option<DeleteStr>,
#[serde(rename = "enable-new")]
#[serde(
serialize_with = "crate::types::serialize_bool_optional",
deserialize_with = "crate::types::deserialize_bool_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Enable newly synced users immediately."]
#[doc = ""]
pub enable_new: Option<bool>,
#[serde(
serialize_with = "crate::types::serialize_bool_optional",
deserialize_with = "crate::types::deserialize_bool_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Determines if the job is enabled."]
#[doc = ""]
pub enabled: Option<bool>,
#[serde(rename = "remove-vanished")]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "A semicolon-separated list of things to remove when they or the user vanishes during a sync. The following values are possible: 'entry' removes the user/group when not returned from the sync. 'properties' removes the set properties on existing user/group that do not appear in the source (even custom ones). 'acl' removes acls when the user/group is not returned from the sync. Instead of a list it also can be 'none' (the default)."]
#[doc = ""]
pub remove_vanished: Option<RemoveVanishedStr>,
#[doc = "Backup schedule. The format is a subset of `systemd` calendar events."]
#[doc = ""]
pub schedule: ScheduleStr,
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Select what to sync."]
#[doc = ""]
pub scope: Option<Scope>,
#[serde(
flatten,
default,
skip_serializing_if = "::std::collections::HashMap::is_empty"
)]
pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
#[doc = "Select what to sync."]
#[doc = ""]
pub enum Scope {
#[serde(rename = "both")]
Both,
#[serde(rename = "groups")]
Groups,
#[serde(rename = "users")]
Users,
}
impl TryFrom<&str> for Scope {
type Error = String;
fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
match value {
"both" => Ok(Self::Both),
"groups" => Ok(Self::Groups),
"users" => Ok(Self::Users),
v => Err(format!("Unknown variant {v}")),
}
}
}
#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub struct CommentStr {
value: String,
}
impl crate::types::bounded_string::BoundedString for CommentStr {
const MIN_LENGTH: Option<usize> = None::<usize>;
const MAX_LENGTH: Option<usize> = Some(512usize);
const DEFAULT: Option<&'static str> = None::<&'static str>;
const PATTERN: Option<&'static str> = None::<&'static str>;
const TYPE_DESCRIPTION: &'static str = "a string with length at most 512";
fn get_value(&self) -> &str {
&self.value
}
fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
Self::validate(&value)?;
Ok(Self { value })
}
}
impl std::convert::TryFrom<String> for CommentStr {
type Error = crate::types::bounded_string::BoundedStringError;
fn try_from(value: String) -> Result<Self, Self::Error> {
crate::types::bounded_string::BoundedString::new(value)
}
}
impl ::serde::Serialize for CommentStr {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: ::serde::Serializer,
{
crate::types::bounded_string::serialize_bounded_string(self, serializer)
}
}
impl<'de> ::serde::Deserialize<'de> for CommentStr {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
crate::types::bounded_string::deserialize_bounded_string(deserializer)
}
}
#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub struct DeleteStr {
value: String,
}
impl crate::types::bounded_string::BoundedString for DeleteStr {
const MIN_LENGTH: Option<usize> = None::<usize>;
const MAX_LENGTH: Option<usize> = Some(4096usize);
const DEFAULT: Option<&'static str> = None::<&'static str>;
const PATTERN: Option<&'static str> = None::<&'static str>;
const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
fn get_value(&self) -> &str {
&self.value
}
fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
Self::validate(&value)?;
Ok(Self { value })
}
}
impl std::convert::TryFrom<String> for DeleteStr {
type Error = crate::types::bounded_string::BoundedStringError;
fn try_from(value: String) -> Result<Self, Self::Error> {
crate::types::bounded_string::BoundedString::new(value)
}
}
impl ::serde::Serialize for DeleteStr {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: ::serde::Serializer,
{
crate::types::bounded_string::serialize_bounded_string(self, serializer)
}
}
impl<'de> ::serde::Deserialize<'de> for DeleteStr {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
crate::types::bounded_string::deserialize_bounded_string(deserializer)
}
}
#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub struct RealmStr {
value: String,
}
impl crate::types::bounded_string::BoundedString for RealmStr {
const MIN_LENGTH: Option<usize> = None::<usize>;
const MAX_LENGTH: Option<usize> = Some(32usize);
const DEFAULT: Option<&'static str> = None::<&'static str>;
const PATTERN: Option<&'static str> = None::<&'static str>;
const TYPE_DESCRIPTION: &'static str = "a string with length at most 32";
fn get_value(&self) -> &str {
&self.value
}
fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
Self::validate(&value)?;
Ok(Self { value })
}
}
impl std::convert::TryFrom<String> for RealmStr {
type Error = crate::types::bounded_string::BoundedStringError;
fn try_from(value: String) -> Result<Self, Self::Error> {
crate::types::bounded_string::BoundedString::new(value)
}
}
impl ::serde::Serialize for RealmStr {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: ::serde::Serializer,
{
crate::types::bounded_string::serialize_bounded_string(self, serializer)
}
}
impl<'de> ::serde::Deserialize<'de> for RealmStr {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
crate::types::bounded_string::deserialize_bounded_string(deserializer)
}
}
#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub struct RemoveVanishedStr {
value: String,
}
impl crate::types::bounded_string::BoundedString for RemoveVanishedStr {
const MIN_LENGTH: Option<usize> = None::<usize>;
const MAX_LENGTH: Option<usize> = None::<usize>;
const DEFAULT: Option<&'static str> = Some("none");
const PATTERN: Option<&'static str> =
Some("(?:(?:(?:acl|properties|entry);)*(?:acl|properties|entry))|none");
const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"(?:(?:(?:acl|properties|entry);)*(?:acl|properties|entry))|none\" and no length constraints";
fn get_value(&self) -> &str {
&self.value
}
fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
Self::validate(&value)?;
Ok(Self { value })
}
}
impl std::convert::TryFrom<String> for RemoveVanishedStr {
type Error = crate::types::bounded_string::BoundedStringError;
fn try_from(value: String) -> Result<Self, Self::Error> {
crate::types::bounded_string::BoundedString::new(value)
}
}
impl ::serde::Serialize for RemoveVanishedStr {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: ::serde::Serializer,
{
crate::types::bounded_string::serialize_bounded_string(self, serializer)
}
}
impl<'de> ::serde::Deserialize<'de> for RemoveVanishedStr {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
crate::types::bounded_string::deserialize_bounded_string(deserializer)
}
}
#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub struct ScheduleStr {
value: String,
}
impl crate::types::bounded_string::BoundedString for ScheduleStr {
const MIN_LENGTH: Option<usize> = None::<usize>;
const MAX_LENGTH: Option<usize> = Some(128usize);
const DEFAULT: Option<&'static str> = None::<&'static str>;
const PATTERN: Option<&'static str> = None::<&'static str>;
const TYPE_DESCRIPTION: &'static str = "a string with length at most 128";
fn get_value(&self) -> &str {
&self.value
}
fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
Self::validate(&value)?;
Ok(Self { value })
}
}
impl std::convert::TryFrom<String> for ScheduleStr {
type Error = crate::types::bounded_string::BoundedStringError;
fn try_from(value: String) -> Result<Self, Self::Error> {
crate::types::bounded_string::BoundedString::new(value)
}
}
impl ::serde::Serialize for ScheduleStr {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: ::serde::Serializer,
{
crate::types::bounded_string::serialize_bounded_string(self, serializer)
}
}
impl<'de> ::serde::Deserialize<'de> for ScheduleStr {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
crate::types::bounded_string::deserialize_bounded_string(deserializer)
}
}