Skip to content

Instantly share code, notes, and snippets.

@codygreen
Created June 15, 2016 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codygreen/075d24fdb02a5de2a945d7ba4f094be2 to your computer and use it in GitHub Desktop.
Save codygreen/075d24fdb02a5de2a945d7ba4f094be2 to your computer and use it in GitHub Desktop.
AFM/APM Dynamic Firewall Rules
/*
* iRulesLX RPC for AFM/APM Dynmanic Address List
*
*/
/* Import the f5-nodejs module. */
var f5 = require('f5-nodejs');
var afm = require('./f5_afm');
/* Create a new rpc server for listening to TCL iRule calls. */
var ilx = new f5.ILXServer();
/**
* add address to AFM address list
*
* @params {String} address
* @return {Boolean} result
*/
ilx.addMethod('addAddress', function(req, res) {
afm.addAddress(req.params()[0], function(result) {
if(typeof result !== undefined) {
res.reply(true);
} else {
res.reply(false);
}
});
});
/**
* remove address from AFM address list
*
* @ params {String} address
* @ return {Boolean} result
*/
ilx.addMethod('deleteAddress', function(req, res) {
afm.deleteAddress(req.params()[0], function(result) {
if(typeof result !== undefined) {
res.reply(true);
} else {
res.reply(false);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment