dns

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

Akamai Config DNS (Zone Record Management)

A golang package that talks to the Akamai OPEN Config DNS API.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Config contains the Akamai OPEN Edgegrid API credentials
	// for automatic signing of requests
	Config edgegrid.Config
)

Functions

func Init

func Init(config edgegrid.Config)

Init sets the FastDNS edgegrid Config

func IsConfigDNSError added in v0.5.0

func IsConfigDNSError(e error) bool

Types

type ARecord added in v0.5.0

type ARecord struct {
	Name   string `json:"name,omitempty"`
	TTL    int    `json:"ttl,omitempty"`
	Active bool   `json:"active,omitempty"`
	Target string `json:"target,omitempty"`
	// contains filtered or unexported fields
}

func NewARecord added in v0.5.0

func NewARecord() *ARecord

func (*ARecord) GetAllowedFields added in v0.5.0

func (record *ARecord) GetAllowedFields() []string

func (*ARecord) SetField added in v0.5.0

func (record *ARecord) SetField(name string, value interface{}) error

func (*ARecord) ToMap added in v0.5.0

func (record *ARecord) ToMap() map[string]interface{}

type AaaaRecord added in v0.5.0

type AaaaRecord struct {
	Name   string `json:"name,omitempty"`
	TTL    int    `json:"ttl,omitempty"`
	Active bool   `json:"active,omitempty"`
	Target string `json:"target,omitempty"`
	// contains filtered or unexported fields
}

func NewAaaaRecord added in v0.5.0

func NewAaaaRecord() *AaaaRecord

func (*AaaaRecord) GetAllowedFields added in v0.5.0

func (record *AaaaRecord) GetAllowedFields() []string

func (*AaaaRecord) SetField added in v0.5.0

func (record *AaaaRecord) SetField(name string, value interface{}) error

func (*AaaaRecord) ToMap added in v0.5.0

func (record *AaaaRecord) ToMap() map[string]interface{}

type AfsdbRecord added in v0.5.0

type AfsdbRecord struct {
	Name    string `json:"name,omitempty"`
	TTL     int    `json:"ttl,omitempty"`
	Active  bool   `json:"active,omitempty"`
	Target  string `json:"target,omitempty"`
	Subtype int    `json:"subtype,omitempty"`
	// contains filtered or unexported fields
}

func NewAfsdbRecord added in v0.5.0

func NewAfsdbRecord() *AfsdbRecord

func (*AfsdbRecord) GetAllowedFields added in v0.5.0

func (record *AfsdbRecord) GetAllowedFields() []string

func (*AfsdbRecord) SetField added in v0.5.0

func (record *AfsdbRecord) SetField(name string, value interface{}) error

func (*AfsdbRecord) ToMap added in v0.5.0

func (record *AfsdbRecord) ToMap() map[string]interface{}

type CnameRecord added in v0.5.0

type CnameRecord struct {
	Name   string `json:"name,omitempty"`
	TTL    int    `json:"ttl,omitempty"`
	Active bool   `json:"active,omitempty"`
	Target string `json:"target,omitempty"`
	// contains filtered or unexported fields
}

func NewCnameRecord added in v0.5.0

func NewCnameRecord() *CnameRecord

func (*CnameRecord) GetAllowedFields added in v0.5.0

func (record *CnameRecord) GetAllowedFields() []string

func (*CnameRecord) SetField added in v0.5.0

func (record *CnameRecord) SetField(name string, value interface{}) error

func (*CnameRecord) ToMap added in v0.5.0

func (record *CnameRecord) ToMap() map[string]interface{}

type ConfigDNSError added in v0.5.0

type ConfigDNSError interface {
	error
	Network() bool
	NotFound() bool
	FailedToSave() bool
	ValidationFailed() bool
}

type DNSRecord added in v0.5.0

