Corsinvest.ProxmoxVE.Api.Shell
8.2.5
dotnet add package Corsinvest.ProxmoxVE.Api.Shell --version 8.2.5
NuGet\Install-Package Corsinvest.ProxmoxVE.Api.Shell -Version 8.2.5
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Shell" Version="8.2.5" />
paket add Corsinvest.ProxmoxVE.Api.Shell --version 8.2.5
#r "nuget: Corsinvest.ProxmoxVE.Api.Shell, 8.2.5"
// Install Corsinvest.ProxmoxVE.Api.Shell as a Cake Addin #addin nuget:?package=Corsinvest.ProxmoxVE.Api.Shell&version=8.2.5 // Install Corsinvest.ProxmoxVE.Api.Shell as a Cake Tool #tool nuget:?package=Corsinvest.ProxmoxVE.Api.Shell&version=8.2.5
Corsinvest.ProxmoxVE.Api
Proxmox VE Client API .Net
______ _ __
/ ____/___ __________(_)___ _ _____ _____/ /_
/ / / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
/ /___/ /_/ / / (__ ) / / / / |/ / __(__ ) /_
\____/\____/_/ /____/_/_/ /_/|___/\___/____/\__/
Corsinvest for Proxmox VE Api Client (Made in Italy)
Copyright and License
Copyright: Corsinvest Srl For licensing details please visit LICENSE
Commercial Support
This software is part of a suite of tools called cv4pve-tools. If you want commercial support, visit the site
General
The client is generated from a JSON Api on Proxmox VE.
Main features
- Easy to learn
- Method named
- Implementation respect the Api structure of Proxmox VE
- Set ResponseType json, png
- Full class and method generated from documentation (about client)
- Comment any method and parameters
- Parameters indexed eg [n] is structured in array index and value
- Tree structure
- client.Nodes["pve1"].Qemu[100].Snapshot().snapshotList().Response.data
- Return data Proxmox VE
- Logger with MicrosMicrosoft.Extensions.Logging
- Return result
- Request
- Response
- Status
- Last result action
- Task utility
- WaitForTaskToFinish
- TaskIsRunning
- GetExitStatusTask
- Method direct access
- Get
- Create (Post)
- Set (Put)
- Delete
- Login return bool if access
- Return Result class more information
- ClientBase lite function
- Form Proxmox VE 6.2 support Api Token for user
- Async / Await
- Add model in Shared library for decode json
- Add Extension method Get to decode in json from result in Extension library
- Login with One-time password for Two-factor authentication
- Set Timeout for the Connection.
- Validate certificate SSL, default not validate
Api token
From version 6.2 of Proxmox VE is possible to use Api token. This feature permit execute Api without using user and password. If using Privilege Separation when create api token remember specify in permission. Format USER@REALM!TOKENID=UUID
Result
The result is class Result and contain properties:
- Response returned from Proxmox VE (data,errors,...) dynamic ExpandoObject
- ResponseToDictionary return response to dictionary
IDictionary<String, object>
- ResponseInError (bool) : Contains errors from Proxmox VE.
- StatusCode (System.Net.HttpStatusCode): Status code of the HTTP response.
- ReasonPhrase (string): The reason phrase which typically is sent by servers together with the status code.
- IsSuccessStatusCode (bool) : Gets a value that indicates if the HTTP response was successful.
- GetError() (string) : Get error.
Example result:
{
"data": {
"smbios1": "uuid=9246585e-0c8b-4d02-8fe2-f48fd0da3975",
"ide2": "none,media=cdrom",
"onboot": 1,
"boot": "cdn",
"cores": 2,
"agent": 1,
"memory": 4096,
"numa": 0,
"bootdisk": "virtio0",
"sockets": 1,
"net0": "virtio=3A:39:38:30:36:31,bridge=vmbr0",
"parent": "auto4hours170904080002",
"digest": "acafde32daab50bce801fef2e029440c54ebe2f7",
"vga": "qxl",
"virtio0": "local-zfs:vm-100-disk-1,cache=writeback,size=50G",
"ostype": "win8",
"name": "phenometa"
}
}
Usage
//if you want use lite version only get/set/create/delete use PveClientBase
var client = new PveClient("10.92.90.91");
if (await client.Login("root", "password"))
{
var vm = await client.Nodes["pve1"].Qemu[100];
//config vm
var config = await vm.Config.VmConfig();
Console.WriteLine(JsonConvert.SerializeObject(config.Response,Formatting.Indented));
//create snapshot
var response = await vm.Snapshot.Snapshot("pippo2311");
//update snapshot description
await vm.Snapshot["pippo2311"].Config.UpdateSnapshotConfig("description");
//delete snapshot
await vm.Snapshot["pippo2311"].Delsnapshot();
//list of snapshot
foreach (var snapshot in (await vm.Snapshot.SnapshotList()).Response.data)
{
Console.WriteLine(JsonConvert.SerializeObject(snapshot,Formatting.Indented));
Console.WriteLine(snapshot.name);
}
//change response type from json to png
client.ResponseType = "png";
var dataImg = client.Nodes["pve1"].Rrd.Rrd("cpu", "day").Response;
Console.WriteLine("<img src=\"{dataImg}\" \>");
}
//using Api Token
var client = new PveClient("10.92.100.33");
client.ApiToken = "root@pam!qqqqqq=8a8c1cd4-d373-43f1-b366-05ce4cb8061f";
var version = await client.Version.Version();
Console.WriteLine(JsonConvert.SerializeObject(version.Response.data, Formatting.Indented));
Corsinvest.ProxmoxVE.Extension
Extension add functionality on Api.
- ApiExplorer
- Retrive VM/CT data from name or id
- Simplify management of VM/CT e.g snapshot
- Extension method Get to decode json from result e.g Client.Cluster.Status.Get() return IEnumerable<IClusterStatus>
Corsinvest.ProxmoxVE.Shared
Contain model for Json conversion and utility.
Corsinvest.ProxmoxVE.Metadata
Read documentation ProxmoxVE API and extract structure.
Corsinvest.ProxmoxVE.Shell
Utility for console application.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- Corsinvest.ProxmoxVE.Api.Extension (>= 8.2.5)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Microsoft.Extensions.Logging.Console (>= 7.0.0)
- System.CommandLine (>= 2.0.0-beta4.22272.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Corsinvest.ProxmoxVE.Api.Shell:
Repository | Stars |
---|---|
Corsinvest/cv4pve-autosnap
Automatic snapshot tool for Proxmox VE
|
|
Corsinvest/cv4pve-pepper
Launching SPICE remote-viewer for Proxmox VE VDI client
|
Version | Downloads | Last updated |
---|---|---|
8.2.5 | 102 | 9/19/2024 |
8.2.4 | 82 | 8/13/2024 |
8.2.3 | 57 | 7/15/2024 |
8.2.2 | 71 | 6/14/2024 |
8.2.1 | 199 | 5/8/2024 |
8.2.0 | 159 | 4/26/2024 |
8.1.7 | 71 | 4/19/2024 |
8.1.6 | 66 | 4/2/2024 |
8.1.5 | 79 | 3/28/2024 |
8.1.4 | 97 | 3/22/2024 |
8.1.3 | 66 | 2/29/2024 |
8.1.2 | 84 | 2/13/2024 |
8.1.1 | 78 | 2/12/2024 |
8.1.0 | 171 | 12/11/2023 |
8.0.3 | 250 | 9/22/2023 |
8.0.2 | 90 | 9/18/2023 |
8.0.1 | 125 | 8/11/2023 |
8.0.0 | 110 | 6/23/2023 |
7.4.6 | 129 | 6/16/2023 |
7.4.5 | 110 | 6/8/2023 |
7.4.4 | 110 | 5/29/2023 |
7.4.3 | 99 | 5/10/2023 |
7.4.2 | 108 | 5/5/2023 |
7.4.1 | 141 | 4/14/2023 |
7.4.0 | 137 | 3/23/2023 |
7.3.8 | 153 | 11/3/2022 |
7.3.7 | 375 | 9/7/2022 |
7.3.6 | 142 | 6/16/2022 |
7.3.5 | 140 | 6/14/2022 |
7.3.4 | 145 | 5/27/2022 |
7.3.2 | 235 | 5/3/2022 |
7.3.1 | 149 | 4/26/2022 |
7.3.0 | 139 | 4/24/2022 |
3.2.0 | 523 | 1/31/2022 |
3.1.2 | 337 | 1/4/2022 |
3.1.1 | 339 | 12/16/2021 |
3.1.0 | 653 | 12/6/2021 |
3.0.0 | 426 | 10/31/2021 |
2.8.1 | 418 | 5/1/2021 |
2.8.0 | 390 | 4/28/2021 |
2.7.0 | 534 | 12/15/2020 |
2.6.11 | 515 | 10/19/2020 |
2.6.10 | 459 | 10/15/2020 |
2.6.9 | 451 | 10/12/2020 |
2.6.8 | 451 | 9/28/2020 |
2.6.7 | 467 | 9/28/2020 |
2.6.6 | 449 | 9/25/2020 |
2.6.5 | 505 | 8/24/2020 |
2.6.3 | 527 | 7/30/2020 |
2.6.2 | 505 | 7/23/2020 |
2.6.1 | 487 | 7/20/2020 |
2.6.0 | 505 | 7/17/2020 |
2.5.7 | 494 | 7/14/2020 |
2.5.6 | 489 | 7/13/2020 |
2.5.4 | 482 | 6/22/2020 |
2.5.3 | 541 | 6/20/2020 |
2.5.2 | 530 | 6/20/2020 |
2.5.1 | 533 | 6/20/2020 |
2.5.0 | 515 | 6/20/2020 |
2.4.0 | 503 | 5/12/2020 |
2.3.3 | 513 | 5/10/2020 |
2.3.2 | 522 | 5/8/2020 |
2.3.1 | 487 | 4/24/2020 |
2.3.0 | 484 | 4/16/2020 |
1.3.0 | 496 | 4/15/2020 |
1.2.0 | 506 | 2/25/2020 |
1.1.1 | 535 | 2/21/2020 |
1.1.0 | 624 | 1/30/2020 |
1.0.1 | 524 | 12/27/2019 |
1.0.0 | 569 | 12/17/2019 |