コード例 #1
0
        private void Configure()
        {
            configuration = new Configuration
            {
                Username = "******",
                Password = "******",
            };

            dcApi = new DataCenterApi(configuration);
            lbApi = new LoadBalancerApi(configuration);

            //Create a datacenter.
            if (datacenter == null)
            {
                datacenter = new Datacenter
                {
                    Properties = new DatacenterProperties
                    {
                        Name        = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Description = "Unit test for .Net SDK PB REST V2",
                        Location    = "us/lasdev"
                    }
                };

                datacenter = dcApi.Create(datacenter);
            }
        }
コード例 #2
0
        private void Configure()
        {
            configuration = new Configuration
            {
                Username = "******",
                Password = "******",
            };

            dcApi     = new DataCenterApi(configuration);
            serverApi = new ServerApi(configuration);
            nicApi    = new NetworkInterfacesApi(configuration);
            lbApi     = new LoadBalancerApi(configuration);

            //Create a datacenter.
            if (datacenter == null)
            {
                datacenter = new Datacenter
                {
                    Properties = new DatacenterProperties
                    {
                        Name        = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Description = "Unit test for .Net SDK PB REST V2",
                        Location    = "us/lasdev"
                    }
                };

                datacenter = dcApi.Create(datacenter);
            }

            if (server == null)
            {
                server = new Server
                {
                    Properties = new ServerProperties
                    {
                        Name  = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Cores = 1,
                        Ram   = 256
                    }
                };

                server = serverApi.Create(datacenter.Id, server);
                DoWait(server.Request);
            }

            if (lb == null)
            {
                lb = new Loadbalancer
                {
                    Properties = new LoadbalancerProperties {
                        Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString()
                    }
                };

                lb = lbApi.Create(datacenter.Id, lb);

                DoWait(lb.Request);
            }
        }
コード例 #3
0
        private void Configure()
        {
            configuration = new Configuration
            {
                Username = "******",
                Password = "******",
            };

            dcApi       = new DataCenterApi(configuration);
            volumeApi   = new VolumeApi(configuration);
            snapshotApi = new SnapshotApi(configuration);
            //Create a datacenter.
            if (datacenter == null)
            {
                datacenter = new Datacenter
                {
                    Properties = new DatacenterProperties
                    {
                        Name        = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Description = "Unit test for .Net SDK PB REST V2",
                        Location    = "us/lasdev"
                    }
                };

                datacenter = dcApi.Create(datacenter);
            }

            if (volume == null)
            {
                volume = new Volume
                {
                    Properties = new VolumeProperties
                    {
                        Size        = 1,
                        LicenceType = "LINUX",
                        Type        = "HDD",
                        Name        = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                    }
                };
                volume = volumeApi.Create(datacenter.Id, volume);
                DoWait(volume.Request);
            }
        }
コード例 #4
0
        private void Configure()
        {
            configuration = new Configuration
            {
                Username = "******",
                Password = "******",
            };

            dcApi = new DataCenterApi(configuration);
            volumeApi = new VolumeApi(configuration);
            snapshotApi = new SnapshotApi(configuration);
            //Create a datacenter.
            if (datacenter == null)
            {
                datacenter = new Datacenter
                {
                    Properties = new DatacenterProperties
                    {
                        Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Description = "Unit test for .Net SDK PB REST V2",
                        Location = "us/lasdev"
                    }
                };

                datacenter = dcApi.Create(datacenter);
            }

            if (volume == null)
            {
                volume = new Volume
                {
                    Properties = new VolumeProperties
                    {
                        Size = 1,
                        LicenceType = "LINUX",
                        Type = "HDD",
                        Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                    }
                };
                volume = volumeApi.Create(datacenter.Id, volume);
                DoWait(volume.Request);
            }
        }
