mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Be more consistent in API handle variable names (#911)
This commit is contained in:
@@ -24,8 +24,8 @@ Info required in `creds.json`:
|
||||
|
||||
*/
|
||||
|
||||
// DoAPI is the handle for operations.
|
||||
type DoAPI struct {
|
||||
// digitaloceanAPI is the handle for operations.
|
||||
type digitaloceanAPI struct {
|
||||
client *godo.Client
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewDo(m map[string]string, metadata json.RawMessage) (providers.DNSServiceP
|
||||
)
|
||||
client := godo.NewClient(oauthClient)
|
||||
|
||||
api := &DoAPI{client: client}
|
||||
api := &digitaloceanAPI{client: client}
|
||||
|
||||
// Get a domain to validate the token
|
||||
_, resp, err := api.client.Domains.List(ctx, &godo.ListOptions{PerPage: 1})
|
||||
@@ -78,7 +78,7 @@ func init() {
|
||||
}
|
||||
|
||||
// EnsureDomainExists returns an error if domain doesn't exist.
|
||||
func (api *DoAPI) EnsureDomainExists(domain string) error {
|
||||
func (api *digitaloceanAPI) EnsureDomainExists(domain string) error {
|
||||
ctx := context.Background()
|
||||
_, resp, err := api.client.Domains.Get(ctx, domain)
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
@@ -92,12 +92,12 @@ func (api *DoAPI) EnsureDomainExists(domain string) error {
|
||||
}
|
||||
|
||||
// GetNameservers returns the nameservers for domain.
|
||||
func (api *DoAPI) GetNameservers(domain string) ([]*models.Nameserver, error) {
|
||||
func (api *digitaloceanAPI) GetNameservers(domain string) ([]*models.Nameserver, error) {
|
||||
return models.ToNameservers(defaultNameServerNames)
|
||||
}
|
||||
|
||||
// GetZoneRecords gets the records of a zone and returns them in RecordConfig format.
|
||||
func (api *DoAPI) GetZoneRecords(domain string) (models.Records, error) {
|
||||
func (api *digitaloceanAPI) GetZoneRecords(domain string) (models.Records, error) {
|
||||
records, err := getRecords(api, domain)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -116,7 +116,7 @@ func (api *DoAPI) GetZoneRecords(domain string) (models.Records, error) {
|
||||
}
|
||||
|
||||
// GetDomainCorrections returns a list of corretions for the domain.
|
||||
func (api *DoAPI) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
|
||||
func (api *digitaloceanAPI) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
|
||||
ctx := context.Background()
|
||||
dc.Punycode()
|
||||
|
||||
@@ -175,7 +175,7 @@ func (api *DoAPI) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Corre
|
||||
return corrections, nil
|
||||
}
|
||||
|
||||
func getRecords(api *DoAPI, name string) ([]godo.DomainRecord, error) {
|
||||
func getRecords(api *digitaloceanAPI, name string) ([]godo.DomainRecord, error) {
|
||||
ctx := context.Background()
|
||||
|
||||
records := []godo.DomainRecord{}
|
||||
|
Reference in New Issue
Block a user