pub mod id;
#[derive(Debug, Clone)]
pub struct MgrClient<T> {
client: T,
path: String,
}
impl<T> MgrClient<T>
where
T: crate::client::Client,
{
pub fn new(client: T, parent_path: &str) -> Self {
Self {
client,
path: format!("{}{}", parent_path, "/mgr"),
}
}
}
impl<T> MgrClient<T>
where
T: crate::client::Client,
{
#[doc = "MGR directory index."]
#[doc = ""]
#[doc = "Permission check: perm(\"/\", [\"Sys.Audit\", \"Datastore.Audit\"], any)"]
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 GetOutputItems {
pub fn new(name: String, state: String) -> Self {
Self {
name,
state,
addr: ::std::default::Default::default(),
host: ::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 addr: Option<String>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub host: Option<String>,
#[doc = "The name (ID) for the MGR"]
#[doc = ""]
pub name: String,
#[doc = "State of the MGR"]
#[doc = ""]
pub state: String,
#[serde(
flatten,
default,
skip_serializing_if = "::std::collections::HashMap::is_empty"
)]
pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
impl<T> MgrClient<T>
where
T: crate::client::Client,
{
pub fn id(&self, id: &str) -> id::IdClient<T> {
id::IdClient::<T>::new(self.client.clone(), &self.path, id)
}
}