Beispiel #1
0
        public void FindAService()
        {
            var identity = new CloudIdentity {
                Username = "******", APIKey = "{api-key}"
            };
            IIdentityProvider identityProvider = new CloudIdentityProvider(identity);
            var service = new ContentDeliveryNetworkService(identityProvider, "DFW");

            IPage <Service> currentPage = service.ListServices();

            Service myService;

            do
            {
                myService = currentPage.FirstOrDefault(x => x.Name == "MyService");
                if (myService != null)
                {
                    break;
                }

                currentPage = currentPage.GetNextPage();
            } while (currentPage.Any());

            if (myService == null)
            {
                Console.Error.WriteLine("Could not find MyService!");
                return;
            }

            Console.WriteLine("MyService: {0}", myService.Status);
        }
Beispiel #2
0
        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();
        }