porkbun

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 13 Imported by: 7

README

Porkbun for libdns

Go Reference

This package implements the libdns interfaces for Porkbun, allowing you to manage DNS records.

Usage

Porkbun API documentation details the process of getting an API key & enable API access for the domain.

An example of usage can be seen in _test/test.go. To run clone the .env_template to a file named .env and populate with the API key and secret API key.

Documentation

Overview

Package porkbun implements a DNS record management client compatible with the libdns interfaces for Porkbun.

Index

Constants

View Source
const ApiBase = "https://porkbun.com/api/json/v3"

Variables

This section is empty.

Functions

func LibdnsZoneToPorkbunDomain added in v0.1.2

func LibdnsZoneToPorkbunDomain(zone string) string

LibdnsZoneToPorkbunDomain Strips the trailing dot from a Zone

func MakeApiRequest added in v0.1.2

func MakeApiRequest[T any](endpoint string, body io.Reader, responseType T) (T, error)

Types

type ApiCredentials

type ApiCredentials struct {
	Apikey       string `json:"apikey"`
	Secretapikey string `json:"secretapikey"`
}

type Provider

type Provider struct {
	APIKey       string `json:"api_key,omitempty"`
	APISecretKey string `json:"api_secret_key,omitempty"`
}

Provider facilitates DNS record manipulation with Porkbun.

func (*Provider) AppendRecords

func (p *Provider) AppendRecords(_ context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

AppendRecords adds records to the zone. It returns the records that were added.

func (*Provider) CheckCredentials

func (p *Provider) CheckCredentials(_ context.Context) (string, error)

CheckCredentials allows verifying credentials work in test scripts

func (*Provider) DeleteRecords

func (p *Provider) DeleteRecords(_ context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

DeleteRecords deletes the records from the zone. It returns the records that were deleted.

func (*Provider) GetRecords

func (p *Provider) GetRecords(_ context.Context, zone string) ([]libdns.Record, error)

GetRecords lists all the records in the zone.

func (*Provider) SetRecords

func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

SetRecords sets the records in the zone, either by updating existing records or creating new ones. It returns the updated records.

Jump to

Keyboard shortcuts

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