dnsclient

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const API_TOKEN_FIELD = "apiToken"

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSClient

type DNSClient interface {
	GetManagedZones(ctx context.Context) (map[string]string, error)
	CreateOrUpdateRecordSet(
		ctx context.Context, managedZone,
		name,
		recordType string,
		rrdatas []string,
		opts DNSRecordOptions) error
	DeleteRecordSet(ctx context.Context, managedZone, name, recordType string) error
}

func NewDNSClient

func NewDNSClient(ctx context.Context, apiToken string) (DNSClient, error)

NewDNSClient creates a new dns client with a cloudflare api token.

func NewDNSClientFromSecretRef

func NewDNSClientFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference) (DNSClient, error)

NewDNSClientFromSecretRef creates a bew dns client from a secret containing an apiToken.

type DNSRecordOptions added in v0.0.4

type DNSRecordOptions struct {
	TTL     int64
	Proxied bool
}

type FakeDNSClient added in v0.0.4

type FakeDNSClient struct {
	Zones   map[string]string
	Records map[string]Record
}

func NewFakeDNSClient added in v0.0.4

func NewFakeDNSClient(
	zones map[string]string,
	records map[string]Record,
) *FakeDNSClient

NewDNSClient creates a new dns client with a cloudflare api token.

func (*FakeDNSClient) CreateOrUpdateRecordSet added in v0.0.4

func (c *FakeDNSClient) CreateOrUpdateRecordSet(
	ctx context.Context,
	zoneID,
	name,
	recordType string,
	rrdatas []string,
	opts DNSRecordOptions,
) error

CreateOrUpdateRecordSet creates or updates the resource recordset with the given name, record type, rrdatas, and ttl in the managed zone with the given name or ID.

func (*FakeDNSClient) DeleteRecordSet added in v0.0.4

func (c *FakeDNSClient) DeleteRecordSet(ctx context.Context, zoneID, name, recordType string) error

DeleteRecordSet deletes the resource recordset with the given name and record type in the managed zone with the given name or ID.

func (*FakeDNSClient) GetManagedZones added in v0.0.4

func (c *FakeDNSClient) GetManagedZones(ctx context.Context) (map[string]string, error)

GetManagedZones returns a map of all managed zone DNS names mapped to their IDs, composed of the project ID and their user assigned resource names.

type Record added in v0.0.4

type Record struct {
	ZoneID     string
	Name       string
	RecordType string
	Rrdata     string
	Opts       DNSRecordOptions
}

Jump to

Keyboard shortcuts

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