initial commit

This commit is contained in:
W Anders
2024-05-06 17:37:57 -06:00
commit 12bcac933a
35 changed files with 3027 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
package netbox
import (
"net/url"
"strconv"
)
type Zone struct {
DefaultTTL uint32 `json:"default_ttl"`
ID int `json:"id"`
Name string `json:"name"`
NameServers []SOAMName `json:"nameservers"`
}
type SOAMName struct {
Name string `json:"name"`
}
func urlZones(netboxurl *url.URL) *url.URL {
return netboxurl.JoinPath("zones", "/")
}
func urlZoneID(netboxurl *url.URL, id int) *url.URL {
return netboxurl.JoinPath("zones", "/", strconv.Itoa(id), "/")
}
func GetZones(requestClient *APIRequestClient) ([]Zone, error) {
requestUrl := urlZones(requestClient.NetboxURL)
zones, err := getMany[Zone](requestClient, requestUrl.String())
if err != nil {
return nil, err
}
return zones, nil
}