The code samples provided here are intended as standalone examples. They can be downloaded, copied and/or modified in any way you see fit.
Please be aware that all code samples provided here are unofficial in nature, are provided as examples only, are unsupported and will need to be heavily modified before they can be used in a production environment.
Most code samples can be directly accessed from the NutanixDev GitHub code samples repo. Larger samples will be published via dedicated repos when required.
These samples require Python 3.7 or later and demonstrate complete, standalone scripts for carrying out common API operations.
For easy sharing of parameters between scripts, most scripts accept their JSON payloads via an on-disk JSON-formatted text file.
Most scripts utilise requests, urllib3, getpass, argparse and json modules.
Repo directory: python
These samples are written specifically for use with Bash Shell; please note that modification will be required before use with the sh shell. All scripts are standalone and can be run without any other script dependencies.
All scripts utilise jq, a free sed-like JSON processor. JQ can be downloaded from here.
Repo directory: shell
Note: This code sample is intended for use within a Nutanix CVM (Controller Virtual Machine) SSH session.
These playbooks are provided as examples of how common tasks can be automated using Ansible. Some modification may be required before these playbooks are used
Ansible installation instructions can be found here.
Repo directory: ansible
These samples are intended for use with Visual Studio. Visual Studio Community can be downloaded from here.
All C# code samples utilise Newtonsoft.Json, a popular high-performance JSON framework for .NET. Please see here for instructions on installing Newtonsoft.Json into your Visual Studio environment.
Repo directory: csharp
A default installation of PowerShell, e.g. on Windows 10 or Windows 2016 (or later) should have all required packages available.
To run these scripts the PowerShell ExecutionPolicy will need to be set to RemoteSigned. To do this, run the following command in an administrative PowerShell session:
Repo directory: powershell
All code samples are covered under the Open Source MIT license, as follows:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.