Skip to content

Instantly share code, notes, and snippets.

@jpboyce
Created March 27, 2019 23:10
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 jpboyce/224d134a8e50298eddc801eb75348a98 to your computer and use it in GitHub Desktop.
Save jpboyce/224d134a8e50298eddc801eb75348a98 to your computer and use it in GitHub Desktop.
Get Pool Names from a F5 Load balance via REST Operation
/*
This script assumes an Input called restOperation of the type REST:RESTOperation and has a return type of Array/String
*/
// Init variables
var inputs = [""];
var content = "";
var poolList = new Array;
// Create request
var request = restOperation.createRequest(inputs,content);
// Get response
var response = request.execute();
// Parse JSON
var jsonObject = JSON.parse(response.contentAsString);
var jsonItems = jsonObject.items
// Iterate - extracting the name value and pushing it into the poolList array
for each (var x in jsonItems) {
System.log(x.name);
poolList.push(x.name);
}
// return populated poolList array
return poolList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment