#[derive(Debug, Clone)]
pub struct GroupidClient<T> {
client: T,
path: String,
}
impl<T> GroupidClient<T>
where
T: crate::client::Client,
{
pub fn new(client: T, parent_path: &str, groupid: &str) -> Self {
Self {
client,
path: format!("{}/{}", parent_path, groupid),
}
}
}
impl<T> GroupidClient<T>
where
T: crate::client::Client,
{
#[doc = "Delete group."]
#[doc = ""]
#[doc = "Permission check: perm(\"/access/groups\", [\"Group.Allocate\"])"]
pub async fn delete(&self) -> Result<(), T::Error> {
let path = self.path.to_string();
self.client.delete(&path, &()).await
}
}
impl<T> GroupidClient<T>
where
T: crate::client::Client,
{
#[doc = "Get group configuration."]
#[doc = ""]
#[doc = "Permission check: perm(\"/access/groups\", [\"Sys.Audit\", \"Group.Allocate\"], any)"]
pub async fn get(&self) -> Result<GetOutput, T::Error> {
let path = self.path.to_string();
self.client.get(&path, &()).await
}
}
impl<T> GroupidClient<T>
where
T: crate::client::Client,
{
#[doc = "Update group data."]
#[doc = ""]
#[doc = "Permission check: perm(\"/access/groups\", [\"Group.Allocate\"])"]
pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
let path = self.path.to_string();
self.client.put(&path, ¶ms).await
}
}
impl GetOutput {
pub fn new(members: Vec<MembersStr>) -> Self {
Self {
members,
comment: ::std::default::Default::default(),
}
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct GetOutput {
#[serde(skip_serializing_if = "Option::is_none", default)]
pub comment: Option<String>,
#[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
pub members: Vec<MembersStr>,
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
pub struct PutParams {
#[serde(skip_serializing_if = "Option::is_none", default)]
pub comment: Option<String>,
#[serde(
flatten,
default,
skip_serializing_if = "::std::collections::HashMap::is_empty"
)]
pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub struct MembersStr {
value: String,
}
impl crate::types::bounded_string::BoundedString for MembersStr {
const MIN_LENGTH: Option<usize> = None::<usize>;
const MAX_LENGTH: Option<usize> = Some(64usize);
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 64";
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 MembersStr {
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 MembersStr {
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 MembersStr {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
crate::types::bounded_string::deserialize_bounded_string(deserializer)
}
}