OnApp API .NET Wrapper

OnAppI needed to interface the OnApp API at some of our installments at Solido Hosting. Sadly there is no official .NET wrapper to the API so I decided to make my own.

By design OnApp returns two-dimensional records-sets making .NET de-serialization a bit messy.

Currently its supporting the following methods:

  • Virtual Machines
  • Hypervisor
  • Hypervisor Groups
  • Image Template
  • Logs
  • Transactions
  • Network

Check it out on my Github page

Samples:

List: 

           
Client.Instance.Host = "http://controlpanel/";
Client.Instance.Username = "admin";
Client.Instance.Password = "changeme";

Console.WriteLine("");
Console.WriteLine("VIRTUAL MACHINES");
Console.WriteLine("-----------");
var virtualMachines = new VirtualMachine();

var machines = virtualMachines.GetAll();
foreach (var h in machines)
{
    Console.WriteLine(h.Id + " - " + h.Label + " - " + h.Built + " - " + h.Booted);
}

Console.WriteLine("");
Console.WriteLine("HYPERVISORS GROUPS");
Console.WriteLine("-----------");
var hypervisorGroup = new HypervisorGroup();
foreach (var h in hypervisorGroup.GetAll())
{

    Console.WriteLine(h.Id + " - " + h.Label);

    Console.WriteLine("- Members in group");
    foreach (var hyper in h.GetHypervisorsInZone())
    {
        Console.WriteLine("- " + hyper.Id + " - " + hyper.Label);
    }
}

Console.WriteLine("");
Console.WriteLine("HYPERVISORS");
Console.WriteLine("-----------");
var hypervisors = new Hypervisor();
foreach (var h in hypervisors.GetAll())
{

    Console.WriteLine(h.Id + " - " + h.Label);
}

Console.WriteLine("");
Console.WriteLine("DATA STORES");
Console.WriteLine("-----------");
var datastores = new DataStoreGroup();

foreach (var d in datastores.GetAll())
{
    Console.WriteLine(d.Id + " - " + d.Label);
}

Console.WriteLine("");
Console.WriteLine("NETWORK");
Console.WriteLine("-----------");
var networks = new Network();

foreach (var n in networks.GetAll())
{
    Console.WriteLine(n.Id + " - " + n.Label);
}

Check it out on my Github page.