protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCIApplicationmigrationMigration", "Remove")) { return; } DeleteMigrationRequest request; try { request = new DeleteMigrationRequest { MigrationId = MigrationId, OpcRequestId = OpcRequestId, IfMatch = IfMatch }; response = client.DeleteMigration(request).GetAwaiter().GetResult(); WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Deletes the specified Application object. /// </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 <DeleteMigrationResponse> DeleteMigration(DeleteMigrationRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called deleteMigration"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/migrations/{migrationId}".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 <DeleteMigrationResponse>(responseMessage)); } catch (Exception e) { logger.Error($"DeleteMigration failed with error: {e.Message}"); throw; } }
/// <summary> /// 本接口(DeleteMigration)用于删除迁移任务 /// </summary> /// <param name="req">参考<see cref="DeleteMigrationRequest"/></param> /// <returns>参考<see cref="DeleteMigrationResponse"/>实例</returns> public async Task <DeleteMigrationResponse> DeleteMigration(DeleteMigrationRequest req) { JsonResponseModel <DeleteMigrationResponse> rsp = null; try { var strResp = await this.InternalRequest(req, "DeleteMigration"); rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteMigrationResponse> >(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return(rsp.Response); }