-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
54 lines (46 loc) · 1.74 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using net.openstack.Core.Domain;
using net.openstack.Providers.Rackspace;
using OpenStack.ContentDeliveryNetworks.v1;
using OpenStack.Synchronous;
namespace ListAllTheThings
{
class Program
{
static void Main(string[] args)
{
var identity = new CloudIdentity
{
Username = Environment.GetEnvironmentVariable("OPENSTACKNET_USER"),
APIKey = Environment.GetEnvironmentVariable("OPENSTACKNET_APIKEY")
};
var authProvider = new CloudIdentityProvider(identity);
Console.WriteLine("--- Servers ---");
var serversProvider = new CloudServersProvider(identity);
var servers = serversProvider.ListServers();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Id\t\t\t\t\tName");
Console.ResetColor();
Console.WriteLine();
foreach (var server in servers)
{
Console.WriteLine("{0}\t{1}", server.Id, server.Name);
}
Console.WriteLine();
Console.WriteLine("--- CDN Services ---");
var cdnService = new ContentDeliveryNetworkService(authProvider, "DFW");
var cdns = cdnService.ListServices();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Id\t\t\t\t\tName");
Console.ResetColor();
Console.WriteLine();
foreach (var cdn in cdns)
{
Console.WriteLine("{0}\t{1}", cdn.Id, cdn.Name);
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadLine();
}
}
}