Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
create_vm_v3_basic
create_vm_v3_basic.json
readme.rst
script_output.png

readme.rst

Nutanix Developer Portal Code Samples - Bash Shell

To use the Bash Shell code samples, the following environment is recommended.

  • curl command available
  • jq (official documentation for jq)
  • The accompanying JSON files from this repository (instructions and usage provided below).
  • A suitable editor, e.g. Microsoft Visual Studio Code for GUI editing or vi for terminal editing.
  • Access to a Nutanix Cluster for API testing purposes.
  • Nutanix Community Edition is supported but may not always provide the exact same APIs as a "full" Nutanix cluster.

Note

The readme below assumes you are creating the scripts from scratch and have not cloned the entire repository to your local system.

Bash Shell Script Usage

The provided bash shell scripts are designed to be standalone and can be run without additional dependencies beyond those provided above.

The examples and screenshots below are from the create_vm_v3_basic sample. This sample uses create_vm_v3_basic.json for the request parameters.

  1. Create a new file:

    touch ~/create_vm_v3_basic
  2. Open the new file in vi:

    vi ~/create_vm_v3_basic
  3. Have the code sample open in your browser.

  4. Copy the script source to your clipboard.

  5. Enable vi INSERT mode by pressing i.

  6. Paste the script source into vi by pressing Ctrl-Shift-V (typical for Linux terminals) or by pressing the middle mouse button, if available.

    Note

    The copy and paste steps don't really need to be included as they will vary from system to system. They're included here for completeness' sake only.

  7. Exit vi INSERT mode by pressing ESC.

  8. Save the file by using the vi save and quit keystroke sequence:

  9. Make the script executable:

  10. Repeat steps 1-8 for the accompanying JSON file (the JSON file does not need to be executable). This file is required as it contains the parameters used for cURL request:

    • Copy the JSON source into the local clipboard, if using the example from the repository
    • In the terminal, create the JSON file and add the contents:
    • Press "i" for vi INSERT mode
    • Paste the JSON into vi
    • Press ESC to exit INSERT mode
    • Save the file by using the vi save and quit keystroke sequence ":wq", as before (without the quotes!)
  11. Run the script:

    script_output.png
  12. Check the output to make sure the request has a state of PENDING.

You can’t perform that action at this time.