示例#1
0
        private async Task PopulateAsgList()
        {
            var helper = new AwsUtilities.AutoScalingHelper(
                GlobalVariables.Enviroment,
                GlobalVariables.Region,
                GlobalVariables.Color);

            gvAsg.AutoGenerateColumns = false;
            gvAsg.DataSource          = await helper.GetAllAutoScalingGroupList(((KeyValuePair <string, string>)ddlAsgRegion.SelectedItem).Key);

            //foreach (DataGridViewRow row in gvAsg.Rows)
            //{
            //    row.DefaultCellStyle.BackColor = System.Drawing.Color.Green;
            //}
        }
示例#2
0
        private async Task PopulateAutoScalingGroup()
        {
            var helper = new AwsUtilities.AutoScalingHelper(
                GlobalVariables.Enviroment,
                GlobalVariables.Region,
                GlobalVariables.Color);
            var lstGroup = await helper.GetEnvironmentAutoScalingGroupList();

            int stoppedGroupCounter = 0;

            listView1.Items.Clear();
            foreach (var group in lstGroup)
            {
                ListViewItem item = new ListViewItem();
                item.Text = group.Name;
                item.SubItems.Add(group.MaxSize.ToString());
                item.SubItems.Add(group.MinSize.ToString());
                item.SubItems.Add(group.RunningInstances.ToString());
                listView1.Items.Add(item);
                if (group.RunningInstances == 0)
                {
                    stoppedGroupCounter++;
                }
            }
            if (stoppedGroupCounter == 0)
            {
                imgAppStatus.Image = Properties.Resources.Button_Blank_Green_icon;
                //return SystemStauts.Running;
            }

            else if (stoppedGroupCounter == lstGroup.Count)
            {
                imgAppStatus.Image = Properties.Resources.Button_Blank_Gray_icon;
                //return SystemStauts.Terminated;
            }
            else
            {
                imgAppStatus.Image = Properties.Resources.Button_Blank_Red_icon;
                //return SystemStauts.Abnormal;
            }
        }
示例#3
0
        private async void btnAsgUpdate_Click(object sender, EventArgs e)
        {
            var datasource = gvAsg.DataSource;
            var helper     = new AwsUtilities.AutoScalingHelper(
                GlobalVariables.Enviroment,
                GlobalVariables.Region,
                GlobalVariables.Color);
            int selectCol = gvAsg.ColumnCount - 1;

            foreach (DataGridViewRow row in gvAsg.Rows)
            {
                if (row.Cells[selectCol].Value != null && (bool)row.Cells[selectCol].Value)
                {
                    var rowDs    = ((List <SA_AutoScalingGroup>)datasource)[row.Index];
                    var settings = new AutoScalingGroupSettings()
                    {
                        MaxSize                = rowDs.MaxSize,
                        MinSize                = rowDs.MinSize,
                        DesiredCapacity        = rowDs.DesiredCapacity,
                        HealthCheckType        = rowDs.HealthCheckType,
                        HealthCheckGracePeriod = rowDs.HealthCheckGracePeriod
                    };
                    var confirmResult = MessageBox.Show(
                        string.Format("Are you sure to change autoscaling group settings: '{0}' to be '{1}-{2}-{3}'? Pleae check the settings first and then click YES button!",
                                      rowDs.AutoScalingGroupName, rowDs.MaxSize, rowDs.MinSize, rowDs.DesiredCapacity),
                        "Confirm Updating Auto Scaling Group Settings",
                        MessageBoxButtons.YesNo);
                    if (confirmResult == DialogResult.Yes)
                    {
                        await helper.ChangeScalingGroup(
                            rowDs.AutoScalingGroupName, settings,
                            ((KeyValuePair <string, string>)ddlAsgRegion.SelectedItem).Key);
                    }
                }
            }
        }