Documentation ¶
Index ¶
- Constants
- Variables
- type APIError
- type Client
- func (c *Client) CallAPI(method, path string, reqBody, resType interface{}, needAuth bool) error
- func (c *Client) CallAPIWithContext(ctx context.Context, method, path string, reqBody, resType interface{}, ...) error
- func (c *Client) Delete(url string, resType interface{}) error
- func (c *Client) DeleteWithContext(ctx context.Context, url string, resType interface{}) error
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) Get(url string, resType interface{}) error
- func (c *Client) GetWithContext(ctx context.Context, url string, resType interface{}) error
- func (c *Client) NewRequest(method, path string, reqBody interface{}, needAuth bool) (*http.Request, error)
- func (c *Client) Patch(url string, reqBody, resType interface{}) error
- func (c *Client) PatchWithContext(ctx context.Context, url string, reqBody, resType interface{}) error
- func (c *Client) Post(url string, reqBody, resType interface{}) error
- func (c *Client) PostWithContext(ctx context.Context, url string, reqBody, resType interface{}) error
- func (c *Client) Put(url string, reqBody, resType interface{}) error
- func (c *Client) PutWithContext(ctx context.Context, url string, reqBody, resType interface{}) error
- func (c *Client) UnmarshalResponse(response *http.Response, resType interface{}) error
- type GDErrorField
- type GDErrorResponse
- type GDProvider
- type Logger
Constants ¶
const DefaultTimeout = 180 * time.Second
DefaultTimeout api requests after 180s
Variables ¶
var (
ErrAPIDown = errors.New("godaddy: the GoDaddy API is down")
)
Errors
var ErrRecordToMutateNotFound = errors.New("record to mutate not found in current zone")
ErrRecordToMutateNotFound when ApplyChange has to update/delete and didn't found the record in the existing zone (Change with no record ID)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // APIKey holds the Application key APIKey string // APISecret holds the Application secret key APISecret string // API endpoint APIEndPoint string // Client is the underlying HTTP client used to run the requests. It may be overloaded but a default one is instanciated in “NewClient“ by default. Client *http.Client // GoDaddy limits to 60 requests per minute Ratelimiter *rate.Limiter // Logger is used to log HTTP requests and responses. Logger Logger Timeout time.Duration }
Client represents a client to call the GoDaddy API
func (*Client) CallAPI ¶
CallAPI is the lowest level call helper. If needAuth is true, inject authentication headers and sign the request.
Request signature is a sha1 hash on following fields, joined by '+': - applicationSecret (from Client instance) - consumerKey (from Client instance) - capitalized method (from arguments) - full request url, including any query string argument - full serialized request body - server current time (takes time delta into account)
Call will automatically assemble the target url from the endpoint configured in the client instance and the path argument. If the reqBody argument is not nil, it will also serialize it as json and inject the required Content-Type header.
If everything went fine, unmarshall response into resType and return nil otherwise, return the error
func (*Client) CallAPIWithContext ¶
func (c *Client) CallAPIWithContext(ctx context.Context, method, path string, reqBody, resType interface{}, needAuth bool) error
CallAPIWithContext is the lowest level call helper. If needAuth is true, inject authentication headers and sign the request.
Request signature is a sha1 hash on following fields, joined by '+': - applicationSecret (from Client instance) - consumerKey (from Client instance) - capitalized method (from arguments) - full request url, including any query string argument - full serialized request body - server current time (takes time delta into account)
Context is used by http.Client to handle context cancelation ¶
Call will automatically assemble the target url from the endpoint configured in the client instance and the path argument. If the reqBody argument is not nil, it will also serialize it as json and inject the required Content-Type header.
If everything went fine, unmarshall response into resType and return nil otherwise, return the error
func (*Client) DeleteWithContext ¶
DeleteWithContext is a wrapper for the DELETE method
func (*Client) GetWithContext ¶
GetWithContext is a wrapper for the GET method
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, path string, reqBody interface{}, needAuth bool) (*http.Request, error)
NewRequest returns a new HTTP request
func (*Client) PatchWithContext ¶
func (c *Client) PatchWithContext(ctx context.Context, url string, reqBody, resType interface{}) error
PatchWithContext is a wrapper for the PATCH method
func (*Client) PostWithContext ¶
func (c *Client) PostWithContext(ctx context.Context, url string, reqBody, resType interface{}) error
PostWithContext is a wrapper for the POST method
type GDErrorField ¶
type GDErrorField struct { Code string `json:"code,omitempty"` Message string `json:"message,omitempty"` Path string `json:"path,omitempty"` PathRelated string `json:"pathRelated,omitempty"` }
GDErrorField describe the error reason
type GDErrorResponse ¶
type GDErrorResponse struct { Code string `json:"code"` Fields []GDErrorField `json:"fields,omitempty"` Message string `json:"message,omitempty"` }
GDErrorResponse is the body response when an API call fails
func (GDErrorResponse) String ¶
func (r GDErrorResponse) String() string
type GDProvider ¶
type GDProvider struct { provider.BaseProvider DryRun bool // contains filtered or unexported fields }
GDProvider declare GoDaddy provider
func NewGoDaddyProvider ¶
func NewGoDaddyProvider(ctx context.Context, domainFilter endpoint.DomainFilter, ttl int64, apiKey, apiSecret string, useOTE, dryRun bool) (*GDProvider, error)
NewGoDaddyProvider initializes a new GoDaddy DNS based Provider.
func (*GDProvider) ApplyChanges ¶
ApplyChanges applies a given set of changes in a given zone.