You need to enable JavaScript to run this app.
导航
查询DNAT规则
最近更新时间:2023.06.09 11:16:55首次发布时间:2023.06.09 11:16:55

本文介绍如何创建一条DNAT规则。

示例代码

# Example Code generated by Beijing Volcanoengine Technology.
from __future__ import print_function
import volcenginesdkcore
import volcenginesdknatgateway
from pprint import pprint
from volcenginesdkcore.rest import ApiException

if __name__ == '__main__':
    configuration = volcenginesdkcore.Configuration()
    
    # 设置您的ak
    configuration.ak = "AK"
    # 设置您的sk
    configuration.sk = "SK"
    # 设置您要访问的地域
    configuration.region = "cn-beijing"
    
    # 设置默认配置
    volcenginesdkcore.Configuration.set_default(configuration)

    # 使用全局默认配置
    api_instance = volcenginesdknatgateway.NATGATEWAYApi()

    # 按条件查询DNAT规则
    describe_dnat_entries_request = volcenginesdknatgateway.DescribeDnatEntriesRequest(
        dnat_entry_ids=["dnat-342abc3bc3****"],        # DNAT规则的ID
        nat_gateway_id="ngw-2feq5xhimd88w59gp686****", # NAT网关的ID
    )

    # 发起请求并处理返回或异常
    try:
        resp = api_instance.describe_dnat_entries(describe_dnat_entries_request)
        pprint(resp)
    except ApiException as e:
        print("Exception when calling api: %s\n" % e)

相关文档