internal

package
v4.12.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client implements a very simple wrapper around the Domeneshop API. For now it will only deal with adding and removing TXT records, as required by ACME providers. https://api.domeneshop.no/docs/

func NewClient

func NewClient(apiToken, apiSecret string) *Client

NewClient returns an instance of the Domeneshop API wrapper.

func (*Client) CreateTXTRecord

func (c *Client) CreateTXTRecord(ctx context.Context, domain *Domain, host string, data string) error

CreateTXTRecord creates a TXT record with the provided host (subdomain) and data. https://api.domeneshop.no/docs/#tag/dns/paths/~1domains~1{domainId}~1dns/post

func (*Client) DeleteTXTRecord

func (c *Client) DeleteTXTRecord(ctx context.Context, domain *Domain, host string, data string) error

DeleteTXTRecord deletes the DNS record matching the provided host and data. https://api.domeneshop.no/docs/#tag/dns/paths/~1domains~1{domainId}~1dns~1{recordId}/delete

func (*Client) GetDomainByName

func (c *Client) GetDomainByName(ctx context.Context, domain string) (*Domain, error)

GetDomainByName fetches the domain list and returns the Domain object for the matching domain. https://api.domeneshop.no/docs/#operation/getDomains

type DNSRecord

type DNSRecord struct {
	Data string `json:"data"`
	Host string `json:"host"`
	ID   int    `json:"id"`
	TTL  int    `json:"ttl"`
	Type string `json:"type"`
}

DNSRecord JSON data structure.

type Domain

type Domain struct {
	Name           string   `json:"domain"`
	ID             int      `json:"id"`
	ExpiryDate     string   `json:"expiry_date"`
	Nameservers    []string `json:"nameservers"`
	RegisteredDate string   `json:"registered_date"`
	Registrant     string   `json:"registrant"`
	Renew          bool     `json:"renew"`
	Services       Service  `json:"services"`
	Status         string
}

Domain JSON data structure.

type Service

type Service struct {
	DNS       bool   `json:"dns"`
	Email     bool   `json:"email"`
	Registrar bool   `json:"registrar"`
	Webhotel  string `json:"webhotel"`
}

Jump to

Keyboard shortcuts

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