dnsv2

package
v0.9.16 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 12 Imported by: 30

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 DeleteZoneKey added in v0.9.11

func DeleteZoneKey(zone string) error

Delete tsig key for zone

func FullIPv6

func FullIPv6(ip net.IP) string

func GetMasterZoneFile

func GetMasterZoneFile(zone string) (string, error)

GetZone retrieves a DNS Zone for a given hostname

func GetNameServerRecordList

func GetNameServerRecordList(contractId string) ([]string, error)

func GetRdata

func GetRdata(zone string, name string, record_type string) ([]string, error)

func Init

func Init(config edgegrid.Config)

Init sets the DNSv2 edgegrid Config

func IsConfigDNSError

func IsConfigDNSError(e error) bool

func PadCoordinates added in v0.9.11

func PadCoordinates(str string) string

Used to pad coordinates to x.xxm format

func ParseRData added in v0.9.11

func ParseRData(rtype string, rdata []string) map[string]interface{}

Utility method to parse RData in context of type. Return map of fields and values

func ProcessRdata added in v0.9.11

func ProcessRdata(rdata []string, rtype string) []string

Types

type AuthorityResponse

type AuthorityResponse struct {
	Contracts []struct {
		ContractID  string   `json:"contractId"`
		Authorities []string `json:"authorities"`
	} `json:"contracts"`
}

func GetAuthorities

func GetAuthorities(contractId string) (*AuthorityResponse, error)

func NewAuthorityResponse

func NewAuthorityResponse(contract string) *AuthorityResponse

type ChangeListResponse

type ChangeListResponse struct {
	Zone             string `json:"zone,omitempty"`
	ChangeTag        string `json:"changeTag,omitempty"`
	ZoneVersionId    string `json:"zoneVersionId,omitempty"`
	LastModifiedDate string `json:"lastModifiedDate,omitempty"`
	Stale            bool   `json:"stale,omitempty"`
}

func GetChangeList

func GetChangeList(zone string) (*ChangeListResponse, error)

GetZone retrieves a DNS Zone for a given hostname

func NewChangeListResponse

func NewChangeListResponse(zone string) *ChangeListResponse

type ConfigDNSError

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

type MetadataH

type MetadataH struct {
	LastPage      int  `json:"lastPage"`
	Page          int  `json:"page"`
	PageSize      int  `json:"pageSize"`
	ShowAll       bool `json:"showAll"`
	TotalElements int  `json:"totalElements"`

} //`json:"metadata"`

type RecordBody

