pub struct NameClient<T> {
client: T,
path: String,
}
impl<T> NameClient<T>
where
T: crate::client::Client,
{
pub fn new(client: T, parent_path: &str, name: &str) -> Self {
Self {
client,
path: format!("{}/{}", parent_path, name),
}
}
}
impl<T> NameClient<T>
where
T: crate::client::Client,
{
#[doc = "Remove IP or Network alias."]
pub fn delete(&self, params: DeleteParams) -> Result<(), T::Error> {
let path = self.path.to_string();
self.client.delete(&path, ¶ms)
}
}
impl<T> NameClient<T>
where
T: crate::client::Client,
{
#[doc = "Read alias."]
pub fn get(&self) -> Result<GetOutput, T::Error> {
let path = self.path.to_string();
self.client.get(&path, &())
}
}
impl<T> NameClient<T>
where
T: crate::client::Client,
{
#[doc = "Update IP or Network alias."]
pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
let path = self.path.to_string();
self.client.put(&path, ¶ms)
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
pub struct DeleteParams {
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
pub digest: Option<String>,
#[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, 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 PutParams {
pub fn new(cidr: String) -> Self {
Self {
cidr,
comment: Default::default(),
digest: Default::default(),
rename: Default::default(),
additional_properties: Default::default(),
}
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct PutParams {
#[doc = "Network/IP specification in CIDR format."]
pub cidr: String,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub comment: Option<String>,
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
pub digest: Option<String>,
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Rename an existing alias."]
pub rename: Option<String>,
#[serde(
flatten,
default,
skip_serializing_if = "::std::collections::HashMap::is_empty"
)]
pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}