metaname

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 3 Imported by: 3

README

Go Metaname

A Go library implementing the Metaname API.

Usage

Create a client with NewMetanameClient, passing it your account reference and API key, then use it to call the needed functions.

client := NewMetanameClient(os.Getenv("ACCOUNT_REF"), os.Getenv("API_KEY"))
client.DeleteDnsRecord(ctx, "example.org", "1234")
Implemented functions

These functions have been implemented:

Known issues

  • ResourceRecords for accounts where the API key was first created before 2023-07-11 will receive Aux values of 0 on MX and SRV records when calling DnsZone. If this affects you, you can email Metaname support and ask them to "flag my account for the numeric aux fix".

Documentation

Overview

Package metaname provides a client for the Metaname API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetanameClient

type MetanameClient struct {
	RpcClient        iJsonRpc2Client
	Host             string
	AccountReference string
	APIKey           string
}

A client for the Metaname API.

func NewMetanameClient

func NewMetanameClient(accountReference string, apiKey string) *MetanameClient

Create a new MetanameClient with some default values.

func (*MetanameClient) ConfigureZone

func (c *MetanameClient) ConfigureZone(ctx context.Context, zoneName string, records []ResourceRecord, options interface{}) error

Create or update a zone.

https://metaname.net/api/1.1/doc#configure_zone

func (*MetanameClient) CreateDnsRecord

func (c *MetanameClient) CreateDnsRecord(ctx context.Context, domainName string, record ResourceRecord) (string, error)

Creates a DNS record in the zone for the given domain and returns a reference that can be used for updating and deleting it.

https://metaname.net/api/1.1/doc#create_dns_record

func (*MetanameClient) DeleteDnsRecord

func (c *MetanameClient) DeleteDnsRecord(ctx context.Context, domainName string, reference string) error

Delete a DNS record from a zone.

https://metaname.net/api/1.1/doc#delete_dns_record

func (*MetanameClient) DnsZone

func (c *MetanameClient) DnsZone(ctx context.Context, domainName string) ([]ResourceRecord, error)

Retrieve all the DNS records in a zone.

https://metaname.net/api/1.1/doc#dns_zone

func (*MetanameClient) UpdateDnsRecord

func (c *MetanameClient) UpdateDnsRecord(ctx context.Context, domainName string, reference string, record ResourceRecord) error

Updates the details of a DNS record in a zone.

https://metaname.net/api/1.1/doc#update_dns_record

type ResourceRecord

type ResourceRecord struct {
	Name      string  `json:"name"`
	Type      string  `json:"type"`
	Aux       *int    `json:"aux"`
	Ttl       int     `json:"ttl"`
	Data      string  `json:"data"`
	Reference *string `json:"reference,omitempty"`
}

A ResourceRecord is a representation of a DNS record.

Aux should be nil for records other than MX and SRV records, where it represents the priority. Reference should be nil when supplying a ResourceRecord, but will be populated when retrieving a record.

https://metaname.net/api/1.1/doc#Resource_record_details

Jump to

Keyboard shortcuts

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