Documentation
¶
Index ¶
- Constants
- func IsError(err error, code ErrorCode) bool
- type BackoffFunc
- type BaseRecord
- 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 WithPollInterval(pollInterval time.Duration) ClientOption
- func WithToken(token string) ClientOption
- type Error
- type ErrorCode
- type ListOpts
- type Meta
- type Pagination
- type Ratelimit
- type Record
- type RecordBulkCreateOpts
- type RecordBulkCreateResult
- type RecordBulkUpdateOpts
- type RecordBulkUpdateResult
- type RecordClient
- func (c *RecordClient) All(ctx context.Context) ([]*Record, error)
- func (c *RecordClient) BulkCreate(ctx context.Context, opts RecordBulkCreateOpts) (RecordBulkCreateResult, *Response, error)
- func (c *RecordClient) BulkUpdate(ctx context.Context, opts RecordBulkUpdateOpts) (RecordBulkUpdateResult, *Response, error)
- func (c *RecordClient) Create(ctx context.Context, opts RecordCreateOpts) (*Record, *Response, error)
- func (c *RecordClient) Delete(ctx context.Context, id string) (*Response, error)
- func (c *RecordClient) GetByID(ctx context.Context, id string) (*Record, *Response, error)
- func (c *RecordClient) List(ctx context.Context, opts RecordListOpts) ([]*Record, *Response, error)
- func (c *RecordClient) Update(ctx context.Context, id string, opts RecordUpdateOpts) (*Record, *Response, error)
- type RecordCreateOpts
- type RecordListOpts
- type RecordUpdateOpts
- type Response
- type Zone
- type ZoneClient
- func (c *ZoneClient) All(ctx context.Context) ([]*Zone, error)
- func (c *ZoneClient) Create(ctx context.Context, opts ZoneCreateOpts) (*Zone, *Response, error)
- func (c *ZoneClient) Delete(ctx context.Context, id string) (*Response, error)
- func (c *ZoneClient) GetByID(ctx context.Context, id string) (*Zone, *Response, error)
- func (c *ZoneClient) Update(ctx context.Context, id string, opts ZoneUpdateOpts) (*Zone, *Response, error)
- type ZoneCreateOpts
- type ZoneTxtVerification
- type ZoneUpdateOpts
Constants ¶
const Endpoint = "https://dns.hetzner.com/api/v1"
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 = "0.3.0"
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 BaseRecord ¶
func BaseRecordFromSchema ¶
func BaseRecordFromSchema(s schema.BaseRecord) *BaseRecord
BaseRecordFromSchema converts a schema.BaseRecord to a BaseRecord.
func BaseRecordsFromSchema ¶
func BaseRecordsFromSchema(s []schema.BaseRecord) []*BaseRecord
type Client ¶
type Client struct { Zone ZoneClient Record RecordClient // contains filtered or unexported fields }
Client is a client for the Hetzner Cloud 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 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 ListOpts ¶
type ListOpts struct { Page int // Page (starting at 1) PerPage int // Items per page (0 means default) }
ListOpts specifies options for listing resources.
type Meta ¶
type Meta struct { Pagination *Pagination Ratelimit Ratelimit }
Meta represents meta information included in an API response.
type Pagination ¶
type Pagination struct { Page int PerPage int PreviousPage int NextPage int LastPage int TotalEntries int }
Pagination represents pagination meta information.
func PaginationFromSchema ¶
func PaginationFromSchema(s schema.MetaPagination) Pagination
PaginationFromSchema converts a schema.MetaPagination to a Pagination.
type Record ¶
func RecordFromSchema ¶
RecordFromSchema converts a schema.Record to a Record.
func RecordsFromSchema ¶
type RecordBulkCreateOpts ¶
type RecordBulkCreateOpts struct {
Records []RecordCreateOpts
}
RecordBulkCreateOpts specifies parameters for creating several Records at once.
type RecordBulkCreateResult ¶
type RecordBulkCreateResult struct { InvalidRecords []*BaseRecord Records []*Record ValidRecords []*BaseRecord }
type RecordBulkUpdateOpts ¶
type RecordBulkUpdateOpts struct {
Records []RecordUpdateOpts
}
RecordBulkUpdateOpts specifies parameters for creating several Records at once.
type RecordBulkUpdateResult ¶
type RecordBulkUpdateResult struct { FailedRecords []*BaseRecord Records []*Record }
type RecordClient ¶
type RecordClient struct {
// contains filtered or unexported fields
}
func (*RecordClient) BulkCreate ¶
func (c *RecordClient) BulkCreate(ctx context.Context, opts RecordBulkCreateOpts) (RecordBulkCreateResult, *Response, error)
BulkCreate creates several Records at once.
func (*RecordClient) BulkUpdate ¶
func (c *RecordClient) BulkUpdate(ctx context.Context, opts RecordBulkUpdateOpts) (RecordBulkUpdateResult, *Response, error)
BulkUpdate updates several Records at once.
func (*RecordClient) Create ¶
func (c *RecordClient) Create(ctx context.Context, opts RecordCreateOpts) (*Record, *Response, error)
Create creates a Record.
func (*RecordClient) List ¶
func (c *RecordClient) List(ctx context.Context, opts RecordListOpts) ([]*Record, *Response, error)
List returns a list of actions for a specific page.
func (*RecordClient) Update ¶
func (c *RecordClient) Update(ctx context.Context, id string, opts RecordUpdateOpts) (*Record, *Response, error)
Update updates a Record.
type RecordCreateOpts ¶
RecordCreateOpts specifies parameters for creating a Record.
type RecordListOpts ¶
ActionListOpts specifies options for listing actions.
type RecordUpdateOpts ¶
RecordUpdateOpts specifies parameters for updating a Record.
type Zone ¶
type Zone struct { ID string Name string TTL int Created schema.Time IsSecondaryDNS bool LegacyDNSHost string LegacyNS []string Modified schema.Time NS []string Owner string Paused bool Permission string Project string RecordsCount int Registrar string Status string TXTVerification ZoneTxtVerification Verified schema.Time }
func ZoneFromSchema ¶
ZoneFromSchema converts a schema.Zone to a Zone.
type ZoneClient ¶
type ZoneClient struct {
// contains filtered or unexported fields
}
func (*ZoneClient) Create ¶
func (c *ZoneClient) Create(ctx context.Context, opts ZoneCreateOpts) (*Zone, *Response, error)
Create creates a Zone.
func (*ZoneClient) Update ¶
func (c *ZoneClient) Update(ctx context.Context, id string, opts ZoneUpdateOpts) (*Zone, *Response, error)
Update updates a Zone.
type ZoneCreateOpts ¶
ZoneCreateOpts specifies parameters for creating a Zone.
type ZoneTxtVerification ¶
type ZoneUpdateOpts ¶
ZoneUpdateOpts specifies parameters for updating a Zone.