pub mod dns;
pub struct DnsClient<T> {
client: T,
path: String,
}
impl<T> DnsClient<T>
where
T: crate::client::Client,
{
pub fn new(client: T, parent_path: &str) -> Self {
Self {
client,
path: format!("{}{}", parent_path, "/dns"),
}
}
}
impl<T> DnsClient<T>
where
T: crate::client::Client,
{
#[doc = "SDN dns index."]
pub fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
let path = self.path.to_string();
self.client.get(&path, ¶ms)
}
}
impl<T> DnsClient<T>
where
T: crate::client::Client,
{
#[doc = "Create a new sdn dns object."]
pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
let path = self.path.to_string();
self.client.post(&path, ¶ms)
}
}
impl GetOutputItems {
pub fn new(dns: String, ty: String) -> Self {
Self {
dns,
ty,
additional_properties: Default::default(),
}
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct GetOutputItems {
pub dns: String,
#[serde(rename = "type")]
pub ty: 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 GetParams {
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Only list sdn dns of specific type"]
pub ty: Option<Type>,
#[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(dns: String, key: String, ty: Type, url: String) -> Self {
Self {
dns,
key,
ty,
url,
reversemaskv6: Default::default(),
reversev6mask: Default::default(),
ttl: Default::default(),
additional_properties: Default::default(),
}
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct PostParams {
#[doc = "The SDN dns object identifier."]
pub dns: String,
pub key: String,
#[serde(
serialize_with = "crate::types::serialize_int_optional",
deserialize_with = "crate::types::deserialize_int_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
pub reversemaskv6: Option<u64>,
#[serde(
serialize_with = "crate::types::serialize_int_optional",
deserialize_with = "crate::types::deserialize_int_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
pub reversev6mask: Option<u64>,
#[serde(
serialize_with = "crate::types::serialize_int_optional",
deserialize_with = "crate::types::deserialize_int_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ttl: Option<u64>,
#[serde(rename = "type")]
#[doc = "Plugin type."]
pub ty: Type,
pub url: 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)]
pub enum Type {
#[serde(rename = "powerdns")]
Powerdns,
}
impl<T> DnsClient<T>
where
T: crate::client::Client,
{
pub fn dns(&self, dns: &str) -> dns::DnsClient<T> {
dns::DnsClient::<T>::new(self.client.clone(), &self.path, dns)
}
}