コード例 #5
0
        private void Configure()
        {
            Configuration = new Configuration
            {
                Username = "******",
                Password = "******",
            };

            dcApi     = new DataCenterApi(configuration);
            serverApi = new ServerApi(configuration);
            nicApi    = new NetworkInterfacesApi(configuration);
            lbApi     = new LoadBalancerApi(configuration);
            fwApi     = new FirewallRuleApi(configuration);

            //Create a datacenter.
            if (datacenter == null)
            {
                datacenter = new Datacenter
                {
                    Properties = new DatacenterProperties
                    {
                        Name        = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Description = "Unit test for .Net SDK PB REST V2",
                        Location    = "us/lasdev"
                    }
                };

                datacenter = dcApi.Create(datacenter);
            }

            if (server == null)
            {
                server = new Server
                {
                    Properties = new ServerProperties
                    {
                        Name  = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Cores = 1,
                        Ram   = 256
                    }
                };

                server = serverApi.Create(datacenter.Id, server);
                DoWait(server.Request);
            }

            if (nic == null)
            {
                nic = new Nic {
                    Properties = new NicProperties {
                        Lan = 1
                    }
                };

                nic = nicApi.Create(datacenter.Id, server.Id, nic);

                DoWait(nic.Request);
            }

            bool isBusy = true;

            while (isBusy == true)
            {
                var temp = dcApi.FindById(datacenter.Id);
                if (temp.Metadata.State != "BUSY")
                {
                    isBusy = false;
                }
                Thread.Sleep(5000);
            }
        }
コード例 #6
0
        private void Configure()
        {
            configuration = new Configuration
            {
                Username = "******",
                Password = "******",

            };

            dcApi = new DataCenterApi(configuration);
            lbApi = new LoadBalancerApi(configuration);

            //Create a datacenter.
            if (datacenter == null)
            {
                datacenter = new Datacenter
                {
                    Properties = new DatacenterProperties
                    {
                        Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Description = "Unit test for .Net SDK PB REST V2",
                        Location = "us/lasdev"
                    }
                };

                datacenter = dcApi.Create(datacenter);
            }
        }
コード例 #7
0
        private void Configure()
        {
            Configuration = new Configuration
            {
                Username = "******",
                Password = "******",

            };

            dcApi = new DataCenterApi(configuration);
            serverApi = new ServerApi(configuration);
            nicApi = new NetworkInterfacesApi(configuration);
            lbApi = new LoadBalancerApi(configuration);
            fwApi = new FirewallRuleApi(configuration);

            //Create a datacenter.
            if (datacenter == null)
            {
                datacenter = new Datacenter
                {
                    Properties = new DatacenterProperties
                    {
                        Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Description = "Unit test for .Net SDK PB REST V2",
                        Location = "us/lasdev"
                    }
                };

                datacenter = dcApi.Create(datacenter);
            }

            if (server == null)
            {
                server = new Server
                {
                    Properties = new ServerProperties
                    {
                        Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Cores = 1,
                        Ram = 256
                    }
                };

                server = serverApi.Create(datacenter.Id, server);
                DoWait(server.Request);
            }

            if (nic == null)
            {
                nic = new Nic { Properties = new NicProperties { Lan = 1 } };

                nic = nicApi.Create(datacenter.Id, server.Id, nic);

                DoWait(nic.Request);
            }

            bool isBusy = true;
            while (isBusy == true)
            {
                var temp = dcApi.FindById(datacenter.Id);
                if (temp.Metadata.State != "BUSY") isBusy = false;
                Thread.Sleep(5000);
            }
        }
コード例 #8
0
        private void Configure()
        {
            configuration = new Configuration
            {
                Username = "******",
                Password = "******",

            };

            dcApi = new DataCenterApi(configuration);
            serverApi = new ServerApi(configuration);
            nicApi = new NetworkInterfacesApi(configuration);
            lbApi = new LoadBalancerApi(configuration);

            //Create a datacenter.
            if (datacenter == null)
            {
                datacenter = new Datacenter
                {
                    Properties = new DatacenterProperties
                    {
                        Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Description = "Unit test for .Net SDK PB REST V2",
                        Location = "us/lasdev"
                    }
                };

                datacenter = dcApi.Create(datacenter);
            }

            if(server == null)
            {
                server = new Server
                {
                    Properties = new ServerProperties
                    {
                        Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                        Cores = 1,
                        Ram = 256
                    }
                };

                server = serverApi.Create(datacenter.Id, server);
                DoWait(server.Request);
            }

            if (lb == null)
            {
                lb = new Loadbalancer
                {
                    Properties = new LoadbalancerProperties { Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString() }
                };

                lb = lbApi.Create(datacenter.Id, lb);

                DoWait(lb.Request);
            }
        }