acme-dns-01-dnsimple.js/lib/index.js

78 lines
2.0 KiB
JavaScript

'use strict';
var request;
var defaults = {};
module.exports.create = function(config) {
return {
init: function(opts) {
request = opts.request;
return null;
},
zones: function(data) {
<<<<<<< HEAD
// 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;
});
});
=======
//console.info('List Zones', data);
throw Error('listing zones not implemented');
>>>>>>> parent of 16db087... integration tests passed
},
set: function(data) {
// console.info('Add TXT', data);
throw Error('setting TXT not implemented');
},
remove: function(data) {
// console.info('Remove TXT', data);
throw Error('removing TXT not implemented');
},
get: function(data) {
// console.info('List TXT', data);
<<<<<<< HEAD
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(txtRecord) return { dnsAuthorization: record.content };
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');
}
});
=======
throw Error('listing TXTs not implemented');
>>>>>>> parent of 16db087... integration tests passed
}
};
};