Documentation ¶
Index ¶
- Variables
- func InterceptorChain(rt http.RoundTripper, interceptors ...Interceptor) http.RoundTripper
- type Client
- func (c *Client) AddDomainRecord(fqdn string, record RecordSet) (int, error)
- func (c *Client) AddRecordByName(fqdn string, record RecordSet) (int, error)
- func (c *Client) AddRecordByNameAndType(fqdn string, record RecordSet) (int, error)
- func (c *Client) GetDomainInfo(fqdn string) (*DomainInfo, error)
- func (c *Client) GetDomainRecords(fqdn string, rqp *RecordsQueryParams) ([]RecordSet, *PagingDetails, error)
- func (c *Client) GetDomains(params *DomainsQueryParams) ([]DomainInfo, *PagingDetails, error)
- func (c *Client) GetNameservers(fqdn string) ([]string, error)
- func (c *Client) GetRecordTypes() ([]string, error)
- func (c *Client) GetRecordsByName(fqdn string, name string) ([]RecordSet, error)
- func (c *Client) GetRecordsByNameAndType(fqdn string, name string, kind string) ([]RecordSet, error)
- func (c *Client) RemoveAllDomainRecords(fqdn string) (int, error)
- func (c *Client) RemoveAllRecordsWithName(fqdn string, name string) (int, error)
- func (c *Client) RemoveRecordByNameAndType(fqdn string, record RecordSet) (int, error)
- func (c *Client) ReplaceAllRecordsByName(fqdn string, records []RecordSet) (int, error)
- func (c *Client) ReplaceDomainRecords(fqdn string, records []RecordSet) (int, error)
- func (c *Client) ReplaceRecordByNameAndType(fqdn string, record RecordSet) (int, error)
- func (c *Client) UpdateDomainInfo(fqdn string, info DomainInfo) (int, error)
- type DomainInfo
- type DomainsQueryParams
- type Interceptor
- type InterceptorRT
- type Option
- type PagingDetails
- type QueryParams
- type RecordSet
- type RecordsQueryParams
Constants ¶
This section is empty.
Variables ¶
var ErrAuthAlreadyDefined = errors.New("only one authorization token may be set at a time")
var ErrAuthTokenRequired = errors.New("one of api key or personal access token must be set")
var ErrEmptySet = errors.New("required set is empty")
var ErrHttpReqFailed = errors.New("failed to get data from Gandi")
var ErrMismatch = errors.New("values do not match")
var ErrMissingRequiredField = errors.New("missing required field")
var ErrParseResFailed = errors.New("failed to parse response from Gandi")
var ErrRecordExists = errors.New("record already exists according to Gandi")
Functions ¶
func InterceptorChain ¶
func InterceptorChain(rt http.RoundTripper, interceptors ...Interceptor) http.RoundTripper
InterceptorChain is a series of Interceptor functions that will be applied on each request. A chain should be supplied as the http.Client.Transport on a http client.
Types ¶
type Client ¶
func (*Client) AddDomainRecord ¶
AddDomainRecord implements https://api.gandi.net/docs/livedns/#post-v5-livedns-domains-fqdn-records
func (*Client) AddRecordByName ¶
AddRecordByName implements https://api.gandi.net/docs/livedns/#post-v5-livedns-domains-fqdn-records-rrset_name
func (*Client) AddRecordByNameAndType ¶
AddRecordByNameAndType implements https://api.gandi.net/docs/livedns/#post-v5-livedns-domains-fqdn-records-rrset_name-rrset_type
func (*Client) GetDomainInfo ¶
func (c *Client) GetDomainInfo(fqdn string) (*DomainInfo, error)
GetDomainInfo implements the `GET` method of https://api.gandi.net/docs/livedns/#v5-livedns-domains-fqdn
func (*Client) GetDomainRecords ¶
func (c *Client) GetDomainRecords(fqdn string, rqp *RecordsQueryParams) ([]RecordSet, *PagingDetails, error)
GetDomainRecords implements https://api.gandi.net/docs/livedns/#get-v5-livedns-domains-fqdn-records
func (*Client) GetDomains ¶
func (c *Client) GetDomains(params *DomainsQueryParams) ([]DomainInfo, *PagingDetails, error)
GetDomains implements https://api.gandi.net/docs/livedns/#get-v5-livedns-domains
The returned list of DomainInfo will only have the Fqdn, Href, and RecordsHref properties set as described by the API documentation.
func (*Client) GetNameservers ¶
GetNameservers implements https://api.gandi.net/docs/livedns/#patch-v5-livedns-domains-fqdn
func (*Client) GetRecordTypes ¶
GetRecordTypes implements https://api.gandi.net/docs/livedns/#get-v5-livedns-dns-rrtypes
func (*Client) GetRecordsByName ¶
GetRecordsByName implements https://api.gandi.net/docs/livedns/#get-v5-livedns-domains-fqdn-records-rrset_name
func (*Client) GetRecordsByNameAndType ¶
func (c *Client) GetRecordsByNameAndType(fqdn string, name string, kind string) ([]RecordSet, error)
GetRecordsByNameAndType implements https://api.gandi.net/docs/livedns/#get-v5-livedns-domains-fqdn-records-rrset_name-rrset_type
func (*Client) RemoveAllDomainRecords ¶
RemoveAllDomainRecords implements https://api.gandi.net/docs/livedns/#delete-v5-livedns-domains-fqdn-records
func (*Client) RemoveAllRecordsWithName ¶
RemoveAllRecordsWithName implements https://api.gandi.net/docs/livedns/#delete-v5-livedns-domains-fqdn-records-rrset_name
func (*Client) RemoveRecordByNameAndType ¶
RemoveRecordByNameAndType implements https://api.gandi.net/docs/livedns/#delete-v5-livedns-domains-fqdn-records-rrset_name-rrset_type
func (*Client) ReplaceAllRecordsByName ¶
ReplaceAllRecordsByName implements https://api.gandi.net/docs/livedns/#put-v5-livedns-domains-fqdn-records-rrset_name
func (*Client) ReplaceDomainRecords ¶
ReplaceDomainRecords implements https://api.gandi.net/docs/livedns/#put-v5-livedns-domains-fqdn-records
func (*Client) ReplaceRecordByNameAndType ¶
ReplaceRecordByNameAndType implements https://api.gandi.net/docs/livedns/#put-v5-livedns-domains-fqdn-records-rrset_name-rrset_type
func (*Client) UpdateDomainInfo ¶
func (c *Client) UpdateDomainInfo(fqdn string, info DomainInfo) (int, error)
UpdateDomainInfo implements https://api.gandi.net/docs/livedns/#patch-v5-livedns-domains-fqdn
type DomainInfo ¶
type DomainsQueryParams ¶
type DomainsQueryParams struct { Page int `json:"page"` PerPage int `json:"per_page"` SharingId string `json:"sharing_id"` }
DomainsQueryParams represent the query parameters supported by Client.GetDomains.
func (*DomainsQueryParams) Values ¶
func (dqp *DomainsQueryParams) Values() url.Values
type Interceptor ¶
type Interceptor func(http.RoundTripper) InterceptorRT
Interceptor is a function that can perform actions on a request before and/or after sending.
func AuthInterceptor ¶
func AuthInterceptor(authHeader string) Interceptor
type InterceptorRT ¶
InterceptorRT implements the http.RoundTripper interface and simplifies creating new middlewares by eliminating the need for middlewares to implement the interface.
type Option ¶
func WithApiKey ¶
func WithBaseUrl ¶
func WithHttpDebug ¶
func WithHttpDebug() Option
func WithPersonalAccessToken ¶
type PagingDetails ¶
PagingDetails represent endpoint paging information returned by some GET methods of the Gandi LiveDNS API. The information can be used to construct parameters for subsequent calls to the API to retrieve pages of data.
type QueryParams ¶
type RecordSet ¶
type RecordSet struct { Href string `json:"rrset_href"` Name string `json:"rrset_name"` Type string `json:"rrset_type"` Ttl int `json:"rrset_ttl"` Values []string `json:"rrset_values"` }
RecordSet represents a record as returned, or accepted, by the Gandi LiveDNS API.
type RecordsQueryParams ¶
RecordsQueryParams represents the URI query parameters supported by the https://api.gandi.net/docs/livedns/#v5-livedns-domains-fqdn-records API. The API documented defaults will be used when any field is set to its zero value, e.g. `Page: 0` will result in `page=1`.
func (*RecordsQueryParams) Values ¶
func (rqp *RecordsQueryParams) Values() url.Values