type DNSRecord interface {
	// Get the list of allowed fields for this type
	GetAllowedFields() []string
	// Set a field on the struct, which check for valid fields
	SetField(name string, value interface{}) error
	// Translate struct properties to a map
	ToMap() map[string]interface{}
}

All record types (below) must implement the DNSRecord interface This allows the record to be used dynamically in slices - see the Zone struct definition in zone.go

The record types implemented and their fields are as defined here https://developer.akamai.com/api/luna/config-dns/data.html

type DnskeyRecord added in v0.5.0

type DnskeyRecord struct {
	Name      string `json:"name,omitempty"`
	TTL       int    `json:"ttl,omitempty"`
	Active    bool   `json:"active,omitempty"`
	Flags     int    `json:"flags,omitempty"`
	Protocol  int    `json:"protocol,omitempty"`
	Algorithm int    `json:"algorithm,omitempty"`
	Key       string `json:"key,omitempty"`
	// contains filtered or unexported fields
}

func NewDnskeyRecord added in v0.5.0

func NewDnskeyRecord() *DnskeyRecord

func (*DnskeyRecord) GetAllowedFields added in v0.5.0

func (record *DnskeyRecord) GetAllowedFields() []string

func (*DnskeyRecord) SetField added in v0.5.0

func (record *DnskeyRecord) SetField(name string, value interface{}) error

func (*DnskeyRecord) ToMap added in v0.5.0

func (record *DnskeyRecord) ToMap() map[string]interface{}

type DsRecord added in v0.5.0

type DsRecord struct {
	Name       string `json:"name,omitempty"`
	TTL        int    `json:"ttl,omitempty"`
	Active     bool   `json:"active,omitempty"`
	Keytag     int    `json:"keytag,omitempty"`
	Algorithm  int    `json:"algorithm,omitempty"`
	DigestType int    `json:"digest_type,omitempty"`
	Digest     string `json:"digest,omitempty"`
	// contains filtered or unexported fields
}

func NewDsRecord added in v0.5.0

func NewDsRecord() *DsRecord

func (*DsRecord) GetAllowedFields added in v0.5.0

func (record *DsRecord) GetAllowedFields() []string

func (*DsRecord) SetField added in v0.5.0

func (record *DsRecord) SetField(name string, value interface{}) error

func (*DsRecord) ToMap added in v0.5.0

func (record *DsRecord) ToMap() map[string]interface{}

type HinfoRecord added in v0.5.0

type HinfoRecord struct {
	Name     string `json:"name,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
	Active   bool   `json:"active,omitempty"`
	Hardware string `json:"hardware,omitempty"`
	Software string `json:"software,omitempty"`
	// contains filtered or unexported fields
}

func NewHinfoRecord added in v0.5.0

func NewHinfoRecord() *HinfoRecord

func (*HinfoRecord) GetAllowedFields added in v0.5.0

func (record *HinfoRecord) GetAllowedFields() []string

func (*HinfoRecord) SetField added in v0.5.0

func (record *HinfoRecord) SetField(name string, value interface{}) error

func (*HinfoRecord) ToMap added in v0.5.0

func (record *HinfoRecord) ToMap() map[string]interface{}

type LocRecord added in v0.5.0

type LocRecord struct {
	Name   string `json:"name,omitempty"`
	TTL    int    `json:"ttl,omitempty"`
	Active bool   `json:"active,omitempty"`
	Target string `json:"target,omitempty"`
	// contains filtered or unexported fields
}

func NewLocRecord added in v0.5.0

func NewLocRecord() *LocRecord

func (*LocRecord) GetAllowedFields added in v0.5.0

func (record *LocRecord) GetAllowedFields() []string

func (*LocRecord) SetField added in v0.5.0

func (record *LocRecord) SetField(name string, value interface{}) error

func (*LocRecord) ToMap added in v0.5.0

func (record *LocRecord) ToMap() map[string]interface{}

type MxRecord added in v0.5.0

type MxRecord struct {
	Name     string `json:"name,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
	Active   bool   `json:"active,omitempty"`
	Target   string `json:"target,omitempty"`
	Priority int    `json:"priority,omitempty"`
	// contains filtered or unexported fields
}

