protected override void ProcessRecord()
        {
            base.ProcessRecord();

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

            DeleteExportRequest request;

            try
            {
                request = new DeleteExportRequest
                {
                    ExportId     = ExportId,
                    IfMatch      = IfMatch,
                    OpcRequestId = OpcRequestId
                };

                response = client.DeleteExport(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Example #2
0
        /// <summary>
        /// 本接口用于删除日志导出
        /// </summary>
        /// <param name="req"><see cref="DeleteExportRequest"/></param>
        /// <returns><see cref="DeleteExportResponse"/></returns>
        public DeleteExportResponse DeleteExportSync(DeleteExportRequest req)
        {
            JsonResponseModel <DeleteExportResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "DeleteExport");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteExportResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
        /**
         * Deletes an export and waits for it to be deleted.
         *
         * @param fsClient the service client used to communicate with the File Storage service
         * @param export the export to delete
         */
        private static async Task DeleteExport(FileStorageClient fsClient, Export export)
        {
            logger.Info("Deleting export");

            DeleteExportRequest deleteExportRequest = new DeleteExportRequest
            {
                ExportId = export.Id
            };
            await fsClient.DeleteExport(deleteExportRequest);

            GetExportRequest getExportRequest = new GetExportRequest
            {
                ExportId = export.Id
            };

            fsClient.Waiters.ForExport(getExportRequest, Export.LifecycleStateEnum.Deleted).Execute();
        }