-
Notifications
You must be signed in to change notification settings - Fork 29
/
zones_example_test.go
45 lines (35 loc) · 1.06 KB
/
zones_example_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package powerdns_test
import (
"context"
"log"
"github.com/joeig/go-powerdns/v3"
)
func ExampleZonesService_AddNative() {
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)
}
func ExampleZonesService_Change() {
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)
}
}
func ExampleZonesService_Get() {
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)
}