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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
package ess
import "github.com/denverdino/aliyungo/common"
type AdjustmentType string
const (
QuantityChangeInCapacity = AdjustmentType("QuantityChangeInCapacity")
PercentChangeInCapacity = AdjustmentType("PercentChangeInCapacity")
TotalCapacity = AdjustmentType("TotalCapacity")
)
type CreateScalingRuleArgs struct {
RegionId common.Region
ScalingGroupId string
AdjustmentType AdjustmentType
AdjustmentValue int
Cooldown int
ScalingRuleName string
}
type CreateScalingRuleResponse struct {
common.Response
ScalingRuleId string
ScalingRuleAri string
}
// CreateScalingRule create scaling rule
//
// You can read doc at https://help.aliyun.com/document_detail/25948.html?spm=5176.doc25944.6.629.FLkNnj
func (client *Client) CreateScalingRule(args *CreateScalingRuleArgs) (resp *CreateScalingRuleResponse, err error) {
response := CreateScalingRuleResponse{}
err = client.Invoke("CreateScalingRule", args, &response)
if err != nil {
return nil, err
}
return &response, nil
}
type ModifyScalingRuleArgs struct {
RegionId common.Region
ScalingRuleId string
AdjustmentType AdjustmentType
AdjustmentValue int
Cooldown int
ScalingRuleName string
}
type ModifyScalingRuleResponse struct {
common.Response
}
// ModifyScalingRule modify scaling rule
//
// You can read doc at https://help.aliyun.com/document_detail/25949.html?spm=5176.doc25948.6.630.HGN1va
func (client *Client) ModifyScalingRule(args *ModifyScalingRuleArgs) (resp *ModifyScalingRuleResponse, err error) {
response := ModifyScalingRuleResponse{}
err = client.Invoke("ModifyScalingRule", args, &response)
if err != nil {
return nil, err
}
return &response, nil
}
type DescribeScalingRulesArgs struct {
common.Pagination
RegionId common.Region
ScalingGroupId string
ScalingRuleId common.FlattenArray
ScalingRuleName common.FlattenArray
ScalingRuleAri common.FlattenArray
}
type DescribeScalingRulesResponse struct {
common.Response
common.PaginationResult
ScalingRules struct {
ScalingRule []ScalingRuleItemType
}
}
type ScalingRuleItemType struct {
ScalingRuleId string
ScalingGroupId string
ScalingRuleName string
AdjustmentType string
ScalingRuleAri string
Cooldown int
AdjustmentValue int
}
// DescribeScalingRules describes scaling rules
//
// You can read doc at https://help.aliyun.com/document_detail/25950.html?spm=5176.doc25949.6.631.RwPguo
func (client *Client) DescribeScalingRules(args *DescribeScalingRulesArgs) (configs []ScalingRuleItemType, pagination *common.PaginationResult, err error) {
args.Validate()
response := DescribeScalingRulesResponse{}
err = client.InvokeByFlattenMethod("DescribeScalingRules", args, &response)
if err == nil {
return response.ScalingRules.ScalingRule, &response.PaginationResult, nil
}
return nil, nil, err
}
type DeleteScalingRuleArgs struct {
RegionId common.Region
ScalingRuleId string
}
type DeleteScalingRuleResponse struct {
common.Response
}
// DeleteScalingRule delete scaling rule
//
// You can read doc at https://help.aliyun.com/document_detail/25951.html?spm=5176.doc25950.6.632.HbPLMZ
func (client *Client) DeleteScalingRule(args *DeleteScalingRuleArgs) (resp *DeleteScalingRuleResponse, err error) {
response := DeleteScalingRuleResponse{}
err = client.InvokeByFlattenMethod("DeleteScalingRule", args, &response)
if err != nil {
return nil, err
}
return &response, nil
}
type ExecuteScalingRuleArgs struct {
ScalingRuleAri string
ClientToken string
}
type ExecuteScalingRuleResponse struct {
common.Response
ScalingActivityId string
}
// ExecuteScalingRule execute scaling rule
//
// You can read doc at https://help.aliyun.com/document_detail/25953.html?spm=5176.doc25961.6.632.7sXDx6
func (client *Client) ExecuteScalingRule(args *ExecuteScalingRuleArgs) (*ExecuteScalingRuleResponse, error) {
resp := ExecuteScalingRuleResponse{}
err := client.InvokeByFlattenMethod("ExecuteScalingRule", args, &resp)
if err != nil {
return nil, err
}
return &resp, nil
}
|