dns

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

README

Akamai Config DNS (Zone Record Management)

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

Documentation

Overview

Package configdns provides a simple wrapper around the Akamai FastDNS DNS Management API

Index

Constants

View Source
const (
	ErrZoneNotFound = iota
	ErrFailedToSave
)

Variables

View Source
var (
	// Config contains the Akamai OPEN Edgegrid API credentials
	Config edgegrid.Config
)

Functions

func Init

func Init(config edgegrid.Config)

Init sets the FastDNS edgegrid Config

Types

type NaptrRecord

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

type NaptrRecordSet

type NaptrRecordSet []*NaptrRecord

NaptrRecordSet represents a collection of NaptrRecords

type NsRecord

type NsRecord struct {
	Record
	Active bool    `json:"active,omitempty"`
	Name   *string `json:"name"`
	Target string  `json:"target,omitempty"`
	TTL    int     `json:"ttl,omitempty"`
}

type NsRecordSet

type NsRecordSet []*NsRecord

NsRecordSet represents a collection of NsRecords

type Nsec3Record

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

type Nsec3RecordSet

type Nsec3RecordSet []*Nsec3Record

Nsec3RecordSet represents a collection of Nsec3Records

type Nsec3paramRecord

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

type Nsec3paramRecordSet

type Nsec3paramRecordSet []*Nsec3paramRecord

Nsec3paramRecordSet represents a collection of Nsec3paramRecords

type Record

type Record struct {
	RecordType          string `json:"-"`
	Active              bool   `json:"active,omitempty"`
	Algorithm           int    `json:"algorithm,omitempty"`
	Contact             string `json:"contact,omitempty"`
	Digest              string `json:"digest,omitempty"`
	DigestType          int    `json:"digest_type,omitempty"`
	Expiration          string `json:"expiration,omitempty"`
	Expire              int    `json:"expire,omitempty"`
	Fingerprint         string `json:"fingerprint,omitempty"`
	FingerprintType     int    `json:"fingerprint_type,omitempty"`
	Flags               int    `json:"flags,omitempty"`
	Hardware            string `json:"hardware,omitempty"`
	Inception           string `json:"inception,omitempty"`
	Iterations          int    `json:"iterations,omitempty"`
	Key                 string `json:"key,omitempty"`
	Keytag              int    `json:"keytag,omitempty"`
	Labels              int    `json:"labels,omitempty"`
	Mailbox             string `json:"mailbox,omitempty"`
	Minimum             int    `json:"minimum,omitempty"`
	Name                string `json:"name,omitempty"`
	NextHashedOwnerName string `json:"next_hashed_owner_name,omitempty"`
	Order               int    `json:"order,omitempty"`
	OriginalTTL         int    `json:"original_ttl,omitempty"`
	Originserver        string `json:"originserver,omitempty"`
	Port                int    `json:"port,omitempty"`
	Preference          int    `json:"preference,omitempty"`
	Priority            int    `json:"priority,omitempty"`
	Protocol            int    `json:"protocol,omitempty"`
	Refresh             int    `json:"refresh,omitempty"`
	Regexp              string `json:"regexp,omitempty"`
	Replacement         string `json:"replacement,omitempty"`
	Retry               int    `json:"retry,omitempty"`
	Salt                string `json:"salt,omitempty"`
	Serial              int    `json:"serial,omitempty"`
	Service             string `json:"service,omitempty"`
	Signature           string `json:"signature,omitempty"`
	Signer              string `json:"signer,omitempty"`
	Software            string `json:"software,omitempty"`
	Subtype             int    `json:"subtype,omitempty"`
	Target              string `json:"target,omitempty"`
	TTL                 int    `json:"ttl,omitempty"`
	Txt                 string `json:"txt,omitempty"`
	TypeBitmaps         string `json:"type_bitmaps,omitempty"`
	TypeCovered         string `json:"type_covered,omitempty"`
	Weight              uint   `json:"weight,omitempty"`
}

Record represents a single DNS Record and it's settings

func (*Record) Allows

func (record *Record) Allows(field string) bool

Allows will validates if a the current record type allows a given field

type RecordSet

type RecordSet []*Record

RecordSet represents a collection of Records

type SrvRecord

type SrvRecord struct {
	Record
	Active   bool   `json:"active,omitempty"`
	Name     string `json:"name,omitempty"`
	Port     int    `json:"port,omitempty"`
	Priority int    `json:"priority,omitempty"`
	Target   string `json:"target,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
	Weight   uint   `json:"weight"`
}

type SrvRecordSet

type SrvRecordSet []*SrvRecord

SrvRecordSet represents a collection of SrvRecords

type Zone

type Zone struct {
	Token string `json:"token"`
	Zone  struct {
		Name       string              `json:"name,omitempty"`
		A          RecordSet           `json:"a,omitempty"`
		AAAA       RecordSet           `json:"aaaa,omitempty"`
		Afsdb      RecordSet           `json:"afsdb,omitempty"`
		Cname      RecordSet           `json:"cname,omitempty"`
		Dnskey     RecordSet           `json:"dnskey,omitempty"`
		Ds         RecordSet           `json:"ds,omitempty"`
		Hinfo      RecordSet           `json:"hinfo,omitempty"`
		Loc        RecordSet           `json:"loc,omitempty"`
		Mx         RecordSet           `json:"mx,omitempty"`
		Naptr      NaptrRecordSet      `json:"naptr,omitempty"`
		Ns         NsRecordSet         `json:"ns,omitempty"`
		Nsec3      Nsec3RecordSet      `json:"nsec3,omitempty"`
		Nsec3param Nsec3paramRecordSet `json:"nsec3param,omitempty"`
		Ptr        RecordSet           `json:"ptr,omitempty"`
		Rp         RecordSet           `json:"rp,omitempty"`
		Rrsig      RecordSet           `json:"rrsig,omitempty"`
		Soa        *Record             `json:"soa,omitempty"`
		Spf        RecordSet           `json:"spf,omitempty"`
		Srv        SrvRecordSet        `json:"srv,omitempty"`
		Sshfp      RecordSet           `json:"sshfp,omitempty"`
		Txt        RecordSet           `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) FindRecordsByName

func (zone *Zone) FindRecordsByName(name string, filterRecordTypes []string) []interface{}

func (*Zone) GetRecordType

func (zone *Zone) GetRecordType(name string) interface{}

func (*Zone) PreMarshalJSON

func (zone *Zone) PreMarshalJSON() error

func (*Zone) RemoveRecord

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

func (*Zone) RemoveRecordsByName

func (zone *Zone) RemoveRecordsByName(name string, filterRecordTypes []string) (count int, err error)

func (*Zone) Save

func (zone *Zone) Save() error

Save updates the Zone

func (*Zone) SetRecord

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

Jump to

Keyboard shortcuts

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