Documentation ¶
Overview ¶
Package nodion contains a client of the DNS API of Nodion.
Index ¶
- Constants
- type APIError
- type Client
- func (c Client) CreateRecord(ctx context.Context, zoneID string, record Record) (*Record, error)
- func (c Client) CreateZone(ctx context.Context, name string) (*Zone, error)
- func (c Client) DeleteRecord(ctx context.Context, zoneID, recordID string) (bool, error)
- func (c Client) DeleteZone(ctx context.Context, zoneID string) (bool, error)
- func (c Client) GetRecords(ctx context.Context, zoneID string, filter *RecordsFilter) ([]Record, error)
- func (c Client) GetZones(ctx context.Context, filter *ZonesFilter) ([]Zone, error)
- type DeleteResponse
- type Record
- type RecordResponse
- type RecordsFilter
- type RecordsResponse
- type Zone
- type ZoneResponse
- type ZonesFilter
- type ZonesResponse
Constants ¶
const ( TypeA = "a" TypeAAAA = "aaaa" TypeNS = "ns" TypeALIAS = "alias" TypeCNAME = "cname" TypeMX = "mx" TypeTXT = "txt" TypePTR = "ptr" TypeSRV = "srv" )
Record types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { StatusCode int `json:"status"` Message string `json:"error"` Errors []string `json:"errors"` }
APIError is the error returned by the server.
type Client ¶
Client the Nodion API client.
func (Client) CreateRecord ¶
CreateRecord To create a new Record for a DNS zone. https://www.nodion.com/en/docs/dns/api/#post-dns-record
func (Client) CreateZone ¶
CreateZone To create a new DNS Zone. https://www.nodion.com/en/docs/dns/api/#post-dns-zone
func (Client) DeleteRecord ¶
DeleteRecord To delete an existing Record for a DNS zone. https://www.nodion.com/en/docs/dns/api/#delete-dns-record
func (Client) DeleteZone ¶
DeleteZone To delete an existing DNS Zone. https://www.nodion.com/en/docs/dns/api/#delete-dns-zone
func (Client) GetRecords ¶
func (c Client) GetRecords(ctx context.Context, zoneID string, filter *RecordsFilter) ([]Record, error)
GetRecords To list all existing Records of a DNS zone. https://www.nodion.com/en/docs/dns/api/#get-dns-records
func (Client) GetZones ¶
GetZones To list all existing DNS zones. https://www.nodion.com/en/docs/dns/api/#get-dns-zones
type DeleteResponse ¶
type DeleteResponse struct {
Deleted bool `json:"deleted"`
}
DeleteResponse represents the response of the API endpoints related to deletion of zone or record.
type Record ¶
type Record struct { ID string `json:"id,omitempty"` RecordType string `json:"record_type,omitempty"` // a, aaaa, ns, alias, cname, mx, txt, ptr, srv. Case-sensitive must be in lowercase. Name string `json:"name,omitempty"` Content string `json:"content,omitempty"` TTL int `json:"ttl,omitempty"` // a number between 60 and 86400. ZoneID string `json:"zone_id,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
Record contains all the information related to a DNS record.
type RecordResponse ¶
type RecordResponse struct {
Record Record `json:"record"`
}
RecordResponse represents the response of the CreateRecord API endpoint.
type RecordsFilter ¶
type RecordsFilter struct { Name string `url:"name"` RecordType string `url:"record_type"` Content string `url:"content"` }
RecordsFilter is filter criteria for records.
type RecordsResponse ¶
type RecordsResponse struct {
Records []Record `json:"records"`
}
RecordsResponse represents the response of the GetRecords API endpoint.
type Zone ¶
type Zone struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` Records []Record `json:"records,omitempty"` }
Zone contains all the information related to a zone.
type ZoneResponse ¶
type ZoneResponse struct {
Zone Zone `json:"dns_zone"`
}
ZoneResponse represents the response of the CreateZone API endpoint.
type ZonesFilter ¶
type ZonesFilter struct {
Name string `url:"name"` // must be the exact name and no FQDN
}
ZonesFilter is filter criteria for zones.
type ZonesResponse ¶
type ZonesResponse struct {
Zones []Zone `json:"dns_zones"`
}
ZonesResponse represents the response of the GetZones API endpoint.