terraform/vendor/github.com/denverdino/aliyungo/ecs/zones.go

66 lines
1.7 KiB
Go

package ecs
import "github.com/denverdino/aliyungo/common"
type ResourceType string
const (
ResourceTypeInstance = ResourceType("Instance")
ResourceTypeDisk = ResourceType("Disk")
ResourceTypeVSwitch = ResourceType("VSwitch")
ResourceTypeIOOptimizedInstance = ResourceType("IoOptimized")
)
type DescribeZonesArgs struct {
RegionId common.Region
}
//
// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&availableresourcecreationtype
type AvailableResourceCreationType struct {
ResourceTypes []ResourceType //enum for Instance, Disk, VSwitch
}
//
// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&availablediskcategoriestype
type AvailableDiskCategoriesType struct {
DiskCategories []DiskCategory //enum for cloud, ephemeral, ephemeral_ssd
}
type AvailableInstanceTypesType struct {
InstanceTypes []string
}
//
// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&zonetype
type ZoneType struct {
ZoneId string
LocalName string
AvailableInstanceTypes AvailableInstanceTypesType
AvailableResourceCreation AvailableResourceCreationType
AvailableDiskCategories AvailableDiskCategoriesType
}
type DescribeZonesResponse struct {
common.Response
Zones struct {
Zone []ZoneType
}
}
// DescribeZones describes zones
func (client *Client) DescribeZones(regionId common.Region) (zones []ZoneType, err error) {
args := DescribeZonesArgs{
RegionId: regionId,
}
response := DescribeZonesResponse{}
err = client.Invoke("DescribeZones", &args, &response)
if err == nil {
return response.Zones.Zone, nil
}
return []ZoneType{}, err
}