Skip to content

Commit

Permalink
gcp_cost: add migration to ignore predictive levels
Browse files Browse the repository at this point in the history
CMK-20528

Change-Id: I3d89b5f6ca8692ac99b57dc285cf6d38f6bba83a
  • Loading branch information
BenediktSeidl committed Jan 22, 2025
1 parent 2ee235a commit a260339
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cmk/plugins/gcp/rulesets/gcp_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,27 @@
Dictionary,
Float,
InputHint,
LevelDirection,
SimpleLevels,
SimpleLevelsConfigModel,
)
from cmk.rulesets.v1.form_specs._levels import LevelDirection
from cmk.rulesets.v1.form_specs._migrations import (
migrate_to_float_simple_levels,
)
from cmk.rulesets.v1.rule_specs import CheckParameters, HostAndItemCondition, Topic


def _parameter_valuespec_gcp_cost():
def migrate_to_float_simple_levels_ignoring_predictive(
value: object,
) -> SimpleLevelsConfigModel[float]:
match value:
case ("cmk_postprocessed", "predictive_levels", value):
return ("no_levels", None)
case _:
return migrate_to_float_simple_levels(value)


def _parameter_valuespec_gcp_cost() -> Dictionary:
return Dictionary(
title=Title("Levels monthly GCP costs"),
elements={
Expand All @@ -29,7 +40,7 @@ def _parameter_valuespec_gcp_cost():
title=Title("Amount in billed currency"),
form_spec_template=Float(),
prefill_fixed_levels=InputHint(value=(0, 0)),
migrate=migrate_to_float_simple_levels,
migrate=migrate_to_float_simple_levels_ignoring_predictive,
)
),
},
Expand Down

0 comments on commit a260339

Please sign in to comment.