Documentation
¶
Overview ¶
Example ¶
domain := fmt.Sprintf("%d.example.com.", rand.Int()) // Let's say // * PowerDNS Authoritative Server is listening on `http://localhost:80`, // * the virtual host is `localhost` and // * the API key is `apipw`. pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) // All API interactions support a Go context, which allow you to pass cancellation signals and deadlines. // If you don't need a context, `context.Background()` would be the right choice for the following examples. // If you want to learn more about how context helps you to build reliable APIs, see: https://go.dev/blog/context ctx := context.Background() // Create a native zone zone, err := pdns.Zones.AddNative(ctx, domain, false, "", false, "", "", true, []string{"localhost."}) if err != nil { log.Fatalf("%v", err) } o, _ := json.MarshalIndent(zone, "", "\t") log.Printf("Zone: %s\n\n", o) // Add and change an A record if err := pdns.Records.Add(ctx, domain, fmt.Sprintf("www.%s", domain), powerdns.RRTypeA, 1337, []string{"127.0.0.9"}); err != nil { log.Fatalf("%v", err) } if err := pdns.Records.Change(ctx, domain, fmt.Sprintf("www.%s", domain), powerdns.RRTypeA, 42, []string{"127.0.0.10"}); err != nil { log.Fatalf("%v", err) } // update the existing record with a comment comment := powerdns.Comment{ Content: powerdns.String("Example comment"), Account: powerdns.String("example account"), ModifiedAt: powerdns.Uint64(uint64(time.Now().Unix())), } if err := pdns.Records.Change(ctx, domain, fmt.Sprintf("www.%s", domain), powerdns.RRTypeA, 42, []string{"127.0.0.10"}, powerdns.WithComments(comment)); err != nil { log.Fatalf("%v", err) } // Add a MX record with multiple values if err := pdns.Records.Add(ctx, domain, domain, powerdns.RRTypeMX, 1337, []string{"10 mx1.example.com.", "20 mx2.example.com."}); err != nil { log.Fatalf("%v", err) } // Add a TXT record if err := pdns.Records.Add(ctx, domain, fmt.Sprintf("www.%s", domain), powerdns.RRTypeTXT, 1337, []string{"\"foo1\""}); err != nil { log.Fatalf("%v", err) } // Create a TSIG Record exampleKey, err := pdns.TSIGKeys.Create(ctx, "examplekey", "hmac-sha256", "") if err != nil { log.Fatalf("%v", err) } // Change a zone zoneChangeSet := &powerdns.Zone{ Account: powerdns.String("test"), DNSsec: powerdns.Bool(true), MasterTSIGKeyIDs: []string{*exampleKey.ID}, } if err := pdns.Zones.Change(ctx, domain, zoneChangeSet); err != nil { log.Fatalf("%v", err) } // Retrieve zone attributes changedZone, err := pdns.Zones.Get(ctx, domain) if err != nil { log.Fatalf("%v", err) } o, _ = json.MarshalIndent(changedZone, "", "\t") log.Printf("Changed zone: %q\n\n", o) log.Printf("Account is %q and DNSsec is %t\n\n", powerdns.StringValue(changedZone.Account), powerdns.BoolValue(changedZone.DNSsec))
Output:
Index ¶
- func Bool(v bool) *bool
- func BoolValue(v *bool) bool
- func String(v string) *string
- func StringValue(v *string) string
- func Uint32(v uint32) *uint32
- func Uint32Value(v *uint32) uint32
- func Uint64(v uint64) *uint64
- func Uint64Value(v *uint64) uint64
- func WithComments(comments ...Comment) func(*RRset)
- type AxfrRetrieveResult
- type CacheFlushResult
- type ChangeType
- type Client
- type Comment
- type ConfigService
- type ConfigSetting
- type Cryptokey
- type CryptokeysService
- type Error
- type Export
- type NewOption
- type NotifyResult
- type RRType
- type RRset
- type RRsets
- type Record
- type RecordsService
- func (r *RecordsService) Add(ctx context.Context, domain string, name string, recordType RRType, ttl uint32, ...) error
- func (r *RecordsService) Change(ctx context.Context, domain string, name string, recordType RRType, ttl uint32, ...) error
- func (r *RecordsService) Delete(ctx context.Context, domain string, name string, recordType RRType) error
- func (r *RecordsService) Get(ctx context.Context, domain, name string, recordType *RRType) ([]RRset, error)
- func (r *RecordsService) Patch(ctx context.Context, domain string, rrSets *RRsets) error
- type Server
- type ServersService
- type Statistic
- type StatisticsService
- type TSIGKey
- type TSIGKeysService
- func (t *TSIGKeysService) Change(ctx context.Context, id string, newKey TSIGKey) (*TSIGKey, error)
- func (t *TSIGKeysService) Create(ctx context.Context, name, algorithm, key string) (*TSIGKey, error)
- func (t *TSIGKeysService) Delete(ctx context.Context, id string) error
- func (t *TSIGKeysService) Get(ctx context.Context, id string) (*TSIGKey, error)
- func (t *TSIGKeysService) List(ctx context.Context) ([]TSIGKey, error)
- type Zone
- type ZoneKind
- type ZoneType
- type ZonesService
- func (z *ZonesService) Add(ctx context.Context, zone *Zone) (*Zone, error)
- func (z *ZonesService) AddMaster(ctx context.Context, domain string, dnssec bool, nsec3Param string, ...) (*Zone, error)
- func (z *ZonesService) AddNative(ctx context.Context, domain string, dnssec bool, nsec3Param string, ...) (*Zone, error)
- func (z *ZonesService) AddSlave(ctx context.Context, domain string, masters []string) (*Zone, error)
- func (z *ZonesService) AxfrRetrieve(ctx context.Context, domain string) (*AxfrRetrieveResult, error)
- func (z *ZonesService) Change(ctx context.Context, domain string, zone *Zone) error
- func (z *ZonesService) Delete(ctx context.Context, domain string) error
- func (z *ZonesService) Export(ctx context.Context, domain string) (Export, error)
- func (z *ZonesService) Get(ctx context.Context, domain string) (*Zone, error)
- func (z *ZonesService) List(ctx context.Context) ([]Zone, error)
- func (z *ZonesService) Notify(ctx context.Context, domain string) (*NotifyResult, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper function that allocates a new bool value to store v and returns a pointer to it.
func String ¶
String is a helper function that allocates a new string value to store v and returns a pointer to it.
func StringValue ¶
StringValue is a helper function that returns the value of a bool pointer or "".
func Uint32 ¶
Uint32 is a helper function that allocates a new uint32 value to store v and returns a pointer to it.
func Uint32Value ¶
Uint32Value is a helper function that returns the value of a bool pointer or 0.
func Uint64 ¶
Uint64 is a helper function that allocates a new uint64 value to store v and returns a pointer to it.
func Uint64Value ¶
Uint64Value is a helper function that returns the value of a bool pointer or 0.
func WithComments ¶ added in v3.9.0
WithComments defines a function to create a comment option for Add and Change methods
Types ¶
type AxfrRetrieveResult ¶ added in v3.3.0
type AxfrRetrieveResult struct {
Result *string `json:"result,omitempty"`
}
AxfrRetrieveResult structure with JSON API metadata
type CacheFlushResult ¶
type CacheFlushResult struct { Count *uint32 `json:"count,omitempty"` Result *string `json:"result,omitempty"` }
CacheFlushResult structure with JSON API metadata
type ChangeType ¶
type ChangeType string
ChangeType represents a string-valued change type
const ( // ChangeTypeReplace represents the REPLACE change type ChangeTypeReplace ChangeType = "REPLACE" // ChangeTypeDelete represents the DELETE change type ChangeTypeDelete ChangeType = "DELETE" )
func ChangeTypePtr ¶
func ChangeTypePtr(v ChangeType) *ChangeType
ChangeTypePtr is a helper function that allocates a new ChangeType value to store v and returns a pointer to it.
type Client ¶
type Client struct { Scheme string Hostname string Port string VHost string Headers map[string]string Config *ConfigService Cryptokeys *CryptokeysService Records *RecordsService Servers *ServersService Statistics *StatisticsService Zones *ZonesService // Deprecated: Use TSIGKeys instead. TSIGKey will be removed with the next major version. TSIGKey *TSIGKeysService TSIGKeys *TSIGKeysService // contains filtered or unexported fields }
Client configuration structure
type Comment ¶
type Comment struct { Content *string `json:"content,omitempty"` Account *string `json:"account,omitempty"` ModifiedAt *uint64 `json:"modified_at,omitempty"` }
Comment structure with JSON API metadata
type ConfigService ¶
type ConfigService service
ConfigService handles communication with the zones related methods of the Client API
func (*ConfigService) List ¶
func (c *ConfigService) List(ctx context.Context) ([]ConfigSetting, error)
List retrieves a list of ConfigSettings
type ConfigSetting ¶
type ConfigSetting struct { Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` Value *string `json:"value,omitempty"` }
ConfigSetting structure with JSON API metadata
type Cryptokey ¶
type Cryptokey struct { Type *string `json:"type,omitempty"` ID *uint64 `json:"id,omitempty"` KeyType *string `json:"keytype,omitempty"` Active *bool `json:"active,omitempty"` DNSkey *string `json:"dnskey,omitempty"` DS []string `json:"ds,omitempty"` Privatekey *string `json:"privatekey,omitempty"` Algorithm *string `json:"algorithm,omitempty"` Bits *uint64 `json:"bits,omitempty"` }
Cryptokey structure with JSON API metadata
type CryptokeysService ¶
type CryptokeysService service
CryptokeysService handles communication with the cryptokeys related methods of the Client API
type Error ¶
type Error struct { StatusCode int `json:"-"` Status string `json:"-"` Message string `json:"error"` }
Error structure with JSON API metadata
type NewOption ¶ added in v3.13.0
type NewOption func(*Client)
NewOption is a functional option for New.
func WithAPIKey ¶ added in v3.13.0
WithAPIKey is an option for New to set the API key.
func WithHTTPClient ¶ added in v3.13.0
WithHTTPClient is an option for New to set an HTTP client.
func WithHeaders ¶ added in v3.13.0
WithHeaders is an option for New to set HTTP client headers.
type NotifyResult ¶
type NotifyResult struct {
Result *string `json:"result,omitempty"`
}
NotifyResult structure with JSON API metadata
type RRType ¶
type RRType string
RRType represents a string-valued resource record type
const ( // RRTypeA represents the A resource record type RRTypeA RRType = "A" // RRTypeAAAA represents the AAAA resource record type RRTypeAAAA RRType = "AAAA" // RRTypeA6 represents the A6 resource record type RRTypeA6 RRType = "A6" // RRTypeAFSDB represents the AFSDB resource record type RRTypeAFSDB RRType = "AFSDB" // RRTypeALIAS represents the ALIAS resource record type RRTypeALIAS RRType = "ALIAS" // RRTypeDHCID represents the DHCID resource record type RRTypeDHCID RRType = "DHCID" // RRTypeDLV represents the DLV resource record type RRTypeDLV RRType = "DLV" // RRTypeCAA represents the CAA resource record type RRTypeCAA RRType = "CAA" // RRTypeCERT represents the CERT resource record type RRTypeCERT RRType = "CERT" // RRTypeCDNSKEY represents the CDNSKEY resource record type RRTypeCDNSKEY RRType = "CDNSKEY" // RRTypeCDS represents the CDS resource record type RRTypeCDS RRType = "CDS" // RRTypeCNAME represents the CNAME resource record type RRTypeCNAME RRType = "CNAME" // RRTypeDNSKEY represents the DNSKEY resource record type RRTypeDNSKEY RRType = "DNSKEY" // RRTypeDNAME represents the DNAME resource record type RRTypeDNAME RRType = "DNAME" // RRTypeDS represents the DS resource record type RRTypeDS RRType = "DS" // RRTypeEUI48 represents the EUI48 resource record type RRTypeEUI48 RRType = "EUI48" // RRTypeEUI64 represents the EUI64 resource record type RRTypeEUI64 RRType = "EUI64" // RRTypeHINFO represents the HINFO resource record type RRTypeHINFO RRType = "HINFO" // RRTypeIPSECKEY represents the IPSECKEY resource record type RRTypeIPSECKEY RRType = "IPSECKEY" // RRTypeKEY represents the KEY resource record type RRTypeKEY RRType = "KEY" // RRTypeKX represents the KX resource record type RRTypeKX RRType = "KX" // RRTypeLOC represents the LOC resource record type RRTypeLOC RRType = "LOC" // RRTypeLUA represents the LUA resource record type RRTypeLUA RRType = "LUA" // RRTypeMAILA represents the MAILA resource record type RRTypeMAILA RRType = "MAILA" // RRTypeMAILB represents the MAILB resource record type RRTypeMAILB RRType = "MAILB" // RRTypeMINFO represents the MINFO resource record type RRTypeMINFO RRType = "MINFO" // RRTypeMR represents the MR resource record type RRTypeMR RRType = "MR" // RRTypeMX represents the MX resource record type RRTypeMX RRType = "MX" // RRTypeNAPTR represents the NAPTR resource record type RRTypeNAPTR RRType = "NAPTR" // RRTypeNS represents the NS resource record type RRTypeNS RRType = "NS" // RRTypeNSEC represents the NSEC resource record type RRTypeNSEC RRType = "NSEC" // RRTypeNSEC3 represents the NSEC3 resource record type RRTypeNSEC3 RRType = "NSEC3" // RRTypeNSEC3PARAM represents the NSEC3PARAM resource record type RRTypeNSEC3PARAM RRType = "NSEC3PARAM" // RRTypeOPENPGPKEY represents the OPENPGPKEY resource record type RRTypeOPENPGPKEY RRType = "OPENPGPKEY" // RRTypePTR represents the PTR resource record type RRTypePTR RRType = "PTR" // RRTypeRKEY represents the RKEY resource record type RRTypeRKEY RRType = "RKEY" // RRTypeRP represents the RP resource record type RRTypeRP RRType = "RP" // RRTypeRRSIG represents the RRSIG resource record type RRTypeRRSIG RRType = "RRSIG" // RRTypeSIG represents the SIG resource record type RRTypeSIG RRType = "SIG" // RRTypeSOA represents the SOA resource record type RRTypeSOA RRType = "SOA" // RRTypeSPF represents the SPF resource record type RRTypeSPF RRType = "SPF" // RRTypeSSHFP represents the SSHFP resource record type RRTypeSSHFP RRType = "SSHFP" // RRTypeSRV represents the SRV resource record type RRTypeSRV RRType = "SRV" // RRTypeTKEY represents the TKEY resource record type RRTypeTKEY RRType = "TKEY" // RRTypeTSIG represents the TSIG resource record type RRTypeTSIG RRType = "TSIG" // RRTypeTLSA represents the TLSA resource record type RRTypeTLSA RRType = "TLSA" // RRTypeSMIMEA represents the SMIMEA resource record type RRTypeSMIMEA RRType = "SMIMEA" // RRTypeTXT represents the TXT resource record type RRTypeTXT RRType = "TXT" // RRTypeURI represents the URI resource record type RRTypeURI RRType = "URI" // RRTypeWKS represents the WKS resource record type RRTypeWKS RRType = "WKS" )
type RRset ¶
type RRset struct { Name *string `json:"name,omitempty"` Type *RRType `json:"type,omitempty"` TTL *uint32 `json:"ttl,omitempty"` ChangeType *ChangeType `json:"changetype,omitempty"` Records []Record `json:"records"` Comments []Comment `json:"comments,omitempty"` }
RRset structure with JSON API metadata
type RRsets ¶
type RRsets struct {
Sets []RRset `json:"rrsets,omitempty"`
}
RRsets structure with JSON API metadata
type Record ¶
type Record struct { Content *string `json:"content,omitempty"` Disabled *bool `json:"disabled,omitempty"` SetPTR *bool `json:"set-ptr,omitempty"` }
Record structure with JSON API metadata
type RecordsService ¶
type RecordsService service
RecordsService handles communication with the records related methods of the Client API
func (*RecordsService) Add ¶
func (r *RecordsService) Add(ctx context.Context, domain string, name string, recordType RRType, ttl uint32, content []string, options ...func(*RRset)) error
Add creates a new resource record
Example (Basic) ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() if err := pdns.Records.Add(ctx, "example.com.", "www.example.com.", powerdns.RRTypeA, 1337, []string{"127.0.0.9"}); err != nil { log.Fatalf("%v", err) }
Output:
Example (MX) ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() if err := pdns.Records.Add(ctx, "example.com.", "www.example.com.", powerdns.RRTypeMX, 1337, []string{"10 mx1.example.com.", "20 mx2.example.com."}); err != nil { log.Fatalf("%v", err) }
Output:
Example (TXT) ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() if err := pdns.Records.Add(ctx, "example.com.", "www.example.com.", powerdns.RRTypeTXT, 1337, []string{"\"foo1\""}); err != nil { log.Fatalf("%v", err) }
Output:
func (*RecordsService) Change ¶
func (r *RecordsService) Change(ctx context.Context, domain string, name string, recordType RRType, ttl uint32, content []string, options ...func(*RRset)) error
Change replaces an existing resource record
Example ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() if err := pdns.Records.Change(ctx, "example.com.", "www.example.com.", powerdns.RRTypeA, 42, []string{"127.0.0.10"}); err != nil { log.Fatalf("%v", err) }
Output:
func (*RecordsService) Delete ¶
func (r *RecordsService) Delete(ctx context.Context, domain string, name string, recordType RRType) error
Delete removes an existing resource record
type Server ¶
type Server struct { Type *string `json:"type,omitempty"` ID *string `json:"id,omitempty"` DaemonType *string `json:"daemon_type,omitempty"` Version *string `json:"version,omitempty"` URL *string `json:"url,omitempty"` ConfigURL *string `json:"config_url,omitempty"` ZonesURL *string `json:"zones_url,omitempty"` }
Server structure with JSON API metadata
type ServersService ¶
type ServersService service
ServersService handles communication with the servers related methods of the Client API
func (*ServersService) CacheFlush ¶
func (s *ServersService) CacheFlush(ctx context.Context, vHost string, domain string) (*CacheFlushResult, error)
CacheFlush flushes a cache-entry by name
type Statistic ¶
type Statistic struct { Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` // Contrary to the authoritative API specification, the "size" field has actually been implemented as string instead of integer. Size *string `json:"size,omitempty"` // The "value" field contains either a string or a list of objects, depending on the "type". Value interface{} `json:"value,omitempty"` }
Statistic structure with JSON API metadata
type StatisticsService ¶
type StatisticsService service
StatisticsService handles communication with the statistics related methods of the Client API
type TSIGKey ¶ added in v3.8.0
type TSIGKey struct { Name *string `json:"name,omitempty"` ID *string `json:"id,omitempty"` Algorithm *string `json:"algorithm,omitempty"` Key *string `json:"key,omitempty"` Type *string `json:"type,omitempty"` }
TSIGKey structure with JSON API metadata
type TSIGKeysService ¶ added in v3.14.0
type TSIGKeysService service
TSIGKeysService handles communication with the tsigs related methods of the Client API
func (*TSIGKeysService) Change ¶ added in v3.14.0
Example ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() if _, err := pdns.TSIGKeys.Change(ctx, *exampleTSIGKey.ID, exampleTSIGKey); err != nil { log.Fatalf("%v", err) }
Output:
func (*TSIGKeysService) Create ¶ added in v3.14.0
func (t *TSIGKeysService) Create(ctx context.Context, name, algorithm, key string) (*TSIGKey, error)
Create a new TSIG Key setting empty string for key will generate it
Example ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() _, err := pdns.TSIGKeys.Create(ctx, *exampleTSIGKey.Name, *exampleTSIGKey.Algorithm, "") if err != nil { log.Fatalf("%v", err) }
Output:
func (*TSIGKeysService) Delete ¶ added in v3.14.0
func (t *TSIGKeysService) Delete(ctx context.Context, id string) error
Example ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() if err := pdns.TSIGKeys.Delete(ctx, *exampleTSIGKey.ID); err != nil { log.Fatalf("%v", err) }
Output:
func (*TSIGKeysService) Get ¶ added in v3.14.0
Get returns a certain TSIGKeys
Example ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() if _, err := pdns.TSIGKeys.Get(ctx, *exampleTSIGKey.ID); err != nil { log.Fatalf("%v", err) }
Output:
func (*TSIGKeysService) List ¶ added in v3.14.0
func (t *TSIGKeysService) List(ctx context.Context) ([]TSIGKey, error)
List retrieves a list of TSIGKeys
Example ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() if _, err := pdns.TSIGKeys.List(ctx); err != nil { log.Fatalf("%v", err) }
Output:
type Zone ¶
type Zone struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Type *ZoneType `json:"type,omitempty"` URL *string `json:"url,omitempty"` Kind *ZoneKind `json:"kind,omitempty"` RRsets []RRset `json:"rrsets,omitempty"` Serial *uint32 `json:"serial,omitempty"` NotifiedSerial *uint32 `json:"notified_serial,omitempty"` EditedSerial *uint32 `json:"edited_serial,omitempty"` Masters []string `json:"masters,omitempty"` DNSsec *bool `json:"dnssec,omitempty"` Nsec3Param *string `json:"nsec3param,omitempty"` Nsec3Narrow *bool `json:"nsec3narrow,omitempty"` Presigned *bool `json:"presigned,omitempty"` SOAEdit *string `json:"soa_edit,omitempty"` SOAEditAPI *string `json:"soa_edit_api,omitempty"` APIRectify *bool `json:"api_rectify,omitempty"` Zone *string `json:"zone,omitempty"` Catalog *string `json:"catalog,omitempty"` Account *string `json:"account,omitempty"` Nameservers []string `json:"nameservers,omitempty"` MasterTSIGKeyIDs []string `json:"master_tsig_key_ids,omitempty"` SlaveTSIGKeyIDs []string `json:"slave_tsig_key_ids,omitempty"` }
Zone structure with JSON API metadata
type ZoneKind ¶
type ZoneKind string
ZoneKind string type
const ( // NativeZoneKind sets the zone's kind to native NativeZoneKind ZoneKind = "Native" // MasterZoneKind sets the zone's kind to master MasterZoneKind ZoneKind = "Master" // SlaveZoneKind sets the zone's kind to slave SlaveZoneKind ZoneKind = "Slave" // ProducerZoneKind sets the zone's kind to producer ProducerZoneKind ZoneKind = "Producer" // ConsumerZoneKind sets the zone's kind to consumer ConsumerZoneKind ZoneKind = "Consumer" )
func ZoneKindPtr ¶
ZoneKindPtr is a helper function that allocates a new ZoneKind value to store v and returns a pointer to it.
type ZoneType ¶
type ZoneType string
ZoneType string type
const ZoneZoneType ZoneType = "Zone"
ZoneZoneType sets the zone's type to zone
func ZoneTypePtr ¶
ZoneTypePtr is a helper function that allocates a new ZoneType value to store v and returns a pointer to it.
type ZonesService ¶
type ZonesService service
ZonesService handles communication with the zones related methods of the Client API
func (*ZonesService) AddMaster ¶
func (z *ZonesService) AddMaster(ctx context.Context, domain string, dnssec bool, nsec3Param string, nsec3Narrow bool, soaEdit, soaEditApi string, apiRectify bool, nameservers []string) (*Zone, error)
AddMaster creates a new master zone
func (*ZonesService) AddNative ¶
func (z *ZonesService) AddNative(ctx context.Context, domain string, dnssec bool, nsec3Param string, nsec3Narrow bool, soaEdit, soaEditApi string, apiRectify bool, nameservers []string) (*Zone, error)
AddNative creates a new native zone
Example ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() zone, err := pdns.Zones.AddNative(ctx, "example.com.", false, "", false, "", "", true, []string{"localhost."}) if err != nil { log.Fatalf("%v", err) } log.Printf("Zone: %v", zone)
Output:
func (*ZonesService) AddSlave ¶
func (z *ZonesService) AddSlave(ctx context.Context, domain string, masters []string) (*Zone, error)
AddSlave creates a new slave zone
func (*ZonesService) AxfrRetrieve ¶ added in v3.3.0
func (z *ZonesService) AxfrRetrieve(ctx context.Context, domain string) (*AxfrRetrieveResult, error)
AxfrRetrieve requests a axfr transfer from the master to requesting slave
func (*ZonesService) Change ¶
Change modifies an existing zone
Example ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() zoneChangeSet := &powerdns.Zone{ Account: powerdns.String("test"), DNSsec: powerdns.Bool(true), } if err := pdns.Zones.Change(ctx, "example.com.", zoneChangeSet); err != nil { log.Fatalf("%v", err) }
Output:
func (*ZonesService) Delete ¶
func (z *ZonesService) Delete(ctx context.Context, domain string) error
Delete removes a certain Zone for a given domain
func (*ZonesService) Get ¶
Get returns a certain Zone for a given domain
Example ¶
pdns := powerdns.New("http://localhost:8080", "localhost", powerdns.WithAPIKey("apipw")) ctx := context.Background() zone, err := pdns.Zones.Get(ctx, "example.com.") if err != nil { log.Fatalf("%v", err) } log.Printf("Zone: %v", zone)
Output:
func (*ZonesService) List ¶
func (z *ZonesService) List(ctx context.Context) ([]Zone, error)
List retrieves a list of Zones
func (*ZonesService) Notify ¶
func (z *ZonesService) Notify(ctx context.Context, domain string) (*NotifyResult, error)
Notify sends a DNS notify packet to all slaves