2019-07-24 04:33:32 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var request;
|
2019-07-25 16:13:59 +00:00
|
|
|
var defaults = {};
|
2019-07-24 04:33:32 +00:00
|
|
|
|
|
|
|
module.exports.create = function(config) {
|
|
|
|
return {
|
|
|
|
init: function(opts) {
|
|
|
|
request = opts.request;
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
zones: function(data) {
|
2019-07-25 16:13:59 +00:00
|
|
|
<<<<<<< HEAD
|
2019-07-25 15:56:01 +00:00
|
|
|
// console.info('List Zones', data);
|
|
|
|
return api('GET', '/' + account + '/zones')
|
|
|
|
.then(function(resp) {
|
|
|
|
return resp['body']['data'].map(function(elem) {
|
|
|
|
// console.log('DEBUG >>> elem.name: ' + elem.name);
|
|
|
|
return elem.name;
|
|
|
|
});
|
|
|
|
});
|
2019-07-25 16:13:59 +00:00
|
|
|
=======
|
|
|
|
//console.info('List Zones', data);
|
|
|
|
throw Error('listing zones not implemented');
|
|
|
|
>>>>>>> parent of 16db087... integration tests passed
|
2019-07-24 04:33:32 +00:00
|
|
|
},
|
|
|
|
set: function(data) {
|
|
|
|
// console.info('Add TXT', data);
|
2019-07-25 16:13:59 +00:00
|
|
|
throw Error('setting TXT not implemented');
|
|
|
|
},
|
|
|
|
remove: function(data) {
|
|
|
|
// console.info('Remove TXT', data);
|
|
|
|
throw Error('removing TXT not implemented');
|
2019-07-24 04:33:32 +00:00
|
|
|
},
|
|
|
|
get: function(data) {
|
|
|
|
// console.info('List TXT', data);
|
2019-07-25 16:13:59 +00:00
|
|
|
<<<<<<< HEAD
|
2019-07-25 15:56:01 +00:00
|
|
|
|
|
|
|
return api('GET', '/' + account + '/zones/' + data.challenge.dnsZone + '/records')
|
|
|
|
.then(function(resp) {
|
|
|
|
|
2019-07-25 16:06:56 +00:00
|
|
|
var record = resp.body.data.filter(function (record) {
|
2019-07-25 15:56:01 +00:00
|
|
|
return data.challenge.dnsAuthorization === record.content;
|
|
|
|
})[0];
|
|
|
|
|
2019-07-25 16:06:56 +00:00
|
|
|
if(txtRecord) return { dnsAuthorization: record.content };
|
2019-07-25 15:56:01 +00:00
|
|
|
else return null;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
remove: function(data) {
|
|
|
|
|
|
|
|
return api('GET', '/' + account + '/zones/' + data.challenge.dnsZone + '/records')
|
|
|
|
.then(function(resp) {
|
|
|
|
|
|
|
|
var record = resp.body.data.filter(function (record) {
|
|
|
|
return data.challenge.dnsAuthorization === record.content;
|
|
|
|
})[0];
|
|
|
|
|
|
|
|
if(record) {
|
|
|
|
return api('DELETE', '/' + account + '/zones/' + data.challenge.dnsZone + '/records/' + record.id)
|
|
|
|
.then(function(resp) {
|
|
|
|
// console.info('DEBUG >>> resp: ', JSON.stringify(resp, null, 2));
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
throw new Error('Txt Record not found for removal');
|
|
|
|
}
|
|
|
|
});
|
2019-07-25 16:13:59 +00:00
|
|
|
=======
|
|
|
|
throw Error('listing TXTs not implemented');
|
|
|
|
>>>>>>> parent of 16db087... integration tests passed
|
2019-07-24 04:33:32 +00:00
|
|
|
}
|
2019-07-25 16:13:59 +00:00
|
|
|
};
|
2019-07-24 04:33:32 +00:00
|
|
|
};
|