2021-03-07 13:19:22 -05:00
|
|
|
package cscglobal
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/StackExchange/dnscontrol/v3/models"
|
2022-06-12 16:01:08 -04:00
|
|
|
"github.com/StackExchange/dnscontrol/v3/pkg/recordaudit"
|
2021-03-07 13:19:22 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// AuditRecords returns an error if any records are not
|
|
|
|
// supportable by this provider.
|
|
|
|
func AuditRecords(records []*models.RecordConfig) error {
|
2022-06-12 16:01:08 -04:00
|
|
|
|
|
|
|
// Each test should be encapsulated in a function that can be tested
|
|
|
|
// individually. If the test is of general use, add it to the
|
|
|
|
// recordaudit module.
|
|
|
|
|
|
|
|
// Each test should document the last time we verified the test was
|
|
|
|
// still needed. Sometimes companies change their API.
|
|
|
|
|
|
|
|
if err := recordaudit.TxtNoDoubleQuotes(records); err != nil {
|
|
|
|
return err
|
|
|
|
} // Needed as of 2022-06-10
|
|
|
|
|
2022-06-20 11:34:05 -04:00
|
|
|
if err := recordaudit.TxtNoStringsLen256orLonger(records); err != nil {
|
2022-06-12 16:01:08 -04:00
|
|
|
return err
|
|
|
|
} // Needed as of 2022-06-10
|
|
|
|
|
|
|
|
if err := recordaudit.TxtNoMultipleStrings(records); err != nil {
|
|
|
|
return err
|
|
|
|
} // Needed as of 2022-06-10
|
|
|
|
|
|
|
|
if err := recordaudit.TxtNoTrailingSpace(records); err != nil {
|
|
|
|
return err
|
|
|
|
} // Needed as of 2022-06-10
|
|
|
|
|
|
|
|
if err := recordaudit.TxtNotEmpty(records); err != nil {
|
|
|
|
return err
|
|
|
|
} // Needed as of 2022-06-10
|
|
|
|
|
2021-03-07 13:19:22 -05:00
|
|
|
return nil
|
|
|
|
}
|