diff --git a/src/dns/interface.js b/src/dns/interface.js new file mode 100644 index 000000000..227d35b9f --- /dev/null +++ b/src/dns/interface.js @@ -0,0 +1,66 @@ +'use strict'; + +// ------------------------------------------- +// This file just describes the interface +// +// New backends can start from here +// ------------------------------------------- + +exports = module.exports = { + upsert: upsert, + get: get, + del: del, + getChangeStatus: getChangeStatus +}; + +var assert = require('assert'), + SubdomainError = require('../subdomains.js').SubdomainError, + util = require('util'); + +function upsert(dnsConfig, zoneName, subdomain, type, values, callback) { + assert.strictEqual(typeof dnsConfig, 'object'); + assert.strictEqual(typeof zoneName, 'string'); + assert.strictEqual(typeof subdomain, 'string'); + assert.strictEqual(typeof type, 'string'); + assert(util.isArray(values)); + assert.strictEqual(typeof callback, 'function'); + + // Result: backend specific change id, to be passed into getChangeStatus() + + callback(new Error('not implemented')); +} + +function get(dnsConfig, zoneName, subdomain, type, callback) { + assert.strictEqual(typeof dnsConfig, 'object'); + assert.strictEqual(typeof zoneName, 'string'); + assert.strictEqual(typeof subdomain, 'string'); + assert.strictEqual(typeof type, 'string'); + assert.strictEqual(typeof callback, 'function'); + + // Result: Array of matching DNS records in string format + + callback(new Error('not implemented')); +} + +function del(dnsConfig, zoneName, subdomain, type, values, callback) { + assert.strictEqual(typeof dnsConfig, 'object'); + assert.strictEqual(typeof zoneName, 'string'); + assert.strictEqual(typeof subdomain, 'string'); + assert.strictEqual(typeof type, 'string'); + assert(util.isArray(values)); + assert.strictEqual(typeof callback, 'function'); + + // Result: none + + callback(new Error('not implemented')); +} + +function getChangeStatus(dnsConfig, changeId, callback) { + assert.strictEqual(typeof dnsConfig, 'object'); + assert.strictEqual(typeof changeId, 'string'); + assert.strictEqual(typeof callback, 'function'); + + // Result: current change state as string. Upstream code checks for 'INSYNC' + + callback(new Error('not implemented')); +}