-
Notifications
You must be signed in to change notification settings - Fork 271
/
create_scaling_group.go
211 lines (193 loc) · 11.7 KB
/
create_scaling_group.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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
package ess
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)
// CreateScalingGroup invokes the ess.CreateScalingGroup API synchronously
func (client *Client) CreateScalingGroup(request *CreateScalingGroupRequest) (response *CreateScalingGroupResponse, err error) {
response = CreateCreateScalingGroupResponse()
err = client.DoAction(request, response)
return
}
// CreateScalingGroupWithChan invokes the ess.CreateScalingGroup API asynchronously
func (client *Client) CreateScalingGroupWithChan(request *CreateScalingGroupRequest) (<-chan *CreateScalingGroupResponse, <-chan error) {
responseChan := make(chan *CreateScalingGroupResponse, 1)
errChan := make(chan error, 1)
err := client.AddAsyncTask(func() {
defer close(responseChan)
defer close(errChan)
response, err := client.CreateScalingGroup(request)
if err != nil {
errChan <- err
} else {
responseChan <- response
}
})
if err != nil {
errChan <- err
close(responseChan)
close(errChan)
}
return responseChan, errChan
}
// CreateScalingGroupWithCallback invokes the ess.CreateScalingGroup API asynchronously
func (client *Client) CreateScalingGroupWithCallback(request *CreateScalingGroupRequest, callback func(response *CreateScalingGroupResponse, err error)) <-chan int {
result := make(chan int, 1)
err := client.AddAsyncTask(func() {
var response *CreateScalingGroupResponse
var err error
defer close(result)
response, err = client.CreateScalingGroup(request)
callback(response, err)
result <- 1
})
if err != nil {
defer close(result)
callback(nil, err)
result <- 0
}
return result
}
// CreateScalingGroupRequest is the request struct for api CreateScalingGroup
type CreateScalingGroupRequest struct {
*requests.RpcRequest
AzBalance requests.Boolean `position:"Query" name:"AzBalance"`
VSwitchIds *[]string `position:"Query" name:"VSwitchIds" type:"Repeated"`
MaxInstanceLifetime requests.Integer `position:"Query" name:"MaxInstanceLifetime"`
SpotInstanceRemedy requests.Boolean `position:"Query" name:"SpotInstanceRemedy"`
ScaleOutAmountCheck requests.Boolean `position:"Query" name:"ScaleOutAmountCheck"`
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
GroupType string `position:"Query" name:"GroupType"`
SyncAlarmRuleToCms requests.Boolean `position:"Query" name:"SyncAlarmRuleToCms"`
CustomPolicyARN string `position:"Query" name:"CustomPolicyARN"`
Tag *[]CreateScalingGroupTag `position:"Query" name:"Tag" type:"Repeated"`
DefaultCooldown requests.Integer `position:"Query" name:"DefaultCooldown"`
ContainerGroupId string `position:"Query" name:"ContainerGroupId"`
MultiAZPolicy string `position:"Query" name:"MultiAZPolicy"`
DBInstanceIds string `position:"Query" name:"DBInstanceIds"`
LaunchTemplateId string `position:"Query" name:"LaunchTemplateId"`
DesiredCapacity requests.Integer `position:"Query" name:"DesiredCapacity"`
ServerGroup *[]CreateScalingGroupServerGroup `position:"Query" name:"ServerGroup" type:"Repeated"`
LaunchTemplateOverride *[]CreateScalingGroupLaunchTemplateOverride `position:"Query" name:"LaunchTemplateOverride" type:"Repeated"`
CompensateWithOnDemand requests.Boolean `position:"Query" name:"CompensateWithOnDemand"`
MinSize requests.Integer `position:"Query" name:"MinSize"`
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
AlbServerGroup *[]CreateScalingGroupAlbServerGroup `position:"Query" name:"AlbServerGroup" type:"Repeated"`
VSwitchId string `position:"Query" name:"VSwitchId"`
InstanceId string `position:"Query" name:"InstanceId"`
MaxSize requests.Integer `position:"Query" name:"MaxSize"`
LifecycleHook *[]CreateScalingGroupLifecycleHook `position:"Query" name:"LifecycleHook" type:"Repeated"`
LoadBalancerIds string `position:"Query" name:"LoadBalancerIds"`
ClientToken string `position:"Query" name:"ClientToken"`
SystemTag *[]CreateScalingGroupSystemTag `position:"Query" name:"SystemTag" type:"Repeated"`
LoadBalancerConfig *[]CreateScalingGroupLoadBalancerConfig `position:"Query" name:"LoadBalancerConfig" type:"Repeated"`
OnDemandBaseCapacity requests.Integer `position:"Query" name:"OnDemandBaseCapacity"`
OnDemandPercentageAboveBaseCapacity requests.Integer `position:"Query" name:"OnDemandPercentageAboveBaseCapacity"`
SpotAllocationStrategy string `position:"Query" name:"SpotAllocationStrategy"`
RemovalPolicy1 string `position:"Query" name:"RemovalPolicy.1"`
RemovalPolicy2 string `position:"Query" name:"RemovalPolicy.2"`
RemovalPolicy3 string `position:"Query" name:"RemovalPolicy.3"`
HealthCheckType string `position:"Query" name:"HealthCheckType"`
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
ScalingGroupName string `position:"Query" name:"ScalingGroupName"`
OwnerAccount string `position:"Query" name:"OwnerAccount"`
SpotInstancePools requests.Integer `position:"Query" name:"SpotInstancePools"`
GroupDeletionProtection requests.Boolean `position:"Query" name:"GroupDeletionProtection"`
LaunchTemplateVersion string `position:"Query" name:"LaunchTemplateVersion"`
ScalingPolicy string `position:"Query" name:"ScalingPolicy"`
AllocationStrategy string `position:"Query" name:"AllocationStrategy"`
VServerGroup *[]CreateScalingGroupVServerGroup `position:"Query" name:"VServerGroup" type:"Repeated"`
}
// CreateScalingGroupTag is a repeated param struct in CreateScalingGroupRequest
type CreateScalingGroupTag struct {
Propagate string `name:"Propagate"`
Value string `name:"Value"`
Key string `name:"Key"`
}
// CreateScalingGroupServerGroup is a repeated param struct in CreateScalingGroupRequest
type CreateScalingGroupServerGroup struct {
ServerGroupId string `name:"ServerGroupId"`
Port string `name:"Port"`
Weight string `name:"Weight"`
Type string `name:"Type"`
}
// CreateScalingGroupLaunchTemplateOverride is a repeated param struct in CreateScalingGroupRequest
type CreateScalingGroupLaunchTemplateOverride struct {
WeightedCapacity string `name:"WeightedCapacity"`
InstanceType string `name:"InstanceType"`
SpotPriceLimit string `name:"SpotPriceLimit"`
}
// CreateScalingGroupAlbServerGroup is a repeated param struct in CreateScalingGroupRequest
type CreateScalingGroupAlbServerGroup struct {
AlbServerGroupId string `name:"AlbServerGroupId"`
Port string `name:"Port"`
Weight string `name:"Weight"`
}
// CreateScalingGroupLifecycleHook is a repeated param struct in CreateScalingGroupRequest
type CreateScalingGroupLifecycleHook struct {
DefaultResult string `name:"DefaultResult"`
LifecycleHookName string `name:"LifecycleHookName"`
HeartbeatTimeout string `name:"HeartbeatTimeout"`
NotificationArn string `name:"NotificationArn"`
NotificationMetadata string `name:"NotificationMetadata"`
LifecycleTransition string `name:"LifecycleTransition"`
}
// CreateScalingGroupSystemTag is a repeated param struct in CreateScalingGroupRequest
type CreateScalingGroupSystemTag struct {
Scope string `name:"Scope"`
Value string `name:"Value"`
Key string `name:"Key"`
Spread string `name:"Spread"`
}
// CreateScalingGroupLoadBalancerConfig is a repeated param struct in CreateScalingGroupRequest
type CreateScalingGroupLoadBalancerConfig struct {
LoadBalancerId string `name:"LoadBalancerId"`
Weight string `name:"Weight"`
}
// CreateScalingGroupVServerGroup is a repeated param struct in CreateScalingGroupRequest
type CreateScalingGroupVServerGroup struct {
LoadBalancerId string `name:"LoadBalancerId"`
VServerGroupAttribute *[]CreateScalingGroupVServerGroupVServerGroupAttribute `name:"VServerGroupAttribute" type:"Repeated"`
}
// CreateScalingGroupVServerGroupVServerGroupAttribute is a repeated param struct in CreateScalingGroupRequest
type CreateScalingGroupVServerGroupVServerGroupAttribute struct {
VServerGroupId string `name:"VServerGroupId"`
Port string `name:"Port"`
Weight string `name:"Weight"`
}
// CreateScalingGroupResponse is the response struct for api CreateScalingGroup
type CreateScalingGroupResponse struct {
*responses.BaseResponse
RequestId string `json:"RequestId" xml:"RequestId"`
ScalingGroupId string `json:"ScalingGroupId" xml:"ScalingGroupId"`
}
// CreateCreateScalingGroupRequest creates a request to invoke CreateScalingGroup API
func CreateCreateScalingGroupRequest() (request *CreateScalingGroupRequest) {
request = &CreateScalingGroupRequest{
RpcRequest: &requests.RpcRequest{},
}
request.InitWithApiInfo("Ess", "2014-08-28", "CreateScalingGroup", "ess", "openAPI")
request.Method = requests.POST
return
}
// CreateCreateScalingGroupResponse creates a response to parse from CreateScalingGroup response
func CreateCreateScalingGroupResponse() (response *CreateScalingGroupResponse) {
response = &CreateScalingGroupResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}