/// <summary>
        /// Cancels the specified run if it has not already completed or was previously cancelled.
        /// If a run is in progress, the executing job will be killed.
        ///
        /// </summary>
        /// <param name="request">The request object containing the details to send. Required.</param>
        /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
        /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
        /// <returns>A response object containing details about the completed operation</returns>
        public async Task <DeleteRunResponse> DeleteRun(DeleteRunRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called deleteRun");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/runs/{runId}".Trim('/')));
            HttpMethod         method         = new HttpMethod("Delete");
            HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);

            requestMessage.Headers.Add("Accept", "application/json");
            GenericRetrier      retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
            HttpResponseMessage responseMessage;

            try
            {
                if (retryingClient != null)
                {
                    responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage);
                }

                return(Converter.FromHttpResponseMessage <DeleteRunResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"DeleteRun failed with error: {e.Message}");
                throw;
            }
        }
Example #2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

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

            DeleteRunRequest request;

            try
            {
                request = new DeleteRunRequest
                {
                    RunId        = RunId,
                    OpcRequestId = OpcRequestId,
                    IfMatch      = IfMatch
                };

                response = client.DeleteRun(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Example #3
0
        public void TestDeleteRun()
        {
            var localName  = "Run.doc";
            var remoteName = "TestDeleteRun.docx";
            var fullName   = Path.Combine(this.dataFolder, remoteName);
            var index      = 0;

            this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.runFolder) + localName));

            var request = new DeleteRunRequest(remoteName, "paragraphs/1", index, this.dataFolder);
            var actual  = this.WordsApi.DeleteRun(request);

            Assert.AreEqual(200, actual.Code);
        }
        public void TestDeleteRun()
        {
            string remoteFileName = "TestDeleteRun.docx";

            this.UploadFileToStorage(
                remoteDataFolder + "/" + remoteFileName,
                null,
                null,
                File.ReadAllBytes(LocalTestDataFolder + localFile)
                );

            var request = new DeleteRunRequest(
                name: remoteFileName,
                paragraphPath: "paragraphs/1",
                index: 0,
                folder: remoteDataFolder
                );

            this.WordsApi.DeleteRun(request);
        }