public ActionResult Show(string poolId) { var pool = _batchClient.PoolOperations.GetPool(poolId); if (pool == null) { return(new HttpNotFoundResult("No such pool")); } var model = new PoolDetailsModel { Pool = pool, ComputeNodes = _batchClient.PoolOperations.ListComputeNodes(poolId).ToList(), }; return(View(model)); }
public async Task <ActionResult <PoolConfigurationModel> > AutoScale(string envId, string poolId) { var environment = await _environmentCoordinator.GetEnvironment(envId); if (environment == null) { return(RedirectToAction("Index", "Environments")); } var pool = await _poolCoordinator.GetPool(environment, poolId); if (pool == null) { return(NotFound()); } var model = new PoolDetailsModel(environment, pool); return(View(model)); }
public async Task <ActionResult <PoolConfigurationModel> > Overview(string envId, string poolId) { var environment = await _environmentCoordinator.GetEnvironment(envId); if (environment == null) { return(RedirectToAction("Index", "Environments")); } var pool = await _poolCoordinator.GetPool(environment, poolId); if (pool == null) { return(NotFound()); } var usage = await _poolUsageProvider.GetUsageForPool(environment, poolId, pool.VmSize); var model = new PoolDetailsModel(environment, pool, usage.Values); return(View(model)); }
public async Task <ActionResult <PoolDetailsModel> > AutoScale(string envId, string poolId, PoolDetailsModel model) { if (!ModelState.IsValid) { return(View("AutoScale", model)); } var environment = await _environmentCoordinator.GetEnvironment(model.EnvironmentName); if (environment == null) { return(RedirectToAction("Index", "Environments")); } try { var pool = await _poolCoordinator.GetPool(environment, poolId); var poolUpdate = new Pool(name: poolId, metadata: pool.Metadata); poolUpdate.Metadata.AddAutoScaleMetadata(model); await _poolCoordinator.UpdatePool(environment, pool); } catch (CloudException cEx) { // TODO: Log somewhere // TODO: Handle .... StatusCode Conflict // The specified pool has an ongoing resize operation. RequestId: 6e080f7d-1765-4a7e-99b4-e76f003b599b Console.WriteLine(cEx); ModelState.AddModelError("", $"Failed to update the pool with error: {cEx}"); return(View("AutoScale", model)); } return(RedirectToAction("AutoScale", new { envId = envId, poolId = poolId })); }
public async Task <ActionResult <PoolDetailsModel> > Overview(string envId, string poolId, PoolDetailsModel model) { if (!ModelState.IsValid) { return(View("Overview", model)); } var environment = await _environmentCoordinator.GetEnvironment(envId); if (environment == null) { return(RedirectToAction("Index", "Environments")); } var pool = new Pool(name: poolId); pool.ScaleSettings = new ScaleSettings( new FixedScaleSettings( targetDedicatedNodes: model.DedicatedNodes, targetLowPriorityNodes: model.LowPriorityNodes)); try { await _poolCoordinator.UpdatePool(environment, pool); } catch (CloudException cEx) { // TODO: Log somewhere // TODO: Handle .... StatusCode Conflict // The specified pool has an ongoing resize operation. RequestId: 6e080f7d-1765-4a7e-99b4-e76f003b599b Console.WriteLine(cEx); ModelState.AddModelError("", $"Failed to update the pool with error: {cEx}"); return(View("Overview", model)); } return(RedirectToAction("Overview", new { envId, poolId })); }