pdns

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// PdnsDelete : PowerDNS changetype used for deleting rrsets
	// ref: https://doc.powerdns.com/authoritative/http-api/zone.html#rrset (see "changetype")
	PdnsDelete pdnsChangeType = "DELETE"
	// PdnsReplace : PowerDNS changetype for creating, updating and patching rrsets
	PdnsReplace pdnsChangeType = "REPLACE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PDNSAPIClient

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

PDNSAPIClient : Struct that encapsulates all the PowerDNS specific implementation details

func (*PDNSAPIClient) ListZone

func (c *PDNSAPIClient) ListZone(zoneID string) (zone pgo.Zone, resp *http.Response, err error)

ListZone : Method returns the details of a specific zone from PowerDNS ref: https://doc.powerdns.com/authoritative/http-api/zone.html#get--servers-server_id-zones-zone_id

func (*PDNSAPIClient) ListZones

func (c *PDNSAPIClient) ListZones() (zones []pgo.Zone, resp *http.Response, err error)

ListZones : Method returns all enabled zones from PowerDNS ref: https://doc.powerdns.com/authoritative/http-api/zone.html#get--servers-server_id-zones

func (*PDNSAPIClient) PartitionZones

func (c *PDNSAPIClient) PartitionZones(zones []pgo.Zone) (filteredZones []pgo.Zone, residualZones []pgo.Zone)

PartitionZones : Method returns a slice of zones that adhere to the domain filter and a slice of ones that does not adhere to the filter

func (*PDNSAPIClient) PatchZone

func (c *PDNSAPIClient) PatchZone(zoneID string, zoneStruct pgo.Zone) (resp *http.Response, err error)

PatchZone : Method used to update the contents of a particular zone from PowerDNS ref: https://doc.powerdns.com/authoritative/http-api/zone.html#patch--servers-server_id-zones-zone_id

type PDNSAPIProvider

type PDNSAPIProvider interface {
	ListZones() ([]pgo.Zone, *http.Response, error)
	PartitionZones(zones []pgo.Zone) ([]pgo.Zone, []pgo.Zone)
	ListZone(zoneID string) (pgo.Zone, *http.Response, error)
	PatchZone(zoneID string, zoneStruct pgo.Zone) (*http.Response, error)
}

PDNSAPIProvider : Interface used and extended by the PDNSAPIClient struct as well as mock APIClients used in testing

type PDNSConfig

type PDNSConfig struct {
	DomainFilter endpoint.DomainFilter
	DryRun       bool
	Server       string
	APIKey       string
	TLSConfig    TLSConfig
}

PDNSConfig is comprised of the fields necessary to create a new PDNSProvider

type PDNSProvider

type PDNSProvider struct {
	provider.BaseProvider
	// contains filtered or unexported fields
}

PDNSProvider is an implementation of the Provider interface for PowerDNS

func NewPDNSProvider

func NewPDNSProvider(ctx context.Context, config PDNSConfig) (*PDNSProvider, error)

NewPDNSProvider initializes a new PowerDNS based Provider.

func (*PDNSProvider) ApplyChanges

func (p *PDNSProvider) ApplyChanges(ctx context.Context, changes *plan.Changes) error

ApplyChanges takes a list of changes (endpoints) and updates the PDNS server by sending the correct HTTP PATCH requests to a matching zone

func (*PDNSProvider) ConvertEndpointsToZones

func (p *PDNSProvider) ConvertEndpointsToZones(eps []*endpoint.Endpoint, changetype pdnsChangeType) (zonelist []pgo.Zone, _ error)

ConvertEndpointsToZones marshals endpoints into pdns compatible Zone structs

func (*PDNSProvider) Records

func (p *PDNSProvider) Records(ctx context.Context) (endpoints []*endpoint.Endpoint, _ error)

Records returns all DNS records controlled by the configured PDNS server (for all zones)

type TLSConfig

type TLSConfig struct {
	SkipTLSVerify         bool
	CAFilePath            string
	ClientCertFilePath    string
	ClientCertKeyFilePath string
}

TLSConfig is comprised of the TLS-related fields necessary to create a new PDNSProvider

Jump to

Keyboard shortcuts

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