powerdns

package module
v0.0.0-...-6def211 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2018 License: MIT Imports: 8 Imported by: 0

README

powerdns-go

Small library which implements a little bit functionality of PowerDNS API

Documentation

Index

Constants

View Source
const (
	// ZoneKindNative - Native kind of zone
	ZoneKindNative string = "Native"

	// ZoneKindMaster - Master kind of zone
	ZoneKindMaster string = "Master"

	// ZoneKindSlave - Slave kind of zone
	ZoneKindSlave string = "Slave"

	// ChangetypeReplace - type of operation - REPLACE
	ChangetypeReplace changetype = "REPLACE"

	// ChangetypeDelete - type of operation - DELETE
	ChangetypeDelete changetype = "DELETE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Error  string   `json:"error"`
	Errors []string `json:"errors"`
}

APIError - represents a error which returned from PowerDNS API https://doc.powerdns.com/md/httpapi/api_spec/#errors

type BasicZoneInfo

type BasicZoneInfo struct {
	Account        string   `json:"account,omitempty"`
	DNSSec         bool     `json:"dnssec,omitempty"`
	ID             string   `json:"id,omitempty"`
	Kind           string   `json:"kind,omitempty"`
	LastCheck      int64    `json:"last_check,omitempty"`
	Masters        []string `json:"masters,omitempty"`
	Name           string   `json:"string,omitempty"`
	NotifiedSerial int64    `json:"notified_serial,omitempty"`
	Serial         int64    `json:"serial,omitempty"`
	URL            string   `json:"url,omitempty"`
}

BasicZoneInfo - reduced representation of zone without RRSet

type Client

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

Client - represents a PowerDNS metadata which needs to interact with PowerDNS server

func NewClient

func NewClient(
	dnsDSN string,
	apiKey string,
	apiVer string,
) *Client

NewClient - create new object of Client

func (*Client) GetServer

func (client *Client) GetServer(
	name string,
) (*Server, error)

GetServer - return server by name

func (*Client) GetServers

func (client *Client) GetServers() ([]*Server, error)

GetServers - return all servers which confugured in PowerDNS

func (*Client) GetZone

func (client *Client) GetZone(
	server string,
	zone string,
) (*Zone, error)

GetZone - return zone by zone name.

func (*Client) GetZones

func (client *Client) GetZones(
	server string,
) ([]*Zone, error)

GetZones - return reduced representation of exists zones in PowerDNS server, without RRSet's.

func (*Client) UpdateZone

func (client *Client) UpdateZone(
	server string,
	zone string,
	rrSetsPayload []RRSet,
) error

UpdateZone - update zone with passed RRSet

type Comment

type Comment struct {
	Content    string `json:"content"`
	Account    string `json:"account"`
	ModifiedAt int64  `json:"modified_at"`
}

Comment - represents commet block in RRSet definition https://doc.powerdns.com/md/httpapi/api_spec/#zones

type Config

type Config struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

Config - represents config resource https://doc.powerdns.com/md/httpapi/api_spec/#config95setting95resource

type RRSet

type RRSet struct {
	Name       string     `json:"name"`
	Type       RecordType `json:"type"`
	TTL        int64      `json:"ttl"`
	Records    []Record   `json:"records"`
	Comments   []Comment  `json:"comments"`
	Changetype changetype `json:"changetype,omitempty"`
}

RRSet - represents RRSet which make up zone https://doc.powerdns.com/md/httpapi/api_spec/#zones

type Record

type Record struct {
	Content  string `json:"content"`
	Disabled bool   `json:"disabled"`
}

Record - represents record in RRSet definition https://doc.powerdns.com/md/httpapi/api_spec/#zones

type RecordType

type RecordType string

RecordType - special type for represents type of record

const (
	// TypeMX - MX record type
	TypeMX RecordType = "MX"

	// TypeA - A record type
	TypeA RecordType = "A"

	// TypeAAAA - AAAA record type
	TypeAAAA RecordType = "AAAA"

	// TypeNS - NS record type
	TypeNS RecordType = "NS"

	// TypeSOA - SOA record type
	TypeSOA RecordType = "SOA"

	// TypeCNAME - CNAME record type
	TypeCNAME RecordType = "CNAME"

	// TypeTXT - TXT record type
	TypeTXT RecordType = "TXT"

	// TypePTR - PTR record type
	TypePTR RecordType = "PTR"

	// TypeSRV - SRV record type
	TypeSRV RecordType = "SRV"
)

type Server

type Server struct {
	ConfigURL  string `json:"config_url"`
	DaemonType string `json:"daemon_type"`
	ID         string `json:"id"`
	Type       string `json:"type"`
	URL        string `json:"url"`
	Version    string `json:"version"`
	ZonesURL   string `json:"zones_url"`
}

Server - represent `Servers` resource https://doc.powerdns.com/md/httpapi/api_spec/#servers

type Zone

type Zone struct {
	BasicZoneInfo
	Nameservers []string `json:"nameservers,omitempty"`
	Servers     []string `json:"servers,omitempty"`
	RRSets      []RRSet  `json:"rrsets,omitempty"`
	SOAEdit     string   `json:"soa_edit,omitempty"`
	SOAEditAPI  string   `json:"soa_edit_api,omitempty"`
}

Zone - represents zone https://doc.powerdns.com/md/httpapi/api_spec/#zones

func (*Zone) GetSOARecord

func (zone *Zone) GetSOARecord() (RRSet, error)

GetSOARecord - returns SOA record of the zone

func (*Zone) QueryRecords

func (zone *Zone) QueryRecords(
	query string,
	contains bool,
) []RRSet

QueryRecords - find and return records filtered by name or content

func (*Zone) QueryRecordsByName

func (zone *Zone) QueryRecordsByName(
	name string,
	contains bool,
) []RRSet

QueryRecordsByName - returns records filtered only by name

Jump to

Keyboard shortcuts

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