traefik/vendor/github.com/edeckers/auroradnsclient/zones.go

30 lines
680 B
Go
Raw Normal View History

2017-02-07 21:33:23 +00:00
package auroradnsclient
import (
"encoding/json"
2018-01-22 11:16:03 +00:00
2017-02-07 21:33:23 +00:00
"github.com/edeckers/auroradnsclient/zones"
2018-01-22 11:16:03 +00:00
"github.com/sirupsen/logrus"
2017-02-07 21:33:23 +00:00
)
// GetZones returns a list of all zones
func (client *AuroraDNSClient) GetZones() ([]zones.ZoneRecord, error) {
logrus.Debugf("GetZones")
response, err := client.requestor.Request("zones", "GET", []byte(""))
if err != nil {
logrus.Errorf("Failed to get zones: %s", err)
return nil, err
}
var respData []zones.ZoneRecord
err = json.Unmarshal(response, &respData)
if err != nil {
logrus.Errorf("Failed to unmarshall response: %s", err)
return nil, err
}
logrus.Debugf("Unmarshalled response: %+v", respData)
return respData, nil
}