Esempio n. 1
0
 /// <summary>
 /// Resize this pool
 /// </summary>
 public async Task ResizeAsync(int target, TimeSpan timeout, ComputeNodeDeallocationOption deallocationOption)
 {
     try
     {
         Task asyncTask = this.Pool.ResizeAsync(target, timeout, deallocationOption);
         AsyncOperationTracker.Instance.AddTrackedOperation(new AsyncOperationModel(
                                                                asyncTask,
                                                                new PoolOperation(PoolOperation.Resize, this.Pool.Id)));
         await asyncTask;
         await this.RefreshAsync(ModelRefreshType.Basic, showTrackedOperation : false);
     }
     catch (Exception e)
     {
         Messenger.Default.Send <GenericDialogMessage>(new GenericDialogMessage(e.ToString()));
     }
 }
        internal static string ToSerializedValue(this ComputeNodeDeallocationOption value)
        {
            switch (value)
            {
            case ComputeNodeDeallocationOption.Requeue:
                return("requeue");

            case ComputeNodeDeallocationOption.Terminate:
                return("terminate");

            case ComputeNodeDeallocationOption.TaskCompletion:
                return("taskcompletion");

            case ComputeNodeDeallocationOption.RetainedData:
                return("retaineddata");
            }
            return(null);
        }
 public async Task ResizePoolAsync(string poolId, int targetDedicated, TimeSpan? timeout, ComputeNodeDeallocationOption? computeNodeDeallocationOption)
 {
     await this.Service.ResizePool(poolId, targetDedicated, timeout, computeNodeDeallocationOption);
 }
 public async Task ResizePool(
     string poolId,
     int targetDedicated,
     TimeSpan? timeout,
     ComputeNodeDeallocationOption? deallocationOption)
 {
     await this.Client.PoolOperations.ResizePoolAsync(poolId, targetDedicated, timeout, deallocationOption);
 }
Esempio n. 5
0
 /// <summary>
 /// Resize this pool
 /// </summary>
 public async Task ResizeAsync(int target, TimeSpan timeout, ComputeNodeDeallocationOption deallocationOption)
 {
     try
     {
         Task asyncTask = this.Pool.ResizeAsync(target, timeout, deallocationOption);
         AsyncOperationTracker.Instance.AddTrackedOperation(new AsyncOperationModel(
             asyncTask,
             new PoolOperation(PoolOperation.Resize, this.Pool.Id)));
         await asyncTask;
         await this.RefreshAsync(ModelRefreshType.Basic, showTrackedOperation: false);
     }
     catch (Exception e)
     {
         Messenger.Default.Send<GenericDialogMessage>(new GenericDialogMessage(e.ToString()));
     }
 }
        public async Task ResizePool(
            string poolId,
            int targetDedicated,
            TimeSpan? timeout,
            ComputeNodeDeallocationOption? deallocationOption)
        {           
            var pool = await this.GetPoolAsync(poolId);
            if (pool.AutoScaleEnabled.HasValue && pool.AutoScaleEnabled.Value)
            {
                await this.Client.PoolOperations.DisableAutoScaleAsync(poolId);
                if (!await this.WaitForResizingOperationToFinish(poolId))
                {
                    throw new InvalidOperationException("Autoscale disable operation is already in progress. Please try again after sometime to Resize the pool.");
                }
            }

            await this.Client.PoolOperations.ResizePoolAsync(poolId, targetDedicated, timeout, deallocationOption);
        }
Esempio n. 7
0
 public static string ToSerialString(this ComputeNodeDeallocationOption value) => value switch
 {
 private bool IsInputValid(out ComputeNodeDeallocationOption? deallocationOption)
 {
     deallocationOption = null;
     
     if (!string.IsNullOrEmpty(this.DeallocationOptionString))
     {
         ComputeNodeDeallocationOption innerDeallocationOption;
         bool parsedCorrectly = Enum.TryParse(this.DeallocationOptionString, out innerDeallocationOption);
         if (parsedCorrectly)
         {
             deallocationOption = innerDeallocationOption;
         }
         else
         {
             Messenger.Default.Send(new GenericDialogMessage("Invalid value for Deallocation Option"));
             return false;
         }
     }
     
     if (string.IsNullOrEmpty(this.PoolId))
     {
         Messenger.Default.Send(new GenericDialogMessage("Invalid values for Pool Id"));
         return false;
     }
     else if (this.TargetDedicated < 0)
     {
         Messenger.Default.Send(new GenericDialogMessage("Invalid value for TargetDedicated"));
         return false;
     }
     
     return true;
 }