mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
NEW PROVIDER: GANDI_V5 (deprecates GANDI) (#572)
* GANDI_v5: Add Registrar support * Add GANDI deprecation warning * vendor github.com/tiramiseb/go-gandi
This commit is contained in:
@@ -306,8 +306,18 @@ func (rc *RecordConfig) Key() RecordKey {
|
||||
// Records is a list of *RecordConfig.
|
||||
type Records []*RecordConfig
|
||||
|
||||
// FQDNMap returns a map of all LabelFQDNs. Useful for making a
|
||||
// truthtable of labels that exist in Records.
|
||||
func (r Records) FQDNMap() (m map[string]bool) {
|
||||
m = map[string]bool{}
|
||||
for _, rec := range r {
|
||||
m[rec.GetLabelFQDN()] = true
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Grouped returns a map of keys to records.
|
||||
func (r Records) Grouped() map[RecordKey]Records {
|
||||
func (r Records) GroupedByKey() map[RecordKey]Records {
|
||||
groups := map[RecordKey]Records{}
|
||||
for _, rec := range r {
|
||||
groups[rec.Key()] = append(groups[rec.Key()], rec)
|
||||
@@ -328,6 +338,20 @@ func (r Records) GroupedByLabel() ([]string, map[string]Records) {
|
||||
return order, groups
|
||||
}
|
||||
|
||||
// GroupedByFQDN returns a map of keys to records, grouped by FQDN.
|
||||
func (r Records) GroupedByFQDN() ([]string, map[string]Records) {
|
||||
order := []string{}
|
||||
groups := map[string]Records{}
|
||||
for _, rec := range r {
|
||||
namefqdn := rec.GetLabelFQDN()
|
||||
if _, found := groups[namefqdn]; !found {
|
||||
order = append(order, namefqdn)
|
||||
}
|
||||
groups[namefqdn] = append(groups[namefqdn], rec)
|
||||
}
|
||||
return order, groups
|
||||
}
|
||||
|
||||
// PostProcessRecords does any post-processing of the downloaded DNS records.
|
||||
func PostProcessRecords(recs []*RecordConfig) {
|
||||
downcase(recs)
|
||||
|
Reference in New Issue
Block a user