本文介绍如何添加静态路由。
# Example Code generated by Beijing Volcanoengine Technology. from __future__ import print_function import volcenginesdkcore import volcenginesdkdirectconnect 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 = volcenginesdkdirectconnect.DIRECTCONNECTApi() # 配置待添加静态路由的参数。 create_direct_connect_gateway_route_request = volcenginesdkdirectconnect.CreateDirectConnectGatewayRouteRequest( destination_cidr_block="172.XX.XX.0/24", # 设置专线网关路由的目的网段。 direct_connect_gateway_id="dcg-2fe3zsmkshs59g****", # 置待添加静态路由的专线网关的ID。 next_hop_id="dcv-7qthudw0ll6jmc****", # 设置专线网关路由下一跳虚拟接口的ID。 ) # 发起请求并处理返回或异常。 try: resp = api_instance.create_direct_connect_gateway_route(create_direct_connect_gateway_route_request) pprint(resp) except ApiException as e: print("Exception when calling api: %s\n" % e)