-
Notifications
You must be signed in to change notification settings - Fork 29
/
tsigkeys_example_test.go
61 lines (47 loc) · 1.63 KB
/
tsigkeys_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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package powerdns_test
import (
"context"
"log"
"github.com/joeig/go-powerdns/v3"
)
var exampleTSIGKey = powerdns.TSIGKey{
Name: powerdns.String("examplekey"),
Algorithm: powerdns.String("hmac-sha256"),
Key: powerdns.String("ruTjBX2Jw/2BlE//5255fmKHaSRvLvp6p+YyDDAXThnBN/1Mz/VwMw+HQJVtkpDsAXvpPuNNZhucdKmhiOS4Tg=="),
}
func ExampleTSIGKeysService_Create() {
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)
}
}
func ExampleTSIGKeysService_List() {
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)
}
}
func ExampleTSIGKeysService_Get() {
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)
}
}
func ExampleTSIGKeysService_Change() {
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)
}
}
func ExampleTSIGKeysService_Delete() {
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)
}
}