File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed
Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,14 @@ fn main() {
6666 false => "A" ,
6767 } ;
6868
69- let mut record = None ;
7069 let mut ttl = None ;
7170 let mut prio = None ;
7271 let mut notes = None ;
7372
74- let records_endpoint = format ! ( "{}/dns/retrieve/{}" , ENDPOINT , & config. domain. base) ;
73+ let records_endpoint = format ! (
74+ "{}/dns/retrieveByNameType/{}/{}/{}" ,
75+ ENDPOINT , & config. domain. base, record_type, & config. domain. subdomain
76+ ) ;
7577 let records_response: RecordsResponse = agent
7678 . post ( & records_endpoint)
7779 . send_json ( & keys)
@@ -82,12 +84,8 @@ fn main() {
8284 println ! ( "Couldn't retrieve records" ) ;
8385 return ;
8486 }
85- for x in records_response. records {
86- if x. name . as_str ( ) == full_domain {
87- record = Some ( x) ;
88- break ;
89- }
90- }
87+
88+ let record = records_response. records . get ( 0 ) ;
9189
9290 if let Some ( x) = record {
9391 if x. content == ip {
@@ -110,9 +108,9 @@ fn main() {
110108 println ! ( "Couldn't delete record." ) ;
111109 return ;
112110 }
113- ttl = x. ttl ;
114- prio = x. prio ;
115- notes = x. notes ;
111+ ttl = x. ttl . clone ( ) ;
112+ prio = x. prio . clone ( ) ;
113+ notes = x. notes . clone ( ) ;
116114 } else {
117115 println ! ( "No record to be deleted." )
118116 }
@@ -183,7 +181,6 @@ struct RecordsResponse {
183181#[ derive( Deserialize ) ]
184182struct Record {
185183 id : String ,
186- name : String ,
187184 #[ serde( rename = "type" ) ]
188185 _type : String ,
189186 content : String ,
You can’t perform that action at this time.
0 commit comments