public static void Main(string[] args) { if (args.Length > 0) { if (args.Contains("AZ") && args.Length == 3) { string vpcId = args[1]; string azId = args[2]; AZFailover azFailover = new AZFailover(vpcId, azId); Task.Run(() => azFailover.Failover()).Wait(); } else if (args.Contains("EC2") && args.Length == 2) { string vpcId = args[1]; InstanceFailover instanceFailover = new InstanceFailover(vpcId); Task.Run(() => instanceFailover.Failover()).Wait(); } else if (args.Contains("RDS") && args.Length == 2) { string vpcId = args[1]; RDSFailover rdsFailover = new RDSFailover(vpcId); Task.Run(() => rdsFailover.Failover()).Wait(); } else { throw new System.ArgumentException("Invalid argument passed"); } } else { Console.WriteLine("Specify either AZ, EC2, or RDS as the first parameter. For AZ, specify the VPC Id and AZ Id. For EC2 and RDS, specify the VPC Id."); } }
public static void Main(string[] args) { if (args.Length > 0) { IList <string> arguments = (IList <string>)(args); if (arguments.Contains("AZ") && arguments.Count == 3) { string vpcId = arguments[1]; string azId = arguments[2]; AZFailover azFailover = new AZFailover(vpcId, azId); azFailover.failover(); } else if (arguments.Contains("EC2") && arguments.Count == 2) { string vpcId = arguments[1]; InstanceFailover instanceFailover = new InstanceFailover(vpcId); instanceFailover.failover(); } else if (arguments.Contains("RDS") && arguments.Count == 2) { string vpcId = arguments[1]; RDSFailover rdsFailover = new RDSFailover(vpcId); rdsFailover.failover(); } else { throw new System.ArgumentException("Invalid argument passed"); } } }