Ansible schedule form: structured playbook-variable fields + first-item dropdown defaults #2
@@ -32,7 +32,13 @@ class AlertRule(Base):
|
|||||||
source_module: Mapped[str] = mapped_column(String(64), nullable=False)
|
source_module: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||||
resource_name: Mapped[str] = mapped_column(String(255), nullable=False)
|
resource_name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||||
metric_name: Mapped[str] = mapped_column(String(128), nullable=False)
|
metric_name: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||||
operator: Mapped[AlertOperator] = mapped_column(Enum(AlertOperator), nullable=False)
|
# The DB enum (migration 0002) stores the operator VALUES (">", "<", …), so
|
||||||
|
# persist values rather than SQLAlchemy's default enum-member NAMES ("gt"…).
|
||||||
|
operator: Mapped[AlertOperator] = mapped_column(
|
||||||
|
Enum(AlertOperator, name="alertoperator",
|
||||||
|
values_callable=lambda e: [m.value for m in e]),
|
||||||
|
nullable=False,
|
||||||
|
)
|
||||||
threshold: Mapped[float] = mapped_column(Float, nullable=False)
|
threshold: Mapped[float] = mapped_column(Float, nullable=False)
|
||||||
consecutive_failures_required: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
|
consecutive_failures_required: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
|
||||||
enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user