获取支持的可用区列表
接口说明
获取优云智算平台当前支持的所有可用区信息,包括地域和可用区的 ID 及名称。
POST
https://api.compshare.cnActionDescribeCompShareSupportZone当前支持的可用区
当前支持以下 6 个可用区。其他接口的 Region 和 Zone 参数均从这份列表中选择。
| 地域 | 地域 ID | 可用区 | 可用区 ID | 名称 | 资源类型 |
|---|---|---|---|---|---|
cn-wlcb | 1000039 | cn-wlcb-01 | 10027 | 华北二A | 云主机 |
cn-sh2 | 1000009 | cn-sh2-02 | 8200 | 上海二B | 云主机 |
cn-bj2 | 1000001 | cn-bj2-03 | 5001 | 华北一C | Pod |
cn-wlcb | 1000039 | cn-wlcb-03 | 10033 | 华北二C | Pod |
cn-sh2 | 1000009 | cn-sh2-01 | 8100 | 上海二A | Pod |
us-den | 1000009 | us-den-01 | 10049 | 丹佛 | Pod |
请求参数
| 名称 | 类型 | 必填 | 描述 | 示例值 |
|---|---|---|---|---|
| Action | String | 是 | 接口名称 | DescribeCompShareSupportZone |
| Region | String | 否 | 地域筛选条件。不传时返回全部支持的可用区 | cn-wlcb |
响应参数
| 名称 | 类型 | 描述 | 示例值 |
|---|---|---|---|
| Action | String | 响应名称 | DescribeCompShareSupportZoneResponse |
| RetCode | Integer | 返回码,0 为成功 | 0 |
| request_uuid | String | 请求唯一标识 | e897f547-bd2d-44dd-9de0-415017aa65ad |
| ZoneInfo | Array of Object | 可用区信息列表 | — |
ZoneInfo 元素结构
| 名称 | 类型 | 描述 |
|---|---|---|
| Region | String | 地域名称 |
| RegionId | Integer | 地域 ID |
| Zone | String | 可用区名称 |
| ZoneId | Integer | 可用区 ID |
| Describe | String | 可用区显示名称 |
| IsPod | Boolean | 是否为 Pod 可用区 |
请求示例
Python(使用 UCloud SDK)
from ucloud.core import exc
from ucloud.client import Client
def main():
client = Client({
"region": "cn-wlcb",
"public_key": "my_public_key", # 替换为你的公钥(控制台 账户中心 → API 密钥:https://console.compshare.cn/uaccount/api_manage)
"private_key": "my_private_key", # 替换为你的私钥
"base_url": "https://api.compshare.cn",
})
try:
resp = client.ucompshare().describe_comp_share_support_zone({})
for zone in resp.get("ZoneInfo", []):
print(f" {zone['Zone']} - {zone['Describe']}")
except exc.UCloudException as e:
print(e)
if __name__ == "__main__":
main()Go(使用 UCloud SDK)
package main
import (
"fmt"
"github.com/ucloud/ucloud-sdk-go/services/ucompshare"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
)
func main() {
cfg := ucloud.NewConfig()
cfg.Region = "cn-wlcb"
cfg.BaseUrl = "https://api.compshare.cn"
credential := auth.NewCredential()
credential.PublicKey = "my_public_key" // 替换为你的公钥(控制台 账户中心 → API 密钥:https://console.compshare.cn/uaccount/api_manage)
credential.PrivateKey = "my_private_key" // 替换为你的私钥
client := ucompshare.NewClient(&cfg, &credential)
req := client.NewDescribeCompShareSupportZoneRequest()
resp, err := client.DescribeCompShareSupportZone(req)
if err != nil {
fmt.Printf("查询失败: %s\n", err)
return
}
for _, zone := range resp.ZoneInfo {
fmt.Printf(" %s - %s\n", zone.Zone, zone.Describe)
}
}响应示例
{
"Action": "DescribeCompShareSupportZoneResponse",
"RetCode": 0,
"request_uuid": "e897f547-bd2d-44dd-9de0-415017aa65ad",
"ZoneInfo": [
{
"Region": "cn-wlcb",
"RegionId": 1000039,
"Zone": "cn-wlcb-01",
"ZoneId": 10027,
"Describe": "华北二A",
"IsPod": false
},
{
"Region": "cn-sh2",
"RegionId": 1000009,
"Zone": "cn-sh2-02",
"ZoneId": 8200,
"Describe": "上海二B",
"IsPod": false
},
{
"Region": "cn-bj2",
"RegionId": 1000001,
"Zone": "cn-bj2-03",
"ZoneId": 5001,
"Describe": "华北一C",
"IsPod": true
},
{
"Region": "cn-wlcb",
"RegionId": 1000039,
"Zone": "cn-wlcb-03",
"ZoneId": 10033,
"Describe": "华北二C",
"IsPod": true
},
{
"Region": "cn-sh2",
"RegionId": 1000009,
"Zone": "cn-sh2-01",
"ZoneId": 8100,
"Describe": "上海二A",
"IsPod": true
},
{
"Region": "us-den",
"RegionId": 1000009,
"Zone": "us-den-01",
"ZoneId": 10049,
"Describe": "丹佛",
"IsPod": true
}
]
}Last updated on