Add record add command

master
Tait Hoyem 1 year ago
parent 6490b071f0
commit 26d01b924a

@ -10,7 +10,9 @@ use crate::{
ZoneListResponse,
ZoneAddResponse,
ZoneRemoveResponse,
RecordType,
RecordListResponse,
RecordAddResponse,
DynListResponse,
DynAddResponse,
DynRemoveResponse,
@ -404,3 +406,33 @@ pub struct ZoneAddRequest {
pub struct ZoneRemoveRequest {
zone_id: i32,
}
#[derive(Serialize, Deserialize, Debug, Clone, Eq, Hash, PartialEq)]
#[serde(rename_all="lowercase")]
pub enum RecordPolicyType {
r#None,
LatLong,
Region,
}
#[lunanode_request(response="RecordAddResponse", endpoint="dns2/record-add/")]
pub struct RecordAddRequest {
zone_id: i32,
name: String,
data: String,
ttl: i32,
r#type: RecordType,
/// The priority for certain record types, like MX and SRV.
aux: Option<i32>,
policy: Option<RecordPolicyType>,
/// The record weight (this is used for balancing or non-round-robin DNS failover).
weight: Option<i32>,
/// latitude if policy is `latlong`
latitude: Option<String>,
/// longitude if policy is `latlong`
longitude: Option<String>,
/// The ID of a monitor check (see `monitor check list`), this record will be disabled if the check fails.
monitor_id: Option<String>,
/// If set, update the existing record with this ID instead of creating a new record.
orig_record_id: Option<String>,
}

@ -379,9 +379,9 @@ pub struct ZoneListResponse {
zones: std::collections::HashMap<i32, Zone>,
}
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash)]
#[serde(rename="UPPERCASE")]
enum RecordType {
pub enum RecordType {
A,
AAAA,
CNAME,
@ -652,3 +652,6 @@ pub struct ZoneAddResponse {}
#[lunanode_response]
pub struct ZoneRemoveResponse {}
#[lunanode_response]
pub struct RecordAddResponse {}

Loading…
Cancel
Save