use std::net::IpAddr;
use super::{deserialize_bool, MikrotikClient};
impl MikrotikClient {
#[tracing::instrument(level = "debug", err)]
pub async fn get_dhcp_leases(&self) -> anyhow::Result<Vec<DhcpEntry>> {
self.get_all("/rest/ip/dhcp-server/lease").await
}
}
#[derive(serde::Deserialize, Clone, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct DhcpEntry {
#[serde(flatten)]
pub active: Option<DhcpEntryActive>,
#[serde(rename = ".id")]
pub id: String,
pub address: IpAddr,
pub address_lists: String,
#[serde(deserialize_with = "deserialize_bool")]
pub blocked: bool, pub client_id: Option<String>, pub comment: Option<String>, pub dhcp_option: String, #[serde(deserialize_with = "deserialize_bool")]
pub disabled: bool,
#[serde(deserialize_with = "deserialize_bool")]
pub dynamic: bool,
pub last_seen: String, pub mac_address: Option<eui48::MacAddress>, pub radius: String, pub server: Option<String>, pub status: String, pub host_name: Option<String>,
pub agent_circuit_id: Option<String>, pub agent_remote_id: Option<String>, }
#[derive(serde::Deserialize, Clone, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct DhcpEntryActive {
#[serde(rename = "active-address")]
pub address: IpAddr,
#[serde(rename = "active-client-id")]
pub client_id: Option<String>, #[serde(rename = "active-mac-address")]
pub mac_address: Option<eui48::MacAddress>, #[serde(rename = "active-server")]
pub active_server: String, pub expires_after: String,
}