/// <summary>
 /// The Begin Rebooting Role Instance By Deployment Slot operation
 /// requests a reboot of a role instance that is running in a
 /// deployment. This operation is an asynchronous operation. To
 /// determine whether the Management service has finished processing
 /// the request, call Get Operation Status. For more information on
 /// asynchronous operations, see Tracking Asynchronous Service
 /// Management Requests at
 /// http://msdn.microsoft.com/en-us/library/windowsazure/ee460791.aspx.
 /// (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/gg441298.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// Required. The name of the cloud service.
 /// </param>
 /// <param name='deploymentSlot'>
 /// Required. The deployment slot.
 /// </param>
 /// <param name='roleInstanceName'>
 /// Required. The name of your role instance.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<AzureOperationResponse> BeginRebootingRoleInstanceByDeploymentSlotAsync(this IDeploymentOperations operations, string serviceName, DeploymentSlot deploymentSlot, string roleInstanceName)
 {
     return operations.BeginRebootingRoleInstanceByDeploymentSlotAsync(serviceName, deploymentSlot, roleInstanceName, CancellationToken.None);
 }
 /// <summary>
 /// The Reboot Role Instance operation requests a reboot of a role
 /// instance that is running in a deployment.  The Reboot Role
 /// Instance operation is an asynchronous operation. To determine
 /// whether the Management service has finished processing the
 /// request, call Get Operation Status. For more information on
 /// asynchronous operations, see Tracking Asynchronous Service
 /// Management Requests.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/gg441298.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the cloud service.
 /// </param>
 /// <param name='deploymentSlot'>
 /// The deployment slot.
 /// </param>
 /// <param name='roleInstanceName'>
 /// The name of your role instance.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static OperationResponse BeginRebootingRoleInstanceByDeploymentSlot(this IDeploymentOperations operations, string serviceName, DeploymentSlot deploymentSlot, string roleInstanceName)
 {
     try
     {
         return operations.BeginRebootingRoleInstanceByDeploymentSlotAsync(serviceName, deploymentSlot, roleInstanceName).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }