Documentation ¶
Index ¶
- func IsNotFound(err error) bool
- type APIKeyAuthenticator
- type Client
- func (c *Client) Delete(ctx context.Context, path string, out interface{}, opts ...RequestOption) error
- func (c *Client) Get(ctx context.Context, path string, out interface{}, opts ...RequestOption) error
- func (c *Client) NewRequest(method string, path string, body io.Reader) (*http.Request, error)
- func (c *Client) Patch(ctx context.Context, path string, out interface{}, opts ...RequestOption) error
- func (c *Client) Post(ctx context.Context, path string, out interface{}, opts ...RequestOption) error
- func (c *Client) Put(ctx context.Context, path string, out interface{}, opts ...RequestOption) error
- type ClientAuthenticator
- type ErrNotFound
- type ErrResponse
- type ErrUnexpectedStatus
- type NoopAuthenticator
- type RequestOption
- type TLSClientCertificateAuthenticator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
Types ¶
type APIKeyAuthenticator ¶
type APIKeyAuthenticator struct {
APIKey string
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(baseURL string, hc *http.Client, auth ClientAuthenticator, debugOutput io.Writer) *Client
NewClient returns a new PowerDNS HTTP client
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, path string, out interface{}, opts ...RequestOption) error
Delete executes a DELETE request
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, path string, out interface{}, opts ...RequestOption) error
Get executes a GET request
func (*Client) NewRequest ¶
NewRequest builds a new request. Usually, this method should not be used; prefer using the "Get", "Post", ... methods if possible.
func (*Client) Patch ¶
func (c *Client) Patch(ctx context.Context, path string, out interface{}, opts ...RequestOption) error
Patch executes a PATCH request
type ClientAuthenticator ¶
type ErrNotFound ¶
type ErrNotFound struct {
URL string
}
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
type ErrResponse ¶ added in v0.5.1
type ErrResponse struct { Message string `json:"error"` Messages []string `json:"errors,omitempty"` }
ErrResponse represents error response from PowerDNS HTTP API
type ErrUnexpectedStatus ¶
type ErrUnexpectedStatus struct { URL string StatusCode int ErrResponse }
func (ErrUnexpectedStatus) Error ¶
func (e ErrUnexpectedStatus) Error() string
type NoopAuthenticator ¶ added in v0.2.2
type NoopAuthenticator struct{}
NoopAuthenticator provides an "empty" implementation of the ClientAuthenticator interface.
type RequestOption ¶ added in v0.2.0
RequestOption is a special type of function that can be passed to most HTTP request functions in this package; it is used to modify an HTTP request and to implement special request logic.
func WithJSONRequestBody ¶ added in v0.2.0
func WithJSONRequestBody(in interface{}) RequestOption
WithJSONRequestBody adds a JSON body to a request. The input type can be anything, as long as it can be marshaled by "json.Marshal". This method will also automatically set the correct content type and content-length.
func WithQueryValue ¶ added in v0.2.0
func WithQueryValue(key, value string) RequestOption
WithQueryValue adds a query parameter to a request's URL.
type TLSClientCertificateAuthenticator ¶
type TLSClientCertificateAuthenticator struct { CACerts []*x509.Certificate ClientCert tls.Certificate ClientKey crypto.PrivateKey }