Skip to content

Instantly share code, notes, and snippets.

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 johnddias/e7375d18676612776fed9bebbeb0561c to your computer and use it in GitHub Desktop.
Save johnddias/e7375d18676612776fed9bebbeb0561c to your computer and use it in GitHub Desktop.
Get vROps Resource ID from UUID
import requests
import json
def getResourceId(context, inputs):
if "verify" not in inputs.keys():
inputs["verify"] = True
headers = {'Content-type':'application/json','Accept':'application/json','Authorization':'vRealizeOpsToken '+ inputs["token"]}
payload = {
'propertyName':'summary|UUID',
'propertyValue':inputs["vmUUID"]
}
r = requests.request('GET','https://vrops-fielddemo.cmbu.local/suite-api/api/resources',params=payload, headers=headers, verify=inputs["verify"])
print (r.text)
resource = json.loads(r.text)
if not resource["resourceList"]:
return()
else:
return(resource["resourceList"][0]["identifier"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment