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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
package ecs
import "github.com/denverdino/aliyungo/common"
type DescribeInstanceTypesArgs struct {
InstanceTypeFamily string
}
//
// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&instancetypeitemtype
type InstanceTypeItemType struct {
InstanceTypeId string
CpuCoreCount int
MemorySize float64
InstanceTypeFamily string
GPUAmount int
GPUSpec string
InitialCredit int
BaselineCredit int
EniQuantity int
LocalStorageCapacity int
LocalStorageAmount int
LocalStorageCategory string
}
type DescribeInstanceTypesResponse struct {
common.Response
InstanceTypes struct {
InstanceType []InstanceTypeItemType
}
}
// DescribeInstanceTypes describes all instance types
//
// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/other&describeinstancetypes
func (client *Client) DescribeInstanceTypes() (instanceTypes []InstanceTypeItemType, err error) {
response := DescribeInstanceTypesResponse{}
err = client.Invoke("DescribeInstanceTypes", &DescribeInstanceTypesArgs{}, &response)
if err != nil {
return []InstanceTypeItemType{}, err
}
return response.InstanceTypes.InstanceType, nil
}
// support user args
func (client *Client) DescribeInstanceTypesNew(args *DescribeInstanceTypesArgs) (instanceTypes []InstanceTypeItemType, err error) {
response := DescribeInstanceTypesResponse{}
err = client.Invoke("DescribeInstanceTypes", args, &response)
if err != nil {
return []InstanceTypeItemType{}, err
}
return response.InstanceTypes.InstanceType, nil
}
type DescribeInstanceTypeFamiliesArgs struct {
RegionId common.Region
Generation string
}
type InstanceTypeFamilies struct {
InstanceTypeFamily []InstanceTypeFamily
}
type InstanceTypeFamily struct {
InstanceTypeFamilyId string
Generation string
}
type DescribeInstanceTypeFamiliesResponse struct {
common.Response
InstanceTypeFamilies InstanceTypeFamilies
}
func (client *Client) DescribeInstanceTypeFamilies(args *DescribeInstanceTypeFamiliesArgs) (*DescribeInstanceTypeFamiliesResponse, error) {
response := &DescribeInstanceTypeFamiliesResponse{}
err := client.Invoke("DescribeInstanceTypeFamilies", args, response)
if err != nil {
return nil, err
}
return response, nil
}
|