func NewMxRecord added in v0.5.0

func NewMxRecord() *MxRecord

func (*MxRecord) GetAllowedFields added in v0.5.0

func (record *MxRecord) GetAllowedFields() []string

func (*MxRecord) SetField added in v0.5.0

func (record *MxRecord) SetField(name string, value interface{}) error

func (*MxRecord) ToMap added in v0.5.0

func (record *MxRecord) ToMap() map[string]interface{}

type NaptrRecord

type NaptrRecord struct {
	Name        string `json:"name,omitempty"`
	TTL         int    `json:"ttl,omitempty"`
	Active      bool   `json:"active,omitempty"`
	Order       uint16 `json:"order,omitempty"`
	Preference  uint16 `json:"preference,omitempty"`
	Flags       string `json:"flags,omitempty"`
	Service     string `json:"service,omitempty"`
	Regexp      string `json:"regexp,omitempty"`
	Replacement string `json:"replacement,omitempty"`
	// contains filtered or unexported fields
}

func NewNaptrRecord added in v0.5.0

func NewNaptrRecord() *NaptrRecord

func (*NaptrRecord) GetAllowedFields added in v0.5.0

func (record *NaptrRecord) GetAllowedFields() []string

func (*NaptrRecord) SetField added in v0.5.0

func (record *NaptrRecord) SetField(name string, value interface{}) error

func (*NaptrRecord) ToMap added in v0.5.0

func (record *NaptrRecord) ToMap() map[string]interface{}

type NsRecord

type NsRecord struct {
	Name   string `json:"name,omitempty"`
	TTL    int    `json:"ttl,omitempty"`
	Active bool   `json:"active,omitempty"`
	Target string `json:"target,omitempty"`
	// contains filtered or unexported fields
}

func NewNsRecord added in v0.5.0

func NewNsRecord() *NsRecord

func (*NsRecord) GetAllowedFields added in v0.5.0

func (record *NsRecord) GetAllowedFields() []string

func (*NsRecord) SetField added in v0.5.0

func (record *NsRecord) SetField(name string, value interface{}) error

func (*NsRecord) ToMap added in v0.5.0

func (record *NsRecord) ToMap() map[string]interface{}

type Nsec3Record

type Nsec3Record struct {
	Name                string `json:"name,omitempty"`
	TTL                 int    `json:"ttl,omitempty"`
	Active              bool   `json:"active,omitempty"`
	Algorithm           int    `json:"algorithm,omitempty"`
	Flags               int    `json:"flags,omitempty"`
	Iterations          int    `json:"iterations,omitempty"`
	Salt                string `json:"salt,omitempty"`
	NextHashedOwnerName string `json:"next_hashed_owner_name,omitempty"`
	TypeBitmaps         string `json:"type_bitmaps,omitempty"`
	// contains filtered or unexported fields
}

func NewNsec3Record added in v0.5.0

func NewNsec3Record() *Nsec3Record

func (*Nsec3Record) GetAllowedFields added in v0.5.0

func (record *Nsec3Record) GetAllowedFields() []string

func (*Nsec3Record) SetField added in v0.5.0

func (record *Nsec3Record) SetField(name string, value interface{}) error

func (*Nsec3Record) ToMap added in v0.5.0

func (record *Nsec3Record) ToMap() map[string]interface{}

type Nsec3paramRecord

type Nsec3paramRecord struct {
	Name       string `json:"name,omitempty"`
	TTL        int    `json:"ttl,omitempty"`
	Active     bool   `json:"active,omitempty"`
	Algorithm  int    `json:"algorithm,omitempty"`
	Flags      int    `json:"flags,omitempty"`
	Iterations int    `json:"iterations,omitempty"`
	Salt       string `json:"salt,omitempty"`
	// contains filtered or unexported fields
}

