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

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

            DeleteNatGatewayRequest request;

            try
            {
                request = new DeleteNatGatewayRequest
                {
                    NatGatewayId = NatGatewayId,
                    IfMatch      = IfMatch
                };

                response = client.DeleteNatGateway(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除公网NAT网关
        /// </summary>
        public DeleteNatGatewayResponse DeleteNatGateway(DeleteNatGatewayRequest deleteNatGatewayRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("nat_gateway_id", deleteNatGatewayRequest.NatGatewayId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/nat_gateways/{nat_gateway_id}", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", deleteNatGatewayRequest);
            HttpResponseMessage response = DoHttpRequestSync("DELETE", request);

            return(JsonUtils.DeSerializeNull <DeleteNatGatewayResponse>(response));
        }