/// <summary>
 /// The Rollback Update Or Upgrade By Deployment Slot operation cancels
 /// an in-progress configuration update and returns the deployment to
 /// its state before the update was started. This operation can only
 /// be called when an update is in progress on the deployment. The
 /// deployment status can be detected by calling the Get Deployment
 /// operation or Get Hosted Service Properties operation and
 /// inspecting the RollbackAllowed element. If the value returned is
 /// true a rollback can be performed.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/hh403977.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// Required. The cloud service to swap deployments for.
 /// </param>
 /// <param name='deploymentSlot'>
 /// Required. The deployment slot.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Rollback Update Or Upgrade By
 /// Deployment Slot operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<AzureOperationResponse> RollbackUpdateOrUpgradeByDeploymentSlotAsync(this IDeploymentOperations operations, string serviceName, DeploymentSlot deploymentSlot, DeploymentRollbackUpdateOrUpgradeParameters parameters)
 {
     return operations.RollbackUpdateOrUpgradeByDeploymentSlotAsync(serviceName, deploymentSlot, parameters, CancellationToken.None);
 }
 /// <summary>
 /// The Rollback Update Or Upgrade operation cancels an in-progress
 /// configuration update and returns the deployment to its state
 /// before the update was started.  The Rollback Update Or Upgrade
 /// operation can only be called when an update is in progress on the
 /// deployment. The deployment status can be detected by calling the
 /// Get Deployment operation or Get Hosted Service Properties
 /// operation and inspecting the RollbackAllowed element. If the value
 /// returned is true a rollback can be performed.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/hh403977.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// The cloud service to swap deployments for.
 /// </param>
 /// <param name='deploymentSlot'>
 /// The deployment slot.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Rollback Update Or Upgrade operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static OperationResponse RollbackUpdateOrUpgradeByDeploymentSlot(this IDeploymentOperations operations, string serviceName, DeploymentSlot deploymentSlot, DeploymentRollbackUpdateOrUpgradeParameters parameters)
 {
     try
     {
         return operations.RollbackUpdateOrUpgradeByDeploymentSlotAsync(serviceName, deploymentSlot, parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <summary>
 /// The Rollback Update Or Upgrade By Deployment Slot operation cancels
 /// an in-progress configuration update and returns the deployment to
 /// its state before the update was started. This operation can only
 /// be called when an update is in progress on the deployment. The
 /// deployment status can be detected by calling the Get Deployment
 /// operation or Get Hosted Service Properties operation and
 /// inspecting the RollbackAllowed element. If the value returned is
 /// true a rollback can be performed.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/hh403977.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// Required. The cloud service to swap deployments for.
 /// </param>
 /// <param name='deploymentSlot'>
 /// Required. The deployment slot.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Rollback Update Or Upgrade By
 /// Deployment Slot operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static AzureOperationResponse RollbackUpdateOrUpgradeByDeploymentSlot(this IDeploymentOperations operations, string serviceName, DeploymentSlot deploymentSlot, DeploymentRollbackUpdateOrUpgradeParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IDeploymentOperations)s).RollbackUpdateOrUpgradeByDeploymentSlotAsync(serviceName, deploymentSlot, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
        protected PSArgument[] CreateDeploymentRollbackUpdateOrUpgradeByDeploymentSlotParameters()
        {
            string serviceName = string.Empty;
            DeploymentSlot deploymentSlot = new DeploymentSlot();
            DeploymentRollbackUpdateOrUpgradeParameters parameters = new DeploymentRollbackUpdateOrUpgradeParameters();

            return ConvertFromObjectsToArguments(new string[] { "ServiceName", "DeploymentSlot", "Parameters" }, new object[] { serviceName, deploymentSlot, parameters });
        }