protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCIDnsZone", "Remove")) { return; } DeleteZoneRequest request; try { request = new DeleteZoneRequest { ZoneNameOrId = ZoneNameOrId, IfMatch = IfMatch, IfUnmodifiedSince = IfUnmodifiedSince, OpcRequestId = OpcRequestId, CompartmentId = CompartmentId }; response = client.DeleteZone(request).GetAwaiter().GetResult(); WriteOutput(response); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Deletes the specified zone and all its steering policy attachments. /// A 204 response indicates that zone has been successfully deleted. /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <DeleteZoneResponse> DeleteZone(DeleteZoneRequest request) { var uriStr = $"{GetEndPoint(DNSServices.Zones, this.Region)}/{request.ZoneNameOrId}"; if (!string.IsNullOrEmpty(request.CompartmentId)) { uriStr = $"{uriStr}?compartmentId={request.CompartmentId}"; } var uri = new Uri(uriStr); var httpRequestHeaderParam = new HttpRequestHeaderParam() { IfMatch = request.IfMatch, IfUnmodifiedSince = request.IfUnmodifiedSince }; var webResponse = await this.RestClientAsync.Delete(uri, httpRequestHeaderParam); using (var stream = webResponse.GetResponseStream()) using (var reader = new StreamReader(stream)) { var response = reader.ReadToEnd(); return(new DeleteZoneResponse() { OpcRequestId = webResponse.Headers.Get("opc-request-id") }); } }
/// <summary> /// DeleteZone接口的同步版本,删除大区 /// </summary> /// <param name="req">参考<see cref="DeleteZoneRequest"/></param> /// <returns>参考<see cref="DeleteZoneResponse"/>实例</returns> public DeleteZoneResponse DeleteZoneSync(DeleteZoneRequest req) { JsonResponseModel <DeleteZoneResponse> rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteZone"); rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteZoneResponse> >(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return(rsp.Response); }
/// <summary> /// 删除zone,该zone下的解析记录和绑定的vpc关联关系将会被删除 /// /// </summary> /// <param name="request">请求参数信息</param> /// <returns>请求结果信息</returns> public async Task <DeleteZoneResponse> DeleteZone(DeleteZoneRequest request) { return(await new DeleteZoneExecutor().Client(this).Execute <DeleteZoneResponse, DeleteZoneResult, DeleteZoneRequest>(request).ConfigureAwait(false)); }
/// <summary> /// 删除zone,该zone下的解析记录和绑定的vpc关联关系将会被删除 /// /// </summary> /// <param name="request">请求参数信息</param> /// <returns>请求结果信息</returns> public DeleteZoneResponse DeleteZone(DeleteZoneRequest request) { return(new DeleteZoneExecutor().Client(this).Execute <DeleteZoneResponse, DeleteZoneResult, DeleteZoneRequest>(request)); }