@@ -34,12 +34,12 @@ type MaintenanceWindowSchedule struct {
3434}
3535
3636type MaintenanceWindowScheduleRecurring struct {
37- End types.String `tfsdk:"end"`
38- Every types.String `tfsdk:"every"`
39- Occurrences types.Float32 `tfsdk:"occurrences"`
40- OnWeekDay types.List `tfsdk:"on_week_day"`
41- OnMonthDay types.List `tfsdk:"on_month_day"`
42- OnMonth types.List `tfsdk:"on_month"`
37+ End types.String `tfsdk:"end"`
38+ Every types.String `tfsdk:"every"`
39+ Occurrences types.Int32 `tfsdk:"occurrences"`
40+ OnWeekDay types.List `tfsdk:"on_week_day"`
41+ OnMonthDay types.List `tfsdk:"on_month_day"`
42+ OnMonth types.List `tfsdk:"on_month"`
4343}
4444
4545/* CREATE */
@@ -73,8 +73,9 @@ func (model MaintenanceWindowModel) toAPICreateRequest(ctx context.Context) (kba
7373 Every : model .CustomSchedule .Recurring .Every .ValueStringPointer (),
7474 }
7575
76- if ! model .CustomSchedule .Recurring .Occurrences .IsNull () && ! model .CustomSchedule .Recurring .Occurrences .IsUnknown () && model .CustomSchedule .Recurring .Occurrences .ValueFloat32 () > 0 {
77- body .Schedule .Custom .Recurring .Occurrences = model .CustomSchedule .Recurring .Occurrences .ValueFloat32Pointer ()
76+ if ! model .CustomSchedule .Recurring .Occurrences .IsNull () && ! model .CustomSchedule .Recurring .Occurrences .IsUnknown () && model .CustomSchedule .Recurring .Occurrences .ValueInt32 () > 0 {
77+ occurrences := float32 (model .CustomSchedule .Recurring .Occurrences .ValueInt32 ())
78+ body .Schedule .Custom .Recurring .Occurrences = & occurrences
7879 }
7980
8081 if ! model .CustomSchedule .Recurring .OnWeekDay .IsNull () && ! model .CustomSchedule .Recurring .OnWeekDay .IsUnknown () {
@@ -148,12 +149,16 @@ func (model *MaintenanceWindowModel) fromAPICreateResponse(ctx context.Context,
148149
149150 if response .Schedule .Custom .Recurring != nil {
150151 model .CustomSchedule .Recurring = & MaintenanceWindowScheduleRecurring {
151- End : types .StringPointerValue (response .Schedule .Custom .Recurring .End ),
152- Every : types .StringPointerValue (response .Schedule .Custom .Recurring .Every ),
153- Occurrences : types .Float32PointerValue (response .Schedule .Custom .Recurring .Occurrences ),
154- OnWeekDay : types .ListNull (types .StringType ),
155- OnMonth : types .ListNull (types .Float32Type ),
156- OnMonthDay : types .ListNull (types .Float32Type ),
152+ End : types .StringPointerValue (response .Schedule .Custom .Recurring .End ),
153+ Every : types .StringPointerValue (response .Schedule .Custom .Recurring .Every ),
154+ OnWeekDay : types .ListNull (types .StringType ),
155+ OnMonth : types .ListNull (types .Int32Type ),
156+ OnMonthDay : types .ListNull (types .Int32Type ),
157+ }
158+
159+ if response .Schedule .Custom .Recurring .Occurrences != nil {
160+ occurrences := int32 (* response .Schedule .Custom .Recurring .Occurrences )
161+ model .CustomSchedule .Recurring .Occurrences = types .Int32PointerValue (& occurrences )
157162 }
158163
159164 if response .Schedule .Custom .Recurring .OnWeekDay != nil {
@@ -211,12 +216,16 @@ func (model *MaintenanceWindowModel) fromAPIReadResponse(ctx context.Context, da
211216
212217 if response .Schedule .Custom .Recurring != nil {
213218 model .CustomSchedule .Recurring = & MaintenanceWindowScheduleRecurring {
214- End : types .StringPointerValue (response .Schedule .Custom .Recurring .End ),
215- Every : types .StringPointerValue (response .Schedule .Custom .Recurring .Every ),
216- Occurrences : types .Float32PointerValue (response .Schedule .Custom .Recurring .Occurrences ),
217- OnWeekDay : types .ListNull (types .StringType ),
218- OnMonth : types .ListNull (types .Float32Type ),
219- OnMonthDay : types .ListNull (types .Float32Type ),
219+ End : types .StringPointerValue (response .Schedule .Custom .Recurring .End ),
220+ Every : types .StringPointerValue (response .Schedule .Custom .Recurring .Every ),
221+ OnWeekDay : types .ListNull (types .StringType ),
222+ OnMonth : types .ListNull (types .Float32Type ),
223+ OnMonthDay : types .ListNull (types .Float32Type ),
224+ }
225+
226+ if response .Schedule .Custom .Recurring .Occurrences != nil {
227+ occurrences := int32 (* response .Schedule .Custom .Recurring .Occurrences )
228+ model .CustomSchedule .Recurring .Occurrences = types .Int32PointerValue (& occurrences )
220229 }
221230
222231 if response .Schedule .Custom .Recurring .OnWeekDay != nil {
@@ -319,8 +328,9 @@ func (model MaintenanceWindowModel) toAPIUpdateRequest(ctx context.Context) (kba
319328 body .Schedule .Custom .Recurring .Every = model .CustomSchedule .Recurring .Every .ValueStringPointer ()
320329 }
321330
322- if ! model .CustomSchedule .Recurring .Occurrences .IsNull () && ! model .CustomSchedule .Recurring .Occurrences .IsUnknown () && model .CustomSchedule .Recurring .Occurrences .ValueFloat32 () > 0 {
323- body .Schedule .Custom .Recurring .Occurrences = model .CustomSchedule .Recurring .Occurrences .ValueFloat32Pointer ()
331+ if ! model .CustomSchedule .Recurring .Occurrences .IsNull () && ! model .CustomSchedule .Recurring .Occurrences .IsUnknown () && model .CustomSchedule .Recurring .Occurrences .ValueInt32 () > 0 {
332+ occurrences := float32 (model .CustomSchedule .Recurring .Occurrences .ValueInt32 ())
333+ body .Schedule .Custom .Recurring .Occurrences = & occurrences
324334 }
325335
326336 if ! model .CustomSchedule .Recurring .OnWeekDay .IsNull () && ! model .CustomSchedule .Recurring .OnWeekDay .IsUnknown () {
@@ -368,7 +378,7 @@ func (model MaintenanceWindowModel) toAPIUpdateRequest(ctx context.Context) (kba
368378 return body , diags
369379}
370380
371- func (model * MaintenanceWindowModel ) fromAPIUpdateResponse (ctx context.Context , data * kbapi.PatchMaintenanceWindowIdResponse , spaceID string ) diag.Diagnostics {
381+ func (model * MaintenanceWindowModel ) fromAPIUpdateResponse (ctx context.Context , data * kbapi.PatchMaintenanceWindowIdResponse ) diag.Diagnostics {
372382 if data == nil {
373383 return nil
374384 }
@@ -394,12 +404,16 @@ func (model *MaintenanceWindowModel) fromAPIUpdateResponse(ctx context.Context,
394404
395405 if response .Schedule .Custom .Recurring != nil {
396406 model .CustomSchedule .Recurring = & MaintenanceWindowScheduleRecurring {
397- End : types .StringPointerValue (response .Schedule .Custom .Recurring .End ),
398- Every : types .StringPointerValue (response .Schedule .Custom .Recurring .Every ),
399- Occurrences : types .Float32PointerValue (response .Schedule .Custom .Recurring .Occurrences ),
400- OnWeekDay : types .ListNull (types .StringType ),
401- OnMonth : types .ListNull (types .Float32Type ),
402- OnMonthDay : types .ListNull (types .Float32Type ),
407+ End : types .StringPointerValue (response .Schedule .Custom .Recurring .End ),
408+ Every : types .StringPointerValue (response .Schedule .Custom .Recurring .Every ),
409+ OnWeekDay : types .ListNull (types .StringType ),
410+ OnMonth : types .ListNull (types .Float32Type ),
411+ OnMonthDay : types .ListNull (types .Float32Type ),
412+ }
413+
414+ if response .Schedule .Custom .Recurring .Occurrences != nil {
415+ occurrences := int32 (* response .Schedule .Custom .Recurring .Occurrences )
416+ model .CustomSchedule .Recurring .Occurrences = types .Int32PointerValue (& occurrences )
403417 }
404418
405419 if response .Schedule .Custom .Recurring .OnWeekDay != nil {
0 commit comments