func NewNsec3paramRecord added in v0.5.0

func NewNsec3paramRecord() *Nsec3paramRecord

func (*Nsec3paramRecord) GetAllowedFields added in v0.5.0

func (record *Nsec3paramRecord) GetAllowedFields() []string

func (*Nsec3paramRecord) SetField added in v0.5.0

func (record *Nsec3paramRecord) SetField(name string, value interface{}) error

func (*Nsec3paramRecord) ToMap added in v0.5.0

func (record *Nsec3paramRecord) ToMap() map[string]interface{}

type PtrRecord added in v0.5.0

type PtrRecord struct {
	Name   string `json:"name,omitempty"`
	TTL    int    `json:"ttl,omitempty"`
	Active bool   `json:"active,omitempty"`
	Target string `json:"target,omitempty"`
	// contains filtered or unexported fields
}

func NewPtrRecord added in v0.5.0

func NewPtrRecord() *PtrRecord

func (*PtrRecord) GetAllowedFields added in v0.5.0

func (record *PtrRecord) GetAllowedFields() []string

func (*PtrRecord) SetField added in v0.5.0

func (record *PtrRecord) SetField(name string, value interface{}) error

func (*PtrRecord) ToMap added in v0.5.0

func (record *PtrRecord) ToMap() map[string]interface{}

type RecordError added in v0.5.0

type RecordError struct {
	// contains filtered or unexported fields
}

func (*RecordError) Error added in v0.5.0

func (e *RecordError) Error() string

func (*RecordError) FailedToSave added in v0.5.0

func (e *RecordError) FailedToSave() bool

func (*RecordError) Network added in v0.5.0

func (e *RecordError) Network() bool

func (*RecordError) NotFound added in v0.5.0

func (e *RecordError) NotFound() bool

func (*RecordError) ValidationFailed added in v0.5.0

func (e *RecordError) ValidationFailed() bool

type RpRecord added in v0.5.0

type RpRecord struct {
	Name    string `json:"name,omitempty"`
	TTL     int    `json:"ttl,omitempty"`
	Active  bool   `json:"active,omitempty"`
	Mailbox string `json:"mailbox,omitempty"`
	Txt     string `json:"txt,omitempty"`
	// contains filtered or unexported fields
}

func NewRpRecord added in v0.5.0

func NewRpRecord() *RpRecord

func (*RpRecord) GetAllowedFields added in v0.5.0

func (record *RpRecord) GetAllowedFields() []string

func (*RpRecord) SetField added in v0.5.0

func (record *RpRecord) SetField(name string, value interface{}) error

func (*RpRecord) ToMap added in v0.5.0

func (record *RpRecord) ToMap() map[string]interface{}

type RrsigRecord added in v0.5.0

type RrsigRecord struct {
	Name        string `json:"name,omitempty"`
	TTL         int    `json:"ttl,omitempty"`
	Active      bool   `json:"active,omitempty"`
	TypeCovered string `json:"type_covered,omitempty"`
	Algorithm   int    `json:"algorithm,omitempty"`
	OriginalTTL int    `json:"original_ttl,omitempty"`
	Expiration  string `json:"expiration,omitempty"`
	Inception   string `json:"inception,omitempty"`
	Keytag      int    `json:"keytag,omitempty"`
	Signer      string `json:"signer,omitempty"`
	Signature   string `json:"signature,omitempty"`
	Labels      int    `json:"labels,omitempty"`
	// contains filtered or unexported fields
}

func NewRrsigRecord added in v0.5.0

func NewRrsigRecord() *RrsigRecord

func (*RrsigRecord) GetAllowedFields added in v0.5.0

func (record *RrsigRecord) GetAllowedFields() []string

func (*RrsigRecord) SetField added in v0.5.0

func (record *RrsigRecord) SetField(name string, value interface{}) error