type RecordBody struct {
	Name       string `json:"name,omitempty"`
	RecordType string `json:"type,omitempty"`
	TTL        int    `json:"ttl,omitempty"`
	// Active field no longer used in v2
	Active bool     `json:"active,omitempty"`
	Target []string `json:"rdata,omitempty"`
	// Remaining Fields are not used in the v2 API
	Subtype             int    `json:"subtype,omitempty"`                //AfsdbRecord
	Flags               int    `json:"flags,omitempty"`                  //DnskeyRecord Nsec3paramRecord
	Protocol            int    `json:"protocol,omitempty"`               //DnskeyRecord
	Algorithm           int    `json:"algorithm,omitempty"`              //DnskeyRecord DsRecord Nsec3paramRecord RrsigRecord SshfpRecord
	Key                 string `json:"key,omitempty"`                    //DnskeyRecord
	Keytag              int    `json:"keytag,omitempty"`                 //DsRecord RrsigRecord
	DigestType          int    `json:"digest_type,omitempty"`            //DsRecord
	Digest              string `json:"digest,omitempty"`                 //DsRecord
	Hardware            string `json:"hardware,omitempty"`               //HinfoRecord
	Software            string `json:"software,omitempty"`               //HinfoRecord
	Priority            int    `json:"priority,omitempty"`               //MxRecord SrvRecord
	Order               uint16 `json:"order,omitempty"`                  //NaptrRecord
	Preference          uint16 `json:"preference,omitempty"`             //NaptrRecord
	FlagsNaptr          string `json:"flags,omitempty"`                  //NaptrRecord
	Service             string `json:"service,omitempty"`                //NaptrRecord
	Regexp              string `json:"regexp,omitempty"`                 //NaptrRecord
	Replacement         string `json:"replacement,omitempty"`            //NaptrRecord
	Iterations          int    `json:"iterations,omitempty"`             //Nsec3Record Nsec3paramRecord
	Salt                string `json:"salt,omitempty"`                   //Nsec3Record Nsec3paramRecord
	NextHashedOwnerName string `json:"next_hashed_owner_name,omitempty"` //Nsec3Record
	TypeBitmaps         string `json:"type_bitmaps,omitempty"`           //Nsec3Record
	Mailbox             string `json:"mailbox,omitempty"`                //RpRecord
	Txt                 string `json:"txt,omitempty"`                    //RpRecord
	TypeCovered         string `json:"type_covered,omitempty"`           //RrsigRecord
	OriginalTTL         int    `json:"original_ttl,omitempty"`           //RrsigRecord
	Expiration          string `json:"expiration,omitempty"`             //RrsigRecord
	Inception           string `json:"inception,omitempty"`              //RrsigRecord
	Signer              string `json:"signer,omitempty"`                 //RrsigRecord
	Signature           string `json:"signature,omitempty"`              //RrsigRecord
	Labels              int    `json:"labels,omitempty"`                 //RrsigRecord
	Weight              uint16 `json:"weight,omitempty"`                 //SrvRecord
	Port                uint16 `json:"port,omitempty"`                   //SrvRecord
	FingerprintType     int    `json:"fingerprint_type,omitempty"`       //SshfpRecord
	Fingerprint         string `json:"fingerprint,omitempty"`            //SshfpRecord
	PriorityIncrement   int    `json:"priority_increment,omitempty"`     //MX priority Increment
}

func GetRecord added in v0.9.11

func GetRecord(zone string, name string, record_type string) (*RecordBody, error)

Get single Recordset. Following convention for other single record CRUD operations, return a RecordBody.

func NewRecordBody

func NewRecordBody(params RecordBody) *RecordBody

func (*RecordBody) Delete

func (record *RecordBody) Delete(zone string, recLock ...bool) error

func (*RecordBody) Save

func (record *RecordBody) Save(zone string, recLock ...bool) error

func (*RecordBody) ToMap

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

func (*RecordBody) Update

func (record *RecordBody) Update(zone string, recLock ...bool) error

type RecordError

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

func (*RecordError) BadRequest added in v0.9.13

func (e *RecordError) BadRequest() bool

func (*RecordError) ConcurrencyConflict added in v0.9.13

func (e *RecordError) ConcurrencyConflict() bool

func (*RecordError) Error

func (e *RecordError) Error() string

func (*RecordError) FailedToSave

func (e *RecordError) FailedToSave() bool

func (*RecordError) Network

func (e *RecordError) Network() bool

func (*RecordError) NotFound

func (e *RecordError) NotFound() bool

func (*RecordError) ValidationFailed

func (e *RecordError) ValidationFailed() bool

type RecordSetResponse

type RecordSetResponse struct {
	Metadata   MetadataH   `json:"metadata"`
	Recordsets []Recordset `json:"recordsets"`
}

func GetRecordList

func GetRecordList(zone string, name string, record_type string) (*RecordSetResponse, error)

func GetRecordsets added in v0.9.11

func GetRecordsets(zone string, queryArgs ...RecordsetQueryArgs) (*RecordSetResponse, error)

Get RecordSets with Query Args. No formatting of arg values!

func NewRecordSetResponse

func NewRecordSetResponse(name string) *RecordSetResponse

type Recordset

type Recordset struct {
	Name  string   `json:"name"`
	Type  string   `json:"type"`
	TTL   int      `json:"ttl"`
	Rdata []string `json:"rdata"`

} //`json:"recordsets"`

type RecordsetQueryArgs added in v0.9.11

type RecordsetQueryArgs struct {
	Page     int
	PageSize int
	Search   string
	ShowAll  bool
	SortBy   string
	Types    string
}

Recordset Query args struct

type TSIGKey added in v0.9.11

