provider/azure.go
func (p *AzureProvider) Records() (endpoints []*endpoint.Endpoint, _ error) {
	zones, err := p.zones()
	if err != nil {
		return nil, err
	}

	for _, zone := range zones {
		err := p.iterateRecords(*zone.Name, func(recordSet dns.RecordSet) bool {
			if recordSet.Name == nil || recordSet.Type == nil {
				log.Error("Skipping invalid record set with nil name or type.")
				return true
			}
			recordType := strings.TrimLeft(*recordSet.Type, "Microsoft.Network/dnszones/")
			if !supportedRecordType(recordType) {
				return true
			}
			name := formatAzureDNSName(*recordSet.Name, *zone.Name)
			targets := extractAzureTargets(&recordSet)
			if len(targets) == 0 {
				log.Errorf("Failed to extract targets for '%s' with type '%s'.", name, recordType)
				return true
			}
			var ttl endpoint.TTL
			if recordSet.TTL != nil {
				ttl = endpoint.TTL(*recordSet.TTL)
			}

			ep := endpoint.NewEndpointWithTTL(name, recordType, endpoint.TTL(ttl), targets...)
			log.Debugf(
				"Found %s record for '%s' with target '%s'.",
				ep.RecordType,
				ep.DNSName,
				ep.Targets,
			)
			endpoints = append(endpoints, ep)
			return true
		})
		if err != nil {
			return nil, err
		}
	}
	return endpoints, nil
}
func (p *AzureProvider) Records() (endpoints []*endpoint.Endpoint, _ error) {
	zones, err := p.zones()
	if err != nil {
		return nil, err
	}

	for _, zone := range zones {
		err := p.iterateRecords(*zone.Name, func(recordSet dns.RecordSet) bool {
			if recordSet.Name == nil || recordSet.Type == nil {
				log.Error("Skipping invalid record set with nil name or type.")
				return true
			}
			recordType := strings.TrimLeft(*recordSet.Type, "Microsoft.Network/dnszones/")
			if !supportedRecordType(recordType) {
				return true
			}
			name := formatAzureDNSName(*recordSet.Name, *zone.Name)
			targets := extractAzureTargets(&recordSet)
			if len(targets) == 0 {
				log.Errorf("Failed to extract targets for '%s' with type '%s'.", name, recordType)
				return true
			}
			var ttl endpoint.TTL
			if recordSet.TTL != nil {
				ttl = endpoint.TTL(*recordSet.TTL)
			}

			ep := endpoint.NewEndpointWithTTL(name, recordType, endpoint.TTL(ttl), targets...)
			log.Debugf(
				"Found %s record for '%s' with target '%s'.",
				ep.RecordType,
				ep.DNSName,
				ep.Targets,
			)
			endpoints = append(endpoints, ep)
			return true
		})
		if err != nil {
			return nil, err
		}
	}
	return endpoints, nil
}
func ( p * AzureProvider ) Records ( ) ( endpoints [ ] * endpoint . Endpoint , _ error ) { zones , err := p . zones ( ) if err != nil { return nil , err } for _ , zone := range zones { err := p . iterateRecords ( * zone . Name , func ( recordSet dns . RecordSet ) bool { if recordSet . Name == nil || recordSet . Type == nil { log . Error ( " " ) return true } recordType := strings . TrimLeft ( * recordSet . Type , " " ) if ! supportedRecordType ( recordType ) { return true } name := formatAzureDNSName ( * recordSet . Name , * zone . Name ) targets := extractAzureTargets ( & recordSet ) if len ( targets ) == 0 { log . Errorf ( " " , name , recordType ) return true } var ttl endpoint . TTL if recordSet . TTL != nil { ttl = endpoint . TTL ( * recordSet . TTL ) } ep := endpoint . NewEndpointWithTTL ( name , recordType , endpoint . TTL ( ttl ) , targets ... ) log . Debugf ( " " , ep . RecordType , ep . DNSName , ep . Targets , ) endpoints = append ( endpoints , ep ) return true } ) if err != nil { return nil , err } } return endpoints , nil }
// Records gets the current records.
//
// Returns the current records or an error if the operation failed.
Records gets the current records . Returns the current records or an error if the operation failed .