mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Rename provider handles to *Provider (#914)
This commit is contained in:
@ -15,7 +15,7 @@ const (
|
||||
domainsPath = "domains"
|
||||
)
|
||||
|
||||
func (c *linodeAPI) fetchDomainList() error {
|
||||
func (c *linodeProvider) fetchDomainList() error {
|
||||
c.domainIndex = map[string]int{}
|
||||
page := 1
|
||||
for {
|
||||
@ -35,7 +35,7 @@ func (c *linodeAPI) fetchDomainList() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *linodeAPI) getRecords(id int) ([]domainRecord, error) {
|
||||
func (c *linodeProvider) getRecords(id int) ([]domainRecord, error) {
|
||||
records := []domainRecord{}
|
||||
page := 1
|
||||
for {
|
||||
@ -56,7 +56,7 @@ func (c *linodeAPI) getRecords(id int) ([]domainRecord, error) {
|
||||
return records, nil
|
||||
}
|
||||
|
||||
func (c *linodeAPI) createRecord(domainID int, rec *recordEditRequest) (*domainRecord, error) {
|
||||
func (c *linodeProvider) createRecord(domainID int, rec *recordEditRequest) (*domainRecord, error) {
|
||||
endpoint := fmt.Sprintf("%s/%d/records", domainsPath, domainID)
|
||||
|
||||
req, err := c.newRequest(http.MethodPost, endpoint, rec)
|
||||
@ -84,7 +84,7 @@ func (c *linodeAPI) createRecord(domainID int, rec *recordEditRequest) (*domainR
|
||||
return record, nil
|
||||
}
|
||||
|
||||
func (c *linodeAPI) modifyRecord(domainID, recordID int, rec *recordEditRequest) error {
|
||||
func (c *linodeProvider) modifyRecord(domainID, recordID int, rec *recordEditRequest) error {
|
||||
endpoint := fmt.Sprintf("%s/%d/records/%d", domainsPath, domainID, recordID)
|
||||
|
||||
req, err := c.newRequest(http.MethodPut, endpoint, rec)
|
||||
@ -104,7 +104,7 @@ func (c *linodeAPI) modifyRecord(domainID, recordID int, rec *recordEditRequest)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *linodeAPI) deleteRecord(domainID, recordID int) error {
|
||||
func (c *linodeProvider) deleteRecord(domainID, recordID int) error {
|
||||
endpoint := fmt.Sprintf("%s/%d/records/%d", domainsPath, domainID, recordID)
|
||||
req, err := c.newRequest(http.MethodDelete, endpoint, nil)
|
||||
if err != nil {
|
||||
@ -123,7 +123,7 @@ func (c *linodeAPI) deleteRecord(domainID, recordID int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *linodeAPI) newRequest(method, endpoint string, body interface{}) (*http.Request, error) {
|
||||
func (c *linodeProvider) newRequest(method, endpoint string, body interface{}) (*http.Request, error) {
|
||||
rel, err := url.Parse(endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -149,7 +149,7 @@ func (c *linodeAPI) newRequest(method, endpoint string, body interface{}) (*http
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func (c *linodeAPI) get(endpoint string, target interface{}) error {
|
||||
func (c *linodeProvider) get(endpoint string, target interface{}) error {
|
||||
req, err := c.newRequest(http.MethodGet, endpoint, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -166,7 +166,7 @@ func (c *linodeAPI) get(endpoint string, target interface{}) error {
|
||||
return decoder.Decode(target)
|
||||
}
|
||||
|
||||
func (c *linodeAPI) handleErrors(resp *http.Response) error {
|
||||
func (c *linodeProvider) handleErrors(resp *http.Response) error {
|
||||
defer resp.Body.Close()
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
|
||||
|
Reference in New Issue
Block a user