当前位置: 首页>>代码示例>>C#>>正文


C# CloudServersProvider.GetDetails方法代码示例

本文整理汇总了C#中CloudServersProvider.GetDetails方法的典型用法代码示例。如果您正苦于以下问题:C# CloudServersProvider.GetDetails方法的具体用法?C# CloudServersProvider.GetDetails怎么用?C# CloudServersProvider.GetDetails使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CloudServersProvider的用法示例。


在下文中一共展示了CloudServersProvider.GetDetails方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestInitialize

 public void TestInitialize()
 {
     IComputeProvider provider = new CloudServersProvider(Bootstrapper.Settings.TestIdentity);
     Server server = provider.GetDetails(_server.Id);
     if (server.Status != ServerState.Active)
         Assert.Inconclusive("Could not run test because the server is in the '{0}' state (expected '{1}').", server.Status, ServerState.Active);
 }
开发者ID:nick-o,项目名称:openstack.net,代码行数:7,代码来源:UserServerTests.cs

示例2: Should_Verify_Server_Is_Deleted

        public void Should_Verify_Server_Is_Deleted()
        {
            var provider = new CloudServersProvider(_testIdentity);

            try
            {
                var server = provider.GetDetails(_created_server_id);
                Assert.Fail("Deleted server was still found");
            }
            catch (Exception ex)
            {
                Assert.AreEqual(ex.GetType(), typeof(net.openstack.Core.Exceptions.Response.ItemNotFoundException), "Expected ItemNotFoundException was not thrown");
            }
        }
开发者ID:jasonmitschke,项目名称:openstack.net,代码行数:14,代码来源:CloudNetworksTests.cs

示例3: Should_Verify_Server_Has_New_Network

 public void Should_Verify_Server_Has_New_Network()
 {
     var provider = new CloudServersProvider(_testIdentity);
     var testServer = provider.GetDetails(_created_server_id);
     Assert.IsNotNull(testServer.Addresses.SingleOrDefault(x => x.Key == "net-sdk-test-network-for-server"));
 }
开发者ID:jasonmitschke,项目名称:openstack.net,代码行数:6,代码来源:CloudNetworksTests.cs

