Created
March 27, 2019 23:10
-
-
Save jpboyce/224d134a8e50298eddc801eb75348a98 to your computer and use it in GitHub Desktop.
Get Pool Names from a F5 Load balance via REST Operation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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