private async void btnClearTargetGroups_Click(object sender, EventArgs e) { try { SwitchDeploymentService service = new SwitchDeploymentService(); await service.ClearTargetGroupAttachments(); WriteNotification($"All targetGroup attachments to autoscaling groups In {GlobalVariables.Enviroment.ToString()} are cleared!"); } catch (Exception ex) { HandleException(ex); } }
private async Task PopulateLoadBalancerControls() { panel1.Controls.Clear(); //btnCreate.Visible = false; lblWarn.Visible = false; SwitchDeploymentService service = new SwitchDeploymentService(); applicationLoadBalancers = await service.GetApplicationLoadBalancers(); if (applicationLoadBalancers == null || applicationLoadBalancers.Count == 0) { lblWarn.Visible = true; lblWarn.Text = "Application load balances are NOT create yet."; btnCreate.Enabled = true; btnSwitch.Enabled = false; panel1.Controls.Add(lblWarn); return; } //Worker and Jumpbox don't need the external ALB if (applicationLoadBalancers.Count < (Enum.GetNames(typeof(ApplicationServer)).Count() - 2)) { lblWarn.Visible = true; lblWarn.Text = "Not all application load balances are created. Please manually delete all load balancers and create again."; panel1.Controls.Add(lblWarn); //btnCreate.Enabled = false; btnSwitch.Enabled = false; } else { //btnCreate.Enabled = false; btnSwitch.Enabled = true; } int counter = 0; foreach (var alb in applicationLoadBalancers) { var ctrl = new CtrlApplicationLoadBalancer(alb); ctrl.Location = new Point(0, counter * 120); panel1.Controls.Add(ctrl); counter++; } }
private async void btnSwitch_Click(object sender, EventArgs e) { try { var confirmResult = MessageBox.Show( $"Are you sure to switch {GlobalVariables.Enviroment.ToString()} deployments?", "Confirm Switching Deployments", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { SwitchDeploymentService service = new SwitchDeploymentService(); await service.SwitchDeployment(); await PopulateLoadBalancerControls(); WriteNotification($"{GlobalVariables.Enviroment.ToString()} deployments are switched!"); } } catch (Exception ex) { HandleException(ex); } }
private async void btnCreate_Click(object sender, EventArgs e) { try { var confirmResult = MessageBox.Show( $"Are you sure to create {GlobalVariables.Enviroment.ToString()} Application Load Balancers?", "Confirm Creating Application Load Balancers", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { SwitchDeploymentService service = new SwitchDeploymentService(); await service.GenerateExternalLoadBalancers(); await PopulateLoadBalancerControls(); WriteNotification($"{GlobalVariables.Enviroment.ToString()} Application Load Balancers are created!"); } } catch (Exception ex) { HandleException(ex); } }