Device management
This commit is contained in:
parent
5635c2af1a
commit
b9a5437909
6 changed files with 294 additions and 9 deletions
|
|
@ -58,6 +58,7 @@ func (dev *RouterosDevice) Init() { // {{{
|
|||
|
||||
// query sends a RouterOS REST API query and returns the unparsed body.
|
||||
func (dev RouterosDevice) query(method, path string, reqBody []byte) (body []byte, err error) { // {{{
|
||||
logger.Debug("FOO", "port", dev.Port)
|
||||
url := fmt.Sprintf("https://%s:%d/rest%s", dev.Host, dev.Port, path)
|
||||
logger.Info("URL", "method", method, "url", url)
|
||||
|
||||
|
|
@ -150,7 +151,7 @@ func (dev *RouterosDevice) UpdateDNSEntry(record DNSEntry) (entry DNSEntry, err
|
|||
err = json.Unmarshal(body, &entry)
|
||||
return
|
||||
}// }}}
|
||||
func (dev *RouterosDevice) DeleteDNSEntry(id string) (err error) {
|
||||
func (dev *RouterosDevice) DeleteDNSEntry(id string) (err error) {// {{{
|
||||
_, err = dev.query("DELETE", "/ip/dns/static/"+id, []byte{})
|
||||
if err != nil {
|
||||
rosError := struct{ Detail string }{}
|
||||
|
|
@ -162,7 +163,7 @@ func (dev *RouterosDevice) DeleteDNSEntry(id string) (err error) {
|
|||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
}// }}}
|
||||
|
||||
/*
|
||||
// FillPeerDetails retrieves RouterOS resource ID, allowed-address and comment from the router
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue