proxmox-api 0.2.0

Rust bindings for the Proxmox VE HTTP API
Documentation
pub mod groupid;
#[derive(Debug, Clone)]
pub struct GroupsClient<T> {
    client: T,
    path: String,
}
impl<T> GroupsClient<T>
where
    T: crate::client::Client,
{
    pub fn new(client: T, parent_path: &str) -> Self {
        Self {
            client,
            path: format!("{}{}", parent_path, "/groups"),
        }
    }
}
impl<T> GroupsClient<T>
where
    T: crate::client::Client,
{
    #[doc = "Group index."]
    #[doc = ""]
    #[doc = "The returned list is restricted to groups where you have 'User.Modify', 'Sys.Audit'  or 'Group.Allocate' permissions on /access/groups/\\<group\\>."]
    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
        let path = self.path.to_string();
        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
        Ok(optional_vec.unwrap_or_default())
    }
}
impl<T> GroupsClient<T>
where
    T: crate::client::Client,
{
    #[doc = "Create new group."]
    #[doc = ""]
    #[doc = "Permission check: perm(\"/access/groups\", [\"Group.Allocate\"])"]
    pub async fn post(&self, params: PostParams) -> Result<(), T::Error> {
        let path = self.path.to_string();
        self.client.post(&path, &params).await
    }
}
impl GetOutputItems {
    pub fn new(groupid: String) -> Self {
        Self {
            groupid,
            comment: ::std::default::Default::default(),
            users: ::std::default::Default::default(),
            additional_properties: ::std::default::Default::default(),
        }
    }
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct GetOutputItems {
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub comment: Option<String>,
    pub groupid: String,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    #[doc = "list of users which form this group"]
    #[doc = ""]
    pub users: Option<String>,
    #[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(groupid: String) -> Self {
        Self {
            groupid,
            comment: ::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)]
    pub comment: Option<String>,
    pub groupid: String,
    #[serde(
        flatten,
        default,
        skip_serializing_if = "::std::collections::HashMap::is_empty"
    )]
    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
impl<T> GroupsClient<T>
where
    T: crate::client::Client,
{
    pub fn groupid(&self, groupid: &str) -> groupid::GroupidClient<T> {
        groupid::GroupidClient::<T>::new(self.client.clone(), &self.path, groupid)
    }
}