type TSIGKey struct {
	Name      string `json:"name"`
	Algorithm string `json:"algorithm,omitempty"`
	Secret    string `json:"secret,omitempty"`
}

func NewTSIGKey added in v0.9.11

func NewTSIGKey(name string) *TSIGKey

Return bare bones tsig key struct

func (*TSIGKey) GetZones added in v0.9.11

func (tsigKey *TSIGKey) GetZones() (*ZoneNameListResponse, error)

GetZones retrieves DNS Zones using tsig key

func (*TSIGKey) Update added in v0.9.11

func (tsigKey *TSIGKey) Update(zone string) error

Update tsig key for zone

type TSIGKeyBulkPost added in v0.9.11

type TSIGKeyBulkPost struct {
	Key   *TSIGKey `json:"key"`
	Zones []string `json:"zones"`
}

func (*TSIGKeyBulkPost) BulkUpdate added in v0.9.11

func (tsigBulk *TSIGKeyBulkPost) BulkUpdate() error

Bulk Zones tsig key update

type TSIGKeyResponse added in v0.9.11

type TSIGKeyResponse struct {
	TSIGKey
	ZoneCount int64 `json:"zoneCount,omitempty"`
}

func GetZoneKey added in v0.9.11

func GetZoneKey(zone string) (*TSIGKeyResponse, error)

GetZoneKey retrieves a DNS Zone's key

type TSIGQueryString added in v0.9.11

type TSIGQueryString struct {
	ContractIds []string `json:"contractIds,omitempty"`
	Search      string   `json:"search,omitempty"`
	SortBy      []string `json:"sortBy,omitempty"`
	Gid         int64    `json:"gid,omitempty"`
}

func NewTSIGQueryString added in v0.9.11

func NewTSIGQueryString() *TSIGQueryString

Return empty query string struct. No elements required.

type TSIGReportMeta added in v0.9.11

type TSIGReportMeta struct {
	TotalElements int64    `json:"totalElements"`
	Search        string   `json:"search,omitempty"`
	Contracts     []string `json:"contracts,omitempty"`
	Gid           int64    `json:"gid,omitempty"`
	SortBy        []string `json:"sortBy,omitempty"`
}

type TSIGReportResponse added in v0.9.11

type TSIGReportResponse struct {
	Metadata *TSIGReportMeta    `json:"metadata"`
	Keys     []*TSIGKeyResponse `json:"keys,omitempty"`
}

func ListTsigKeys added in v0.9.11

func ListTsigKeys(tsigquerystring *TSIGQueryString) (*TSIGReportResponse, error)

List TSIG Keys

type TSIGZoneAliases added in v0.9.11

type TSIGZoneAliases struct {
	Aliases []string `json:"aliases"`
}

type TsigError added in v0.9.11

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

func (*TsigError) Error added in v0.9.11

func (e *TsigError) Error() string

func (*TsigError) FailedToSave added in v0.9.11

func (e *TsigError) FailedToSave() bool

func (*TsigError) Network added in v0.9.11

func (e *TsigError) Network() bool

func (*TsigError) NotFound added in v0.9.11

func (e *TsigError) NotFound() bool

func (*TsigError) ValidationFailed added in v0.9.11

func (e *TsigError) ValidationFailed() bool

type ZoneCreate

type ZoneCreate struct {
	Zone                  string   `json:"zone"`
	Type                  string   `json:"type"`
	Masters               []string `json:"masters,omitempty"`
	Comment               string   `json:"comment,omitempty"`
	SignAndServe          bool     `json:"signAndServe"`
	SignAndServeAlgorithm string   `json:"signAndServeAlgorithm,omitempty"`
	TsigKey               *TSIGKey `json:"tsigKey,omitempty"`
	Target                string   `json:"target,omitempty"`
	EndCustomerId         string   `json:"endCustomerId,omitempty"`
	ContractId            string   `json:"contractid,omitempty"`
}

func NewZone

func NewZone(params ZoneCreate) *ZoneCreate

NewZone creates a new Zone. Supports subset of fields

func (*ZoneCreate) Delete

func (zone *ZoneCreate) Delete(zonequerystring ZoneQueryString) error

