use serde::{Deserialize, Serialize};
#[derive(Debug, serde::Deserialize)]
pub struct DnsRecord {
pub record_id: DnsRecordId,
pub name: String,
pub ttl: u32,
pub data: String,
#[serde(rename = "type")]
pub record_type: String,
pub priority: Option<u32>,
pub comment: Option<String>,
}
impl From<DnsRecordResponse> for DnsRecord {
fn from(value: DnsRecordResponse) -> Self {
DnsRecord {
record_id: DnsRecordId {
id: value.record_id,
},
name: value.name,
ttl: value.ttl,
data: value.data,
record_type: value.record_type,
priority: value.priority,
comment: value.comment,
}
}
}
#[derive(Debug, serde::Deserialize)]
pub(crate) struct DnsRecordResponse {
pub record_id: u32,
pub name: String,
pub ttl: u32,
pub data: String,
#[serde(rename = "type")]
pub record_type: String,
pub priority: Option<u32>,
pub comment: Option<String>,
}
#[derive(Debug, Deserialize)]
pub(crate) struct ListDnsRecordsResponse {
pub records: Vec<DnsRecordResponse>,
}
#[derive(Debug, Serialize)]
pub struct CreateDnsRecordRequest {
#[serde(rename = "type")]
pub record_type: String,
pub name: String,
pub data: String,
pub priority: Option<u32>,
pub ttl: Option<u32>,
pub comment: Option<String>,
}
#[derive(Debug, Deserialize)]
pub(crate) struct CreateDnsRecordResponse {
pub record: Option<Vec<DnsRecordId>>, }
#[derive(Debug, Deserialize)]
pub struct DnsRecordId {
pub(crate) id: u32,
}
#[derive(Debug, Serialize)]
pub struct UpdateDnsRecordRequest {
#[serde(rename = "type")]
pub record_type: String,
pub name: String,
pub data: String,
pub priority: Option<u32>,
pub ttl: Option<u32>,
pub comment: Option<String>,
}
#[derive(Debug, Deserialize)]
pub(crate) struct GeneralResponse {
pub message: Option<String>,
}