/// <summary>
 /// The Begin Swapping Deployment operation initiates a virtual IP
 /// address swap between the staging and production deployment
 /// environments for a service. If the service is currently running in
 /// the staging environment, it will be swapped to the production
 /// environment. If it is running in the production environment, it
 /// will be swapped to staging. For more information on this type of
 /// upgrade, see Performing Virtual IP Swap Upgrades at
 /// http://msdn.microsoft.com/en-us/library/windowsazure/ee517253.aspx.
 /// (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/ee460814.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='parameters'>
 /// Required. Parameters supplied to the Begin Swapping Deployment
 /// operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<AzureOperationResponse> BeginSwappingAsync(this IDeploymentOperations operations, string serviceName, DeploymentSwapParameters parameters)
 {
     return operations.BeginSwappingAsync(serviceName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// The Swap Deployment operation initiates a virtual IP address swap
 /// between the staging and production deployment environments for a
 /// service. If the service is currently running in the staging
 /// environment, it will be swapped to the production environment. If
 /// it is running in the production environment, it will be swapped to
 /// staging. For more information on this type of upgrade, see
 /// Performing Virtual IP Swap Upgrades.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/ee460814.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='parameters'>
 /// Parameters supplied to the Swap Deployment operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static OperationResponse BeginSwapping(this IDeploymentOperations operations, string serviceName, DeploymentSwapParameters parameters)
 {
     try
     {
         return operations.BeginSwappingAsync(serviceName, parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }