-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathdns.go
43 lines (34 loc) · 1.11 KB
/
dns.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
// This file is part of gobizfly
package gobizfly
import (
"context"
"strings"
)
const (
zonesPath = "/zones"
zonePath = "/zone"
recordPath = "/record"
)
type dnsService struct {
client *Client
}
var _ DNSService = (*dnsService)(nil)
type DNSService interface {
ListZones(ctx context.Context, opts *ListOptions) (*ListZoneResp, error)
CreateZone(ctx context.Context, czpl *CreateZonePayload) (*ExtendedZone, error)
GetZone(ctx context.Context, zoneID string) (*ExtendedZone, error)
DeleteZone(ctx context.Context, zoneID string) error
CreateRecord(ctx context.Context, zoneID string, crpl interface{}) (*Record, error)
GetRecord(ctx context.Context, recordID string) (*Record, error)
UpdateRecord(ctx context.Context, recordID string, urpl interface{}) (*Record, error)
DeleteRecord(ctx context.Context, recordID string) error
}
func (d dnsService) resourcePath() string {
return zonesPath
}
func (d dnsService) zoneItemPath(id string) string {
return strings.Join([]string{zonePath, id}, "/")
}
func (d dnsService) recordItemPath(id string) string {
return strings.Join([]string{recordPath, id}, "/")
}