Nutanix.VmmSDK
1.0.0
Prefix Reserved
dotnet add package Nutanix.VmmSDK --version 1.0.0
NuGet\Install-Package Nutanix.VmmSDK -Version 1.0.0
<PackageReference Include="Nutanix.VmmSDK" Version="1.0.0" />
<PackageVersion Include="Nutanix.VmmSDK" Version="1.0.0" />
<PackageReference Include="Nutanix.VmmSDK" />
paket add Nutanix.VmmSDK --version 1.0.0
#r "nuget: Nutanix.VmmSDK, 1.0.0"
#:package Nutanix.VmmSDK@1.0.0
#addin nuget:?package=Nutanix.VmmSDK&version=1.0.0
#tool nuget:?package=Nutanix.VmmSDK&version=1.0.0
.NET Client For Nutanix Virtual Machine Management APIs
The .NET client for Nutanix Virtual Machine Management APIs is designed for .NET client application developers offering them simple and flexible access to APIs that manage the life-cycle of virtual machines hosted on Nutanix.
Features
- Invoke Nutanix APIs with a simple interface.
- Handle Authentication seamlessly.
- Reduce boilerplate code implementation.
- Use standard methods for installation.
Version
- API version: v4.2
- Package version: 1.0.0
Version Negotiation
By default, the client negotiates the API version with the server to ensure compatibility. Version negotiation is enabled by default. To disable version negotiation and use a fixed API version, call the DisableVersionNegotiation() method on the ApiClient:
using Nutanix.Vmm.Client;
namespace Sample
{
class Program
{
static void Main(string[] args)
{
Configuration _config = new Configuration()
{
Host = "10.19.50.27",
Username = "admin",
Password = Configuration.CreateSecurePassword("password")
};
ApiClient client = new ApiClient(_config);
client.DisableVersionNegotiation(); // Disables automatic version negotiation
}
}
}
When version negotiation is disabled, the client will use the SDK's default API version.
Requirements.
- .NET 8 or higher
Usage
Installation
This library is distributed on Nuget.org. In order to add it as a dependency, please do the following:
In .csproj
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Nutanix.Vmm" Version="1.0.0" />
</ItemGroup>
</Project>
Configuration
The .NET client for Nutanix Virtual Machine Management APIs can be configured with the following parameters
| Parameter | Description | Required | Default Value |
|---|---|---|---|
| Host | IPv4/IPv6 address or FQDN of the cluster to which the client will connect to | Yes | N/A |
| Port | Port on the cluster to which the client will connect to | No | 9440 |
| Username | Username to connect to a cluster | Yes | N/A |
| Password | SecureString password to connect to a cluster (use Configuration.CreateSecurePassword or pass SecureString) | Yes | N/A |
| ApiKey | Gets or sets the API key based on the authentication name | No | N/A |
| Debugging | Runs the client in debug mode if specified | No | False |
| VerifySsl | Verify SSL certificate of cluster, the client will connect to | No | True |
| MaxRetryAttempts | Maximum number of retry attempts while connecting to the cluster | No | 5 |
| Timeout | Timeout in milliseconds for all operations | No | 30000 |
Sample Configuration
using Nutanix.Vmm.Client;
namespace Sample
{
class Program
{
private static Configuration _config = new Configuration()
{
Username = "admin", // UserName to connect to the cluster
Password = Configuration.CreateSecurePassword("password"), // SecureString password to connect to the cluster
Host = "10.19.50.27", // IPv4/IPv6 address or FQDN of the cluster
Port = 9440, // Port to which to connect to
};
static void Main(string[] args)
{
ApiClient client = new ApiClient(_config);
}
}
}
Authentication
Nutanix APIs currently support two type of authentication schemes:
- HTTP Basic Authentication - The .NET client can be configured using the username and password parameters to send Basic headers along with every request.
- API Key Authentication
- The .NET client can be configured to set an API key to send "X-ntnx-api-key" header with every request.
Additionally, "X-ntnx-api-key" header can be sent directly to an operation similar to the example explained in Operation specific headers section.using Nutanix.Vmm.Client; namespace Sample { class Program { static void Main(string[] args) { Configuration _config = new Configuration(); _config.AddApiKey("X-ntnx-api-key", "abcde12345"); ApiClient client = new ApiClient(_config); } } }
Retry Mechanism
The client can be configured to retry requests that fail with the following status codes. The numbers of seconds before which the next retry is power of 2, such as 2, 4, 8, ...
using Nutanix.Vmm.Client;
namespace Sample
{
class Program
{
private static Configuration _config = new Configuration()
{
MaxRetryAttempts = 5, // Max retry attempts while reconnecting on a loss of connection
};
static void main(string[] args)
{
ApiClient client = new ApiClient(_config);
}
}
}
Usage
Invoking an operation
using Nutanix.Vmm.Client;
using Nutanix.VmmSDK.Api;
using Nutanix.VmmSDK.Model.Vmm.V4.Content;
namespace Sample
{
class Program
{
// Configure the client
// ...
private Configuration _config = new Configuration();
public void performOperation()
{
ApiClient client = new ApiClient(_config);
ImagesApi imagesApi = new ImagesApi(client);
String extId = "ae2b15F4-bB60-ab51-EaAD-e4d7ADdd0Be3";
GetImageApiResponse getImageApiResponse = imagesApi.GetImageById(extId);
}
}
}
Request Options
The library provides the ability to specify additional options that can be applied directly on the 'ApiClient' object used to make network calls to the API. The library also provides a mechanism to specify operation specific headers.
Client headers
The 'ApiClient' can be configured to send additional headers on each request.
using Nutanix.Vmm.Client;
namespace Sample
{
class Program
{
static void Main(string[] args)
{
Configuration _config = new Configuration();
ApiClient client = new ApiClient(_config);
client.AddDefaultHeader("Accept-Encoding","gzip, deflate, br");
}
}
}
You can also modify the headers sent with each individual operation:
Operation specific headers
Nutanix APIs require that concurrent updates are protected using ETag headers. This would mean that the ETag header received in the response of a fetch (GET) operation should be used as an If-Match header for the modification (PUT) operation.
using Nutanix.Vmm.Client;
using Nutanix.VmmSDK.Api;
using Nutanix.VmmSDK.Model.Vmm.V4.Content;
namespace Sample
{
class Program
{
public void performOperation()
{
Configuration _config = new Configuration();
ApiClient client = new ApiClient(_config);
// perform GET call
ImagesApi imagesApi = new ImagesApi(client);
String extId = "ae2b15F4-bB60-ab51-EaAD-e4d7ADdd0Be3";
GetImageApiResponse getImageApiResponse = imagesApi.GetImageById(extId);
// Extract E-Tag Header
string eTagHeader = ApiClient.GetEtag(getImageApiResponse);
// ...
// Perform update call with received E-Tag reference
Image image = (Image) getImageApiResponse.Data;
// initialize/change parameters for update
Dictionary<string, object> opts = new Dictionary<string, object>();
opts["If-Match"] = eTagHeader;
imagesApi.UpdateImageById(image, extId, , opts);
}
}
}
List Operations
List operations for Nutanix APIs support pagination, filtering, sorting and projections. The table below details the parameters that can be used to set the options for pagination etc.
| Parameter | Description |
|---|---|
| page | specifies the page number of the result set. Must be a positive integer between 0 and the maximum number of pages that are available for that resource. Any number out of this range will lead to no results being returned. |
| limit | specifies the total number of records returned in the result set. Must be a positive integer between 0 and 100. Any number out of this range will lead to a validation error. If the limit is not provided a default value of 50 records will be returned in the result set |
| filter | allows clients to filter a collection of resources. The expression specified with $filter is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Expression specified with the $filter must conform to the OData V4.01 URL conventions. |
| orderby | allows clients to specify the sort criteria for the returned list of objects. Resources can be sorted in ascending order using asc or descending order using desc. If asc or desc are not specified the resources will be sorted in ascending order by default. For example, 'orderby=templateName desc' would get all templates sorted by templateName in desc order. |
| select | allows clients to request a specific set of properties for each entity or complex type. Expression specified with the $select must conform to the OData V4.01 URL conventions. If a $select expression consists of a single select item that is an asterisk (i.e., *), then all properties on the matching resource will be returned. |
| expand | allows clients to request related resources when a resource that satisfies a particular request is retrieved. Each expanded item is evaluated relative to the entity containing the property being expanded. Other query options can be applied to an expanded property by appending a semicolon-separated list of query options, enclosed in parentheses, to the property name. Permissible system query options are $filter,$select and $orderby. |
List Options can be passed to list operations in order to perform pagination, filtering etc.
using Nutanix.Vmm.Client;
using Nutanix.VmmSDK.Api;
using Nutanix.VmmSDK.Model.Vmm.V4.Content;
namespace Sample
{
class Program
{
public void performOperation()
{
// Configure the client
// ...
Configuration _config = new Configuration();
ApiClient client = new ApiClient(_config);
ImagesApi imagesApi = new ImagesApi(client);
int page = 0;
int limit = 50;
String filter = "string_sample_data";
String orderby = "string_sample_data";
String select = "string_sample_data";
ListImagesApiResponse listImagesApiResponse = imagesApi.ListImages(page, limit, filter, orderby, select);
}
}
}
The list of filterable and sortable fields with expansion keys can be found in the documentation here.
API Reference
This library has a full set of API Reference Documentation. This documentation is auto-generated, and the location may change.
License
This library is licensed under Apache 2.0 license. Full license text is available in LICENSE.
Contact us
In case of issues please reach out to us at the mailing list
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 90 | 5/29/2026 |