forked from denverdino/aliyungo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zones.go
51 lines (41 loc) · 1004 Bytes
/
zones.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package slb
import (
"github.com/denverdino/aliyungo/common"
)
type DescribeZonesArgs struct {
RegionId common.Region
}
//
// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&zonetype
type ZoneType struct {
ZoneId string
LocalName string
SlaveZones struct {
SlaveZone []ZoneType
}
}
type DescribeZonesResponse struct {
common.Response
Zones struct {
Zone []ZoneType
}
}
// DescribeZones describes zones
func (client *Client) DescribeZones(regionId common.Region) (zones []ZoneType, err error) {
response, err := client.DescribeZonesWithRaw(regionId)
if err == nil {
return response.Zones.Zone, nil
}
return []ZoneType{}, err
}
func (client *Client) DescribeZonesWithRaw(regionId common.Region) (response *DescribeZonesResponse, err error) {
args := DescribeZonesArgs{
RegionId: regionId,
}
response = &DescribeZonesResponse{}
err = client.Invoke("DescribeZones", &args, response)
if err == nil {
return response, nil
}
return nil, err
}