Documentation ¶
Index ¶
- func IsNotFound(err error) bool
- type ErrNotFound
- type ErrUnexpectedStatus
- type PDNSClient
- func (pc *PDNSClient) Delete(path string, out interface{}, opts ...RequestOption) error
- func (pc *PDNSClient) Get(path string, out interface{}, opts ...RequestOption) error
- func (pc *PDNSClient) NewRequest(method string, path string, body io.Reader) (*http.Request, error)
- func (pc *PDNSClient) Patch(path string, out interface{}, opts ...RequestOption) error
- func (pc *PDNSClient) Post(path string, out interface{}, opts ...RequestOption) error
- func (pc *PDNSClient) Put(path string, out interface{}, opts ...RequestOption) error
- type RequestOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrNotFound ¶
type ErrNotFound struct {
URL string
}
ErrNotFound error not found with URL
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
type ErrUnexpectedStatus ¶
ErrUnexpectedStatus error with URL and HTTP status code
func (ErrUnexpectedStatus) Error ¶
func (e ErrUnexpectedStatus) Error() string
type PDNSClient ¶
type PDNSClient struct {
// contains filtered or unexported fields
}
PDNSClient is the client for PowerDNS API
func NewPDNSClient ¶
NewPDNSClient creates a new PDNSClient
func (*PDNSClient) Delete ¶
func (pc *PDNSClient) Delete(path string, out interface{}, opts ...RequestOption) error
Delete executes a DELETE request
func (*PDNSClient) Get ¶
func (pc *PDNSClient) Get(path string, out interface{}, opts ...RequestOption) error
Get executes a GET request
func (*PDNSClient) NewRequest ¶
NewRequest builds a new request. Usually, this method should not be used; prefer using the "Get", "Post", ... methods if possible.
func (*PDNSClient) Patch ¶
func (pc *PDNSClient) Patch(path string, out interface{}, opts ...RequestOption) error
Patch executes a PATCH request
func (*PDNSClient) Post ¶
func (pc *PDNSClient) Post(path string, out interface{}, opts ...RequestOption) error
Post executes a POST request
func (*PDNSClient) Put ¶
func (pc *PDNSClient) Put(path string, out interface{}, opts ...RequestOption) error
Put executes a PUT request
type RequestOption ¶
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 ¶
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 ¶
func WithQueryValue(key, value string) RequestOption
WithQueryValue adds a query parameter to a request's URL.