| 1 |
package ecs |
| 2 |
|
| 3 |
import "github.com/denverdino/aliyungo/common" |
| 4 |
|
| 5 |
type DescribeInstanceTypesArgs struct { |
| 6 |
InstanceTypeFamily string |
| 7 |
} |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
type InstanceTypeItemType struct { |
| 12 |
InstanceTypeId string |
| 13 |
CpuCoreCount int |
| 14 |
MemorySize float64 |
| 15 |
InstanceTypeFamily string |
| 16 |
GPUAmount int |
| 17 |
GPUSpec string |
| 18 |
InitialCredit int |
| 19 |
BaselineCredit int |
| 20 |
EniQuantity int |
| 21 |
LocalStorageCapacity int |
| 22 |
LocalStorageAmount int |
| 23 |
LocalStorageCategory string |
| 24 |
} |
| 25 |
|
| 26 |
type DescribeInstanceTypesResponse struct { |
| 27 |
common.Response |
| 28 |
InstanceTypes struct { |
| 29 |
InstanceType []InstanceTypeItemType |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
func (client *Client) DescribeInstanceTypes() (instanceTypes []InstanceTypeItemType, err error) { |
| 37 |
response := DescribeInstanceTypesResponse{} |
| 38 |
|
| 39 |
err = client.Invoke("DescribeInstanceTypes", &DescribeInstanceTypesArgs{}, &response) |
| 40 |
|
| 41 |
if err != nil { |
| 42 |
return []InstanceTypeItemType{}, err |
| 43 |
} |
| 44 |
return response.InstanceTypes.InstanceType, nil |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
func (client *Client) DescribeInstanceTypesNew(args *DescribeInstanceTypesArgs) (instanceTypes []InstanceTypeItemType, err error) { |
| 50 |
response := DescribeInstanceTypesResponse{} |
| 51 |
|
| 52 |
err = client.Invoke("DescribeInstanceTypes", args, &response) |
| 53 |
|
| 54 |
if err != nil { |
| 55 |
return []InstanceTypeItemType{}, err |
| 56 |
} |
| 57 |
return response.InstanceTypes.InstanceType, nil |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
type DescribeInstanceTypeFamiliesArgs struct { |
| 62 |
RegionId common.Region |
| 63 |
Generation string |
| 64 |
} |
| 65 |
|
| 66 |
type InstanceTypeFamilies struct { |
| 67 |
InstanceTypeFamily []InstanceTypeFamily |
| 68 |
} |
| 69 |
|
| 70 |
type InstanceTypeFamily struct { |
| 71 |
InstanceTypeFamilyId string |
| 72 |
Generation string |
| 73 |
} |
| 74 |
|
| 75 |
type DescribeInstanceTypeFamiliesResponse struct { |
| 76 |
common.Response |
| 77 |
|
| 78 |
InstanceTypeFamilies InstanceTypeFamilies |
| 79 |
} |
| 80 |
|
| 81 |
func (client *Client) DescribeInstanceTypeFamilies(args *DescribeInstanceTypeFamiliesArgs) (*DescribeInstanceTypeFamiliesResponse, error) { |
| 82 |
response := &DescribeInstanceTypeFamiliesResponse{} |
| 83 |
|
| 84 |
err := client.Invoke("DescribeInstanceTypeFamilies", args, response) |
| 85 |
if err != nil { |
| 86 |
return nil, err |
| 87 |
} |
| 88 |
|
| 89 |
return response, nil |
| 90 |
} |