diff --git a/internal/define/auto_scale.go b/internal/define/auto_scale.go index d7f916d..e18e924 100644 --- a/internal/define/auto_scale.go +++ b/internal/define/auto_scale.go @@ -122,6 +122,7 @@ var ( fields.AutoScaleTriggerType(), fields.AutoScaleCPUThreshold(), fields.AutoScaleRouterThreshold(), + fields.AutoScaleScheduleScaling(), fields.SettingsHash(), // status @@ -161,6 +162,7 @@ var ( fields.AutoScaleTriggerType(), fields.AutoScaleCPUThreshold(), fields.AutoScaleRouterThreshold(), + fields.AutoScaleScheduleScaling(), // status fields.AutoScaleAPIKeyID(), @@ -184,6 +186,7 @@ var ( fields.AutoScaleTriggerType(), fields.AutoScaleCPUThreshold(), fields.AutoScaleRouterThreshold(), + fields.AutoScaleScheduleScaling(), // settings hash fields.SettingsHash(), }, @@ -200,6 +203,7 @@ var ( fields.AutoScaleTriggerType(), fields.AutoScaleCPUThreshold(), fields.AutoScaleRouterThreshold(), + fields.AutoScaleScheduleScaling(), // settings hash fields.SettingsHash(), }, diff --git a/internal/define/fields.go b/internal/define/fields.go index 9ed7dab..b491f49 100644 --- a/internal/define/fields.go +++ b/internal/define/fields.go @@ -2916,7 +2916,7 @@ func (f *fieldsDef) AutoScaleDisabled() *dsl.FieldDesc { func (f *fieldsDef) AutoScaleTriggerType() *dsl.FieldDesc { return &dsl.FieldDesc{ Name: "TriggerType", - Type: meta.TypeString, + Type: meta.Static(types.EAutoScaleTriggerType("")), Tags: &dsl.FieldTags{ MapConv: "Settings.TriggerType", }, @@ -2958,3 +2958,23 @@ func (f *fieldsDef) AutoScaleRouterThreshold() *dsl.FieldDesc { }, } } + +func (f *fieldsDef) AutoScaleScheduleScaling() *dsl.FieldDesc { + return &dsl.FieldDesc{ + Name: "ScheduleScaling", + Type: &dsl.Model{ + Name: "AutoScaleScheduleScaling", + IsArray: true, + NakedType: meta.Static(naked.AutoScaleScheduleScaling{}), + Fields: []*dsl.FieldDesc{ + fields.Def("Action", meta.Static(types.EAutoScaleAction(""))), + fields.Def("Hour", meta.TypeInt), + fields.Def("Minute", meta.TypeInt), + fields.Def("DayOfWeek", meta.Static([]types.EDayOfTheWeek{})), + }, + }, + Tags: &dsl.FieldTags{ + MapConv: "Settings.ScheduleScaling,recursive", + }, + } +} diff --git a/naked/auto_scale.go b/naked/auto_scale.go index 2250677..7e9b08e 100644 --- a/naked/auto_scale.go +++ b/naked/auto_scale.go @@ -45,11 +45,12 @@ type AutoScaleSettingsUpdate struct { // AutoScaleSettings セッティング type AutoScaleSettings struct { - TriggerType string + TriggerType types.EAutoScaleTriggerType CPUThresholdScaling *AutoScaleCPUThresholdScaling `json:",omitempty" yaml:",omitempty" structs:",omitempty"` RouterThresholdScaling *AutoScaleRouterThresholdScaling `json:",omitempty" yaml:",omitempty" structs:",omitempty"` - Zones []string `json:"SakuraCloudZones"` - Config string `json:",omitempty" yaml:",omitempty"` + ScheduleScaling []*AutoScaleScheduleScaling + Zones []string `json:"SakuraCloudZones"` + Config string `json:",omitempty" yaml:",omitempty"` Disabled bool } @@ -65,6 +66,13 @@ type AutoScaleRouterThresholdScaling struct { Mbps int `json:",omitempty" yaml:",omitempty"` } +type AutoScaleScheduleScaling struct { + Action types.EAutoScaleAction + Hour int + Minute int + DayOfWeek []types.EDayOfTheWeek +} + // AutoScaleStatus ステータス type AutoScaleStatus struct { RegisteredBy string `json:",omitempty" yaml:",omitempty"` diff --git a/test/auto_scale_op_test.go b/test/auto_scale_op_test.go index eec298e..dd34181 100644 --- a/test/auto_scale_op_test.go +++ b/test/auto_scale_op_test.go @@ -69,6 +69,13 @@ func TestAutoScaleOp_CRUD(t *testing.T) { IgnoreFields: ignoreAutoScaleFields, }), }, + { + Func: testAutoScaleUpdateTriggerType, + CheckFunc: testutil.AssertEqualWithExpected(&testutil.CRUDTestExpect{ + ExpectValue: updateAutoScaleTriggerTypeExpected, + IgnoreFields: ignoreAutoScaleFields, + }), + }, }, Delete: &testutil.CRUDTestDeleteFunc{ Func: testAutoScaleDelete, @@ -83,6 +90,7 @@ var ( "SettingsHash", "CreatedAt", "ModifiedAt", + "ScheduleScaling", } createAutoScaleParam = &iaas.AutoScaleCreateRequest{ Name: testutil.ResourceName("auto-scale"), @@ -91,7 +99,7 @@ var ( Config: fmt.Sprintf(autoScaleConfigTemplate, autoScaleTestServerName, testutil.TestZone()), Zones: []string{testutil.TestZone()}, - TriggerType: "cpu", + TriggerType: types.AutoScaleTriggerTypes.CPU, Disabled: true, CPUThresholdScaling: &iaas.AutoScaleCPUThresholdScaling{ ServerPrefix: autoScaleTestServerName, @@ -106,7 +114,7 @@ var ( Tags: createAutoScaleParam.Tags, Availability: types.Availabilities.Available, - TriggerType: "cpu", + TriggerType: types.AutoScaleTriggerTypes.CPU, Disabled: true, Config: fmt.Sprintf(autoScaleConfigTemplate, autoScaleTestServerName, testutil.TestZone()), Zones: []string{testutil.TestZone()}, @@ -125,7 +133,7 @@ var ( Config: fmt.Sprintf(autoScaleConfigTemplateUpd, autoScaleTestServerName, testutil.TestZone()), Zones: []string{testutil.TestZone()}, - TriggerType: "cpu", + TriggerType: types.AutoScaleTriggerTypes.CPU, Disabled: false, CPUThresholdScaling: &iaas.AutoScaleCPUThresholdScaling{ ServerPrefix: autoScaleTestServerName, @@ -142,7 +150,7 @@ var ( Config: fmt.Sprintf(autoScaleConfigTemplateUpd, autoScaleTestServerName, testutil.TestZone()), Zones: []string{testutil.TestZone()}, - TriggerType: "cpu", + TriggerType: types.AutoScaleTriggerTypes.CPU, Disabled: false, CPUThresholdScaling: &iaas.AutoScaleCPUThresholdScaling{ ServerPrefix: autoScaleTestServerName, @@ -151,6 +159,58 @@ var ( }, APIKeyID: os.Getenv("SAKURACLOUD_API_KEY_ID"), } + updateAutoScaleTriggerTypeParam = &iaas.AutoScaleUpdateRequest{ + Name: testutil.ResourceName("auto-scale-upd"), + Description: "desc-upd", + Tags: []string{"tag1-upd", "tag2-upd"}, + IconID: testIconID, + + Config: fmt.Sprintf(autoScaleConfigTemplateUpd, autoScaleTestServerName, testutil.TestZone()), + Zones: []string{testutil.TestZone()}, + TriggerType: types.AutoScaleTriggerTypes.Schedule, + Disabled: false, + ScheduleScaling: []*iaas.AutoScaleScheduleScaling{ + { + Action: types.AutoScaleActions.Up, + Hour: 10, + Minute: 15, + DayOfWeek: []types.EDayOfTheWeek{types.DaysOfTheWeek.Monday}, + }, + { + Action: types.AutoScaleActions.Down, + Hour: 18, + Minute: 15, + DayOfWeek: []types.EDayOfTheWeek{types.DaysOfTheWeek.Monday}, + }, + }, + } + updateAutoScaleTriggerTypeExpected = &iaas.AutoScale{ + Name: updateAutoScaleParam.Name, + Description: updateAutoScaleParam.Description, + Tags: updateAutoScaleParam.Tags, + Availability: types.Availabilities.Available, + IconID: testIconID, + + Config: fmt.Sprintf(autoScaleConfigTemplateUpd, autoScaleTestServerName, testutil.TestZone()), + Zones: []string{testutil.TestZone()}, + TriggerType: types.AutoScaleTriggerTypes.Schedule, + Disabled: false, + ScheduleScaling: []*iaas.AutoScaleScheduleScaling{ + { + Action: types.AutoScaleActions.Up, + Hour: 10, + Minute: 15, + DayOfWeek: []types.EDayOfTheWeek{types.DaysOfTheWeek.Monday}, + }, + { + Action: types.AutoScaleActions.Down, + Hour: 18, + Minute: 15, + DayOfWeek: []types.EDayOfTheWeek{types.DaysOfTheWeek.Monday}, + }, + }, + APIKeyID: os.Getenv("SAKURACLOUD_API_KEY_ID"), + } ) func testAutoScaleCreate(ctx *testutil.CRUDTestContext, caller iaas.APICaller) (interface{}, error) { @@ -168,6 +228,11 @@ func testAutoScaleUpdate(ctx *testutil.CRUDTestContext, caller iaas.APICaller) ( return client.Update(ctx, ctx.ID, updateAutoScaleParam) } +func testAutoScaleUpdateTriggerType(ctx *testutil.CRUDTestContext, caller iaas.APICaller) (interface{}, error) { + client := iaas.NewAutoScaleOp(caller) + return client.Update(ctx, ctx.ID, updateAutoScaleTriggerTypeParam) +} + func testAutoScaleDelete(ctx *testutil.CRUDTestContext, caller iaas.APICaller) error { client := iaas.NewAutoScaleOp(caller) return client.Delete(ctx, ctx.ID) diff --git a/types/auto_scale_action.go b/types/auto_scale_action.go new file mode 100644 index 0000000..a518ebf --- /dev/null +++ b/types/auto_scale_action.go @@ -0,0 +1,36 @@ +// Copyright 2022-2023 The sacloud/iaas-api-go Authors +// +// 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. + +package types + +type EAutoScaleAction string + +// AutoScaleActions サーバプランCPUコミットメント +var AutoScaleActions = struct { + // Up . + Up EAutoScaleAction + // Down . + Down EAutoScaleAction +}{ + Up: EAutoScaleAction("up"), + Down: EAutoScaleAction("down"), +} + +// String EAutoScaleActionの文字列表現 +func (c EAutoScaleAction) String() string { + return string(c) +} + +// AutoScaleActionStrings サーバプランCPUコミットメントを表す文字列 +var AutoScaleActionStrings = []string{"cpu", "router", "schedule"} diff --git a/types/auto_scale_trigger_type.go b/types/auto_scale_trigger_type.go new file mode 100644 index 0000000..7d5e796 --- /dev/null +++ b/types/auto_scale_trigger_type.go @@ -0,0 +1,42 @@ +// Copyright 2022-2023 The sacloud/iaas-api-go Authors +// +// 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. + +package types + +type EAutoScaleTriggerType string + +// AutoScaleTriggerTypes サーバプランCPUコミットメント +var AutoScaleTriggerTypes = struct { + // Default CPUトリガーがデフォルト + Default EAutoScaleTriggerType + // Standard 通常 + CPU EAutoScaleTriggerType + // DedicatedCPU コア専有 + Router EAutoScaleTriggerType + // DedicatedCPU コア専有 + Schedule EAutoScaleTriggerType +}{ + Default: EAutoScaleTriggerType(""), + CPU: EAutoScaleTriggerType("cpu"), + Router: EAutoScaleTriggerType("router"), + Schedule: EAutoScaleTriggerType("schedule"), +} + +// String EAutoScaleTriggerTypeの文字列表現 +func (c EAutoScaleTriggerType) String() string { + return string(c) +} + +// AutoScaleTriggerTypeStrings サーバプランCPUコミットメントを表す文字列 +var AutoScaleTriggerTypeStrings = []string{"cpu", "router", "schedule"} diff --git a/zz_models.go b/zz_models.go index 55bc9a6..4b917c9 100644 --- a/zz_models.go +++ b/zz_models.go @@ -2114,9 +2114,10 @@ type AutoScale struct { Disabled bool `mapconv:"Settings.Disabled"` Zones []string `mapconv:"Settings.Zones"` Config string `mapconv:"Settings.Config"` - TriggerType string `mapconv:"Settings.TriggerType"` + TriggerType types.EAutoScaleTriggerType `mapconv:"Settings.TriggerType"` CPUThresholdScaling *AutoScaleCPUThresholdScaling `mapconv:"Settings.CPUThresholdScaling,recursive"` RouterThresholdScaling *AutoScaleRouterThresholdScaling `mapconv:"Settings.RouterThresholdScaling,recursive"` + ScheduleScaling []*AutoScaleScheduleScaling `mapconv:"Settings.ScheduleScaling,recursive"` SettingsHash string `json:",omitempty" mapconv:",omitempty"` APIKeyID string `mapconv:"Status.APIKey.ID"` } @@ -2135,9 +2136,10 @@ func (o *AutoScale) setDefaults() interface{} { Disabled bool `mapconv:"Settings.Disabled"` Zones []string `mapconv:"Settings.Zones"` Config string `mapconv:"Settings.Config"` - TriggerType string `mapconv:"Settings.TriggerType"` + TriggerType types.EAutoScaleTriggerType `mapconv:"Settings.TriggerType"` CPUThresholdScaling *AutoScaleCPUThresholdScaling `mapconv:"Settings.CPUThresholdScaling,recursive"` RouterThresholdScaling *AutoScaleRouterThresholdScaling `mapconv:"Settings.RouterThresholdScaling,recursive"` + ScheduleScaling []*AutoScaleScheduleScaling `mapconv:"Settings.ScheduleScaling,recursive"` SettingsHash string `json:",omitempty" mapconv:",omitempty"` APIKeyID string `mapconv:"Status.APIKey.ID"` }{ @@ -2155,6 +2157,7 @@ func (o *AutoScale) setDefaults() interface{} { TriggerType: o.GetTriggerType(), CPUThresholdScaling: o.GetCPUThresholdScaling(), RouterThresholdScaling: o.GetRouterThresholdScaling(), + ScheduleScaling: o.GetScheduleScaling(), SettingsHash: o.GetSettingsHash(), APIKeyID: o.GetAPIKeyID(), } @@ -2311,12 +2314,12 @@ func (o *AutoScale) SetConfig(v string) { } // GetTriggerType returns value of TriggerType -func (o *AutoScale) GetTriggerType() string { +func (o *AutoScale) GetTriggerType() types.EAutoScaleTriggerType { return o.TriggerType } // SetTriggerType sets value to TriggerType -func (o *AutoScale) SetTriggerType(v string) { +func (o *AutoScale) SetTriggerType(v types.EAutoScaleTriggerType) { o.TriggerType = v } @@ -2340,6 +2343,16 @@ func (o *AutoScale) SetRouterThresholdScaling(v *AutoScaleRouterThresholdScaling o.RouterThresholdScaling = v } +// GetScheduleScaling returns value of ScheduleScaling +func (o *AutoScale) GetScheduleScaling() []*AutoScaleScheduleScaling { + return o.ScheduleScaling +} + +// SetScheduleScaling sets value to ScheduleScaling +func (o *AutoScale) SetScheduleScaling(v []*AutoScaleScheduleScaling) { + o.ScheduleScaling = v +} + // GetSettingsHash returns value of SettingsHash func (o *AutoScale) GetSettingsHash() string { return o.SettingsHash @@ -2468,6 +2481,73 @@ func (o *AutoScaleRouterThresholdScaling) SetMbps(v int) { o.Mbps = v } +/************************************************* +* AutoScaleScheduleScaling +*************************************************/ + +// AutoScaleScheduleScaling represents API parameter/response structure +type AutoScaleScheduleScaling struct { + Action types.EAutoScaleAction + Hour int + Minute int + DayOfWeek []types.EDayOfTheWeek +} + +// setDefaults implements iaas.argumentDefaulter +func (o *AutoScaleScheduleScaling) setDefaults() interface{} { + return &struct { + Action types.EAutoScaleAction + Hour int + Minute int + DayOfWeek []types.EDayOfTheWeek + }{ + Action: o.GetAction(), + Hour: o.GetHour(), + Minute: o.GetMinute(), + DayOfWeek: o.GetDayOfWeek(), + } +} + +// GetAction returns value of Action +func (o *AutoScaleScheduleScaling) GetAction() types.EAutoScaleAction { + return o.Action +} + +// SetAction sets value to Action +func (o *AutoScaleScheduleScaling) SetAction(v types.EAutoScaleAction) { + o.Action = v +} + +// GetHour returns value of Hour +func (o *AutoScaleScheduleScaling) GetHour() int { + return o.Hour +} + +// SetHour sets value to Hour +func (o *AutoScaleScheduleScaling) SetHour(v int) { + o.Hour = v +} + +// GetMinute returns value of Minute +func (o *AutoScaleScheduleScaling) GetMinute() int { + return o.Minute +} + +// SetMinute sets value to Minute +func (o *AutoScaleScheduleScaling) SetMinute(v int) { + o.Minute = v +} + +// GetDayOfWeek returns value of DayOfWeek +func (o *AutoScaleScheduleScaling) GetDayOfWeek() []types.EDayOfTheWeek { + return o.DayOfWeek +} + +// SetDayOfWeek sets value to DayOfWeek +func (o *AutoScaleScheduleScaling) SetDayOfWeek(v []types.EDayOfTheWeek) { + o.DayOfWeek = v +} + /************************************************* * AutoScaleCreateRequest *************************************************/ @@ -2481,9 +2561,10 @@ type AutoScaleCreateRequest struct { Disabled bool `mapconv:"Settings.Disabled"` Zones []string `mapconv:"Settings.Zones"` Config string `mapconv:"Settings.Config"` - TriggerType string `mapconv:"Settings.TriggerType"` + TriggerType types.EAutoScaleTriggerType `mapconv:"Settings.TriggerType"` CPUThresholdScaling *AutoScaleCPUThresholdScaling `mapconv:"Settings.CPUThresholdScaling,recursive"` RouterThresholdScaling *AutoScaleRouterThresholdScaling `mapconv:"Settings.RouterThresholdScaling,recursive"` + ScheduleScaling []*AutoScaleScheduleScaling `mapconv:"Settings.ScheduleScaling,recursive"` APIKeyID string `mapconv:"Status.APIKey.ID"` } @@ -2497,9 +2578,10 @@ func (o *AutoScaleCreateRequest) setDefaults() interface{} { Disabled bool `mapconv:"Settings.Disabled"` Zones []string `mapconv:"Settings.Zones"` Config string `mapconv:"Settings.Config"` - TriggerType string `mapconv:"Settings.TriggerType"` + TriggerType types.EAutoScaleTriggerType `mapconv:"Settings.TriggerType"` CPUThresholdScaling *AutoScaleCPUThresholdScaling `mapconv:"Settings.CPUThresholdScaling,recursive"` RouterThresholdScaling *AutoScaleRouterThresholdScaling `mapconv:"Settings.RouterThresholdScaling,recursive"` + ScheduleScaling []*AutoScaleScheduleScaling `mapconv:"Settings.ScheduleScaling,recursive"` APIKeyID string `mapconv:"Status.APIKey.ID"` Class string `mapconv:"Provider.Class"` ServiceClass string @@ -2514,6 +2596,7 @@ func (o *AutoScaleCreateRequest) setDefaults() interface{} { TriggerType: o.GetTriggerType(), CPUThresholdScaling: o.GetCPUThresholdScaling(), RouterThresholdScaling: o.GetRouterThresholdScaling(), + ScheduleScaling: o.GetScheduleScaling(), APIKeyID: o.GetAPIKeyID(), Class: "autoscale", ServiceClass: "cloud/autoscale/1", @@ -2611,12 +2694,12 @@ func (o *AutoScaleCreateRequest) SetConfig(v string) { } // GetTriggerType returns value of TriggerType -func (o *AutoScaleCreateRequest) GetTriggerType() string { +func (o *AutoScaleCreateRequest) GetTriggerType() types.EAutoScaleTriggerType { return o.TriggerType } // SetTriggerType sets value to TriggerType -func (o *AutoScaleCreateRequest) SetTriggerType(v string) { +func (o *AutoScaleCreateRequest) SetTriggerType(v types.EAutoScaleTriggerType) { o.TriggerType = v } @@ -2640,6 +2723,16 @@ func (o *AutoScaleCreateRequest) SetRouterThresholdScaling(v *AutoScaleRouterThr o.RouterThresholdScaling = v } +// GetScheduleScaling returns value of ScheduleScaling +func (o *AutoScaleCreateRequest) GetScheduleScaling() []*AutoScaleScheduleScaling { + return o.ScheduleScaling +} + +// SetScheduleScaling sets value to ScheduleScaling +func (o *AutoScaleCreateRequest) SetScheduleScaling(v []*AutoScaleScheduleScaling) { + o.ScheduleScaling = v +} + // GetAPIKeyID returns value of APIKeyID func (o *AutoScaleCreateRequest) GetAPIKeyID() string { return o.APIKeyID @@ -2663,9 +2756,10 @@ type AutoScaleUpdateRequest struct { Disabled bool `mapconv:"Settings.Disabled"` Zones []string `mapconv:"Settings.Zones"` Config string `mapconv:"Settings.Config"` - TriggerType string `mapconv:"Settings.TriggerType"` + TriggerType types.EAutoScaleTriggerType `mapconv:"Settings.TriggerType"` CPUThresholdScaling *AutoScaleCPUThresholdScaling `mapconv:"Settings.CPUThresholdScaling,recursive"` RouterThresholdScaling *AutoScaleRouterThresholdScaling `mapconv:"Settings.RouterThresholdScaling,recursive"` + ScheduleScaling []*AutoScaleScheduleScaling `mapconv:"Settings.ScheduleScaling,recursive"` SettingsHash string `json:",omitempty" mapconv:",omitempty"` } @@ -2679,9 +2773,10 @@ func (o *AutoScaleUpdateRequest) setDefaults() interface{} { Disabled bool `mapconv:"Settings.Disabled"` Zones []string `mapconv:"Settings.Zones"` Config string `mapconv:"Settings.Config"` - TriggerType string `mapconv:"Settings.TriggerType"` + TriggerType types.EAutoScaleTriggerType `mapconv:"Settings.TriggerType"` CPUThresholdScaling *AutoScaleCPUThresholdScaling `mapconv:"Settings.CPUThresholdScaling,recursive"` RouterThresholdScaling *AutoScaleRouterThresholdScaling `mapconv:"Settings.RouterThresholdScaling,recursive"` + ScheduleScaling []*AutoScaleScheduleScaling `mapconv:"Settings.ScheduleScaling,recursive"` SettingsHash string `json:",omitempty" mapconv:",omitempty"` }{ Name: o.GetName(), @@ -2694,6 +2789,7 @@ func (o *AutoScaleUpdateRequest) setDefaults() interface{} { TriggerType: o.GetTriggerType(), CPUThresholdScaling: o.GetCPUThresholdScaling(), RouterThresholdScaling: o.GetRouterThresholdScaling(), + ScheduleScaling: o.GetScheduleScaling(), SettingsHash: o.GetSettingsHash(), } } @@ -2789,12 +2885,12 @@ func (o *AutoScaleUpdateRequest) SetConfig(v string) { } // GetTriggerType returns value of TriggerType -func (o *AutoScaleUpdateRequest) GetTriggerType() string { +func (o *AutoScaleUpdateRequest) GetTriggerType() types.EAutoScaleTriggerType { return o.TriggerType } // SetTriggerType sets value to TriggerType -func (o *AutoScaleUpdateRequest) SetTriggerType(v string) { +func (o *AutoScaleUpdateRequest) SetTriggerType(v types.EAutoScaleTriggerType) { o.TriggerType = v } @@ -2818,6 +2914,16 @@ func (o *AutoScaleUpdateRequest) SetRouterThresholdScaling(v *AutoScaleRouterThr o.RouterThresholdScaling = v } +// GetScheduleScaling returns value of ScheduleScaling +func (o *AutoScaleUpdateRequest) GetScheduleScaling() []*AutoScaleScheduleScaling { + return o.ScheduleScaling +} + +// SetScheduleScaling sets value to ScheduleScaling +func (o *AutoScaleUpdateRequest) SetScheduleScaling(v []*AutoScaleScheduleScaling) { + o.ScheduleScaling = v +} + // GetSettingsHash returns value of SettingsHash func (o *AutoScaleUpdateRequest) GetSettingsHash() string { return o.SettingsHash @@ -2837,9 +2943,10 @@ type AutoScaleUpdateSettingsRequest struct { Disabled bool `mapconv:"Settings.Disabled"` Zones []string `mapconv:"Settings.Zones"` Config string `mapconv:"Settings.Config"` - TriggerType string `mapconv:"Settings.TriggerType"` + TriggerType types.EAutoScaleTriggerType `mapconv:"Settings.TriggerType"` CPUThresholdScaling *AutoScaleCPUThresholdScaling `mapconv:"Settings.CPUThresholdScaling,recursive"` RouterThresholdScaling *AutoScaleRouterThresholdScaling `mapconv:"Settings.RouterThresholdScaling,recursive"` + ScheduleScaling []*AutoScaleScheduleScaling `mapconv:"Settings.ScheduleScaling,recursive"` SettingsHash string `json:",omitempty" mapconv:",omitempty"` } @@ -2849,9 +2956,10 @@ func (o *AutoScaleUpdateSettingsRequest) setDefaults() interface{} { Disabled bool `mapconv:"Settings.Disabled"` Zones []string `mapconv:"Settings.Zones"` Config string `mapconv:"Settings.Config"` - TriggerType string `mapconv:"Settings.TriggerType"` + TriggerType types.EAutoScaleTriggerType `mapconv:"Settings.TriggerType"` CPUThresholdScaling *AutoScaleCPUThresholdScaling `mapconv:"Settings.CPUThresholdScaling,recursive"` RouterThresholdScaling *AutoScaleRouterThresholdScaling `mapconv:"Settings.RouterThresholdScaling,recursive"` + ScheduleScaling []*AutoScaleScheduleScaling `mapconv:"Settings.ScheduleScaling,recursive"` SettingsHash string `json:",omitempty" mapconv:",omitempty"` }{ Disabled: o.GetDisabled(), @@ -2860,6 +2968,7 @@ func (o *AutoScaleUpdateSettingsRequest) setDefaults() interface{} { TriggerType: o.GetTriggerType(), CPUThresholdScaling: o.GetCPUThresholdScaling(), RouterThresholdScaling: o.GetRouterThresholdScaling(), + ScheduleScaling: o.GetScheduleScaling(), SettingsHash: o.GetSettingsHash(), } } @@ -2895,12 +3004,12 @@ func (o *AutoScaleUpdateSettingsRequest) SetConfig(v string) { } // GetTriggerType returns value of TriggerType -func (o *AutoScaleUpdateSettingsRequest) GetTriggerType() string { +func (o *AutoScaleUpdateSettingsRequest) GetTriggerType() types.EAutoScaleTriggerType { return o.TriggerType } // SetTriggerType sets value to TriggerType -func (o *AutoScaleUpdateSettingsRequest) SetTriggerType(v string) { +func (o *AutoScaleUpdateSettingsRequest) SetTriggerType(v types.EAutoScaleTriggerType) { o.TriggerType = v } @@ -2924,6 +3033,16 @@ func (o *AutoScaleUpdateSettingsRequest) SetRouterThresholdScaling(v *AutoScaleR o.RouterThresholdScaling = v } +// GetScheduleScaling returns value of ScheduleScaling +func (o *AutoScaleUpdateSettingsRequest) GetScheduleScaling() []*AutoScaleScheduleScaling { + return o.ScheduleScaling +} + +// SetScheduleScaling sets value to ScheduleScaling +func (o *AutoScaleUpdateSettingsRequest) SetScheduleScaling(v []*AutoScaleScheduleScaling) { + o.ScheduleScaling = v +} + // GetSettingsHash returns value of SettingsHash func (o *AutoScaleUpdateSettingsRequest) GetSettingsHash() string { return o.SettingsHash