Created
January 26, 2021 06:07
-
-
Save cybergavin/ff7901dfe0be197a732f4add3fe931db to your computer and use it in GitHub Desktop.
Nutanix API Calls
This file contains hidden or 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
| # Get VM UUID from PC | |
| curl -k -X "POST" \ | |
| -H "${acceptHeader}" \ | |
| -H "${authHeader}" \ | |
| -H "${contentHeader}" \ | |
| -d '{"kind":"vm","filter":"'"vm_name==$userDataHostname"'"}' "${ntxApiEndpoint}" \ | |
| | jq -r --arg VM $userDataHostname '.entities[] | select (.spec.resources.guest_customization.cloud_init.custom_key_values.hostname==$VM) | .metadata.uuid' | |
| #Example Output: | |
| #--------------- | |
| % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 4907 100 4866 100 41 2964 24 0:00:01 0:00:01 --:--:-- 2967 | |
| 84926682-e09f-40f1-a46d-4e752fff142 | |
| # Mount NGT via PE | |
| curl -k -X "POST" \ | |
| -H "${acceptHeader}" \ | |
| -H "${authHeader}" \ | |
| -H "${contentHeader}" https://prismelement:9440/PrismGateway/services/rest/v1/vms/84926682-e09f-40f1-a46d-4e752fff1422/guest_tools/mount | |
| #Example Output: | |
| #--------------- | |
| {"value":true} | |
| # Enable NGT via PE | |
| curl -k -X "POST" \ | |
| -H "${acceptHeader}" \ | |
| -H "${authHeader}" \ | |
| -H "${contentHeader}" \ | |
| -d '{ | |
| "vmUuid": "84926682-e09f-40f1-a46d-4e752fff1422", | |
| "enabled": "true", | |
| "applications": {"file_level_restore": "true","vss_snapshot": "true"}}' https://prismelement:9440/PrismGateway/services/rest/v1/vms/84926682-e09f-40f1-a46d-4e752fff1422/guest_tools/ | |
| #Example Output: | |
| #--------------- | |
| {"vmId":"0005b671-e59e-4ab9-59d5-48df37d18390::84926682-e09f-40f1-a46d-4e752fff1422","vmUuid":"84926682-e09f-40f1-a46d-4e752fff1422","enabled":true,"applications":{"Vss Snapshot":true,"File Level Restore":true},"toolsMounted":true,"installedVersion":null,"clusterVersion":"1.7.5","vmName":"testvm","communicationLinkActive":false,"toRemove":false} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment