python java go powershell

Python API client for nutanix

Overview

This Python package is automatically generated, Details of this project:

Requirements.

Python 2.7 and 3.4+

Download

You can download this Python API client here.

Installation & Usage-Python

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Getting Started

Follow the installation & usage and after successfull installation of tools and software, run the following sample code.

import nutanix

Sample Code:

import time
import nutanix
from nutanix.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basicAuth
nutanix.configuration.username = 'YOUR_USERNAME'
nutanix.configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = nutanix.AppblueprintApi
get_entities_request = nutanix.AppBlueprintListMetadata() # AppBlueprintListMetadata | 

try:
    # List the App Blueprints
    api_response = api_instance.app_blueprints_list_post(get_entities_request)
    pprint(api_response)
except ApiException as e:
    print "Exception when calling AppblueprintApi->app_blueprints_list_post: %s\n" % e 

Go API client for nutanix

Overview

This GO package is automatically generated, Details of this project:

Requirements.

Go : go version >= 1.7.4

Download

You can download this Go API client here.

Installation & Usage-Go

Download and extract gosdk packages in src/nutanix folder. To install the package use command :

go get -v ./…

import (
        "nutanix"
)

Getting Started

Please follow the Installation & Usage and then run the following:

Sample Code:

import (
        "nutanix"
)
func main() {
    
    nutanix.Configuration.Username := "YOUR_USERNAME"
    nutanix.Configuration.Password := "YOUR_PASSWORD"
	nutanix.Configuration.BasePath := "URL"
    
    // create an instance of the API class
    api_instance := nutanix.AppblueprintApi
    getEntitiesRequest := nutanix.AppBlueprintListMetadata() // AppBlueprintListMetadata | 

    // List the App Blueprints
    appblueprintslistpost_response, , api_response, err := api_instance.AppBlueprintsListPost(getEntitiesRequest)
    if err != nil {
        fmt.Println("Error : ", err)
    } else {
        fmt.Println("Api response : ", *api_response)
        fmt.Println("AppBlueprintsListPost response : ", *appblueprintslistpost_response)
    } 
}

Powershell API client for nutanix

This generator creates C# code targeting the .Net 2.0 framework. The resulting DLLs can be used in places where .Net 2.0 is the maximum supported version, such as in the Unity3d.

Overview

This Python package is automatically generated, Details of this project:

Requirements.

PowerShell

To import powershell API client dependencies,

Add-Type -Path "RestSharp.Net2.dll"
Add-Type -Path "Newtonsoft.Json.dll"

Download

You can download this PowerShell API client here.

Installation & Usage-Powershell

Compile the downloaded sdk by running the compile-mono.sh to generate the dll library. You can find the script inside the downloaded sdk itself. You can find the generated dll inside bin folder. Generated DLL should be imported to powershell script.

Also import the "Newtonsoft.Json.dll" and "RestSharp.Net2.dll" from the vendor folder.

Getting Started

Please follow the Installation & Usage and then run the following:

To ignore ssl certificate verification in powershell

# For SSL connection
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

Sample code:

# Including DDL & s/w modules
Add-Type -Path "nutanix.dll"

# Configure HTTP basic authorization: basicAuth
[nutanix.Client.Configuration]::Username = "YOUR_NAME"
[nutanix.Client.Configuration]::Password = "YOUR_PASSWORD"

# Base URL
$basepath = "Base URL"

# Metadata Object for request
$getEntitiesRequest = New-Object -TypeName nutanix.AppBlueprintListMetadata # AppBlueprintListMetadata | 
#create object for AppblueprintApi RestAPI.
$api_instance = New-Object -TypeName nutanix.AppblueprintApi
#Function Calls
try
{
# List the App Blueprints
    $response = ($api_instance.AppBlueprintsListPost($getEntitiesRequest)).ToJson()
    Write-Host $response
}catch{
    Write-Host "Failed to call AppblueprintApi->AppBlueprintsListPost "
    return $_
}