-
Notifications
You must be signed in to change notification settings - Fork 5
/
api.go
46 lines (38 loc) · 1.23 KB
/
api.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
/*
Package route53 implements a simple DNS record reader and writer using AWS
Route 53.
*/
package route53
import (
"time"
"github.com/Cloud-Foundations/golib/pkg/dns"
"github.com/Cloud-Foundations/golib/pkg/log"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/route53"
)
type RecordReadWriter struct {
awsService *route53.Route53
hostedZoneId *string
logger log.DebugLogger
}
// New creates a *RecordReadWriter.
// The logger is used for logging messages.
func New(awsSession *session.Session, hostedZoneId string,
logger log.DebugLogger) (*RecordReadWriter, error) {
return newRecordReadWriter(awsSession, hostedZoneId, logger)
}
func (rrw *RecordReadWriter) DeleteRecords(fqdn, recType string) error {
return rrw.deleteRecords(fqdn, recType)
}
func (rrw *RecordReadWriter) ReadRecords(fqdn, recType string) (
[]string, time.Duration, error) {
return rrw.readRecords(fqdn, recType)
}
func (rrw *RecordReadWriter) WriteRecords(fqdn, recType string,
records []string, ttl time.Duration, wait bool) error {
return rrw.writeRecords(fqdn, recType, records, ttl, wait)
}
// Put the compile-time interface check next to the implementation.
func interfaceTest() {
_ = dns.RecordManager(&RecordReadWriter{})
}