/// <summary>
 /// Checks the availability of the given service namespace across all
 /// Windows Azure subscriptions. This is useful because the domain
 /// name is created based on the service namespace name.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj870968.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.INamespaceOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// The namespace name.
 /// </param>
 /// <returns>
 /// The response to a query for the availability status of a namespace
 /// name.
 /// </returns>
 public static CheckNamespaceAvailabilityResponse CheckAvailability(this INamespaceOperations operations, string namespaceName)
 {
     try
     {
         return operations.CheckAvailabilityAsync(namespaceName).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <summary>
 /// Checks the availability of the given service namespace across all
 /// Windows Azure subscriptions. This is useful because the domain
 /// name is created based on the service namespace name.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj870968.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.INamespaceOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <returns>
 /// The response to a query for the availability status of a namespace
 /// name.
 /// </returns>
 public static Task<CheckNamespaceAvailabilityResponse> CheckAvailabilityAsync(this INamespaceOperations operations, string namespaceName)
 {
     return operations.CheckAvailabilityAsync(namespaceName, CancellationToken.None);
 }
 /// <summary>
 /// Checks the availability of the given notificationHub in a
 /// namespace.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj870968.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.NotificationHubs.INotificationHubOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The notificationHub name.
 /// </param>
 /// <returns>
 /// Response of the Check NameAvailability operation.
 /// </returns>
 public static Task<CheckAvailabilityResponse> CheckAvailabilityAsync(this INotificationHubOperations operations, string resourceGroupName, string namespaceName, CheckAvailabilityParameters parameters)
 {
     return operations.CheckAvailabilityAsync(resourceGroupName, namespaceName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// Checks the availability of the given service namespace across all
 /// Windows Azure subscriptions. This is useful because the domain
 /// name is created based on the service namespace name.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj870968.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.NotificationHubs.INamespaceOperations.
 /// </param>
 /// <param name='parameters'>
 /// Required. The namespace name.
 /// </param>
 /// <returns>
 /// Response of the Check NameAvailability operation.
 /// </returns>
 public static Task<CheckAvailabilityResponse> CheckAvailabilityAsync(this INamespaceOperations operations, CheckAvailabilityParameters parameters)
 {
     return operations.CheckAvailabilityAsync(parameters, CancellationToken.None);
 }