示例#1
0
        static void Main(string[] args)
        {
            const string region = "RegionOne";

            // Configure OpenStack.NET
            OpenStackNet.Configure(options => options.DefaultTimeout = TimeSpan.FromSeconds(5));

            // Authenticate
            var identityUrl = new Uri("http://example.com");
            var user        = new CloudIdentityWithProject();
            var identity    = new OpenStackIdentityProvider(identityUrl, user);

            identity.Authenticate();

            // Use legacy and new providers
            var legacyNetworking = new CloudNetworksProvider(null, identity);

            legacyNetworking.ListNetworks();
            var networks = new NetworkingService(identity, region);

            networks.ListNetworks();

            var legacyCompute = new CloudServersProvider(null, identity);

            legacyCompute.ListServers();
            var compute = new ComputeService(identity, region);

            compute.ListServers();
        }