/// <summary>
 /// Get the execution history of a Job with a filter on the job Status.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations.
 /// </param>
 /// <param name='jobId'>
 /// Required. Id of the job to get the history of.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Job History With Filter
 /// operation.
 /// </param>
 /// <returns>
 /// The Get Job History operation response.
 /// </returns>
 public static JobGetHistoryResponse GetHistoryWithFilter(this IJobOperations operations, string jobId, JobGetHistoryWithFilterParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IJobOperations)s).GetHistoryWithFilterAsync(jobId, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// Get the execution history of a Job with a filter on the job Status.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations.
 /// </param>
 /// <param name='jobId'>
 /// Required. Id of the job to get the history of.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Job History With Filter
 /// operation.
 /// </param>
 /// <returns>
 /// The Get Job History operation response.
 /// </returns>
 public static Task<JobGetHistoryResponse> GetHistoryWithFilterAsync(this IJobOperations operations, string jobId, JobGetHistoryWithFilterParameters parameters)
 {
     return operations.GetHistoryWithFilterAsync(jobId, parameters, CancellationToken.None);
 }
 /// <summary>
 /// Get the execution history of a Job with a filter on the job Status.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations.
 /// </param>
 /// <param name='jobId'>
 /// Id of the job to get the history of.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Get Job History With Filter operation.
 /// </param>
 /// <returns>
 /// The Get Job History operation response.
 /// </returns>
 public static JobGetHistoryResponse GetHistoryWithFilter(this IJobOperations operations, string jobId, JobGetHistoryWithFilterParameters parameters)
 {
     try
     {
         return operations.GetHistoryWithFilterAsync(jobId, parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }