go-powerdns

module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT

README

go-powerdns

go-powerdns is a Go client for accessing the PowerDNS API.

This client initially just has the ability to add and delete A records to/from a specific zone and was done primarily for use with Jenkins.

You can view the PowerDNS Http API docs here: https://doc.powerdns.com/authoritative/http-api/index.html

You can view the client API docs by serving the docs from this repository : http://localhost:6060/pkg/

 godoc -http :6060

Status

Build Status Go Report Card GoDoc GitHub Repo size GitHub Tag GitHub Activity GitHub Contributors

Usage (package)

Download package
 go get github.com/bishy999/go-powerdns
Use package
import (
	
	"github.com/bishy999/go-powerdns/pkg/powerdns"
)
Authentication

You will need an api key with sufficent priviliges to perform actions against the powerdns api.

You can then create a new client to add dns records. An example of a client is stored under the cmd directory in this repository

You will be required to set the folllowimg environmental variables "PDNS_URL", "PDNS_APIKEY", "PDNS_APIPASSWD"


package main

import (
	"log"

	"github.com/bishy999/go-powerdns/pkg/powerdns"
)

var (
	version    string
	buildstamp string
)

func main() {

	log.Printf("Version    : %s\n", version)
	log.Printf("Build Time : %s\n", buildstamp)

	pdns, err := powerdns.NewClientConn()
	if err != nil {
		log.Fatalf("error creating client: [ %v ]", err)
	}

	err = pdns.UpdateARecord()
	if err != nil {
		log.Fatalf("error updating record: [ %v ]", err)
	}

}







Usage (binary)

Download the client binary from the repository and compile it with version

Go get will download from the master, as such when we download it give it the tag verison from the master

go get -ldflags "-X main.version=v1.0.1 -X main.buildstamp=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'`)" github.com/bishy999/go-powerdns/cmd/powerdns-client


Set the required environmental variables "PDNS_URL", "PDNS_APIKEY", "PDNS_APIPASSWD"

powerdns-client add -domain=example.org -record=jbtest -ttl=3600 -ip=10.0.0.1

powerdns-client delete -domain=example.org -record=jbtest

Contributing

We love pull requests! Please see the contribution guidelines.

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

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