func (*ZoneCreate) Save

func (zone *ZoneCreate) Save(zonequerystring ZoneQueryString) error

Create a Zone

func (*ZoneCreate) SaveChangelist

func (zone *ZoneCreate) SaveChangelist() error

Create changelist for the Zone. Side effect is to create default NS SOA records

func (*ZoneCreate) SubmitChangelist

func (zone *ZoneCreate) SubmitChangelist() error

Save changelist for the Zone to create default NS SOA records

func (*ZoneCreate) Update

func (zone *ZoneCreate) Update(zonequerystring ZoneQueryString) error

Save updates the Zone

type ZoneError

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

func (*ZoneError) ConcurrencyConflict added in v0.9.14

func (e *ZoneError) ConcurrencyConflict() bool

func (*ZoneError) Error

func (e *ZoneError) Error() string

func (*ZoneError) FailedToSave

func (e *ZoneError) FailedToSave() bool

func (*ZoneError) Network

func (e *ZoneError) Network() bool

func (*ZoneError) NotFound

func (e *ZoneError) NotFound() bool

func (*ZoneError) ValidationFailed

func (e *ZoneError) ValidationFailed() bool

type ZoneNameListResponse added in v0.9.11

type ZoneNameListResponse struct {
	Zones []string `json:"zones"`
}

Zones List Response

func GetZoneKeyAliases added in v0.9.11

func GetZoneKeyAliases(zone string) (*ZoneNameListResponse, error)

GetZoneKeyAliases retrieves a DNS Zone's aliases func GetZoneKeyAliases(zone string) (*TSIGZoneAliases, error) {

There is a discrepency between the technical doc and API operation. API currently returns a zone name list. TODO: Reconcile

type ZoneNameTypesResponse added in v0.9.11

type ZoneNameTypesResponse struct {
	Types []string `json:"types"`
}
{
    "types": [
        "A",
        "MX"
    ]
}

Recordset Types for Zone|Name Response

func GetZoneNameTypes added in v0.9.11

func GetZoneNameTypes(zname string, zone string) (*ZoneNameTypesResponse, error)

Get Zone Name's record types

type ZoneNamesResponse added in v0.9.11

type ZoneNamesResponse struct {
	Names []string `json:"names"`
}
{
    "names": [
        "example.com",
        "bar.example.com"
    ]
}

returned list of Zone Names

func GetZoneNames added in v0.9.11

func GetZoneNames(zone string) (*ZoneNamesResponse, error)

Get Zone's Names

type ZoneQueryString

type ZoneQueryString struct {
	Contract string `json:"contractid,omitempty"`
	Group    string `json:"lastactivationdate,omitempty"`
}

func NewZoneQueryString

func NewZoneQueryString(Contract string, group string) *ZoneQueryString

type ZoneResponse

type ZoneResponse struct {
	Zone                  string   `json:"zone,omitempty"`
	Type                  string   `json:"type,omitempty"`
	Masters               []string `json:"masters,omitempty"`
	Comment               string   `json:"comment,omitempty"`
	SignAndServe          bool     `json:"signAndServe"`
	SignAndServeAlgorithm string   `json:"signAndServeAlgorithm,omitempty"`
	TsigKey               *TSIGKey `json:"tsigKey,omitempty"`
	Target                string   `json:"target,omitempty"`
	EndCustomerId         string   `json:"endCustomerId,omitempty"`
	ContractId            string   `json:"contractid,omitempty"`
	AliasCount            int64    `json:"aliasCount,omitempty"`
	ActivationState       string   `json:"activationstate,omitempty"`
	LastActivationDate    string   `json:"lastactivationdate,omitempty"`
	LastModifiedBy        string   `json:"lastmodifiedby,omitempty"`
	LastModifiedDate      string   `json:"lastmodifieddate,omitempty"`
	VersionId             string   `json:"versionid,omitempty"`
}

func GetZone

func GetZone(zonename string) (*ZoneResponse, error)

GetZone retrieves a DNS Zone for a given hostname

func NewZoneResponse

func NewZoneResponse(zonename string) *ZoneResponse

Jump to

Keyboard shortcuts

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