You need to enable JavaScript to run this app.
导航

删除NAT网关

最近更新时间2023.06.09 11:16:54

首次发布时间2023.06.09 11:16:54

本文介绍如何删除指定的NAT网关。

示例代码

/**
* Example Code generated by Beijing Volcanoengine Technology.
*/
package com.volcengine.natgateway.examples;

import com.volcengine.ApiClient;
import com.volcengine.ApiException;
import com.volcengine.sign.Credentials;

import com.volcengine.natgateway.NatgatewayApi;
import com.volcengine.natgateway.model.*;


public class TestDeleteNatGateway {
    public static void main(String[] args) throws Exception {
        // 设置您的ak
        String ak = "Your AK";
        // 设置您的sk
        String sk = "Your SK";
        // 设置您要访问的地域
        String region = "Your Region";

				// 初始化apiclient
        ApiClient apiClient = new ApiClient()
                .setCredentials(Credentials.getCredentials(ak, sk))
                .setRegion(region);

        NatgatewayApi api = new NatgatewayApi(apiClient);

        // 删除NAT网关
        DeleteNatGatewayRequest deleteNatGatewayRequest = new DeleteNatGatewayRequest();
        deleteNatGatewayRequest.setNatGatewayId("ngw-vv3t043k05sm****"); // NAT网关的ID

        // 发起请求并处理返回或异常
        try {
            DeleteNatGatewayResponse response = api.deleteNatGateway(deleteNatGatewayRequest);
            System.out.println(response);
        } catch (ApiException e) {
            System.out.println(e.getResponseBody());
        }
    }
}

相关文档