示例4: Should_Resize_Server_Back

        public void Should_Resize_Server_Back()
        {
            Assert.IsTrue(_resizeSuccess);

            var provider = new CloudServersProvider(_testIdentity);
            var details = provider.GetDetails(_testServer.Id);
            var flavor = int.Parse(details.Flavor.Id) - 1;

            _resizeSuccess = provider.ResizeServer(_testServer.Id, string.Format("{0}_RESIZED_BACK", details.Name), flavor.ToString());

            Assert.IsTrue(_resizeSuccess);
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:12,代码来源:CloudServersTests.cs

示例5: Should_Rebuild_Server

        public void Should_Rebuild_Server()
        {
            var provider = new CloudServersProvider(_testIdentity);
            _preBuildDetails = provider.GetDetails(_testServer.Id);
            var image = provider.ListImages().First(i => i.Name.Contains("CentOS") && i.Id != _preBuildDetails.Image.Id);
            var flavor = int.Parse(_preBuildDetails.Flavor.Id) + 1;

            _rebuildServer = provider.RebuildServer(_testServer.Id, string.Format("{0}_REBUILD", _preBuildDetails.Name), image.Id, flavor.ToString(), _testServer.AdminPassword);

            Assert.IsNotNull(_rebuildServer);
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:11,代码来源:CloudServersTests.cs

示例6: Should_Successfully_To_And_Login_With_New_Password

        public void Should_Successfully_To_And_Login_With_New_Password()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var serverDetails = provider.GetDetails(_testServer.Id);
            bool sucess = false;
            for (int i = 0; i < 10; i++)
            {
                using (var client = new Renci.SshNet.SshClient(serverDetails.AccessIPv4, "root", NewPassword))
                {
                    client.Connect();

                    sucess = client.IsConnected;

                    if (sucess)
                        break;
                }
                Thread.Sleep(1000);
            }

            Assert.IsTrue(sucess);
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:21,代码来源:CloudServersTests.cs

示例7: Should_Successfully_To_And_Login_With_Old_Password

        public void Should_Successfully_To_And_Login_With_Old_Password()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var serverDetails = provider.GetDetails(_testServer.Id);
            using (var client = new Renci.SshNet.SshClient(serverDetails.AccessIPv4, "root", _testServer.AdminPassword))
            {
                client.Connect();

                Assert.IsTrue(client.IsConnected);
            }
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:11,代码来源:CloudServersTests.cs

示例8: Should_Create_Image_From_Server

        public void Should_Create_Image_From_Server()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var detail = provider.GetDetails(_testServer.Id);

            _testImageName = "Image_of_" + detail.Id;
            var sucess = provider.CreateImage(detail.Id, _testImageName);

            Assert.IsTrue(sucess);
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:10,代码来源:CloudServersTests.cs

示例9: Should_Match_AccessIPv6_and_Public_Network_IP

        public void Should_Match_AccessIPv6_and_Public_Network_IP()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var server = provider.GetDetails(_testServer2.Id);

            Assert.AreEqual(server.AccessIPv6, server.Addresses.Public.First(a => a.Version.Equals("6")).Address);
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:7,代码来源:CloudServersTests.cs

示例10: Should_Contain_Network_Addresses_For_Server2

        public void Should_Contain_Network_Addresses_For_Server2()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var server = provider.GetDetails(_testServer2.Id);

            Assert.IsTrue(server.Addresses.Public.Any());
            Assert.IsTrue(server.Addresses.Private.Any());
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:8,代码来源:CloudServersTests.cs

示例11: Should_Contain_AccessIP_v6_Address_For_Server2

        public void Should_Contain_AccessIP_v6_Address_For_Server2()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var server = provider.GetDetails(_testServer2.Id);

            Assert.IsTrue(!string.IsNullOrWhiteSpace(server.AccessIPv6));
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:7,代码来源:CloudServersTests.cs

示例12: Should_Get_Details_For_Newly_Created_Complex_Server_In_DFW

        public void Should_Get_Details_For_Newly_Created_Complex_Server_In_DFW()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var serverDetails = provider.GetDetails(_testServer2.Id);

            Assert.IsNotNull(serverDetails);
            Assert.AreEqual("net-sdk-test-server2", serverDetails.Name);
            Assert.AreEqual("d531a2dd-7ae9-4407-bb5a-e5ea03303d98", serverDetails.Image.Id);
            Assert.AreEqual("2", serverDetails.Flavor.Id);
        }
开发者ID:Dan-Pallone-II,项目名称:openstack.net,代码行数:10,代码来源:CloudServersTests.cs

示例13: TestUpdateServer

        public void TestUpdateServer()
        {
            IComputeProvider provider = new CloudServersProvider(Bootstrapper.Settings.TestIdentity);

            string newName = UserComputeTests.UnitTestServerPrefix + Path.GetRandomFileName() + "²";
            bool updated = provider.UpdateServer(_server.Id, name: newName);
            Assert.IsTrue(updated);
            Server updatedServer = provider.GetDetails(_server.Id);
            Assert.AreEqual(_server.Id, updatedServer.Id);
            Assert.AreEqual(newName, updatedServer.Name);
            Assert.AreNotEqual(_server.Name, updatedServer.Name);
            _server = updatedServer;
        }
开发者ID:nick-o,项目名称:openstack.net,代码行数:13,代码来源:UserServerTests.cs

示例14: TestGetDetails

        public void TestGetDetails()
        {
            IComputeProvider provider = new CloudServersProvider(Bootstrapper.Settings.TestIdentity);
            IEnumerable<Server> servers = UserComputeTests.ListAllServersWithDetails(provider);
            Assert.IsNotNull(servers);
            if (!servers.Any())
                Assert.Inconclusive("The test could not proceed because the specified account and/or region does not appear to contain any configured servers.");

            foreach (Server server in servers)
            {
                Assert.IsNotNull(server);
                Server details = provider.GetDetails(server.Id);
                Assert.AreEqual(server.AccessIPv4, details.AccessIPv4);
                Assert.AreEqual(server.AccessIPv6, details.AccessIPv6);
                //Assert.AreEqual(server.Addresses, details.Addresses);
                Assert.AreEqual(server.Created, details.Created);
                Assert.AreEqual(server.DiskConfig, details.DiskConfig);
                Assert.AreEqual(server.Flavor.Id, details.Flavor.Id);
                Assert.AreEqual(server.HostId, details.HostId);
                Assert.AreEqual(server.Id, details.Id);
                Assert.AreEqual(server.Image.Id, details.Image.Id);
                //Assert.AreEqual(server.Links, details.Links);
                Assert.AreEqual(server.Name, details.Name);
                Assert.AreEqual(server.PowerState, details.PowerState);
                //Assert.AreEqual(server.Progress, details.Progress);
                //Assert.AreEqual(server.Status, details.Status);
                //Assert.AreEqual(server.TaskState, details.TaskState);
                Assert.AreEqual(server.TenantId, details.TenantId);
                Assert.AreEqual(server.Updated, details.Updated);
                Assert.AreEqual(server.UserId, details.UserId);
                //Assert.AreEqual(server.VMState, details.VMState);
            }
        }
开发者ID:nick-o,项目名称:openstack.net,代码行数:33,代码来源:UserServerTests.cs

示例15: Main

        static void Main(string[] args)
        {
            /* Login
             * List servers
             * select server to clone
             * create image of server
             * create server using image
             * delete image
             */

            Console.WriteLine();
            if (ParseArguments(args))
            {
                Console.WriteLine("Logging in...");

                if (Login())
                {
                    var cloudServers = new CloudServersProvider(auth);

                    Console.WriteLine("Listing servers...");

                    try
                    {
                        var servers = cloudServers.ListServers(status: ServerState.ACTIVE, limit: 9, region: ServerRegion).ToList();

                        if (servers.Count == 0)
                            throw new Exception("No active servers on account");

                        Console.WriteLine();

                        for (int i = 0; i < servers.Count(); i++)
                        {
                            Console.WriteLine(String.Format("{0,2} {1}", i+1, servers[i].Name));
                        }

                        Console.WriteLine();

                        var validSelection = false;
                        int index = -1;
                        do
                        {
                            Console.Write(String.Format("Select server to clone [1-{0}]:", Math.Min(9, servers.Count)));
                            var selection = Console.ReadLine();
                            if (Int32.TryParse(selection, out index))
                            {
                                index--;
                                validSelection = (index >= 0 && index < servers.Count);
                            }
                        } while (!validSelection);

                        var imageName = String.Format("clone{0}", DateTime.Now.ToString("yyyy-MM-dd HH.mm.ss"));
                        Console.Write("Enter new server name:");
                        var serverName = Console.ReadLine();

                        // get detailed information of the selected server, this allows us to access the server's flavor ID
                        var server = cloudServers.GetDetails(servers[index].Id, ServerRegion);

                        Console.WriteLine("Creating image...");
                        if (cloudServers.CreateImage(servers[index].Id, imageName, region: ServerRegion))
                        {
                            SimpleServerImage image = null;
                            // find the image we just created so we can monitor the progress.
                            image = cloudServers.ListImages(server: servers[index].Id, region: ServerRegion).Where(result => result.Name == imageName).Single();
                            if (image != null)
                            {
                                try
                                {
                                    image.WaitForActive(progressUpdatedCallback: delegate(int p)
                                    {
                                        Console.SetCursorPosition(0, Console.CursorTop - 1);
                                        Console.WriteLine(String.Format("{0} {1}%", "Creating image...", p));
                                    });

                                    Console.WriteLine("Creating Server...");
                                    var newServer = cloudServers.CreateServer(serverName, image.Id, server.Flavor.Id, region: ServerRegion);

                                    Console.WriteLine(String.Format(" {0,-2} {1,-10} {2,-14} {3,-15} {4,-10} {5,-21}", "%", "Name", "Password", "IPv4", "Status", "Task"));
                                    Console.WriteLine();

                                    newServer.WaitForActive(progressUpdatedCallback: delegate(int p)
                                    {
                                        server = newServer.GetDetails();

                                        Console.SetCursorPosition(0, Console.CursorTop - 1);
                                        Console.WriteLine(String.Format("{0,-3} {1,-10} {2,-14} {3,-15} {4,-10} {5,-21}", p, server.Name, newServer.AdminPassword, server.AccessIPv4, server.VMState, server.TaskState));
                                    });

                                    // output the server details one last time so we capture the IPv4 address.
                                    server = newServer.GetDetails();
                                    Console.SetCursorPosition(0, Console.CursorTop - 1);
                                    Console.WriteLine(String.Format("100 {0,-10} {1,-14} {2,-15} {3,-10} {4,-21}", server.Name, newServer.AdminPassword, server.AccessIPv4, server.VMState, server.TaskState));
                                }
                                finally
                                {
                                    Console.WriteLine("Cleaning up temporary image...");
                                    Console.WriteLine();
                                    if (image.Delete())
                                    {
                                        image.WaitForDelete(progressUpdatedCallback: delegate(int p)
                                        {
//.........这里部分代码省略.........
开发者ID:jonwalton,项目名称:cloud_code_samples,代码行数:101,代码来源:Program.cs


注:本文中的CloudServersProvider.GetDetails方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。