/// <summary>
 /// Jobs can be updated through a simple PATCH operation to a job's
 /// address. The format of the request is the same as that for
 /// creating a job, though if a field is unspecified we will carry
 /// forward the current value.
 /// </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;
         }
     }
 }
 /// <summary>
 /// Jobs can be updated through a simple PATCH operation to a job's
 /// address. The format of the request is the same as that for
 /// creating a job, though if a field is unspecified we will carry
 /// forward the current value.
 /// </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 Task <JobUpdateStateResponse> UpdateStateAsync(this IJobOperations operations, string jobId, JobUpdateStateParameters parameters)
 {
     return(operations.UpdateStateAsync(jobId, parameters, CancellationToken.None));
 }
Ejemplo n.º 3
0
 /// <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());
 }