예제 #1
0
        /// <summary>
        /// <para>The CancelJob operation cancels an unfinished job.</para> <para><b>NOTE:</b>You can only cancel a job that has a status of Submitted.
        /// To prevent a pipeline from starting to process a job while you're getting the job identifier, use UpdatePipelineStatus to temporarily pause
        /// the pipeline.</para>
        /// </summary>
        ///
        /// <param name="cancelJobRequest">Container for the necessary parameters to execute the CancelJob service method on
        /// AmazonElasticTranscoder.</param>
        ///
        /// <returns>The response from the CancelJob service method, as returned by AmazonElasticTranscoder.</returns>
        ///
        /// <exception cref="T:Amazon.ElasticTranscoder.Model.ResourceNotFoundException" />
        /// <exception cref="T:Amazon.ElasticTranscoder.Model.AccessDeniedException" />
        /// <exception cref="T:Amazon.ElasticTranscoder.Model.ResourceInUseException" />
        /// <exception cref="T:Amazon.ElasticTranscoder.Model.InternalServiceException" />
        /// <exception cref="T:Amazon.ElasticTranscoder.Model.ValidationException" />
        /// <exception cref="T:Amazon.ElasticTranscoder.Model.IncompatibleVersionException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        public Task <CancelJobResponse> CancelJobAsync(CancelJobRequest cancelJobRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new CancelJobRequestMarshaller();
            var unmarshaller = CancelJobResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, CancelJobRequest, CancelJobResponse>(cancelJobRequest, marshaller, unmarshaller, signer, cancellationToken));
        }
