/// <summary> /// Jobs can be created or updated with a PUT operation to a job's /// address. The resource name is the ID of the job. Doing a PUT /// operation on a jobId that already exists will completely overwrite /// the existing job. Putting an existing job (replace) will reset /// internal execution counters. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations. /// </param> /// <param name='jobId'> /// Id of the job to create or update. /// </param> /// <param name='parameters'> /// Parameters supplied to the job operation. /// </param> /// <returns> /// The Update Job operation response. /// </returns> public static JobCreateOrUpdateResponse CreateOrUpdate(this IJobOperations operations, string jobId, JobCreateOrUpdateParameters parameters) { try { return(operations.CreateOrUpdateAsync(jobId, parameters).Result); } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// Jobs can be created or updated with a PUT operation to a job's /// address. The resource name is the ID of the job. Doing a PUT /// operation on a jobId that already exists will completely overwrite /// the existing job. Putting an existing job (replace) will reset /// internal execution counters. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations. /// </param> /// <param name='jobId'> /// Id of the job to create or update. /// </param> /// <param name='parameters'> /// Parameters supplied to the job operation. /// </param> /// <returns> /// The Update Job operation response. /// </returns> public static Task <JobCreateOrUpdateResponse> CreateOrUpdateAsync(this IJobOperations operations, string jobId, JobCreateOrUpdateParameters parameters) { return(operations.CreateOrUpdateAsync(jobId, parameters, CancellationToken.None)); }