/// <summary>
 /// You can retrieve historical usage metrics for a site by issuing an
 /// HTTP GET request.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/dn166964.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.WebSites.IWebSiteOperations.
 /// </param>
 /// <param name='webSpaceName'>
 /// Required. The name of the web space.
 /// </param>
 /// <param name='webSiteName'>
 /// Required. The name of the web site.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Historical Usage Metrics
 /// Web Site operation.
 /// </param>
 /// <returns>
 /// The Get Historical Usage Metrics Web Site operation response.
 /// </returns>
 public static WebSiteGetHistoricalUsageMetricsResponse GetHistoricalUsageMetrics(this IWebSiteOperations operations, string webSpaceName, string webSiteName, WebSiteGetHistoricalUsageMetricsParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IWebSiteOperations)s).GetHistoricalUsageMetricsAsync(webSpaceName, webSiteName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// You can retrieve historical usage metrics for a site by issuing an
 /// HTTP GET request.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/dn166964.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.WebSites.IWebSiteOperations.
 /// </param>
 /// <param name='webSpaceName'>
 /// Required. The name of the web space.
 /// </param>
 /// <param name='webSiteName'>
 /// Required. The name of the web site.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Historical Usage Metrics
 /// Web Site operation.
 /// </param>
 /// <returns>
 /// The Get Historical Usage Metrics Web Site operation response.
 /// </returns>
 public static Task<WebSiteGetHistoricalUsageMetricsResponse> GetHistoricalUsageMetricsAsync(this IWebSiteOperations operations, string webSpaceName, string webSiteName, WebSiteGetHistoricalUsageMetricsParameters parameters)
 {
     return operations.GetHistoricalUsageMetricsAsync(webSpaceName, webSiteName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// You can retrieve historical usage metrics for a site by issuing an
 /// HTTP GET request.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/dn166964.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.WebSites.IWebSiteOperations.
 /// </param>
 /// <param name='webSpaceName'>
 /// The name of the web space.
 /// </param>
 /// <param name='webSiteName'>
 /// The name of the web site.
 /// </param>
 /// <param name='parameters'>
 /// The Get Web Site Historical Usage Metrics parameters.
 /// </param>
 /// <returns>
 /// The Get Web Site Historical Usage Metrics operation response.
 /// </returns>
 public static WebSiteGetHistoricalUsageMetricsResponse GetHistoricalUsageMetrics(this IWebSiteOperations operations, string webSpaceName, string webSiteName, WebSiteGetHistoricalUsageMetricsParameters parameters)
 {
     try
     {
         return operations.GetHistoricalUsageMetricsAsync(webSpaceName, webSiteName, parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }