Documentation
¶
Index ¶
- type CreateNoteRequest
- type CreateRecordRequest
- type CreateTemplateRequest
- type CreateZoneRequest
- type GetRecordResponseBody
- type GetRecordsResponseBody
- type GetTemplateResponseBody
- type GetTemplatesResponseBody
- type GetZoneNoteResponseBody
- type GetZoneNotesResponseBody
- type GetZoneResponseBody
- type GetZonesResponseBody
- type Note
- type PatchRecordRequest
- type PatchTemplateRequest
- type Record
- type RecordTTL
- 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) 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) ([]Record, error)
- func (s *Service) GetTemplates(parameters connection.APIRequestParameters) ([]Template, error)
- func (s *Service) GetTemplatesPaginated(parameters connection.APIRequestParameters) ([]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) ([]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) ([]Record, error)
- func (s *Service) GetZones(parameters connection.APIRequestParameters) ([]Zone, error)
- func (s *Service) GetZonesPaginated(parameters connection.APIRequestParameters) ([]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) PatchZoneRecord(zoneName string, recordID int, patch PatchRecordRequest) (int, error)
- func (s *Service) UpdateTemplate(template Template) (int, error)
- func (s *Service) UpdateTemplateRecord(templateID int, record Record) (int, error)
- func (s *Service) UpdateZoneRecord(zoneName string, record Record) (int, error)
- 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 DomainID int `json:"domain_id,omitempty"` RecordID int `json:"record_id,omitempty"` UserID int `json:"user_id,omitempty"` Notes string `json:"notes" validate:"required"` IP string `json:"ip,omitempty"` }
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"` 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 GetRecordResponseBody ¶
type GetRecordResponseBody struct { connection.APIResponseBody Data Record `json:"data"` }
GetRecordResponseBody represents the API response body from the GetRecord resource
type GetRecordsResponseBody ¶
type GetRecordsResponseBody struct { connection.APIResponseBody Data []Record `json:"data"` }
GetRecordsResponseBody represents the API response body from the GetRecords resource
type GetTemplateResponseBody ¶
type GetTemplateResponseBody struct { connection.APIResponseBody Data Template `json:"data"` }
GetTemplateResponseBody represents the API response body from the GetTemplate resource
type GetTemplatesResponseBody ¶
type GetTemplatesResponseBody struct { connection.APIResponseBody Data []Template `json:"data"` }
GetTemplatesResponseBody represents the API response body from the GetTemplates resource
type GetZoneNoteResponseBody ¶
type GetZoneNoteResponseBody struct { connection.APIResponseBody Data Note `json:"data"` }
GetZoneNoteResponseBody represents the API response body from the GetZoneNote resource
type GetZoneNotesResponseBody ¶
type GetZoneNotesResponseBody struct { connection.APIResponseBody Data []Note `json:"data"` }
GetZoneNotesResponseBody represents the API response body from the GetZoneNotes resource
type GetZoneResponseBody ¶
type GetZoneResponseBody struct { connection.APIResponseBody Data Zone `json:"data"` }
GetZoneResponseBody represents the API response body from the GetZone resource
type GetZonesResponseBody ¶
type GetZonesResponseBody struct { connection.APIResponseBody Data []Zone `json:"data"` }
GetZonesResponseBody represents the API response body from the GetZones resource
type Note ¶
type Note struct { ID int `json:"id"` ContactID int `json:"user_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 Record ¶
type Record struct { connection.APIRequestBodyDefaultValidator ID int `json:"id"` TemplateID int `json:"template_id"` Name string `json:"name" validate:"required"` Type string `json:"type"` Content string `json:"content" validate:"required"` UpdatedAt connection.DateTime `json:"updated_at"` TTL RecordTTL `json:"ttl"` Priority int `json:"priority"` }
Record represents a SafeDNS record
func (*Record) Validate ¶
func (c *Record) Validate() *connection.ValidationError
Validate returns an error if struct properties are missing/invalid
type RecordTTL ¶
type RecordTTL int
RecordTTL represents the record TTL time in seconds
type SafeDNSService ¶
type SafeDNSService interface { GetZones(parameters connection.APIRequestParameters) ([]Zone, error) GetZonesPaginated(parameters connection.APIRequestParameters) ([]Zone, error) GetZone(zoneName string) (Zone, error) CreateZone(req CreateZoneRequest) error DeleteZone(zoneName string) error GetZoneRecords(zoneName string, parameters connection.APIRequestParameters) ([]Record, error) GetZoneRecordsPaginated(zoneName string, parameters connection.APIRequestParameters) ([]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) ([]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) ([]Template, error) GetTemplate(templateID int) (Template, error) CreateTemplate(req CreateTemplateRequest) (int, error) UpdateTemplate(template Template) (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) ([]Record, error) GetTemplateRecord(templateID int, recordID int) (Record, error) CreateTemplateRecord(templateID int, req CreateRecordRequest) (int, error) UpdateTemplateRecord(templateID int, record Record) (int, error) PatchTemplateRecord(templateID int, recordID int, patch PatchRecordRequest) (int, error) DeleteTemplateRecord(templateID int, recordID int) 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) 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) ([]Record, error)
GetTemplateRecordsPaginated retrieves a paginated list of template records
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) ([]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 zone notes
func (*Service) GetZoneNotesPaginated ¶
func (s *Service) GetZoneNotesPaginated(zoneName string, parameters connection.APIRequestParameters) ([]Note, error)
GetZoneNotesPaginated retrieves a paginated list of zone notes
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) ([]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) ([]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) PatchZoneRecord ¶
func (s *Service) PatchZoneRecord(zoneName string, recordID int, patch PatchRecordRequest) (int, error)
PatchZoneRecord patches a SafeDNS zone record
func (*Service) UpdateTemplate ¶
UpdateTemplate updates a SafeDNS template
func (*Service) UpdateTemplateRecord ¶
UpdateTemplateRecord updates a SafeDNS template record
type Template ¶
type Template struct { connection.APIRequestBodyDefaultValidator ID int `json:"id"` Name string `json:"name" validate:"required"` Default bool `json:"default"` CreatedAt connection.Date `json:"created_at"` }
Template represents a SafeDNS template
func (*Template) Validate ¶
func (c *Template) Validate() *connection.ValidationError
Validate returns an error if struct properties are missing/invalid
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