api

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package api defines the common API interface for DNS managers

Index

Constants

View Source
const (
	RecordTypeA     = "A"
	RecordTypeAAAA  = "AAAA"
	RecordTypeCNAME = "CNAME"
	RecordTypeTXT   = "TXT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	InfoContext(ctx context.Context, msg string, keysAndValues ...interface{})
}

Logger interface allows a logger to be used by the providers. This uses a context to support opentracing span-based logging.

type Provider

type Provider interface {
	// GetDNSRecords returns a list of DNS records. If name is
	// provided, that is used as a filter.
	GetDNSRecords(ctx context.Context, zone, name string) ([]Record, error)
	// CreateOrUpdateDNSRecord changes the existing record if found,
	// or adds a new one
	CreateOrUpdateDNSRecord(ctx context.Context, zone, name, rtype, content string, ttl int, proxy bool) error
	// DeleteDNSRecord deletes all DNS records for the name.
	DeleteDNSRecord(ctx context.Context, zone, name string) error
}

Provider common interface for managing DNS entries.

type ProviderType

type ProviderType string

ProviderType enumerates the types of providers supported

const (
	CloudflareProvider       ProviderType = "cloudflare"
	GoogleCloudDNSProvider   ProviderType = "googleclouddns"
	OpenTelekomCloudProvider ProviderType = "otc"
)

type Record

type Record struct {
	Type    string   `json:"type,omitempty"`
	Name    string   `json:"name,omitempty"`
	Content []string `json:"content,omitempty"`
	TTL     int      `json:"ttl,omitempty"`
}

Record represents a DNS record in a zone.

Jump to

Keyboard shortcuts

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