Skip to content

Commit 602ca53

Browse files
thriqonfrittentheke
authored andcommitted
provider: Refactor supportedRecordType
1 parent c840b97 commit 602ca53

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

internal/designate/provider/provider.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func (p designateProvider) Records(ctx context.Context) ([]*endpoint.Endpoint, e
135135
for zoneID := range managedZones {
136136
err = p.client.ForEachRecordSet(ctx, zoneID,
137137
func(recordSet *recordsets.RecordSet) error {
138-
if recordSet.Type != endpoint.RecordTypeA && recordSet.Type != endpoint.RecordTypeTXT && recordSet.Type != endpoint.RecordTypeCNAME && recordSet.Type != endpoint.RecordTypeNS {
138+
if !p.supportedRecordType(recordSet.Type) {
139139
return nil
140140
}
141141

@@ -156,6 +156,15 @@ func (p designateProvider) Records(ctx context.Context) ([]*endpoint.Endpoint, e
156156
return result, nil
157157
}
158158

159+
func (p designateProvider) supportedRecordType(recordType string) bool {
160+
switch recordType {
161+
case endpoint.RecordTypeA, endpoint.RecordTypeTXT, endpoint.RecordTypeCNAME, endpoint.RecordTypeNS:
162+
return true
163+
default:
164+
return false
165+
}
166+
}
167+
159168
// temporary structure to hold recordset parameters so that we could aggregate endpoints into recordsets
160169
type recordSet struct {
161170
dnsName string

0 commit comments

Comments
 (0)