lego/vendor/github.com/dnsimple/dnsimple-go/dnsimple/domains_dnssec.go
Ludovic Fernandez 6004e599ed Manage vendor (#557)
* feat: add dep configuration files.

* chore: add vendor folder.

* refactor: update Dockerfile.

* review: remove git from Dockerfile.

* review: remove RUN apk.

* review: dep status.

* feat: added .dockerignore
2018-05-30 16:28:41 -06:00

70 lines
1.9 KiB
Go

package dnsimple
import (
"fmt"
)
// Dnssec represents the current DNSSEC settings for a domain in DNSimple.
type Dnssec struct {
Enabled bool `json:"enabled"`
}
func dnssecPath(accountID string, domainIdentifier string) (path string) {
path = fmt.Sprintf("%v/dnssec", domainPath(accountID, domainIdentifier))
return
}
// dnssecResponse represents a response from an API method that returns a Dnssec struct.
type dnssecResponse struct {
Response
Data *Dnssec `json:"data"`
}
// EnableDnssec enables DNSSEC on the domain.
//
// See https://developer.dnsimple.com/v2/domains/dnssec/#enable
func (s *DomainsService) EnableDnssec(accountID string, domainIdentifier string) (*dnssecResponse, error) {
path := versioned(dnssecPath(accountID, domainIdentifier))
dnssecResponse := &dnssecResponse{}
resp, err := s.client.post(path, dnssecResponse, nil)
if err != nil {
return nil, err
}
dnssecResponse.HttpResponse = resp
return dnssecResponse, nil
}
// DisableDnssec disables DNSSEC on the domain.
//
// See https://developer.dnsimple.com/v2/domains/dnssec/#disable
func (s *DomainsService) DisableDnssec(accountID string, domainIdentifier string) (*dnssecResponse, error) {
path := versioned(dnssecPath(accountID, domainIdentifier))
dnssecResponse := &dnssecResponse{}
resp, err := s.client.delete(path, dnssecResponse, nil)
if err != nil {
return nil, err
}
dnssecResponse.HttpResponse = resp
return dnssecResponse, nil
}
// GetDnssec retrieves the current status of DNSSEC on the domain.
//
// See https://developer.dnsimple.com/v2/domains/dnssec/#get
func (s *DomainsService) GetDnssec(accountID string, domainIdentifier string) (*dnssecResponse, error) {
path := versioned(dnssecPath(accountID, domainIdentifier))
dnssecResponse := &dnssecResponse{}
resp, err := s.client.get(path, dnssecResponse)
if err != nil {
return nil, err
}
dnssecResponse.HttpResponse = resp
return dnssecResponse, nil
}