/// <summary> /// Update the state of a job. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations. /// </param> /// <param name='jobId'> /// Required. Id of the job to update. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Update Job State operation. /// </param> /// <returns> /// The Update Job State operation response. /// </returns> public static JobUpdateStateResponse UpdateState(this IJobOperations operations, string jobId, JobUpdateStateParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IJobOperations)s).UpdateStateAsync(jobId, parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Update the state of a job. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations. /// </param> /// <param name='jobId'> /// Required. Id of the job to update. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Update Job State operation. /// </param> /// <returns> /// The Update Job State operation response. /// </returns> public static Task<JobUpdateStateResponse> UpdateStateAsync(this IJobOperations operations, string jobId, JobUpdateStateParameters parameters) { return operations.UpdateStateAsync(jobId, parameters, CancellationToken.None); }
/// <summary> /// Update the state of a job. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations. /// </param> /// <param name='jobId'> /// Id of the job to update. /// </param> /// <param name='parameters'> /// Parameters supplied to the Update Job State operation. /// </param> /// <returns> /// The Update Job State operation response. /// </returns> public static JobUpdateStateResponse UpdateState(this IJobOperations operations, string jobId, JobUpdateStateParameters parameters) { try { return operations.UpdateStateAsync(jobId, parameters).Result; } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }