-
Notifications
You must be signed in to change notification settings - Fork 29
/
records_example_test.go
44 lines (34 loc) · 1.37 KB
/
records_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
package powerdns_test
import (
"context"
"log"
"github.com/joeig/go-powerdns/v3"
)
func ExampleRecordsService_Add_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)
}
}
func ExampleRecordsService_Add_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)
}
}
func ExampleRecordsService_Add_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)
}
}
func ExampleRecordsService_Change() {
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)
}
}