Exemplo n.º 1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            if (!ConfirmDelete("OCIDatacatalogJob", "Remove"))
            {
                return;
            }

            DeleteJobRequest request;

            try
            {
                request = new DeleteJobRequest
                {
                    CatalogId    = CatalogId,
                    JobKey       = JobKey,
                    IfMatch      = IfMatch,
                    OpcRequestId = OpcRequestId
                };

                response = client.DeleteJob(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            if (!ConfirmDelete("OCIDatascienceJob", "Remove"))
            {
                return;
            }

            DeleteJobRequest request;

            try
            {
                request = new DeleteJobRequest
                {
                    JobId                = JobId,
                    IfMatch              = IfMatch,
                    OpcRequestId         = OpcRequestId,
                    DeleteRelatedJobRuns = DeleteRelatedJobRuns
                };

                response = client.DeleteJob(request).GetAwaiter().GetResult();
                WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId));
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Exemplo n.º 3
0
 public DeleteJobResponse DeleteJob(DeleteJobRequest request)
 {
     return(new DeleteJobResponse
     {
         Success = jobManager.JobStore.DeleteJob(request.JobId, request.DeleteHistory),
     });
 }
Exemplo n.º 4
0
        internal virtual DeleteJobResponse DeleteJob(DeleteJobRequest request)
        {
            var marshaller   = DeleteJobRequestMarshaller.Instance;
            var unmarshaller = DeleteJobResponseUnmarshaller.Instance;

            return(Invoke <DeleteJobRequest, DeleteJobResponse>(request, marshaller, unmarshaller));
        }
Exemplo n.º 5
0
        public async Task <bool> Handle(DeleteJobRequest message, IOutputPort <DeleteJobResponse> outputPort)
        {
            bool isOwner = await jobOwnerShipValidator.IsJobOwner(message.CallerId, message.JobId);

            var loadedJob = await jobRepository.GetById(message.JobId);

            if (loadedJob == null)
            {
                outputPort.Handle(new DeleteJobResponse(new[]
                                                        { applicationErrorFactory.ResourceNotFound }));
                return(false);
            }

            if (!isOwner)
            {
                outputPort.Handle(new DeleteJobResponse(new[]
                                                        { applicationErrorFactory.ResourceNotOwned }));
                return(false);
            }

            await jobRepository.Delete(loadedJob);

            outputPort.Handle(new DeleteJobResponse());
            return(true);
        }
Exemplo n.º 6
0
 public void DeleteJob(DeleteJobRequest request)
 {
     using (var response = _netLayer.Invoke(request))
     {
         ResponseParseUtilities.HandleStatusCode(response, HttpStatusCode.NoContent);
     }
 }
Exemplo n.º 7
0
 public async Task DeleteJobAsync(string jobId)
 {
     var request = new DeleteJobRequest {
         JobId = jobId, Force = true
     };
     var response = await _awsClientsService.IoTClient.DeleteJobAsync(request);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteJob operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteJob 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>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/amplify-2017-07-25/DeleteJob">REST API Reference for DeleteJob Operation</seealso>
        public virtual Task <DeleteJobResponse> DeleteJobAsync(DeleteJobRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = DeleteJobRequestMarshaller.Instance;
            var unmarshaller = DeleteJobResponseUnmarshaller.Instance;

            return(InvokeAsync <DeleteJobRequest, DeleteJobResponse>(request, marshaller,
                                                                     unmarshaller, cancellationToken));
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteJob operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteJob 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>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/amplify-2017-07-25/DeleteJob">REST API Reference for DeleteJob Operation</seealso>
        public virtual Task <DeleteJobResponse> DeleteJobAsync(DeleteJobRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeleteJobRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeleteJobResponseUnmarshaller.Instance;

            return(InvokeAsync <DeleteJobResponse>(request, options, cancellationToken));
        }
Exemplo n.º 10
0
        internal virtual DeleteJobResponse DeleteJob(DeleteJobRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeleteJobRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeleteJobResponseUnmarshaller.Instance;

            return(Invoke <DeleteJobResponse>(request, options));
        }
        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);
        }
        /// <summary>
        /// Delete print job from google cloud
        /// reference: https://developers.google.com/cloud-print/docs/appInterfaces#deletejob
        /// </summary>
        /// <param name="request">Parameters for /deletejob interface</param>
        /// <param name="cancellationToken">Cancellation token</param>
        /// <returns>Response from google cloud</returns>
        public async Task <JobsResponse <DeleteJobRequest> > DeleteJobAsync(DeleteJobRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            await UpdateTokenAsync(cancellationToken);

            return(await GoogleCloudPrintBaseUrl
                   .AppendPathSegment("deletejob")
                   .WithOAuthBearerToken(_token.AccessToken)
                   .PostRequestAsync(request, cancellationToken)
                   .ReceiveJsonButThrowIfFails <JobsResponse <DeleteJobRequest> >()
                   .ConfigureAwait(false));
        }
Exemplo n.º 13
0
        public async Task DeleteJobTest()
        {
            var requset = new DeleteJobRequest()
            {
                JobId = 138318
            };
            var result = await Manager.DeleteJobAsync(requset);

            Assert.NotNull(result);
            Assert.Equal(0, result.Status);
        }
Exemplo n.º 14
0
        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);
            }
        }
        // [START job_search_delete_job_beta]
        public static object DeleteJob(string projectId, string tenantId, string jobId)
        {
            JobServiceClient jobServiceClient = JobServiceClient.Create();
            JobName          name             = new JobName(projectId, tenantId, jobId);
            DeleteJobRequest request          = new DeleteJobRequest
            {
                JobNameOneof = JobNameOneof.From(name)
            };

            jobServiceClient.DeleteJob(request);

            Console.WriteLine("Deleted Job.");
            return(0);
        }
