Beispiel #1
0
        public ApRunInstancesResponse RunInstances(ApRunInstancesRequest request)
        {
            Log.Debug(this, "RunInstances()");

            try
            {
                Authenticate(request);
                ApRunInstancesResponse response = new ApRunInstancesResponse();
                response.Reservation = IaasClient.RunInstances(request.ImageId, request.InstanceType, request.KeyName, request.NoOfInstances);
                return response;
            }
            catch (Exception e)
            {
                Log.Error(this, e);
                throw e;
            }
        }
        public ActionResult RunInstance(Instance instance)
        {
            try
            {
                ApRunInstancesRequest request = new ApRunInstancesRequest(Credentials);
                request.ImageId = instance.ImageId;
                request.InstanceType = instance.Type;
                request.NoOfInstances = 1;
                ApRunInstancesResponse response = EndPoints.ApDashboardService.RunInstances(request);
                Reservation reservation = response.Reservation;

                if ((reservation != null) && ((reservation.Instances == null) || (reservation.Instances.Count < 1)))
                    return View("Reservation", reservation);
                else
                    return RedirectToAction("Instances");
            }
            catch (Exception e)
            {
                return ShowError(e);
            }
        }