zone

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package zone implements API functions residing under /zone. This path contains methods for managing IPs.

Package zone implements API functions residing under /zone. This path contains methods for querying and setting the DNS zones and records.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyRecordNameNotSupported is returned for Create requests when the record has no name set.
	// Instead "@" must be used to target the domain root.
	ErrEmptyRecordNameNotSupported = errors.New("empty record name not supported - use \"@\" instead")
)

Functions

This section is empty.

Types

type API

type API interface {
	List(ctx context.Context) ([]Zone, error)
	Get(ctx context.Context, name string) (Zone, error)
	Create(ctx context.Context, create Definition) (Zone, error)
	Update(ctx context.Context, name string, update Definition) (Zone, error)
	Delete(ctx context.Context, name string) error
	Apply(ctx context.Context, name string, changeset ChangeSet) ([]Record, error)
	Import(ctx context.Context, name string, zoneData Import) (Revision, error)
	ListRecords(ctx context.Context, name string) ([]Record, error)
	NewRecord(ctx context.Context, zone string, record RecordRequest) (Zone, error)
	UpdateRecord(ctx context.Context, zone string, id uuid.UUID, record RecordRequest) (Zone, error)
	DeleteRecord(ctx context.Context, zone string, id uuid.UUID) error
}

API contains methods for zone and record management

func NewAPI

func NewAPI(c client.Client) API

type ChangeSet

type ChangeSet struct {
	Create []ResourceRecord `json:"create"`
	Delete []ResourceRecord `json:"delete"`
}

type Create

type Create struct {
	Name   string `json:"zoneName"`
	Master bool   `json:"master"`
}

type DNSServer

type DNSServer struct {
	// Required - DNS Server name (FQDN).
	Server string `json:"server"`

	// DNS Server alias
	Alias string
}

type Definition

type Definition struct {

	// Zone name
	Name string `json:"name,omitempty"`

	// Required - Zone name parameter
	// Parameter used for create/update/delete etc.
	ZoneName string `json:"zoneName"`

	// Required - Is master flag
	// Flag designating if CloudDNS operates as master or slave.
	IsMaster bool `json:"master"`

	// Required - DNSSEC mode
	// DNSSEC mode (master-only) ["managed" or "unvalidated"].
	DNSSecMode string `json:"dnssec_mode"`

	// Required - Admin email address
	// Admin email address used in SOA record.
	AdminEmail string `json:"admin_email"`

	// Required - Refresh value
	// Refresh value used in SOA record.
	Refresh int `json:"refresh"`

	// Required - Retry value
	//Retry value used in SOA record.
	Retry int `json:"retry"`

	// Required - Expire value
	// Expire value used in SOA record.
	Expire int `json:"expire"`

	// Required - Time to live
	// Default TTL for NS records.
	TTL int `json:"ttl"`

	// Master Name Server
	MasterNS string `json:"master_ns,omitempty"`

	// IP addresses allowed to initiate domain transfer (DNS NOTIFY).
	NotifyAllowedIPs []string `json:"notify_allowed_ips,omitempty"`

	// Configured DNS servers (empty means default servers).
	DNSServers []DNSServer `json:"dns_servers,omitempty"`
}

type Import

type Import struct {
	ZoneData string `json:"zoneData"`
}

type Record

type Record struct {
	Identifier uuid.UUID `json:"identifier"`
	Immutable  bool      `json:"immutable"`
	Name       string    `json:"name"`
	RData      string    `json:"rdata"`
	Region     string    `json:"region"`
	TTL        *int      `json:"ttl"`
	Type       string    `json:"Type"`
}

type RecordRequest

type RecordRequest struct {
	// Name of the DNS record.
	// Use "@" to select the domain root. Creation of records with an empty Name field is not supported.
	Name   string `json:"name"`
	Type   string `json:"type"`
	RData  string `json:"rdata"`
	Region string `json:"region"`
	TTL    int    `json:"ttl,omitempty"`
}

type ResourceRecord

type ResourceRecord struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Region string `json:"region"`
	RData  string `json:"rdata"`
	TTL    int    `json:"ttl"`
}

type Revision

type Revision struct {
	CreatedAt  time.Time `json:"created_at"`
	Identifier uuid.UUID `json:"identifier"`
	ModifiedAt time.Time `json:"modified_at"`
	Records    []Record  `json:"records"`
	Serial     int       `json:"serial"`
	State      string    `json:"state"`
}

type Zone

type Zone struct {
	*Definition
	Customer        string     `json:"customer"`
	CreatedAt       time.Time  `json:"created_at"`
	UpdatedAt       time.Time  `json:"updated_at"`
	PublishedAt     time.Time  `json:"published_at"`
	IsEditable      bool       `json:"is_editable"`
	ValidationLevel int        `json:"validation_level"`
	DeploymentLevel int        `json:"deployment_level"`
	Revisions       []Revision `json:"revisions"`
}

Jump to

Keyboard shortcuts

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