func (*RrsigRecord) ToMap added in v0.5.0

func (record *RrsigRecord) ToMap() map[string]interface{}

type SoaRecord added in v0.5.0

type SoaRecord struct {
	TTL          int    `json:"ttl,omitempty"`
	Originserver string `json:"originserver,omitempty"`
	Contact      string `json:"contact,omitempty"`
	Serial       uint   `json:"serial,omitempty"`
	Refresh      int    `json:"refresh,omitempty"`
	Retry        int    `json:"retry,omitempty"`
	Expire       int    `json:"expire,omitempty"`
	Minimum      uint   `json:"minimum,omitempty"`
	// contains filtered or unexported fields
}

func NewSoaRecord added in v0.5.0

func NewSoaRecord() *SoaRecord

func (*SoaRecord) GetAllowedFields added in v0.5.0

func (record *SoaRecord) GetAllowedFields() []string

func (*SoaRecord) SetField added in v0.5.0

func (record *SoaRecord) SetField(name string, value interface{}) error

func (*SoaRecord) ToMap added in v0.5.0

func (record *SoaRecord) ToMap() map[string]interface{}

type SpfRecord added in v0.5.0

type SpfRecord struct {
	Name   string `json:"name,omitempty"`
	TTL    int    `json:"ttl,omitempty"`
	Active bool   `json:"active,omitempty"`
	Target string `json:"target,omitempty"`
	// contains filtered or unexported fields
}

func NewSpfRecord added in v0.5.0

func NewSpfRecord() *SpfRecord

func (*SpfRecord) GetAllowedFields added in v0.5.0

func (record *SpfRecord) GetAllowedFields() []string

func (*SpfRecord) SetField added in v0.5.0

func (record *SpfRecord) SetField(name string, value interface{}) error

func (*SpfRecord) ToMap added in v0.5.0

func (record *SpfRecord) ToMap() map[string]interface{}

type SrvRecord

