1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

ROUTE53: fix R53_ZONE() handling for domains (#2306)

Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
Tom Limoncelli
2023-05-02 13:04:59 -04:00
committed by GitHub
parent 49e9279388
commit 489be2e3dc
52 changed files with 151 additions and 89 deletions

View File

@@ -134,7 +134,6 @@ func (r *route53Provider) ListZones() ([]string, error) {
}
func (r *route53Provider) getZones() error {
// TODO(tlim) This should memoize itself.
if r.zonesByDomain != nil {
return nil
@@ -212,20 +211,34 @@ func (r *route53Provider) GetNameservers(domain string) ([]*models.Nameserver, e
return models.ToNameservers(nss)
}
func (r *route53Provider) GetZoneRecords(domain string) (models.Records, error) {
func (r *route53Provider) GetZoneRecords(domain string, meta map[string]string) (models.Records, error) {
if err := r.getZones(); err != nil {
return nil, err
}
var zone r53Types.HostedZone
// If the zone_id is specified in meta, use it.
if zoneID, ok := meta["zone_id"]; ok {
zone = r.zonesByID[zoneID]
return r.getZoneRecords(zone)
}
// fmt.Printf("DEBUG: ROUTE53 zones:\n")
// for i, j := range r.zonesByDomain {
// fmt.Printf(" %s: %v\n", i, aws.ToString(j.Id))
// }
// Otherwise, use the domain name to look up the zone.
if zone, ok := r.zonesByDomain[domain]; ok {
return r.getZoneRecords(zone)
}
// Not found there? Error.
return nil, errDomainNoExist{domain}
}
func (r *route53Provider) getZone(dc *models.DomainConfig) (r53Types.HostedZone, error) {
// TODO(tlim) This should memoize itself.
if err := r.getZones(); err != nil {
return r53Types.HostedZone{}, err