可用区
更新时间:2024-07-02
查询可用区列表
如下代码可以查询所有的可用区列表:
Go
1result, err := client.ListZone()
2if err != nil {
3 fmt.Println("list zone failed: ", err)
4} else {
5 fmt.Println("list zone success: ", result)
6}
查询机型的可用区
使用以下代码可以查询指定机型支持的可用区列表:
Go
1args := &api.ListTypeZonesArgs{
2 // 选择实例类型,可以选择N1, N2, N3等
3 InstanceType: "",
4 // 产品类型, 可以选择Prepaid,Postpaid
5 ProductType: "",
6 // 实例套餐规格,可以选择bcc.g3.c2m12等
7 Spec: "",
8 // 实例套餐规格族,可以选择g3,ic4等
9 SpecId: "",
10}
11if res, err := BCC_CLIENT.ListTypeZones(args); err != nil {
12 fmt.Println("Get the specific zone flavor failed: ", err)
13} else {
14 fmt.Println("Get the specific zone flavor success, result: ", res)
15}