Skip to content

Instantly share code, notes, and snippets.

@imtrinity94
Forked from deangrant/getRestHostByName.js
Created July 18, 2022 08:57
Show Gist options
  • Save imtrinity94/27629af2266f2c5b4979130aa0a80ace to your computer and use it in GitHub Desktop.
Save imtrinity94/27629af2266f2c5b4979130aa0a80ace to your computer and use it in GitHub Desktop.
com.deangrant.http-rest/getRestHostByName
// Returns a collection of REST:RESTHost object types from the inventory service plugin
var getHosts = RESTHostManager.getHosts()
// Iterates the collection to return the REST:RESTHost object type and perform a match on the name attribute provided as an input parameter and returns the REST:RESTHost type if true.
for(var restHostId in getHosts){
var restHost = RESTHostManager.getHost(getHosts[restHostId])
if(restHost.name == name){
return restHost
} // if(restHost.name == name)
} // var restHost = RESTHostManager.getHost(getHosts[restHostId])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment