powerdns

package
v0.0.0-...-d12f142 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCacheSize int

DefaultCacheSize is client default cache size

View Source
var DefaultSchema = "https"

DefaultSchema is the value used for the URL in case no schema is explicitly defined

Functions

This section is empty.

Types

type Config

type Config struct {
	Version  string `pulumi:"version"`
	Url      string `pulumi:"url"`
	Key      string `pulumi:"key" provider:"secret"`
	Insecure *bool  `pulumi:"insecure,optional"`
	Logging  *bool  `pulumi:"logging,optional"`
	Client   *PDNSClient
}

func (*Config) Annotate

func (c *Config) Annotate(a infer.Annotator)

func (*Config) Check

func (c *Config) Check(ctx p.Context, name string, oldInputs, newInputs resource.PropertyMap) (*Config, []p.CheckFailure, error)

workaround for https://github.com/pulumi/pulumi-go-provider/issues/110

func (*Config) Configure

func (c *Config) Configure(ctx p.Context) error

type PDNSClient

type PDNSClient struct {
	ServerURL     string // Location of PowerDNS server to use
	ServerVersion string
	APIKey        string // REST API Static authentication key
	APIVersion    int    // API version to use
	HTTP          *http.Client
	CacheEnable   bool // Enable/Disable chache for REST API requests
	Cache         *freecache.Cache
	CacheTTL      int
}

PDNSClient is a PowerDNS client representation

func NewClient

func NewClient(serverURL string, apiKey string, configTLS *tls.Config, cacheEnable bool, cacheSizeMB string, cacheTTL int) (*PDNSClient, error)

NewClient returns a new PowerDNS client

func (*PDNSClient) CreateZone

func (client *PDNSClient) CreateZone(zoneInfo ZoneInfo) (ZoneInfo, error)

CreateZone creates a zone

func (*PDNSClient) DeleteRecordSet

func (client *PDNSClient) DeleteRecordSet(zone string, name string, tpe string) error

DeleteRecordSet deletes record set from Zone

func (*PDNSClient) DeleteRecordSetByID

func (client *PDNSClient) DeleteRecordSetByID(zone string, recID string) error

DeleteRecordSetByID deletes record from Zone by its ID

func (*PDNSClient) DeleteZone

func (client *PDNSClient) DeleteZone(name string) error

DeleteZone deletes a zone

func (*PDNSClient) GetZone

func (client *PDNSClient) GetZone(name string) (ZoneInfo, error)

GetZone gets a zone

func (*PDNSClient) GetZoneInfoFromCache

func (client *PDNSClient) GetZoneInfoFromCache(zone string) (*ZoneInfo, error)

GetZoneInfoFromCache return ZoneInfo struct

func (*PDNSClient) ListRecords

func (client *PDNSClient) ListRecords(zone string) ([]RecordApi, error)

ListRecords returns all records in Zone

func (*PDNSClient) ListRecordsByID

func (client *PDNSClient) ListRecordsByID(zone string, recID string) ([]RecordApi, error)

ListRecordsByID returns all records by IDs

func (*PDNSClient) ListRecordsInRRSet

func (client *PDNSClient) ListRecordsInRRSet(zone string, name string, tpe string) ([]RecordApi, error)

ListRecordsInRRSet returns only records of specified name and type

func (*PDNSClient) ListZones

func (client *PDNSClient) ListZones() ([]ZoneInfo, error)

ListZones returns all Zones of server, without records

func (*PDNSClient) RecordExists

func (client *PDNSClient) RecordExists(zone string, name string, tpe string) (bool, error)

RecordExists checks if requested record exists in Zone

func (*PDNSClient) RecordExistsByID

func (client *PDNSClient) RecordExistsByID(zone string, recID string) (bool, error)

RecordExistsByID checks if requested record exists in Zone by it's ID

func (*PDNSClient) ReplaceRecordSet

func (client *PDNSClient) ReplaceRecordSet(zone string, rrSet ResourceRecordSet) (string, error)

ReplaceRecordSet creates new record set in Zone

func (*PDNSClient) UpdateZone

func (client *PDNSClient) UpdateZone(name string, zoneInfo ZoneInfoUpd) error

UpdateZone updates a zone

func (*PDNSClient) ZoneExists

func (client *PDNSClient) ZoneExists(name string) (bool, error)

ZoneExists checks if requested zone exists

type Record

type Record struct{}

func (*Record) Annotate

func (r *Record) Annotate(a infer.Annotator)

Implementing Annotate lets you provide descriptions and default values for resources and they will be visible in the provider's schema and the generated SDKs.

func (*Record) Check

func (r *Record) Check(ctx p.Context, name string, oldInputs resource.PropertyMap, newInputs resource.PropertyMap) (RecordArgs, []p.CheckFailure, error)

