コード例 #1
0
        private async Task UploadEnvironment(Model.Environment environment)
        {
            var resource = await LoadResource(_repository.Environments, environment.Identifier);

            resource.UpdateWith(environment);
            await Upsert(_repository.Environments, resource);
        }
コード例 #2
0
        public static RootModel RootModelSample(ISubnetCalculator calculator)
        {
            var model = new RootModel
            {
                ZoneGroup = "Zone Group Id",
                Regions   = new List <Region>()
            };

            var region = new Region {
                Id = "australiaeast", Environments = new List <Model.Environment>()
            };
            var environment = new Model.Environment()
            {
                Id    = "platform-cnry",
                Cidr  = "10.2.0.0/16",
                Rules = new List <Rule> {
                    NetworkRuleSample("rule-id"), new NetworkRule {
                        Id    = "rule-id-24691",
                        From  = "frontend",
                        To    = "backend",
                        Ports = new List <int> {
                            22, 80
                        },
                        IsBidirectional = true,
                        Description     = "Frontend should access backend"
                    }
                },
                Zones = new List <Zone> {
                    ZoneSample("backend", 1), ZoneSample("frontend", 2)
                }
            };
            var hub = new Environment()
            {
                Id     = "hub",
                Cidr   = "10.2.0.0/16",
                Ignore = true
            };

            environment.Zones.ForEach(z =>
                                      z.Cidr = calculator.GetSubnetOffset(environment.Cidr, (byte)environment.ZoneSubnetMaskSize, z.Index));

            region.Environments.Add(environment);
            region.Environments.Add(hub);
            model.Regions.Add(region);

            return(model);
        }
コード例 #3
0
        protected void GetFeatureTeamConfigurations()
        {
            FeatureTeams = new List <FeatureTeam>();
            Configuration envConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) as Configuration;
            TeamEnvironmentConfigurationsSection teamEnvCfgs = envConfig.GetSection("FeatureTeamConfigurations") as TeamEnvironmentConfigurationsSection;

            if (teamEnvCfgs != null)
            {
                FeatureTeam       team;
                Model.Environment env;

                (from TeamEnvironmentConfig teamCfg in teamEnvCfgs.TeamEnvironments select teamCfg)
                .ToList().ForEach(x =>
                {
                    List <Model.Environment> environments = null;
                    if (x.DeployedEnvironments.Count != 0)
                    {
                        environments = new List <Model.Environment>();
                        (from DeployedEnvironment deployedEnv in x.DeployedEnvironments select deployedEnv)
                        .ToList().ForEach(y =>
                        {
                            env = new Model.Environment {
                                EnvironmentName = y.Name
                            };
                            environments.Add(env);
                        });
                    }

                    team = new FeatureTeam
                    {
                        FeatureTeamName      = x.Team,
                        SqlDatabaseSuffix    = String.IsNullOrEmpty(x.SqlDatabaseSuffix) ? null : x.SqlDatabaseSuffix,
                        WebAppSuffix         = String.IsNullOrEmpty(x.WebAppSuffix) ? null : x.WebAppSuffix,
                        DeployedEnvironments = environments == null ? null : environments
                    };
                    FeatureTeams.Add(team);
                });
            }
            else
            {
                throw new ConfigurationErrorsException("Failed to read FeatureTeamConfigurations");
            }
        }
コード例 #4
0
 public TabItemPlus(Model.Environment father)
 {
     InitializeComponent();
     this.father = father;
 }