safedns

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Code generated by model_paginated_gen. DO NOT EDIT.

Index

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

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

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

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

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:"contact_id"`
	Notes     string               `json:"notes"`
	CreatedAt connection.DateTime  `json:"created_at"`
	IP        connection.IPAddress `json:"ip"`
}

Note represents a SafeDNS note

type PaginatedNote added in v1.1.0

type PaginatedNote struct {
	*connection.PaginatedBase

	Items []Note
}

PaginatedNote represents a paginated collection of Note

func NewPaginatedNote added in v1.1.0

NewPaginatedNote returns a pointer to an initialized PaginatedNote struct

type PaginatedRecord added in v1.1.0

type PaginatedRecord struct {
	*connection.PaginatedBase

	Items []Record
}

PaginatedRecord represents a paginated collection of Record

func NewPaginatedRecord added in v1.1.0

NewPaginatedRecord returns a pointer to an initialized PaginatedRecord struct

type PaginatedTemplate added in v1.1.0

type PaginatedTemplate struct {
	*connection.PaginatedBase

	Items []Template
}

PaginatedTemplate represents a paginated collection of Template

func NewPaginatedTemplate added in v1.1.0

NewPaginatedTemplate returns a pointer to an initialized PaginatedTemplate struct

type PaginatedZone added in v1.1.0

type PaginatedZone struct {
	*connection.PaginatedBase

	Items []Zone
}

PaginatedZone represents a paginated collection of Zone

func NewPaginatedZone added in v1.1.0

NewPaginatedZone returns a pointer to an initialized PaginatedZone struct

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

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

Validate returns an error if struct properties are missing/invalid

type PatchZoneRequest added in v1.0.29

type PatchZoneRequest struct {
	Description string `json:"default,omitempty"`
}

PatchZoneRequest represents a SafeDNS zone patch request

func (*PatchZoneRequest) Validate added in v1.0.29

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       RecordType          `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

func (RecordTTL) Duration

func (r RecordTTL) Duration() time.Duration

Duration returns the record TTL duration (seconds)

func (RecordTTL) String

func (r RecordTTL) String() string

func (RecordTTL) Time

func (r RecordTTL) Time() time.Time

Time returns the record TTL time

type RecordType added in v1.0.7

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 added in v1.0.7

func (s RecordType) String() string

type SafeDNSService

type SafeDNSService interface {
	GetZones(parameters connection.APIRequestParameters) ([]Zone, error)
	GetZonesPaginated(parameters connection.APIRequestParameters) (*PaginatedZone, 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) (*PaginatedRecord, 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) (*PaginatedNote, 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) (*PaginatedTemplate, 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) (*PaginatedRecord, 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

func (s *Service) DeleteTemplate(templateID int) error

DeleteTemplate removes a SafeDNS template

func (*Service) DeleteTemplateRecord

func (s *Service) DeleteTemplateRecord(templateID int, recordID int) error

DeleteTemplateRecord removes a SafeDNS template record

func (*Service) DeleteZone

func (s *Service) DeleteZone(zoneName string) error

DeleteZone removes a SafeDNS zone

func (*Service) DeleteZoneRecord

func (s *Service) DeleteZoneRecord(zoneName string, recordID int) error

DeleteZoneRecord removes a SafeDNS zone record

func (*Service) GetTemplate

func (s *Service) GetTemplate(templateID int) (Template, error)

GetTemplate retrieves a single template by ID

func (*Service) GetTemplateRecord

func (s *Service) GetTemplateRecord(templateID int, recordID int) (Record, error)

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) (*PaginatedRecord, 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) (*PaginatedTemplate, error)

GetTemplatesPaginated retrieves a paginated list of templates

func (*Service) GetZone

func (s *Service) GetZone(zoneName string) (Zone, error)

GetZone retrieves a single zone by name

func (*Service) GetZoneNote

func (s *Service) GetZoneNote(zoneName string, noteID int) (Note, error)

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) (*PaginatedNote, error)

GetZoneNotesPaginated retrieves a paginated list of zones

func (*Service) GetZoneRecord

func (s *Service) GetZoneRecord(zoneName string, recordID int) (Record, error)

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) (*PaginatedRecord, 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) (*PaginatedZone, 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 added in v1.0.29

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

func (*Service) UpdateTemplate

func (s *Service) UpdateTemplate(template Template) (int, error)

UpdateTemplate updates a SafeDNS template

func (*Service) UpdateTemplateRecord

func (s *Service) UpdateTemplateRecord(templateID int, record Record) (int, error)

UpdateTemplateRecord updates a SafeDNS template record

func (*Service) UpdateZoneRecord

func (s *Service) UpdateZoneRecord(zoneName string, record Record) (int, error)

UpdateZoneRecord updates a SafeDNS zone 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

type TemplateRecordNotFoundError struct {
	TemplateID int
	RecordID   int
}

TemplateRecordNotFoundError indicates a record was not found within SafeDNS

func (*TemplateRecordNotFoundError) Error

type Zone

type Zone struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

Zone represents a SafeDNS zone

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

type ZoneNoteNotFoundError struct {
	ZoneName string
	NoteID   int
}

ZoneNoteNotFoundError indicates a zone note was not found within SafeDNS

func (*ZoneNoteNotFoundError) Error

func (e *ZoneNoteNotFoundError) Error() string

type ZoneRecordNotFoundError

type ZoneRecordNotFoundError struct {
	ZoneName string
	RecordID int
}

ZoneRecordNotFoundError indicates a record was not found within SafeDNS

func (*ZoneRecordNotFoundError) Error

func (e *ZoneRecordNotFoundError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL