Skip to content

Commit 5a9411c

Browse files
authored
Adds further settings management
I think the generated settings model found at generated/slo/model_settings.go is still missing a final component here, but that file is generated by OpenAPI so we probably have a change to make in our open API docs, or we need to re-run the generation script there?
1 parent 0c2442a commit 5a9411c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

internal/kibana/slo.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,14 @@ func getOrNilFloat(path string, d *schema.ResourceData) *float64 {
513513
return nil
514514
}
515515

516+
func getOrNilBool(path string, d *schema.ResourceData) *bool {
517+
if v, ok := d.GetOk(path); ok {
518+
b := v.(bool)
519+
return &b
520+
}
521+
return nil
522+
}
523+
516524
func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostics) {
517525
var diags diag.Diagnostics
518526

@@ -655,8 +663,9 @@ func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostic
655663
}
656664

657665
settings := slo.Settings{
658-
SyncDelay: getOrNilString("settings.0.sync_delay", d),
659-
Frequency: getOrNilString("settings.0.frequency", d),
666+
SyncDelay: getOrNilString("settings.0.sync_delay", d),
667+
Frequency: getOrNilString("settings.0.frequency", d),
668+
PreventInitialBackfill: getOrNilBool("settings.0.prevent_initial_backfill", d),
660669
}
661670

662671
budgetingMethod := slo.BudgetingMethod(d.Get("budgeting_method").(string))
@@ -909,8 +918,9 @@ func resourceSloRead(ctx context.Context, d *schema.ResourceData, meta interface
909918

910919
if err := d.Set("settings", []interface{}{
911920
map[string]interface{}{
912-
"sync_delay": s.Settings.SyncDelay,
913-
"frequency": s.Settings.Frequency,
921+
"sync_delay": s.Settings.SyncDelay,
922+
"frequency": s.Settings.Frequency,
923+
"prevent_initial_backfill": s.Settings.PreventInitialBackfill,
914924
},
915925
}); err != nil {
916926
return diag.FromErr(err)

0 commit comments

Comments
 (0)