-
Notifications
You must be signed in to change notification settings - Fork 10
/
api_create_scaling_configuration.go
537 lines (439 loc) · 18.8 KB
/
api_create_scaling_configuration.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
// Code generated by volcengine with private/model/cli/gen-api/main.go. DO NOT EDIT.
package autoscaling
import (
"fmt"
"github.com/volcengine/volcengine-go-sdk/volcengine"
"github.com/volcengine/volcengine-go-sdk/volcengine/request"
"github.com/volcengine/volcengine-go-sdk/volcengine/response"
"github.com/volcengine/volcengine-go-sdk/volcengine/volcengineutil"
)
const opCreateScalingConfigurationCommon = "CreateScalingConfiguration"
// CreateScalingConfigurationCommonRequest generates a "volcengine/request.Request" representing the
// client's request for the CreateScalingConfigurationCommon operation. The "output" return
// value will be populated with the CreateScalingConfigurationCommon request's response once the request completes
// successfully.
//
// Use "Send" method on the returned CreateScalingConfigurationCommon Request to send the API call to the service.
// the "output" return value is not valid until after CreateScalingConfigurationCommon Send returns without error.
//
// See CreateScalingConfigurationCommon for more information on using the CreateScalingConfigurationCommon
// API call, and error handling.
//
// // Example sending a request using the CreateScalingConfigurationCommonRequest method.
// req, resp := client.CreateScalingConfigurationCommonRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
func (c *AUTOSCALING) CreateScalingConfigurationCommonRequest(input *map[string]interface{}) (req *request.Request, output *map[string]interface{}) {
op := &request.Operation{
Name: opCreateScalingConfigurationCommon,
HTTPMethod: "GET",
HTTPPath: "/",
}
if input == nil {
input = &map[string]interface{}{}
}
output = &map[string]interface{}{}
req = c.newRequest(op, input, output)
return
}
// CreateScalingConfigurationCommon API operation for AUTOSCALING.
//
// Returns volcengineerr.Error for service API and SDK errors. Use runtime type assertions
// with volcengineerr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the VOLCENGINE API reference guide for AUTOSCALING's
// API operation CreateScalingConfigurationCommon for usage and error information.
func (c *AUTOSCALING) CreateScalingConfigurationCommon(input *map[string]interface{}) (*map[string]interface{}, error) {
req, out := c.CreateScalingConfigurationCommonRequest(input)
return out, req.Send()
}
// CreateScalingConfigurationCommonWithContext is the same as CreateScalingConfigurationCommon with the addition of
// the ability to pass a context and additional request options.
//
// See CreateScalingConfigurationCommon for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur.
// In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *AUTOSCALING) CreateScalingConfigurationCommonWithContext(ctx volcengine.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {
req, out := c.CreateScalingConfigurationCommonRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
const opCreateScalingConfiguration = "CreateScalingConfiguration"
// CreateScalingConfigurationRequest generates a "volcengine/request.Request" representing the
// client's request for the CreateScalingConfiguration operation. The "output" return
// value will be populated with the CreateScalingConfigurationCommon request's response once the request completes
// successfully.
//
// Use "Send" method on the returned CreateScalingConfigurationCommon Request to send the API call to the service.
// the "output" return value is not valid until after CreateScalingConfigurationCommon Send returns without error.
//
// See CreateScalingConfiguration for more information on using the CreateScalingConfiguration
// API call, and error handling.
//
// // Example sending a request using the CreateScalingConfigurationRequest method.
// req, resp := client.CreateScalingConfigurationRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
func (c *AUTOSCALING) CreateScalingConfigurationRequest(input *CreateScalingConfigurationInput) (req *request.Request, output *CreateScalingConfigurationOutput) {
op := &request.Operation{
Name: opCreateScalingConfiguration,
HTTPMethod: "GET",
HTTPPath: "/",
}
if input == nil {
input = &CreateScalingConfigurationInput{}
}
output = &CreateScalingConfigurationOutput{}
req = c.newRequest(op, input, output)
return
}
// CreateScalingConfiguration API operation for AUTOSCALING.
//
// Returns volcengineerr.Error for service API and SDK errors. Use runtime type assertions
// with volcengineerr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the VOLCENGINE API reference guide for AUTOSCALING's
// API operation CreateScalingConfiguration for usage and error information.
func (c *AUTOSCALING) CreateScalingConfiguration(input *CreateScalingConfigurationInput) (*CreateScalingConfigurationOutput, error) {
req, out := c.CreateScalingConfigurationRequest(input)
return out, req.Send()
}
// CreateScalingConfigurationWithContext is the same as CreateScalingConfiguration with the addition of
// the ability to pass a context and additional request options.
//
// See CreateScalingConfiguration for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. Ifthe context is nil a panic will occur.
// In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *AUTOSCALING) CreateScalingConfigurationWithContext(ctx volcengine.Context, input *CreateScalingConfigurationInput, opts ...request.Option) (*CreateScalingConfigurationOutput, error) {
req, out := c.CreateScalingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
type CreateScalingConfigurationInput struct {
_ struct{} `type:"structure"`
ClientToken *string `type:"string"`
Eip *EipForCreateScalingConfigurationInput `type:"structure"`
HostName *string `type:"string"`
HpcClusterId *string `type:"string"`
// ImageId is a required field
ImageId *string `type:"string" required:"true"`
InstanceDescription *string `type:"string"`
// InstanceName is a required field
InstanceName *string `type:"string" required:"true"`
// InstanceTypes is a required field
InstanceTypes []*string `type:"list" required:"true"`
Ipv6AddressCount *int32 `type:"int32"`
KeyPairName *string `type:"string"`
Password *string `min:"8" max:"30" type:"string"`
ProjectName *string `max:"64" type:"string"`
// ScalingConfigurationName is a required field
ScalingConfigurationName *string `min:"1" max:"128" type:"string" required:"true"`
// ScalingGroupId is a required field
ScalingGroupId *string `type:"string" required:"true"`
SecurityEnhancementStrategy *string `type:"string" enum:"EnumOfSecurityEnhancementStrategyForCreateScalingConfigurationInput"`
// SecurityGroupIds is a required field
SecurityGroupIds []*string `type:"list" required:"true"`
SpotStrategy *string `type:"string" enum:"EnumOfSpotStrategyForCreateScalingConfigurationInput"`
Tags *string `type:"string"`
UserData *string `type:"string"`
// Volumes is a required field
Volumes []*VolumeForCreateScalingConfigurationInput `type:"list" required:"true"`
ZoneId *string `type:"string"`
}
// String returns the string representation
func (s CreateScalingConfigurationInput) String() string {
return volcengineutil.Prettify(s)
}
// GoString returns the string representation
func (s CreateScalingConfigurationInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *CreateScalingConfigurationInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "CreateScalingConfigurationInput"}
if s.ImageId == nil {
invalidParams.Add(request.NewErrParamRequired("ImageId"))
}
if s.InstanceName == nil {
invalidParams.Add(request.NewErrParamRequired("InstanceName"))
}
if s.InstanceTypes == nil {
invalidParams.Add(request.NewErrParamRequired("InstanceTypes"))
}
if s.Password != nil && len(*s.Password) < 8 {
invalidParams.Add(request.NewErrParamMinLen("Password", 8))
}
if s.Password != nil && len(*s.Password) > 30 {
invalidParams.Add(request.NewErrParamMaxLen("Password", 30, *s.Password))
}
if s.ProjectName != nil && len(*s.ProjectName) > 64 {
invalidParams.Add(request.NewErrParamMaxLen("ProjectName", 64, *s.ProjectName))
}
if s.ScalingConfigurationName == nil {
invalidParams.Add(request.NewErrParamRequired("ScalingConfigurationName"))
}
if s.ScalingConfigurationName != nil && len(*s.ScalingConfigurationName) < 1 {
invalidParams.Add(request.NewErrParamMinLen("ScalingConfigurationName", 1))
}
if s.ScalingConfigurationName != nil && len(*s.ScalingConfigurationName) > 128 {
invalidParams.Add(request.NewErrParamMaxLen("ScalingConfigurationName", 128, *s.ScalingConfigurationName))
}
if s.ScalingGroupId == nil {
invalidParams.Add(request.NewErrParamRequired("ScalingGroupId"))
}
if s.SecurityGroupIds == nil {
invalidParams.Add(request.NewErrParamRequired("SecurityGroupIds"))
}
if s.Volumes == nil {
invalidParams.Add(request.NewErrParamRequired("Volumes"))
}
if s.Volumes != nil {
for i, v := range s.Volumes {
if v == nil {
continue
}
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Volumes", i), err.(request.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetClientToken sets the ClientToken field's value.
func (s *CreateScalingConfigurationInput) SetClientToken(v string) *CreateScalingConfigurationInput {
s.ClientToken = &v
return s
}
// SetEip sets the Eip field's value.
func (s *CreateScalingConfigurationInput) SetEip(v *EipForCreateScalingConfigurationInput) *CreateScalingConfigurationInput {
s.Eip = v
return s
}
// SetHostName sets the HostName field's value.
func (s *CreateScalingConfigurationInput) SetHostName(v string) *CreateScalingConfigurationInput {
s.HostName = &v
return s
}
// SetHpcClusterId sets the HpcClusterId field's value.
func (s *CreateScalingConfigurationInput) SetHpcClusterId(v string) *CreateScalingConfigurationInput {
s.HpcClusterId = &v
return s
}
// SetImageId sets the ImageId field's value.
func (s *CreateScalingConfigurationInput) SetImageId(v string) *CreateScalingConfigurationInput {
s.ImageId = &v
return s
}
// SetInstanceDescription sets the InstanceDescription field's value.
func (s *CreateScalingConfigurationInput) SetInstanceDescription(v string) *CreateScalingConfigurationInput {
s.InstanceDescription = &v
return s
}
// SetInstanceName sets the InstanceName field's value.
func (s *CreateScalingConfigurationInput) SetInstanceName(v string) *CreateScalingConfigurationInput {
s.InstanceName = &v
return s
}
// SetInstanceTypes sets the InstanceTypes field's value.
func (s *CreateScalingConfigurationInput) SetInstanceTypes(v []*string) *CreateScalingConfigurationInput {
s.InstanceTypes = v
return s
}
// SetIpv6AddressCount sets the Ipv6AddressCount field's value.
func (s *CreateScalingConfigurationInput) SetIpv6AddressCount(v int32) *CreateScalingConfigurationInput {
s.Ipv6AddressCount = &v
return s
}
// SetKeyPairName sets the KeyPairName field's value.
func (s *CreateScalingConfigurationInput) SetKeyPairName(v string) *CreateScalingConfigurationInput {
s.KeyPairName = &v
return s
}
// SetPassword sets the Password field's value.
func (s *CreateScalingConfigurationInput) SetPassword(v string) *CreateScalingConfigurationInput {
s.Password = &v
return s
}
// SetProjectName sets the ProjectName field's value.
func (s *CreateScalingConfigurationInput) SetProjectName(v string) *CreateScalingConfigurationInput {
s.ProjectName = &v
return s
}
// SetScalingConfigurationName sets the ScalingConfigurationName field's value.
func (s *CreateScalingConfigurationInput) SetScalingConfigurationName(v string) *CreateScalingConfigurationInput {
s.ScalingConfigurationName = &v
return s
}
// SetScalingGroupId sets the ScalingGroupId field's value.
func (s *CreateScalingConfigurationInput) SetScalingGroupId(v string) *CreateScalingConfigurationInput {
s.ScalingGroupId = &v
return s
}
// SetSecurityEnhancementStrategy sets the SecurityEnhancementStrategy field's value.
func (s *CreateScalingConfigurationInput) SetSecurityEnhancementStrategy(v string) *CreateScalingConfigurationInput {
s.SecurityEnhancementStrategy = &v
return s
}
// SetSecurityGroupIds sets the SecurityGroupIds field's value.
func (s *CreateScalingConfigurationInput) SetSecurityGroupIds(v []*string) *CreateScalingConfigurationInput {
s.SecurityGroupIds = v
return s
}
// SetSpotStrategy sets the SpotStrategy field's value.
func (s *CreateScalingConfigurationInput) SetSpotStrategy(v string) *CreateScalingConfigurationInput {
s.SpotStrategy = &v
return s
}
// SetTags sets the Tags field's value.
func (s *CreateScalingConfigurationInput) SetTags(v string) *CreateScalingConfigurationInput {
s.Tags = &v
return s
}
// SetUserData sets the UserData field's value.
func (s *CreateScalingConfigurationInput) SetUserData(v string) *CreateScalingConfigurationInput {
s.UserData = &v
return s
}
// SetVolumes sets the Volumes field's value.
func (s *CreateScalingConfigurationInput) SetVolumes(v []*VolumeForCreateScalingConfigurationInput) *CreateScalingConfigurationInput {
s.Volumes = v
return s
}
// SetZoneId sets the ZoneId field's value.
func (s *CreateScalingConfigurationInput) SetZoneId(v string) *CreateScalingConfigurationInput {
s.ZoneId = &v
return s
}
type CreateScalingConfigurationOutput struct {
_ struct{} `type:"structure"`
Metadata *response.ResponseMetadata
ScalingConfigurationId *string `type:"string"`
}
// String returns the string representation
func (s CreateScalingConfigurationOutput) String() string {
return volcengineutil.Prettify(s)
}
// GoString returns the string representation
func (s CreateScalingConfigurationOutput) GoString() string {
return s.String()
}
// SetScalingConfigurationId sets the ScalingConfigurationId field's value.
func (s *CreateScalingConfigurationOutput) SetScalingConfigurationId(v string) *CreateScalingConfigurationOutput {
s.ScalingConfigurationId = &v
return s
}
type EipForCreateScalingConfigurationInput struct {
_ struct{} `type:"structure"`
Bandwidth *int32 `type:"int32"`
BandwidthPackageId *string `type:"string"`
BillingType *string `type:"string" enum:"EnumOfEipBillingTypeForCreateScalingConfigurationInput"`
ISP *string `type:"string"`
}
// String returns the string representation
func (s EipForCreateScalingConfigurationInput) String() string {
return volcengineutil.Prettify(s)
}
// GoString returns the string representation
func (s EipForCreateScalingConfigurationInput) GoString() string {
return s.String()
}
// SetBandwidth sets the Bandwidth field's value.
func (s *EipForCreateScalingConfigurationInput) SetBandwidth(v int32) *EipForCreateScalingConfigurationInput {
s.Bandwidth = &v
return s
}
// SetBandwidthPackageId sets the BandwidthPackageId field's value.
func (s *EipForCreateScalingConfigurationInput) SetBandwidthPackageId(v string) *EipForCreateScalingConfigurationInput {
s.BandwidthPackageId = &v
return s
}
// SetBillingType sets the BillingType field's value.
func (s *EipForCreateScalingConfigurationInput) SetBillingType(v string) *EipForCreateScalingConfigurationInput {
s.BillingType = &v
return s
}
// SetISP sets the ISP field's value.
func (s *EipForCreateScalingConfigurationInput) SetISP(v string) *EipForCreateScalingConfigurationInput {
s.ISP = &v
return s
}
type VolumeForCreateScalingConfigurationInput struct {
_ struct{} `type:"structure"`
DeleteWithInstance *bool `type:"boolean"`
// Size is a required field
Size *int32 `type:"int32" required:"true"`
// VolumeType is a required field
VolumeType *string `type:"string" required:"true"`
}
// String returns the string representation
func (s VolumeForCreateScalingConfigurationInput) String() string {
return volcengineutil.Prettify(s)
}
// GoString returns the string representation
func (s VolumeForCreateScalingConfigurationInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *VolumeForCreateScalingConfigurationInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "VolumeForCreateScalingConfigurationInput"}
if s.Size == nil {
invalidParams.Add(request.NewErrParamRequired("Size"))
}
if s.VolumeType == nil {
invalidParams.Add(request.NewErrParamRequired("VolumeType"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetDeleteWithInstance sets the DeleteWithInstance field's value.
func (s *VolumeForCreateScalingConfigurationInput) SetDeleteWithInstance(v bool) *VolumeForCreateScalingConfigurationInput {
s.DeleteWithInstance = &v
return s
}
// SetSize sets the Size field's value.
func (s *VolumeForCreateScalingConfigurationInput) SetSize(v int32) *VolumeForCreateScalingConfigurationInput {
s.Size = &v
return s
}
// SetVolumeType sets the VolumeType field's value.
func (s *VolumeForCreateScalingConfigurationInput) SetVolumeType(v string) *VolumeForCreateScalingConfigurationInput {
s.VolumeType = &v
return s
}
const (
// EnumOfEipBillingTypeForCreateScalingConfigurationInputPostPaidByBandwidth is a EnumOfEipBillingTypeForCreateScalingConfigurationInput enum value
EnumOfEipBillingTypeForCreateScalingConfigurationInputPostPaidByBandwidth = "PostPaidByBandwidth"
// EnumOfEipBillingTypeForCreateScalingConfigurationInputPostPaidByTraffic is a EnumOfEipBillingTypeForCreateScalingConfigurationInput enum value
EnumOfEipBillingTypeForCreateScalingConfigurationInputPostPaidByTraffic = "PostPaidByTraffic"
)
const (
// EnumOfSecurityEnhancementStrategyForCreateScalingConfigurationInputActive is a EnumOfSecurityEnhancementStrategyForCreateScalingConfigurationInput enum value
EnumOfSecurityEnhancementStrategyForCreateScalingConfigurationInputActive = "Active"
// EnumOfSecurityEnhancementStrategyForCreateScalingConfigurationInputInActive is a EnumOfSecurityEnhancementStrategyForCreateScalingConfigurationInput enum value
EnumOfSecurityEnhancementStrategyForCreateScalingConfigurationInputInActive = "InActive"
)
const (
// EnumOfSpotStrategyForCreateScalingConfigurationInputNoSpot is a EnumOfSpotStrategyForCreateScalingConfigurationInput enum value
EnumOfSpotStrategyForCreateScalingConfigurationInputNoSpot = "NoSpot"
// EnumOfSpotStrategyForCreateScalingConfigurationInputSpotAsPriceGo is a EnumOfSpotStrategyForCreateScalingConfigurationInput enum value
EnumOfSpotStrategyForCreateScalingConfigurationInputSpotAsPriceGo = "SpotAsPriceGo"
)