Пример #1
0
        public async Task ShutDownSystem(bool stopJumpBox)
        {
            var autoScalingHelper = new AutoScalingHelper(GlobalVariables.Enviroment, GlobalVariables.Region, GlobalVariables.Color);
            var lstGroup          = await autoScalingHelper.GetEnvironmentAutoScalingGroupList();

            if (!stopJumpBox)
            {
                var jumpBox = lstGroup.Find(o => o.Name.IndexOf("Jump") >= 0);
                if (jumpBox != null)
                {
                    lstGroup.Remove(jumpBox);
                }
            }
            foreach (var group in lstGroup)
            {
                await autoScalingHelper.StopScalingGroup(group.AutoScalingGroupName);
            }

            ElasticBeanstalkServices service = new ElasticBeanstalkServices();

            service.DisableScheduleActions(true);

            //helper.ShutdownSystem();
            RDSHelper rdsHelper = new RDSHelper(GlobalVariables.Enviroment, GlobalVariables.Region, GlobalVariables.Color);
            var       response  = await rdsHelper.GetRDSInstance();

            await rdsHelper.StopRdsInstance(response.DBInstanceIdentifier);
        }
Пример #2
0
        public async Task StopRdsInstances(List <SA_RdsInstance> lstInstances)
        {
            RDSHelper rdsHelper = new RDSHelper(GlobalVariables.Enviroment, GlobalVariables.Region, GlobalVariables.Color);

            foreach (var instance in lstInstances)
            {
                await rdsHelper.StopRdsInstance(instance.DBInstanceIdentifier);

                LogServices.WriteLog($"{GlobalVariables.Enviroment} RDS {instance.DBInstanceIdentifier} was shut down.", LogType.Information, GlobalVariables.Enviroment.ToString());
            }
        }