@ -14,6 +14,7 @@ use crate::{
RecordType ,
RecordListResponse ,
RecordAddResponse ,
RecordRemoveResponse ,
DynListResponse ,
DynAddResponse ,
DynRemoveResponse ,
@ -45,6 +46,7 @@ use serde::{
Serialize ,
Deserialize ,
} ;
use serde_with ::skip_serializing_none ;
#[ derive(Serialize, Deserialize, Debug, clap::Subcommand) ]
/// All possible `ssh-key` subcommands.
@ -129,6 +131,10 @@ pub enum ImageSubArgs {
pub enum RecordSubArgs {
/// List all records in a domain.
List ( RecordListRequest ) ,
/// Add a new DNS record to a domain.
Add ( RecordAddRequest ) ,
/// Remove a DNS record for a domain.
Remove ( RecordRemoveRequest ) ,
}
#[ derive(Serialize, Deserialize, Debug, clap::Subcommand) ]
@ -286,6 +292,8 @@ impl Args {
Self ::Monitor ( MonitorSubArgs ::Check ( MonitorCheckSubArgs ::List ( monitor_check_list ) ) ) = > print_req ( monitor_check_list ) ? ,
Self ::SshKey ( SshKeySubArgs ::List ( ssk_list ) ) = > print_req ( ssk_list ) ? ,
Self ::Record ( RecordSubArgs ::List ( rec_list ) ) = > print_req ( rec_list ) ? ,
Self ::Record ( RecordSubArgs ::Add ( add_req ) ) = > print_req ( add_req ) ? ,
Self ::Record ( RecordSubArgs ::Remove ( rem_req ) ) = > print_req ( rem_req ) ? ,
Self ::Network ( NetworkSubArgs ::List ( net_list ) ) = > print_req ( net_list ) ? ,
Self ::Floating ( FloatingSubArgs ::List ( ip_list ) ) = > print_req ( ip_list ) ? ,
Self ::Vm ( VmSubArgs ::List ( vm_list ) ) = > print_req ( vm_list ) ? ,
@ -497,6 +505,7 @@ pub enum RecordPolicyType {
Region ,
}
#[ skip_serializing_none ]
#[ lunanode_request(response= " RecordAddResponse " , endpoint= " dns2/record-add/ " ) ]
/// Add a new DNS record to your zone.
pub struct RecordAddRequest {
@ -523,3 +532,12 @@ pub struct RecordAddRequest {
/// If set, update the existing record with this ID instead of creating a new record.
orig_record_id : Option < String > ,
}
#[ lunanode_request(response= " RecordRemoveResponse " , endpoint= " dns2/record-remove/ " ) ]
/// Remove a DNS record from a given zone.
pub struct RecordRemoveRequest {
/// The ID of the zone which the DNS record is contained in. This is usually an FQDN like example.com, but we just need the zone ID from Lunanode. See: [`ZoneListResponse`].
zone_id : i32 ,
/// The ID of the DNS record to remove. See [`RecordListResponse`]
record_id : i32 ,
}