/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DeleteJobResponse response = new DeleteJobResponse(); return(response); }
public void JobDeleteJobRequest() { CreateJobResponse createResponse = Zencoder.CreateJob("s3://bucket-name/file-name.avi", null, null, null, true, false); Assert.IsTrue(createResponse.Success); // TODO: Investigate whether Zencoder has truly deprecated this API operation. // For now, just test for an InConflict status, because that's what it seems // we should expect. DeleteJobResponse deleteResponse = Zencoder.DeleteJob(createResponse.Id); Assert.IsTrue(deleteResponse.InConflict); AutoResetEvent[] handles = new AutoResetEvent[] { new AutoResetEvent(false) }; Zencoder.DeleteJob( createResponse.Id, r => { Assert.IsTrue(r.InConflict); handles[0].Set(); }); WaitHandle.WaitAll(handles); }
public static DeleteJobResponse Unmarshall(UnmarshallerContext context) { DeleteJobResponse deleteJobResponse = new DeleteJobResponse(); deleteJobResponse.HttpResponse = context.HttpResponse; deleteJobResponse.RequestId = context.StringValue("DeleteJob.RequestId"); return(deleteJobResponse); }
public DeleteJobResponse Any(DeleteJobRequest request) { DeleteJobResponse resp = new DeleteJobResponse(); Scheduler.DeleteJob(new JobKey(request.JobKey)); Console.WriteLine("Job Deleted " + request.JobKey + " At " + DateTime.Now); return(resp); }
public static DeleteJobResponse Unmarshall(UnmarshallerContext context) { DeleteJobResponse deleteJobResponse = new DeleteJobResponse(); deleteJobResponse.HttpResponse = context.HttpResponse; deleteJobResponse.RequestId = context.StringValue("DeleteJob.RequestId"); deleteJobResponse.Code = context.IntegerValue("DeleteJob.Code"); deleteJobResponse.Message = context.StringValue("DeleteJob.Message"); deleteJobResponse.Success = context.BooleanValue("DeleteJob.Success"); return(deleteJobResponse); }
public static DeleteJobResponse Unmarshall(UnmarshallerContext _ctx) { DeleteJobResponse deleteJobResponse = new DeleteJobResponse(); deleteJobResponse.HttpResponse = _ctx.HttpResponse; deleteJobResponse.RequestId = _ctx.StringValue("DeleteJob.RequestId"); deleteJobResponse.Success = _ctx.BooleanValue("DeleteJob.Success"); deleteJobResponse.Code = _ctx.StringValue("DeleteJob.Code"); deleteJobResponse.ErrorMessage = _ctx.StringValue("DeleteJob.ErrorMessage"); return(deleteJobResponse); }
bool DeleteJob(string jobID) { using (JobServiceClient jobService = new JobServiceClient()) { string address = string.Format("{0}/JobService.svc", _wcfAddress); jobService.Endpoint.Address = new System.ServiceModel.EndpointAddress(address); //Delete the selected job using the DeleteJob WCF Service DeleteJobRequest deleteJobRequest = new DeleteJobRequest(); deleteJobRequest.ID = jobID; DeleteJobResponse deleteJobResponse = jobService.DeleteJob(deleteJobRequest); return(deleteJobResponse.IsDeleted); } }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DeleteJobResponse response = new DeleteJobResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("JobName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.JobName = unmarshaller.Unmarshall(context); continue; } } return(response); }
public void JobDeleteJobRequest() { CreateJobResponse createResponse = Zencoder.CreateJob("s3://bucket-name/file-name.avi", null, null, null, true); Assert.IsTrue(createResponse.Success); DeleteJobResponse deleteResponse = Zencoder.DeleteJob(createResponse.Id); Assert.IsTrue(deleteResponse.Success); AutoResetEvent[] handles = new AutoResetEvent[] { new AutoResetEvent(false) }; Zencoder.DeleteJob( createResponse.Id, r => { Assert.IsTrue(r.StatusCode == HttpStatusCode.NotFound); handles[0].Set(); }); WaitHandle.WaitAll(handles); }
private void _tsDeleteJob_Click(object sender, EventArgs e) { string address = string.Format("{0}/JobService.svc", _userHost ? _hostAddress : _IISAddress); try { using (JobServiceClient jobService = new JobServiceClient()) { jobService.Endpoint.Address = new System.ServiceModel.EndpointAddress(address); foreach (DataGridViewRow rowToDelete in _dgDBJobs.SelectedRows) { //Remove from database DeleteJobRequest deleteRequest = new DeleteJobRequest(); deleteRequest.ID = rowToDelete.Cells[JobProcessorConstants.Database.GuidColumn].Value.ToString(); DeleteJobResponse deleteJobResponse = jobService.DeleteJob(deleteRequest); if (deleteJobResponse.IsDeleted) { //Remove from grid. Check if job stil exist in case it was removed by a refresh if (_dgDBJobs.Rows.IndexOf(rowToDelete) != -1) { _dgDBJobs.Rows.Remove(rowToDelete); } } else { MessageBox.Show("Error removing job"); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } UpdateRowCount(); }
public void RemoveBatchJobParametersTest() { // Setup cmdlet without the required parameters BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; // Setup cmdlet to skip confirmation popup cmdlet.Force = true; commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny <string>(), It.IsAny <string>())).Returns(true); Assert.Throws <ArgumentException>(() => cmdlet.ExecuteCmdlet()); cmdlet.WorkItemName = "testWorkItem"; cmdlet.Name = "job-0000000001"; // Don't go to the service on a DeleteJob call YieldInjectionInterceptor interceptor = new YieldInjectionInterceptor((opContext, request) => { if (request is DeleteJobRequest) { DeleteJobResponse response = new DeleteJobResponse(); Task <object> task = Task <object> .Factory.StartNew(() => { return(response); }); return(task); } return(null); }); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; // Verify no exceptions when required parameters are set cmdlet.ExecuteCmdlet(); }
public static string DeleteJob(long jobId) { string returnMessage = string.Format("Could not delete job {0}.", jobId); try { using (AccessPointClient client = new AccessPointClient()) { DeleteJobResponse response = client.DeleteJob(new DeleteJobRequest { JobId = jobId, }); if (response.Success) { returnMessage = string.Format("Successfully deleted job {0}.", jobId); } } } catch (Exception ex) { returnMessage += "<br /><br />" + ex.Message; } return(returnMessage); }