Documentation ¶
Index ¶
- type CreateNoteRequest
- type CreateRecordRequest
- type CreateTemplateRequest
- type CreateZoneRequest
- type CustomAXFRSettings
- type Nameserver
- type Note
- type PatchRecordRequest
- type PatchTemplateRequest
- type PatchZoneRequest
- type Record
- type RecordTTL
- type RecordType
- type SafeDNSService
- type Service
- func (s *Service) CreateTemplate(req CreateTemplateRequest) (int, error)
- func (s *Service) CreateTemplateRecord(templateID int, req CreateRecordRequest) (int, error)
- func (s *Service) CreateZone(req CreateZoneRequest) error
- func (s *Service) CreateZoneNote(zoneName string, req CreateNoteRequest) (int, error)
- func (s *Service) CreateZoneRecord(zoneName string, req CreateRecordRequest) (int, error)
- func (s *Service) DeleteTemplate(templateID int) error
- func (s *Service) DeleteTemplateRecord(templateID int, recordID int) error
- func (s *Service) DeleteZone(zoneName string) error
- func (s *Service) DeleteZoneRecord(zoneName string, recordID int) error
- func (s *Service) GetSettings() (Settings, error)
- func (s *Service) GetTemplate(templateID int) (Template, error)
- func (s *Service) GetTemplateRecord(templateID int, recordID int) (Record, error)
- func (s *Service) GetTemplateRecords(templateID int, parameters connection.APIRequestParameters) ([]Record, error)
- func (s *Service) GetTemplateRecordsPaginated(templateID int, parameters connection.APIRequestParameters) (*connection.Paginated[Record], error)
- func (s *Service) GetTemplates(parameters connection.APIRequestParameters) ([]Template, error)
- func (s *Service) GetTemplatesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Template], error)
- func (s *Service) GetZone(zoneName string) (Zone, error)
- func (s *Service) GetZoneNote(zoneName string, noteID int) (Note, error)
- func (s *Service) GetZoneNotes(zoneName string, parameters connection.APIRequestParameters) ([]Note, error)
- func (s *Service) GetZoneNotesPaginated(zoneName string, parameters connection.APIRequestParameters) (*connection.Paginated[Note], error)
- func (s *Service) GetZoneRecord(zoneName string, recordID int) (Record, error)
- func (s *Service) GetZoneRecords(zoneName string, parameters connection.APIRequestParameters) ([]Record, error)
- func (s *Service) GetZoneRecordsPaginated(zoneName string, parameters connection.APIRequestParameters) (*connection.Paginated[Record], error)
- func (s *Service) GetZones(parameters connection.APIRequestParameters) ([]Zone, error)
- func (s *Service) GetZonesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Zone], error)
- func (s *Service) PatchTemplate(templateID int, patch PatchTemplateRequest) (int, error)
- func (s *Service) PatchTemplateRecord(templateID int, recordID int, patch PatchRecordRequest) (int, error)
- func (s *Service) PatchZone(zoneName string, req PatchZoneRequest) error
- func (s *Service) PatchZoneRecord(zoneName string, recordID int, patch PatchRecordRequest) (int, error)
- func (s *Service) UpdateZoneRecord(zoneName string, record Record) (int, error)
- type Settings
- type Template
- type TemplateNotFoundError
- type TemplateRecordNotFoundError
- type Zone
- type ZoneNotFoundError
- type ZoneNoteNotFoundError
- type ZoneRecordNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateNoteRequest ¶
type CreateNoteRequest struct { connection.APIRequestBodyDefaultValidator ContactID int `json:"contact_id,omitempty"` Notes string `json:"notes" validate:"required"` }
CreateNoteRequest represents a request to create a SafeDNS note
func (*CreateNoteRequest) Validate ¶
func (c *CreateNoteRequest) Validate() *connection.ValidationError
Validate returns an error if struct properties are missing/invalid
type CreateRecordRequest ¶
type CreateRecordRequest struct { connection.APIRequestBodyDefaultValidator Name string `json:"name" validate:"required"` TemplateID int `json:"template_id,omitempty"` Type string `json:"type" validate:"required"` Content string `json:"content" validate:"required"` TTL *RecordTTL `json:"ttl,omitempty"` Priority *int `json:"priority,omitempty"` }
CreateRecordRequest represents a request to create a SafeDNS record
func (*CreateRecordRequest) Validate ¶
func (c *CreateRecordRequest) Validate() *connection.ValidationError
Validate returns an error if struct properties are missing/invalid
type CreateTemplateRequest ¶
type CreateTemplateRequest struct { connection.APIRequestBodyDefaultValidator Name string `json:"name" validate:"required"` Default bool `json:"default"` }
CreateTemplateRequest represents a request to create a SafeDNS template
func (*CreateTemplateRequest) Validate ¶
func (c *CreateTemplateRequest) Validate() *connection.ValidationError
Validate returns an error if struct properties are missing/invalid
type CreateZoneRequest ¶
type CreateZoneRequest struct { connection.APIRequestBodyDefaultValidator Name string `json:"name" validate:"required"` Description string `json:"description,omitempty"` }
CreateZoneRequest represents a request to create a SafeDNS zone
func (*CreateZoneRequest) Validate ¶
func (c *CreateZoneRequest) Validate() *connection.ValidationError
Validate returns an error if struct properties are missing/invalid
type CustomAXFRSettings ¶
type CustomAXFRSettings struct { Allowed bool `json:"allowed"` Name []string `json:"name"` IP []connection.IPAddress `json:"ip"` }
CustomAXFRSettings represents SafeDNS account AXFR settings
type Nameserver ¶
type Nameserver struct { Name string `json:"name"` IP connection.IPAddress `json:"ip"` }
Nameserver represents a SafeDNS nameserver
type Note ¶
type Note struct { ID int `json:"id"` ContactID int `json:"contact_id"` Notes string `json:"notes"` CreatedAt connection.DateTime `json:"created_at"` IP connection.IPAddress `json:"ip"` }
Note represents a SafeDNS note
type PatchRecordRequest ¶
type PatchRecordRequest struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Content string `json:"content,omitempty"` TTL *RecordTTL `json:"ttl,omitempty"` Priority *int `json:"priority,omitempty"` }
PatchRecordRequest represents a SafeDNS record patch request
func (*PatchRecordRequest) Validate ¶
func (c *PatchRecordRequest) Validate() *connection.ValidationError
Validate returns an error if struct properties are missing/invalid
type PatchTemplateRequest ¶
type PatchTemplateRequest struct { Name string `json:"name,omitempty"` Default *bool `json:"default,omitempty"` }
PatchTemplateRequest represents a SafeDNS template patch request
func (*PatchTemplateRequest) Validate ¶
func (c *PatchTemplateRequest) Validate() *connection.ValidationError
Validate returns an error if struct properties are missing/invalid
type PatchZoneRequest ¶
type PatchZoneRequest struct {
Description string `json:"description,omitempty"`
}
PatchZoneRequest represents a SafeDNS zone patch request
func (*PatchZoneRequest) Validate ¶
func (c *PatchZoneRequest) Validate() *connection.ValidationError
Validate returns an error if struct properties are missing/invalid
type Record ¶
type Record struct { ID int `json:"id"` TemplateID int `json:"template_id"` Name string `json:"name"` Type RecordType `json:"type"` Content string `json:"content"` UpdatedAt connection.DateTime `json:"updated_at"` TTL RecordTTL `json:"ttl"` Priority int `json:"priority"` }
Record represents a SafeDNS record
type RecordTTL ¶
type RecordTTL int
RecordTTL represents the record TTL time in seconds
type RecordType ¶
type RecordType string
const ( RecordTypeA RecordType = "A" RecordTypeAAAA RecordType = "AAAA" RecordTypeCAA RecordType = "CAA" RecordTypeCNAME RecordType = "CNAME" RecordTypeMX RecordType = "MX" RecordTypeSPF RecordType = "SPF" RecordTypeSRV RecordType = "SRV" RecordTypeTXT RecordType = "TXT" RecordTypeNS RecordType = "NS" RecordTypeSOA RecordType = "SOA" RecordTypeAXFR RecordType = "AXFR" )
func (RecordType) String ¶
func (s RecordType) String() string
type SafeDNSService ¶
type SafeDNSService interface { GetZones(parameters connection.APIRequestParameters) ([]Zone, error) GetZonesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Zone], error) GetZone(zoneName string) (Zone, error) CreateZone(req CreateZoneRequest) error PatchZone(zoneName string, req PatchZoneRequest) error DeleteZone(zoneName string) error GetZoneRecords(zoneName string, parameters connection.APIRequestParameters) ([]Record, error) GetZoneRecordsPaginated(zoneName string, parameters connection.APIRequestParameters) (*connection.Paginated[Record], error) GetZoneRecord(zoneName string, recordID int) (Record, error) CreateZoneRecord(zoneName string, req CreateRecordRequest) (int, error) UpdateZoneRecord(zoneName string, record Record) (int, error) PatchZoneRecord(zoneName string, recordID int, patch PatchRecordRequest) (int, error) DeleteZoneRecord(zoneName string, recordID int) error GetZoneNotes(zoneName string, parameters connection.APIRequestParameters) ([]Note, error) GetZoneNotesPaginated(zoneName string, parameters connection.APIRequestParameters) (*connection.Paginated[Note], error) GetZoneNote(zoneName string, noteID int) (Note, error) CreateZoneNote(zoneName string, req CreateNoteRequest) (int, error) GetTemplates(parameters connection.APIRequestParameters) ([]Template, error) GetTemplatesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Template], error) GetTemplate(templateID int) (Template, error) CreateTemplate(req CreateTemplateRequest) (int, error) PatchTemplate(templateID int, patch PatchTemplateRequest) (int, error) DeleteTemplate(templateID int) error GetTemplateRecords(templateID int, parameters connection.APIRequestParameters) ([]Record, error) GetTemplateRecordsPaginated(templateID int, parameters connection.APIRequestParameters) (*connection.Paginated[Record], error) GetTemplateRecord(templateID int, recordID int) (Record, error) CreateTemplateRecord(templateID int, req CreateRecordRequest) (int, error) PatchTemplateRecord(templateID int, recordID int, patch PatchRecordRequest) (int, error) DeleteTemplateRecord(templateID int, recordID int) error GetSettings() (Settings, error) }
SafeDNSService is an interface for managing SafeDNS
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements SafeDNSService for managing SafeDNS via the UKFast API
func NewService ¶
func NewService(connection connection.Connection) *Service
NewService returns a new instance of SafeDNSService
func (*Service) CreateTemplate ¶
func (s *Service) CreateTemplate(req CreateTemplateRequest) (int, error)
CreateTemplate creates a new SafeDNS template
func (*Service) CreateTemplateRecord ¶
func (s *Service) CreateTemplateRecord(templateID int, req CreateRecordRequest) (int, error)
CreateTemplateRecord creates a new SafeDNS zone record
func (*Service) CreateZone ¶
func (s *Service) CreateZone(req CreateZoneRequest) error
CreateZone creates a new SafeDNS zone
func (*Service) CreateZoneNote ¶
func (s *Service) CreateZoneNote(zoneName string, req CreateNoteRequest) (int, error)
CreateZoneNote creates a new SafeDNS zone note
func (*Service) CreateZoneRecord ¶
func (s *Service) CreateZoneRecord(zoneName string, req CreateRecordRequest) (int, error)
CreateZoneRecord creates a new SafeDNS zone record
func (*Service) DeleteTemplate ¶
DeleteTemplate removes a SafeDNS template
func (*Service) DeleteTemplateRecord ¶
DeleteTemplateRecord removes a SafeDNS template record
func (*Service) DeleteZone ¶
DeleteZone removes a SafeDNS zone
func (*Service) DeleteZoneRecord ¶
DeleteZoneRecord removes a SafeDNS zone record
func (*Service) GetSettings ¶
GetSettings retrieves account settings
func (*Service) GetTemplate ¶
GetTemplate retrieves a single template by ID
func (*Service) GetTemplateRecord ¶
GetTemplateRecord retrieves a single zone record by ID
func (*Service) GetTemplateRecords ¶
func (s *Service) GetTemplateRecords(templateID int, parameters connection.APIRequestParameters) ([]Record, error)
GetTemplateRecords retrieves a list of records
func (*Service) GetTemplateRecordsPaginated ¶
func (s *Service) GetTemplateRecordsPaginated(templateID int, parameters connection.APIRequestParameters) (*connection.Paginated[Record], error)
GetTemplateRecordsPaginated retrieves a paginated list of templates
func (*Service) GetTemplates ¶
func (s *Service) GetTemplates(parameters connection.APIRequestParameters) ([]Template, error)
GetTemplates retrieves a list of templates
func (*Service) GetTemplatesPaginated ¶
func (s *Service) GetTemplatesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Template], error)
GetTemplatesPaginated retrieves a paginated list of templates
func (*Service) GetZoneNote ¶
GetZoneNote retrieves a single zone note by ID
func (*Service) GetZoneNotes ¶
func (s *Service) GetZoneNotes(zoneName string, parameters connection.APIRequestParameters) ([]Note, error)
GetZoneNotes retrieves a list of notes
func (*Service) GetZoneNotesPaginated ¶
func (s *Service) GetZoneNotesPaginated(zoneName string, parameters connection.APIRequestParameters) (*connection.Paginated[Note], error)
GetZoneNotesPaginated retrieves a paginated list of zones
func (*Service) GetZoneRecord ¶
GetZoneRecord retrieves a single zone record by ID
func (*Service) GetZoneRecords ¶
func (s *Service) GetZoneRecords(zoneName string, parameters connection.APIRequestParameters) ([]Record, error)
GetZoneRecords retrieves a list of records
func (*Service) GetZoneRecordsPaginated ¶
func (s *Service) GetZoneRecordsPaginated(zoneName string, parameters connection.APIRequestParameters) (*connection.Paginated[Record], error)
GetZoneRecordsPaginated retrieves a paginated list of zones
func (*Service) GetZones ¶
func (s *Service) GetZones(parameters connection.APIRequestParameters) ([]Zone, error)
GetZones retrieves a list of zones
func (*Service) GetZonesPaginated ¶
func (s *Service) GetZonesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Zone], error)
GetZonesPaginated retrieves a paginated list of zones
func (*Service) PatchTemplate ¶
func (s *Service) PatchTemplate(templateID int, patch PatchTemplateRequest) (int, error)
PatchTemplate patches a SafeDNS template
func (*Service) PatchTemplateRecord ¶
func (s *Service) PatchTemplateRecord(templateID int, recordID int, patch PatchRecordRequest) (int, error)
PatchTemplateRecord patches a SafeDNS template record
func (*Service) PatchZone ¶
func (s *Service) PatchZone(zoneName string, req PatchZoneRequest) error
PatchZone patches a SafeDNS zone
func (*Service) PatchZoneRecord ¶
func (s *Service) PatchZoneRecord(zoneName string, recordID int, patch PatchRecordRequest) (int, error)
PatchZoneRecord patches a SafeDNS zone record
type Settings ¶
type Settings struct { ID int `json:"id"` Email string `json:"email"` Nameservers []Nameserver `json:"nameservers"` CustomSOAAllowed bool `json:"custom_soa_allowed"` CustomBaseNSAllowed bool `json:"custom_base_ns_allowed"` CustomAXFR CustomAXFRSettings `json:"custom_axfr"` DelegationAllowed bool `json:"delegation_allowed"` Product string `json:"product"` }
Settings represents SafeDNS account settings/configuration
type Template ¶
type Template struct { ID int `json:"id"` Name string `json:"name"` Default bool `json:"default"` CreatedAt connection.Date `json:"created_at"` }
Template represents a SafeDNS template
type TemplateNotFoundError ¶
type TemplateNotFoundError struct {
TemplateID int
}
TemplateNotFoundError indicates a template was not found within SafeDNS
func (*TemplateNotFoundError) Error ¶
func (e *TemplateNotFoundError) Error() string
type TemplateRecordNotFoundError ¶
TemplateRecordNotFoundError indicates a record was not found within SafeDNS
func (*TemplateRecordNotFoundError) Error ¶
func (e *TemplateRecordNotFoundError) Error() string
type ZoneNotFoundError ¶
type ZoneNotFoundError struct {
ZoneName string
}
ZoneNotFoundError indicates a zone was not found within SafeDNS
func (*ZoneNotFoundError) Error ¶
func (e *ZoneNotFoundError) Error() string
type ZoneNoteNotFoundError ¶
ZoneNoteNotFoundError indicates a zone note was not found within SafeDNS
func (*ZoneNoteNotFoundError) Error ¶
func (e *ZoneNoteNotFoundError) Error() string
type ZoneRecordNotFoundError ¶
ZoneRecordNotFoundError indicates a record was not found within SafeDNS
func (*ZoneRecordNotFoundError) Error ¶
func (e *ZoneRecordNotFoundError) Error() string