type SrvRecord struct {
	Name     string `json:"name,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
	Active   bool   `json:"active,omitempty"`
	Target   string `json:"target,omitempty"`
	Priority int    `json:"priority,omitempty"`
	Weight   uint16 `json:"weight,omitempty"`
	Port     uint16 `json:"port,omitempty"`
	// contains filtered or unexported fields
}

func NewSrvRecord added in v0.5.0

func NewSrvRecord() *SrvRecord

func (*SrvRecord) GetAllowedFields added in v0.5.0

func (record *SrvRecord) GetAllowedFields() []string

func (*SrvRecord) SetField added in v0.5.0

func (record *SrvRecord) SetField(name string, value interface{}) error

func (*SrvRecord) ToMap added in v0.5.0

func (record *SrvRecord) ToMap() map[string]interface{}

type SshfpRecord added in v0.5.0

type SshfpRecord struct {
	Name            string `json:"name,omitempty"`
	TTL             int    `json:"ttl,omitempty"`
	Active          bool   `json:"active,omitempty"`
	Algorithm       int    `json:"algorithm,omitempty"`
	FingerprintType int    `json:"fingerprint_type,omitempty"`
	Fingerprint     string `json:"fingerprint,omitempty"`
	// contains filtered or unexported fields
}

func NewSshfpRecord added in v0.5.0

func NewSshfpRecord() *SshfpRecord

func (*SshfpRecord) GetAllowedFields added in v0.5.0

func (record *SshfpRecord) GetAllowedFields() []string

func (*SshfpRecord) SetField added in v0.5.0

func (record *SshfpRecord) SetField(name string, value interface{}) error

func (*SshfpRecord) ToMap added in v0.5.0

func (record *SshfpRecord) ToMap() map[string]interface{}

type TxtRecord added in v0.5.0

type TxtRecord struct {
	Name   string `json:"name,omitempty"`
	TTL    int    `json:"ttl,omitempty"`
	Active bool   `json:"active,omitempty"`
	Target string `json:"target,omitempty"`
	// contains filtered or unexported fields
}

func NewTxtRecord added in v0.5.0

func NewTxtRecord() *TxtRecord

func (*TxtRecord) GetAllowedFields added in v0.5.0

func (record *TxtRecord) GetAllowedFields() []string

func (*TxtRecord) SetField added in v0.5.0

func (record *TxtRecord) SetField(name string, value interface{}) error

func (*TxtRecord) ToMap added in v0.5.0

func (record *TxtRecord) ToMap() map[string]interface{}

type Zone

type Zone struct {
	Token string `json:"token"`
	Zone  struct {
		Name       string              `json:"name,omitempty"`
		A          []*ARecord          `json:"a,omitempty"`
		Aaaa       []*AaaaRecord       `json:"aaaa,omitempty"`
		Afsdb      []*AfsdbRecord      `json:"afsdb,omitempty"`
		Cname      []*CnameRecord      `json:"cname,omitempty"`
		Dnskey     []*DnskeyRecord     `json:"dnskey,omitempty"`
		Ds         []*DsRecord         `json:"ds,omitempty"`
		Hinfo      []*HinfoRecord      `json:"hinfo,omitempty"`
		Loc        []*LocRecord        `json:"loc,omitempty"`
		Mx         []*MxRecord         `json:"mx,omitempty"`
		Naptr      []*NaptrRecord      `json:"naptr,omitempty"`
		Ns         []*NsRecord         `json:"ns,omitempty"`
		Nsec3      []*Nsec3Record      `json:"nsec3,omitempty"`
		Nsec3param []*Nsec3paramRecord `json:"nsec3param,omitempty"`
		Ptr        []*PtrRecord        `json:"ptr,omitempty"`
		Rp         []*RpRecord         `json:"rp,omitempty"`
		Rrsig      []*RrsigRecord      `json:"rrsig,omitempty"`
		Soa        *SoaRecord          `json:"soa,omitempty"`
		Spf        []*SpfRecord        `json:"spf,omitempty"`
		Srv        []*SrvRecord        `json:"srv,omitempty"`
		Sshfp      []*SshfpRecord      `json:"sshfp,omitempty"`
		Txt        []*TxtRecord        `json:"txt,omitempty"`
	} `json:"zone"`
}

Zone represents a DNS zone

func GetZone

func GetZone(hostname string) (*Zone, error)

GetZone retrieves a DNS Zone for a given hostname

func NewZone

func NewZone(hostname string) *Zone

NewZone creates a new Zone

func (*Zone) AddRecord

func (zone *Zone) AddRecord(recordPtr interface{}) error

func (*Zone) Delete added in v0.5.0

func (zone *Zone) Delete() error

func (*Zone) FindRecords added in v0.5.3

func (zone *Zone) FindRecords(recordType string, options map[string]interface{}) []DNSRecord

func (*Zone) PostUnmarshalJSON added in v0.7.1

func (zone *Zone) PostUnmarshalJSON() error

func (*Zone) PreMarshalJSON

func (zone *Zone) PreMarshalJSON() error

func (*Zone) RemoveRecord

func (zone *Zone) RemoveRecord(recordPtr interface{}) error

func (*Zone) Save

func (zone *Zone) Save() error

Save updates the Zone

type ZoneError added in v0.5.0

type ZoneError struct {
	// contains filtered or unexported fields
}

func (*ZoneError) Error added in v0.5.0

func (e *ZoneError) Error() string

func (*ZoneError) FailedToSave added in v0.5.0

func (e *ZoneError) FailedToSave() bool

func (*ZoneError) Network added in v0.5.0

func (e *ZoneError) Network() bool

func (*ZoneError) NotFound added in v0.5.0

func (e *ZoneError) NotFound() bool

func (*ZoneError) ValidationFailed added in v0.5.0

func (e *ZoneError) ValidationFailed() bool

Jump to

Keyboard shortcuts

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