Exemplo n.º 16
0
        /// <summary>Snippet for DeleteJob</summary>
        public void DeleteJob_RequestObject()
        {
            // Snippet: DeleteJob(DeleteJobRequest,CallSettings)
            // Create client
            CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.Create();
            // Initialize request argument(s)
            DeleteJobRequest request = new DeleteJobRequest
            {
                JobName = new JobName("[PROJECT]", "[LOCATION]", "[JOB]"),
            };

            // Make the request
            cloudSchedulerClient.DeleteJob(request);
            // End snippet
        }
Exemplo n.º 17
0
        /// <summary>
        /// DeleteJob接口的同步版本,删除训练任务
        /// </summary>
        /// <param name="req">参考<see cref="DeleteJobRequest"/></param>
        /// <returns>参考<see cref="DeleteJobResponse"/>实例</returns>
        public DeleteJobResponse DeleteJobSync(DeleteJobRequest req)
        {
            JsonResponseModel <DeleteJobResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "DeleteJob");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteJobResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
Exemplo n.º 18
0
        /// <summary>Snippet for DeleteJob</summary>
        public void DeleteJob_RequestObject()
        {
            // Snippet: DeleteJob(DeleteJobRequest,CallSettings)
            // Create client
            JobServiceClient jobServiceClient = JobServiceClient.Create();
            // Initialize request argument(s)
            DeleteJobRequest request = new DeleteJobRequest
            {
                JobNameOneof = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")),
            };

            // Make the request
            jobServiceClient.DeleteJob(request);
            // End snippet
        }
