示例#1
0
        protected void Page_Load()
        {
            if (!IsPostBack)
            {
                var id     = Request.QueryString["Id"];
                var action = Request.QueryString["Action"];
                if (id == null || action == null)
                {
                    lblSuccessMessage.Visible = true;
                    lblSuccessMessage.Text    = "Click here to go to the account details page";
                    btnOkay.Visible           = true;
                }
                else
                {
                    var provider = new AWSManagementServiceProvider();
                    switch (action.ToLower())
                    {
                    case "terminate":
                        provider.TerminateInstance(id);
                        ShowSuccessMessage(action);
                        break;

                    case "start":
                        provider.StartInstance(id);
                        ShowSuccessMessage(action);
                        break;

                    case "stop":
                        provider.StopInstance(id);
                        ShowSuccessMessage(action);
                        break;

                    case "launchinstance":
                        ShowSuccessMessage("launch");
                        break;

                    default:
                        break;
                    }
                }
            }
        }
示例#2
0
 private void TerminateInstance(string id)
 {
     var provider = new AWSManagementServiceProvider();
     var response = provider.TerminateInstance(id);
 }