You need to enable JavaScript to run this app.
文档中心
NAT网关

NAT网关

复制全文
下载 pdf
JAVA
修改SNAT规则
复制全文
下载 pdf
修改SNAT规则
本文介绍如何修改SNAT规则。​
示例代码​
​
/**​
* 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 TestModifySnatEntryAttributes {​
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);​
​
// 修改SNAT规则​
ModifySnatEntryAttributesRequest modifySnatEntryAttributesRequest = new ModifySnatEntryAttributesRequest();​
modifySnatEntryAttributesRequest.setEipId("eip-2feaac9wtccn459gp67qe****"); // 修改后公网IP的ID​
modifySnatEntryAttributesRequest.setSnatEntryId("snat-2fedi096gdiww59gp680r****"); // SNAT规则的ID​
​
// 发起请求并处理返回或异常​
try {​
ModifySnatEntryAttributesResponse response = api.modifySnatEntryAttributes(modifySnatEntryAttributesRequest);​
System.out.println(response);​
} catch (ApiException e) {​
System.out.println(e.getResponseBody());​
}​
}​
}​
​
相关文档​
​
最近更新时间:2025.07.23 16:22:02
这个页面对您有帮助吗?
有用
有用
无用
无用