mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
AZURE_DNS: Add support for Alias: AZURE_ALIAS() (#675)
* Add support for Alias in Azure * Actioned comments and added parse tests * GetTargetDebug * Go formatting
This commit is contained in:
@@ -79,7 +79,7 @@ func (dc *DomainConfig) Punycode() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case "A", "AAAA", "CAA", "NAPTR", "SOA", "SSHFP", "TXT", "TLSA":
|
||||
case "A", "AAAA", "CAA", "NAPTR", "SOA", "SSHFP", "TXT", "TLSA", "AZURE_ALIAS":
|
||||
// Nothing to do.
|
||||
default:
|
||||
msg := fmt.Sprintf("Punycode rtype %v unimplemented", rec.Type)
|
||||
|
@@ -95,6 +95,7 @@ type RecordConfig struct {
|
||||
TlsaMatchingType uint8 `json:"tlsamatchingtype,omitempty"`
|
||||
TxtStrings []string `json:"txtstrings,omitempty"` // TxtStrings stores all strings (including the first). Target stores only the first one.
|
||||
R53Alias map[string]string `json:"r53_alias,omitempty"`
|
||||
AzureAlias map[string]string `json:"azure_alias,omitempty"`
|
||||
|
||||
Original interface{} `json:"-"` // Store pointer to provider-specific record object. Used in diffing.
|
||||
}
|
||||
@@ -307,6 +308,12 @@ func (rc *RecordConfig) Key() RecordKey {
|
||||
// label with different alias types are considered separate.
|
||||
t = fmt.Sprintf("%s_%s", t, v)
|
||||
}
|
||||
} else if rc.AzureAlias != nil {
|
||||
if v, ok := rc.AzureAlias["type"]; ok {
|
||||
// Azure aliases append their alias type, so that records for the same
|
||||
// label with different alias types are considered separate.
|
||||
t = fmt.Sprintf("%s_%s", t, v)
|
||||
}
|
||||
}
|
||||
return RecordKey{rc.NameFQDN, t}
|
||||
}
|
||||
|
@@ -52,6 +52,9 @@ func (rc *RecordConfig) GetTargetCombined() string {
|
||||
case "R53_ALIAS":
|
||||
// Differentiate between multiple R53_ALIASs on the same label.
|
||||
return fmt.Sprintf("%s atype=%s zone_id=%s", rc.Target, rc.R53Alias["type"], rc.R53Alias["zone_id"])
|
||||
case "AZURE_ALIAS":
|
||||
// Differentiate between multiple AZURE_ALIASs on the same label.
|
||||
return fmt.Sprintf("%s atype=%s", rc.Target, rc.AzureAlias["type"])
|
||||
case "SOA":
|
||||
return fmt.Sprintf("%s %v %d %d %d %d %d", rc.Target, rc.SoaMbox, rc.SoaSerial, rc.SoaRefresh, rc.SoaRetry, rc.SoaExpire, rc.SoaMinttl)
|
||||
default:
|
||||
@@ -101,6 +104,8 @@ func (rc *RecordConfig) GetTargetDebug() string {
|
||||
content += fmt.Sprintf(" caatag=%s caaflag=%d", rc.CaaTag, rc.CaaFlag)
|
||||
case "R53_ALIAS":
|
||||
content += fmt.Sprintf(" type=%s zone_id=%s", rc.R53Alias["type"], rc.R53Alias["zone_id"])
|
||||
case "AZURE_ALIAS":
|
||||
content += fmt.Sprintf(" type=%s", rc.AzureAlias["type"])
|
||||
default:
|
||||
panic(fmt.Errorf("rc.String rtype %v unimplemented", rc.Type))
|
||||
// We panic so that we quickly find any switch statements
|
||||
|
Reference in New Issue
Block a user