1
0
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:
Vatsalya Goel
2020-03-02 20:25:42 +04:00
committed by GitHub
parent 56b448f329
commit 884118f6dd
16 changed files with 384 additions and 130 deletions

View File

@ -165,6 +165,31 @@ var AAAA = recordBuilder('AAAA');
// ALIAS(name,target, recordModifiers...)
var ALIAS = recordBuilder('ALIAS');
// AZURE_ALIAS(name, type, target, recordModifiers...)
var AZURE_ALIAS = recordBuilder('AZURE_ALIAS', {
args: [
['name', _.isString],
['type', validateAzureAliasType],
['target', _.isString],
],
transform: function(record, args, modifier) {
record.name = args.name;
record.target = args.target;
if (_.isObject(record.azure_alias)) {
record.azure_alias['type'] = args.type;
} else {
record.azure_alias = { type: args.type };
}
},
});
function validateAzureAliasType(value) {
if (!_.isString(value)) {
return false;
}
return ['A', 'AAAA', 'CNAME'].indexOf(value) !== -1;
}
// R53_ALIAS(name, target, type, recordModifiers...)
var R53_ALIAS = recordBuilder('R53_ALIAS', {
args: [
@ -210,7 +235,7 @@ function validateR53AliasType(value) {
'SPF',
'SRV',
'NAPTR',
].indexOf(value) != -1
].indexOf(value) !== -1
);
}
@ -741,7 +766,8 @@ function CAA_BUILDER(value) {
(!value.issue && !value.issuewild) ||
(value.issue &&
value.issue.length == 0 &&
value.issuewild && value.issuewild.length == 0)
value.issuewild &&
value.issuewild.length == 0)
) {
throw 'CAA_BUILDER requires at least one entry at issue or issuewild';
}