func (*Record) Create

func (r *Record) Create(ctx p.Context, name string, input RecordArgs, preview bool) (string, RecordState, error)

func (*Record) Delete

func (r *Record) Delete(ctx p.Context, id string, props RecordState) (err error)

func (*Record) Read

func (r *Record) Read(ctx p.Context, id string, input RecordArgs, state RecordState) (string, RecordArgs, RecordState, error)

type RecordApi

type RecordApi struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Content  string `json:"content"`
	TTL      int    `json:"ttl"` // For API v0
	Disabled bool   `json:"disabled"`
	SetPtr   bool   `json:"set-ptr"`
}

RecordApi represents a PowerDNS record object

func (*RecordApi) ID

func (record *RecordApi) ID() string

ID returns a record with the ID format

type RecordArgs

type RecordArgs struct {
	// Fields projected into Pulumi must be public and hava a `pulumi:"..."` tag.
	// The pulumi tag doesn't need to match the field name, but its generally a
	// good idea.
	Zone    string   `pulumi:"zone"`
	Name    string   `pulumi:"name"`
	Type    string   `pulumi:"type"`
	TTL     int      `pulumi:"ttl"`
	Records []string `pulumi:"records"`
	SetPtr  *bool    `pulumi:"setptr,optional"`
}

type RecordState

type RecordState struct {
	RecId string `pulumi:"recId"`
	// It is generally a good idea to embed args in outputs, but it isn't strictly necessary.
	RecordArgs
	// Here we define a required output called result.
	Result string `pulumi:"result"`
}

Each resource has a state, describing the fields that exist on the created resource.

type ResourceRecordSet

type ResourceRecordSet struct {
	Name       string      `json:"name"`
	Type       string      `json:"type"`
	ChangeType string      `json:"changetype"`
	TTL        int         `json:"ttl"` // For API v1
	Records    []RecordApi `json:"records,omitempty"`
}

ResourceRecordSet represents a PowerDNS RRSet object

func (*ResourceRecordSet) ID

func (rrSet *ResourceRecordSet) ID() string

ID returns a rrSet with the ID format

type Zone

type Zone struct{}

func (*Zone) Create

func (*Zone) Create(ctx p.Context, id string, input ZoneArgs, preview bool) (name string, state ZoneState, err error)

func (*Zone) Delete

func (*Zone) Delete(ctx p.Context, id string, props ZoneState) (err error)

func (*Zone) Read

func (*Zone) Read(ctx p.Context, id string, input ZoneArgs, state ZoneState) (string, ZoneArgs, ZoneState, error)

func (*Zone) Update

func (*Zone) Update(ctx p.Context, id string, olds ZoneState, news ZoneArgs, preview bool) (ZoneState, error)

type ZoneArgs

type ZoneArgs struct {
	// Fields projected into Pulumi must be public and hava a `pulumi:"..."` tag.
	// The pulumi tag doesn't need to match the field name, but its generally a
	// good idea.
	Name        string   `pulumi:"name"`
	Kind        string   `pulumi:"kind"`
	Account     string   `pulumi:"account,optional"`
	Nameservers []string `pulumi:"nameservers,optional"`
	Masters     []string `pulumi:"masters,optional"`
	SoaEditAPI  string   `pulumi:"soaEditAPI,optional"`
}

type ZoneInfo

type ZoneInfo struct {
	ID                 string              `json:"id"`
	Name               string              `json:"name"`
	URL                string              `json:"url"`
	Kind               string              `json:"kind"`
	DNSSec             bool                `json:"dnsssec"`
	Serial             int64               `json:"serial"`
	Records            []RecordApi         `json:"records,omitempty"`
	ResourceRecordSets []ResourceRecordSet `json:"rrsets,omitempty"`
	Account            string              `json:"account"`
	Nameservers        []string            `json:"nameservers,omitempty"`
	Masters            []string            `json:"masters,omitempty"`
	SoaEditAPI         string              `json:"soa_edit_api"`
}

ZoneInfo represents a PowerDNS zone object

type ZoneInfoUpd

type ZoneInfoUpd struct {
	Name       string `json:"name"`
	Kind       string `json:"kind"`
	SoaEditAPI string `json:"soa_edit_api,omitempty"`
	Account    string `json:"account"`
}

ZoneInfoUpd is a limited subset for supported updates

type ZoneState

type ZoneState struct {
	ZoneId string `pulumi:"zoneId"`
	// It is generally a good idea to embed args in outputs, but it isn't strictly necessary.
	ZoneArgs
	// Here we define a required output called result.
	Result string `pulumi:"result"`
}

Each resource has a state, describing the fields that exist on the created resource.

Jump to

Keyboard shortcuts

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