Beispiel #1
0
        public static ICloudServiceProvider ConstructCloudProvider(CloudServiceProviders cloudProvider)
        {
            ICloudServiceProvider provider = null;

            switch (cloudProvider)
            {
            case CloudServiceProviders.IGS:
                provider = new IGSCloudService();
                break;

            case CloudServiceProviders.Azure:
                provider = new AzureCloudService();
                break;

            case CloudServiceProviders.AWS:
                provider = new AWSCloudService();
                break;

            case CloudServiceProviders.Google:
                provider = new GoogleCloudService();
                break;

            default:
                provider = new IGSCloudService();
                break;
            }
            return(provider);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            string cloudInfraPath;
            ICloudProviderFactory _cloudProviderFactory;

            ConfigureServices(out cloudInfraPath, out _cloudProviderFactory);

            IGSCloudService _IGSCloudService = new IGSCloudService(_cloudProviderFactory, cloudInfraPath);


            // Create Test environment (Window & Linux VMs, SQL & MySQL RDS)
            var created = _IGSCloudService.CreateVirtualMachine(new VirtualMachine()
            {
                Type = VirtualMachineTypes.Linux
            },
                                                                CloudEnvironments.Test);

            Console.WriteLine(created);
            created = _IGSCloudService.CreateVirtualMachine(new VirtualMachine()
            {
                Type = VirtualMachineTypes.Windows
            },
                                                            CloudEnvironments.Test);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateDatabaseServer(new DatabaseServer()
            {
                Type = DatabaseServerTypes.MySQL
            },
                                                            CloudEnvironments.Test);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateDatabaseServer(new DatabaseServer()
            {
                Type = DatabaseServerTypes.SQL
            },
                                                            CloudEnvironments.Test);
            Console.WriteLine(created);

            // Create UAT environment (2 Window VMs, SQL & MySQL RDS)
            created = _IGSCloudService.CreateVirtualMachine(new VirtualMachine()
            {
                Type = VirtualMachineTypes.Windows
            },
                                                            CloudEnvironments.UAT);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateVirtualMachine(new VirtualMachine()
            {
                Type = VirtualMachineTypes.Windows
            },
                                                            CloudEnvironments.UAT);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateDatabaseServer(new DatabaseServer()
            {
                Type = DatabaseServerTypes.MySQL
            },
                                                            CloudEnvironments.UAT);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateDatabaseServer(new DatabaseServer()
            {
                Type = DatabaseServerTypes.SQL
            },
                                                            CloudEnvironments.UAT);
            Console.WriteLine(created);

            // Create Prod environment (3 Window VMs, 3 SQL RDS)
            created = _IGSCloudService.CreateVirtualMachine(new VirtualMachine()
            {
                Type = VirtualMachineTypes.Windows
            },
                                                            CloudEnvironments.Production);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateVirtualMachine(new VirtualMachine()
            {
                Type = VirtualMachineTypes.Windows
            },
                                                            CloudEnvironments.Production);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateVirtualMachine(new VirtualMachine()
            {
                Type = VirtualMachineTypes.Windows
            },
                                                            CloudEnvironments.Production);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateDatabaseServer(new DatabaseServer()
            {
                Type = DatabaseServerTypes.SQL
            },
                                                            CloudEnvironments.Production);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateDatabaseServer(new DatabaseServer()
            {
                Type = DatabaseServerTypes.SQL
            },
                                                            CloudEnvironments.Production);
            Console.WriteLine(created);
            created = _IGSCloudService.CreateDatabaseServer(new DatabaseServer()
            {
                Type = DatabaseServerTypes.SQL
            },
                                                            CloudEnvironments.Production);
            Console.WriteLine(created);

            Thread.Sleep(5000);
            created = _IGSCloudService.DeleteInfrastructure(CloudEnvironments.Test);
            Console.WriteLine(created);
            Thread.Sleep(5000);
            created = _IGSCloudService.DeleteInfrastructure(CloudEnvironments.UAT);
            Console.WriteLine(created);


            Console.ReadLine();
        }