Documentation
¶
Overview ¶
Package hdns is a library for the Hetzner DNS API.
Index ¶
- Constants
- func Bool(b bool) *bool
- func Int(i int) *int
- func IsError(err error, code ErrorCode) bool
- func String(s string) *string
- type BackoffFunc
- type Client
- type ClientOption
- func WithApplication(name, version string) ClientOption
- func WithBackoffFunc(f BackoffFunc) ClientOption
- func WithDebugWriter(debugWriter io.Writer) ClientOption
- func WithEndpoint(endpoint string) ClientOption
- func WithHTTPClient(httpClient *http.Client) ClientOption
- func WithPollInterval(pollInterval time.Duration) ClientOption
- func WithToken(token string) ClientOption
- type Error
- type ErrorCode
- type Meta
- type Pagination
- type Response
- type TxtVerification
- type TxtVerificationClient
- type Zone
Constants ¶
const Endpoint = "https://dns.hetzner.com/api/v1"
Endpoint is the base URL of the API.
const UserAgent = "hdns-go/" + Version
UserAgent is the value for the library part of the User-Agent header that is sent with each request.
const Version = "1.0.0"
Version is the library's version following Semantic Versioning.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BackoffFunc ¶
A BackoffFunc returns the duration to wait before performing the next retry. The retries argument specifies how many retries have already been performed. When called for the first time, retries is 0.
func ConstantBackoff ¶
func ConstantBackoff(d time.Duration) BackoffFunc
ConstantBackoff returns a BackoffFunc which backs off for constant duration d.
func ExponentialBackoff ¶
func ExponentialBackoff(b float64, d time.Duration) BackoffFunc
ExponentialBackoff returns a BackoffFunc which implements an exponential backoff using the formula: b^retries * d
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for the Hetzner DNS API.
type ClientOption ¶
type ClientOption func(*Client)
A ClientOption is used to configure a Client.
func WithApplication ¶
func WithApplication(name, version string) ClientOption
WithApplication configures a Client with the given application name and application version. The version may be blank. Programs are encouraged to at least set an application name.
func WithBackoffFunc ¶
func WithBackoffFunc(f BackoffFunc) ClientOption
WithBackoffFunc configures a Client to use the specified backoff function.
func WithDebugWriter ¶
func WithDebugWriter(debugWriter io.Writer) ClientOption
WithDebugWriter configures a Client to print debug information to the given writer. To, for example, print debug information on stderr, set it to os.Stderr.
func WithEndpoint ¶
func WithEndpoint(endpoint string) ClientOption
WithEndpoint configures a Client to use the specified API endpoint.
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient configures a Client to perform HTTP requests with httpClient.
func WithPollInterval ¶
func WithPollInterval(pollInterval time.Duration) ClientOption
WithPollInterval configures a Client to use the specified interval when polling from the API.
func WithToken ¶
func WithToken(token string) ClientOption
WithToken configures a Client to use the specified token for authentication.
type Error ¶
Error is an error returned from the API.
func ErrorFromSchema ¶
ErrorFromSchema converts a schema.Error to an Error.
type ErrorCode ¶
type ErrorCode string
ErrorCode represents an error code returned from the API.
const ( ErrorCodePaginationError ErrorCode = "400" // Pagination selectors are mutually exclusive ErrorCodeForbidden ErrorCode = "403" // Insufficient permissions ErrorCodeNotFound ErrorCode = "404" // Resource not found ErrorCodeNotAcceptable ErrorCode = "406" // Not acceptable ErrorCodeConflict ErrorCode = "409" // Conflict ErrorCodeUnprocessableEntity ErrorCode = "422" // Unprocessable entity )
Error codes returned from the API.
type Meta ¶
type Meta struct {
Pagination *Pagination
}
Meta represents meta information included in an API response.
type Pagination ¶
Pagination represents pagination meta information.
func PaginationFromSchema ¶
func PaginationFromSchema(s schema.MetaPagination) Pagination
PaginationFromSchema converts a schema.MetaPagination to a Pagination.
type TxtVerification ¶
TxtVerification represents TXT Verification of zone.
type TxtVerificationClient ¶
type TxtVerificationClient struct {
// contains filtered or unexported fields
}
TxtVerificationClient is a client for the TxtVerification API.
type Zone ¶
type Zone struct { ID string Created time.Time Modified time.Time LegacyDNSHost string LegacyNs []string Name string Ns []string Owner string Paused bool Permission string Project string Registrar string Status string TTL uint64 Verified time.Time RecordsCount uint64 IsSecondaryDNS bool TxtVerification TxtVerification }
Zone represents a zone in the Hetzner DNS