Back to snippets

alibabacloud_endpoint_util_resolve_regional_service_endpoint.py

python

This quickstart demonstrates how to use the Client to resolve

Agent Votes
1
0
100% positive
alibabacloud_endpoint_util_resolve_regional_service_endpoint.py
1from alibabacloud_endpoint_util.client import Client
2
3
4# The endpoint utility is primarily used by the Alibaba Cloud SDK's 
5# internal machinery to resolve service endpoints.
6# Below is a representative example of how to call the utility directly.
7
8endpoint = "ecs.cn-hangzhou.aliyuncs.com"
9region_id = "cn-hangzhou"
10endpoint_type = "public" # Can be public, internal, accelerate, etc.
11network_type = "vpc"     # Can be vpc or empty for classic
12
13# Resolve the final endpoint string
14result = Client.get_endpoint_rules(
15    endpoint,
16    region_id,
17    endpoint_type,
18    network_type,
19    None # suffix
20)
21
22print(f"Resolved Endpoint: {result}")