예제 #2
0
        /// <summary>
        /// This operation cancels a specified job. Only the job owner can cancel it. The operation
        /// fails if the job has already started or is complete.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CancelJob service method.</param>
        ///
        /// <returns>The response from the CancelJob service method, as returned by ImportExport.</returns>
        /// <exception cref="Amazon.ImportExport.Model.CanceledJobIdException">
        /// The specified job ID has been canceled and is no longer valid.
        /// </exception>
        /// <exception cref="Amazon.ImportExport.Model.ExpiredJobIdException">
        /// Indicates that the specified job has expired out of the system.
        /// </exception>
        /// <exception cref="Amazon.ImportExport.Model.InvalidAccessKeyIdException">
        /// The AWS Access Key ID specified in the request did not match the manifest's accessKeyId
        /// value. The manifest and the request authentication must use the same AWS Access Key
        /// ID.
        /// </exception>
        /// <exception cref="Amazon.ImportExport.Model.InvalidJobIdException">
        /// The JOBID was missing, not found, or not associated with the AWS account.
        /// </exception>
        /// <exception cref="Amazon.ImportExport.Model.InvalidVersionException">
        /// The client tool version is invalid.
        /// </exception>
        /// <exception cref="Amazon.ImportExport.Model.UnableToCancelJobIdException">
        /// AWS Import/Export cannot cancel the job
        /// </exception>
        public virtual CancelJobResponse CancelJob(CancelJobRequest request)
        {
            var marshaller   = CancelJobRequestMarshaller.Instance;
            var unmarshaller = CancelJobResponseUnmarshaller.Instance;

            return(Invoke <CancelJobRequest, CancelJobResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// <para> This operation cancels a specified job. Only the job owner can
        /// cancel it. The operation fails if the job has already started or is
        /// complete. </para>
        /// </summary>
        ///
        /// <param name="cancelJobRequest">Container for the necessary parameters
        ///           to execute the CancelJob service method on AmazonImportExport.</param>
        ///
        /// <returns>The response from the CancelJob service method, as returned
        ///         by AmazonImportExport.</returns>
        ///
        /// <exception cref="CanceledJobIdException"/>
        /// <exception cref="ExpiredJobIdException"/>
        /// <exception cref="InvalidAccessKeyIdException"/>
        /// <exception cref="InvalidJobIdException"/>
        /// <exception cref="UnableToCancelJobIdException"/>
        public CancelJobResponse CancelJob(CancelJobRequest cancelJobRequest)
        {
            IRequest <CancelJobRequest> request  = new CancelJobRequestMarshaller().Marshall(cancelJobRequest);
            CancelJobResponse           response = Invoke <CancelJobRequest, CancelJobResponse> (request, this.signer, CancelJobResponseUnmarshaller.GetInstance());

            return(response);
        }
예제 #4
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            if (!ConfirmDelete("OCIResourcemanagerJob", "Stop"))
            {
                return;
            }

            CancelJobRequest request;

            try
            {
                request = new CancelJobRequest
                {
                    JobId        = JobId,
                    OpcRequestId = OpcRequestId,
                    IfMatch      = IfMatch
                };

                response = client.CancelJob(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
예제 #5
0
        public void Cancel_ShouldCancelAllWorkItems()
        {
            var command     = AutoFixture.Create <AddJobRequest>();
            var addResponse = ServerChannel.SendRequest <CreateEntityResponse <int> >(UriFactory.Create(EndPoint.QueueJob),
                                                                                      command);

            addResponse.Succeeded.Should().BeTrue();

            var cancelcommand = new CancelJobRequest()
            {
                JobId = addResponse.EntityIdentifier
            };
            var cancelResponse = ServerChannel.SendRequest <Response>(UriFactory.Create(EndPoint.CancelJob),
                                                                      cancelcommand);

            cancelResponse.Succeeded.Should().BeTrue();

            using (var session = DocumentStore.OpenSession())
            {
                var job = session.Load <Job>(addResponse.EntityIdentifier);

                job.Should().NotBeNull();
                var workItems = session.Query <WorkItem>().Where(w => w.Job.Id.Equals(job.Id)).ToList();

                workItems.All(t => t.Status.Equals(WorkItemStatus.Cancelled)).Should().BeTrue();
            }
        }
        internal CancelJobResponse CancelJob(CancelJobRequest request)
        {
            var marshaller   = new CancelJobRequestMarshaller();
            var unmarshaller = CancelJobResponseUnmarshaller.Instance;

            return(Invoke <CancelJobRequest, CancelJobResponse>(request, marshaller, unmarshaller));
        }
        public void CancelJob()
        {
            Mock <JobController.JobControllerClient> mockGrpcClient = new Mock <JobController.JobControllerClient>(MockBehavior.Strict);
            CancelJobRequest expectedRequest = new CancelJobRequest
            {
                ProjectId = "projectId-1969970175",
                Region    = "region-934795532",
                JobId     = "jobId-1154752291",
            };
            Job expectedResponse = new Job
            {
                DriverOutputResourceUri = "driverOutputResourceUri-542229086",
                DriverControlFilesUri   = "driverControlFilesUri207057643",
            };

            mockGrpcClient.Setup(x => x.CancelJob(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null);
            string projectId           = "projectId-1969970175";
            string region   = "region-934795532";
            string jobId    = "jobId-1154752291";
            Job    response = client.CancelJob(projectId, region, jobId);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #8
0
        public async Task CancelJobAsync()
        {
            Mock <JobController.JobControllerClient> mockGrpcClient = new Mock <JobController.JobControllerClient>(MockBehavior.Strict);
            CancelJobRequest expectedRequest = new CancelJobRequest
            {
                ProjectId = "projectId-1969970175",
                Region    = "region-934795532",
                JobId     = "jobId-1154752291",
            };
            Job expectedResponse = new Job
            {
                DriverOutputResourceUri = "driverOutputResourceUri-542229086",
                DriverControlFilesUri   = "driverControlFilesUri207057643",
                JobUuid = "jobUuid-1615012099",
            };

            mockGrpcClient.Setup(x => x.CancelJobAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Job>(Task.FromResult(expectedResponse), null, null, null, null));
            JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null);
            string projectId           = "projectId-1969970175";
            string region   = "region-934795532";
            string jobId    = "jobId-1154752291";
            Job    response = await client.CancelJobAsync(projectId, region, jobId);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #9
0
        /// <summary>
        /// Initiates the asynchronous execution of the CancelJob operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CancelJob operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public virtual Task<CancelJobResponse> CancelJobAsync(CancelJobRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = CancelJobRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CancelJobResponseUnmarshaller.Instance;

            return InvokeAsync<CancelJobResponse>(request, options, cancellationToken);
        }
예제 #10
0
        /// <summary>
        /// Initiates the asynchronous execution of the CancelJob operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CancelJob operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <CancelJobResponse> CancelJobAsync(CancelJobRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new CancelJobRequestMarshaller();
            var unmarshaller = CancelJobResponseUnmarshaller.Instance;

            return(InvokeAsync <CancelJobRequest, CancelJobResponse>(request, marshaller,
                                                                     unmarshaller, cancellationToken));
        }
예제 #11
0
        /// <summary>
        /// Initiates the asynchronous execution of the CancelJob operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CancelJob operation on AmazonSnowballClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCancelJob
        ///         operation.</returns>
        public IAsyncResult BeginCancelJob(CancelJobRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new CancelJobRequestMarshaller();
            var unmarshaller = CancelJobResponseUnmarshaller.Instance;

            return(BeginInvoke <CancelJobRequest>(request, marshaller, unmarshaller,
                                                  callback, state));
        }
예제 #12
0
        internal virtual CancelJobResponse CancelJob(CancelJobRequest request)
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = CancelJobRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CancelJobResponseUnmarshaller.Instance;

            return Invoke<CancelJobResponse>(request, options);
        }
        IAsyncResult invokeCancelJob(CancelJobRequest cancelJobRequest, AsyncCallback callback, object state, bool synchronized)
        {
            IRequest    irequest     = new CancelJobRequestMarshaller().Marshall(cancelJobRequest);
            var         unmarshaller = CancelJobResponseUnmarshaller.GetInstance();
            AsyncResult result       = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);

            Invoke(result);
            return(result);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the CancelJob operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CancelJob operation on AmazonImportExportClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCancelJob
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/importexport-2010-06-01/CancelJob">REST API Reference for CancelJob Operation</seealso>
        public virtual IAsyncResult BeginCancelJob(CancelJobRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CancelJobRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CancelJobResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
예제 #15
0
        private async Task CancelJobAsync(int jobId)
        {
            var request = new CancelJobRequest {
                PrinterUri = Options.Value.PrinterUrl, JobId = jobId
            };

            using var client = GetSharpIppClientWithoutLog;
            await client.CancelJobAsync(request);
        }
예제 #16
0
        public void CancelJobAsync()
        {
            var request = new CancelJobRequest {
                PrinterUri = PrinterUrl, JobId = JobId
            };
            var result = _protocol.Construct(request);

            CheckResult(result);
        }
예제 #17
0
 public async Task CancelJobAsync()
 {
     await TestJobRequestAsync(async jobId =>
     {
         var request = new CancelJobRequest {
             PrinterUri = Options.Value.PrinterUrl, JobId = jobId
         };
         return(await TestRequestAsync(request, (client, r) => client.CancelJobAsync(r)));
     });
 }
        public async stt::Task CancelJobAsync()
        {
            moq::Mock <JobController.JobControllerClient> mockGrpcClient = new moq::Mock <JobController.JobControllerClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            CancelJobRequest request = new CancelJobRequest
            {
                ProjectId = "project_id43ad98b0",
                JobId     = "job_id38ea97d6",
                Region    = "regionedb20d96",
            };
            Job expectedResponse = new Job
            {
                Reference        = new JobReference(),
                Placement        = new JobPlacement(),
                HadoopJob        = new HadoopJob(),
                SparkJob         = new SparkJob(),
                PysparkJob       = new PySparkJob(),
                HiveJob          = new HiveJob(),
                PigJob           = new PigJob(),
                Status           = new JobStatus(),
                YarnApplications =
                {
                    new YarnApplication(),
                },
                SparkSqlJob             = new SparkSqlJob(),
                StatusHistory           = { new JobStatus(), },
                DriverControlFilesUri   = "driver_control_files_uribe41e88b",
                DriverOutputResourceUri = "driver_output_resource_urie2b470d7",
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                Scheduling = new JobScheduling(),
                SparkRJob  = new SparkRJob(),
                JobUuid    = "job_uuid7530ffdd",
                PrestoJob  = new PrestoJob(),
                Done       = true,
            };

            mockGrpcClient.Setup(x => x.CancelJobAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Job>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null);
            Job responseCallSettings   = await client.CancelJobAsync(request.ProjectId, request.Region, request.JobId, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Job responseCancellationToken = await client.CancelJobAsync(request.ProjectId, request.Region, request.JobId, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
예제 #19
0
        internal CancelJobResponse CancelJob(CancelJobRequest request)
        {
            var task = CancelJobAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
예제 #20
0
 /// <summary>Snippet for CancelJob</summary>
 public void CancelJobRequestObject()
 {
     // Snippet: CancelJob(CancelJobRequest, CallSettings)
     // Create client
     JobControllerClient jobControllerClient = JobControllerClient.Create();
     // Initialize request argument(s)
     CancelJobRequest request = new CancelJobRequest
     {
         ProjectId = "",
         JobId     = "",
         Region    = "",
     };
     // Make the request
     Job response = jobControllerClient.CancelJob(request);
     // End snippet
 }
예제 #21
0
        public Response Cancel(CancelJobRequest
                               jobRequest)
        {
            using (var session = _docStore.OpenSession())
            {
                var workItems = session.Query <WorkItem>().Where(w => w.Job.Id.Equals(jobRequest.JobId));
                foreach (var workItem in workItems)
                {
                    workItem.Cancel();
                    session.Store(workItem);
                }

                session.SaveChanges();
            }
            return(new Response(true, "Job {Id} canceled".FormatWith(new { Id = jobRequest.JobId })));
        }
예제 #22
0
        public void CancelJob()
        {
            moq::Mock <JobController.JobControllerClient> mockGrpcClient = new moq::Mock <JobController.JobControllerClient>(moq::MockBehavior.Strict);
            CancelJobRequest request = new CancelJobRequest
            {
                ProjectId = "project_id43ad98b0",
                JobId     = "job_id38ea97d6",
                Region    = "regionedb20d96",
            };
            Job expectedResponse = new Job
            {
                Reference        = new JobReference(),
                Placement        = new JobPlacement(),
                HadoopJob        = new HadoopJob(),
                SparkJob         = new SparkJob(),
                PysparkJob       = new PySparkJob(),
                HiveJob          = new HiveJob(),
                PigJob           = new PigJob(),
                Status           = new JobStatus(),
                YarnApplications =
                {
                    new YarnApplication(),
                },
                SparkSqlJob             = new SparkSqlJob(),
                StatusHistory           = { new JobStatus(), },
                DriverControlFilesUri   = "driver_control_files_uribe41e88b",
                DriverOutputResourceUri = "driver_output_resource_urie2b470d7",
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                Scheduling = new JobScheduling(),
                SparkRJob  = new SparkRJob(),
                JobUuid    = "job_uuid7530ffdd",
                PrestoJob  = new PrestoJob(),
            };

            mockGrpcClient.Setup(x => x.CancelJob(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null);
            Job response = client.CancelJob(request.ProjectId, request.Region, request.JobId);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for CancelJobAsync</summary>
        public async Task CancelJobAsync_RequestObject()
        {
            // Snippet: CancelJobAsync(CancelJobRequest,CallSettings)
            // Create client
            JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();

            // Initialize request argument(s)
            CancelJobRequest request = new CancelJobRequest
            {
                ProjectId = "",
                Region    = "",
                JobId     = "",
            };
            // Make the request
            Job response = await jobControllerClient.CancelJobAsync(request);

            // End snippet
        }
        /// <summary>
        /// <para> This operation cancels a specified job. Only the job owner can cancel it. The operation fails if the job has already started or is
        /// complete. </para>
        /// </summary>
        ///
        /// <param name="cancelJobRequest">Container for the necessary parameters to execute the CancelJob service method on AmazonImportExport.</param>
        ///
        /// <returns>The response from the CancelJob service method, as returned by AmazonImportExport.</returns>
        ///
        /// <exception cref="CanceledJobIdException"/>
        /// <exception cref="ExpiredJobIdException"/>
        /// <exception cref="InvalidAccessKeyIdException"/>
        /// <exception cref="InvalidJobIdException"/>
        /// <exception cref="UnableToCancelJobIdException"/>
        public CancelJobResponse CancelJob(CancelJobRequest cancelJobRequest)
        {
            IAsyncResult asyncResult = invokeCancelJob(cancelJobRequest, null, null, true);

            return(EndCancelJob(asyncResult));
        }
예제 #25
0
 public ActionResult Cancel(CancelJobRequest cmd)
 {
     return(Json(_queue.Cancel(cmd)));
 }
예제 #26
0
        /// <summary>
        /// A blocking cancel request/response cycle.
        /// </summary>
        /// <param name="jobId">The ID of the job to cancel.</param>
        /// <param name="callback">The call response.</param>
        public void CancelJob(int jobId, Action<CancelJobResponse> callback)
        {
            CancelJobRequest request = new CancelJobRequest(this)
            {
                JobId = jobId
            };

            request.GetResponseAsync(callback);
        }
예제 #27
0
        /// <summary>
        /// A blocking cancel job request/response cycle.
        /// </summary>
        /// <param name="jobId">The ID of the job to cancel.</param>
        /// <returns>The call response.</returns>
        public CancelJobResponse CancelJob(int jobId)
        {
            CancelJobRequest request = new CancelJobRequest(this)
            {
                JobId = jobId
            };

            return request.GetResponse();
        }
 /// <summary>
 /// Initiates the asynchronous execution of the CancelJob operation.
 /// <seealso cref="Amazon.ImportExport.IAmazonImportExport.CancelJob"/>
 /// </summary>
 ///
 /// <param name="cancelJobRequest">Container for the necessary parameters to execute the CancelJob operation on AmazonImportExport.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 ///
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCancelJob
 ///         operation.</returns>
 public IAsyncResult BeginCancelJob(CancelJobRequest cancelJobRequest, AsyncCallback callback, object state)
 {
     return(invokeCancelJob(cancelJobRequest, callback, state, false));
 }
예제 #29
0
 /// <summary>
 ///     Cancel-Job Operation
 ///     https://tools.ietf.org/html/rfc2911#section-3.3.3
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public async Task <CancelJobResponse> CancelJobAsync(CancelJobRequest request)
 {
     return(await SendAsync(request.PrinterUri, () => _ippProtocol.Construct(request),
                            ippResponse => _ippProtocol.ConstructCancelJobResponse(ippResponse)));
 }
예제 #30
0
 public IppRequestMessage Construct(CancelJobRequest request) => ConstructIppRequest(request);
예제 #31
0
        /// <summary>
        /// Starts a job cancellation request. To access the job resource after cancellation, call [jobs.list](/dataproc/reference/rest/v1beta1/projects.jobs/list) or [jobs.get](/dataproc/reference/rest/v1beta1/projects.jobs/get).
        /// Documentation https://developers.google.com/dataproc/v1beta1/reference/jobs/cancel
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated dataproc service.</param>
        /// <param name="projectId">[Required] The ID of the Google Cloud Platform project that the job belongs to.</param>
        /// <param name="jobId">[Required] The job ID.</param>
        /// <param name="body">A valid dataproc v1beta1 body.</param>
        /// <returns>JobResponse</returns>
        public static Job Cancel(dataprocService service, string projectId, string jobId, CancelJobRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }
                if (jobId == null)
                {
                    throw new ArgumentNullException(jobId);
                }

                // Make the request.
                return(service.Jobs.Cancel(body, projectId, jobId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Jobs.Cancel failed.", ex);
            }
        }