Exemplo n.º 19
0
        public async Task DeleteJobAsync2()
        {
            Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict);
            DeleteJobRequest request = new DeleteJobRequest
            {
                JobNameOneof = JobNameOneof.From(new JobOldName("[PROJECT]", "[JOBS]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteJobAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null);
            await client.DeleteJobAsync(request);

            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 20
0
        public async Task DeleteJobAsync2()
        {
            Mock <CloudScheduler.CloudSchedulerClient> mockGrpcClient = new Mock <CloudScheduler.CloudSchedulerClient>(MockBehavior.Strict);
            DeleteJobRequest request = new DeleteJobRequest
            {
                Name = new JobName("[PROJECT]", "[LOCATION]", "[JOB]").ToString(),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteJobAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            CloudSchedulerClient client = new CloudSchedulerClientImpl(mockGrpcClient.Object, null);
            await client.DeleteJobAsync(request);

            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 21
0
        public void DeleteJob2()
        {
            Mock <CloudScheduler.CloudSchedulerClient> mockGrpcClient = new Mock <CloudScheduler.CloudSchedulerClient>(MockBehavior.Strict);
            DeleteJobRequest request = new DeleteJobRequest
            {
                Name = new JobName("[PROJECT]", "[LOCATION]", "[JOB]").ToString(),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteJob(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CloudSchedulerClient client = new CloudSchedulerClientImpl(mockGrpcClient.Object, null);

            client.DeleteJob(request);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 22
0
        public void DeleteJob2()
        {
            Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict);
            DeleteJobRequest request = new DeleteJobRequest
            {
                JobNameOneof = JobNameOneof.From(new JobOldName("[PROJECT]", "[JOBS]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteJob(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null);

            client.DeleteJob(request);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 23
0
        public void DeleteJob()
        {
            Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict);
            DeleteJobRequest expectedRequest = new DeleteJobRequest
            {
                Name = new JobName("[PROJECT]", "[JOB]").ToString(),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteJob(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            JobServiceClient client        = new JobServiceClientImpl(mockGrpcClient.Object, null);
            string           formattedName = new JobName("[PROJECT]", "[JOB]").ToString();

            client.DeleteJob(formattedName);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 24
0
        /// <summary>Snippet for DeleteJob</summary>
        public void DeleteJobRequestObject()
        {
            // Snippet: DeleteJob(DeleteJobRequest, CallSettings)
            // Create client
            JobControllerClient jobControllerClient = JobControllerClient.Create();
            // Initialize request argument(s)
            DeleteJobRequest request = new DeleteJobRequest
            {
                ProjectId = "",
                JobId     = "",
                Region    = "",
            };

            // Make the request
            jobControllerClient.DeleteJob(request);
            // End snippet
        }
Exemplo n.º 25
0
        /// <summary>Snippet for DeleteJobAsync</summary>
        public async Task DeleteJobAsync_RequestObject()
        {
            // Snippet: DeleteJobAsync(DeleteJobRequest,CallSettings)
            // Additional: DeleteJobAsync(DeleteJobRequest,CancellationToken)
            // Create client
            CloudSchedulerClient cloudSchedulerClient = await CloudSchedulerClient.CreateAsync();

            // Initialize request argument(s)
            DeleteJobRequest request = new DeleteJobRequest
            {
                JobName = new JobName("[PROJECT]", "[LOCATION]", "[JOB]"),
            };
            // Make the request
            await cloudSchedulerClient.DeleteJobAsync(request);

            // End snippet
        }
Exemplo n.º 26
0
        /// <summary>Snippet for DeleteJobAsync</summary>
        public async Task DeleteJobAsync_RequestObject()
        {
            // Snippet: DeleteJobAsync(DeleteJobRequest,CallSettings)
            // Additional: DeleteJobAsync(DeleteJobRequest,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteJobRequest request = new DeleteJobRequest
            {
                JobNameOneof = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")),
            };
            // Make the request
            await jobServiceClient.DeleteJobAsync(request);

            // End snippet
        }
Exemplo n.º 27
0
 public SuccessResponse Delete(DeleteJobRequest request)
 {
     try
     {
         var job = _jobRepository.FindBy(request.Id);
         job.ThrowExceptionIfRecordIsNull();
         var isReference = _jobRepository.IsReference(request.Id);
         isReference.ThrowExceptionIfIsReference();
         _jobRepository.Remove(job);
         return(new SuccessResponse {
             IsSuccess = true
         });
     }
     catch (DataAccessException)
     {
         throw new ApplicationException();
     }
 }
Exemplo n.º 28
0
        public void DeleteJob2()
        {
            Mock <JobController.JobControllerClient> mockGrpcClient = new Mock <JobController.JobControllerClient>(MockBehavior.Strict);
            DeleteJobRequest request = new DeleteJobRequest
            {
                ProjectId = "projectId-1969970175",
                Region    = "region-934795532",
                JobId     = "jobId-1154752291",
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteJob(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null);

            client.DeleteJob(request);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for DeleteJobAsync</summary>
        public async Task DeleteJobAsync_RequestObject()
        {
            // Snippet: DeleteJobAsync(DeleteJobRequest,CallSettings)
            // Create client
            JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();

            // Initialize request argument(s)
            DeleteJobRequest request = new DeleteJobRequest
            {
                ProjectId = "",
                Region    = "",
                JobId     = "",
            };
            // Make the request
            await jobControllerClient.DeleteJobAsync(request);

            // End snippet
        }
Exemplo n.º 30
0
        public async Task DeleteJobAsync2()
        {
            Mock <JobController.JobControllerClient> mockGrpcClient = new Mock <JobController.JobControllerClient>(MockBehavior.Strict);
            DeleteJobRequest request = new DeleteJobRequest
            {
                ProjectId = "projectId-1969970175",
                Region    = "region-934795532",
                JobId     = "jobId-1154752291",
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteJobAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null);
            await client.DeleteJobAsync(request);

            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 31
0
        /// <summary>
        /// A blocking delete request/response cycle.
        /// </summary>
        /// <param name="jobId">The ID of the job to delete.</param>
        /// <param name="callback">The call response.</param>
        public void DeleteJob(int jobId, Action<DeleteJobResponse> callback)
        {
            DeleteJobRequest request = new DeleteJobRequest(this)
            {
                JobId = jobId
            };

            request.GetResponseAsync(callback);
        }
Exemplo n.º 32
0
        /// <summary>
        /// A blocking delete job request/response cycle.
        /// </summary>
        /// <param name="jobId">The ID of the job to delete.</param>
        /// <returns>The call response.</returns>
        public DeleteJobResponse DeleteJob(int jobId)
        {
            DeleteJobRequest request = new DeleteJobRequest(this)
            {
                JobId = jobId
            };

            return request.GetResponse();
        }