Skip to content
Open
1 change: 1 addition & 0 deletions changelog.d/1502.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add INCIDENT_RESTART event type to allow source systems to reopen incidents
6 changes: 6 additions & 0 deletions docs/reference/api/v2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,12 @@ Incident endpoints
the incident if it has been closed (either manually or by a
source system).

- ``RES`` - Incident restart

Only source systems can post an event of this type, which reopens
the incident if it has been closed (either manually or by a
source system).

- ``ACK`` - Acknowledge

Use the ``/api/v2/incidents/<int:pk>/acks/`` endpoint.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Generated by Django 5.2 on 2025-06-18 09:32

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("argus_incident", "0001_squashed_incident_20250514"),
]

operations = [
migrations.AlterField(
model_name="event",
name="id",
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name="event",
name="type",
field=models.TextField(
choices=[
("STA", "Incident start"),
("END", "Incident end"),
("CHI", "Incident change"),
("RES", "Incident restart"),
("CLO", "Close"),
("REO", "Reopen"),
("ACK", "Acknowledge"),
("OTH", "Other"),
("LES", "Stateless"),
]
),
),
migrations.AlterField(
model_name="incident",
name="id",
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name="incidenttagrelation",
name="id",
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name="tag",
name="id",
field=models.BigAutoField(primary_key=True, serialize=False),
),
]
2 changes: 2 additions & 0 deletions src/argus/incident/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class Type(models.TextChoices):
INCIDENT_START = "STA", "Incident start"
INCIDENT_END = "END", "Incident end"
INCIDENT_CHANGE = "CHI", "Incident change"
INCIDENT_RESTART = "RES", "Incident restart"
CLOSE = "CLO", "Close"
REOPEN = "REO", "Reopen"
ACKNOWLEDGE = "ACK", "Acknowledge"
Expand All @@ -256,6 +257,7 @@ class Type(models.TextChoices):
ALLOWED_TYPES_FOR_SOURCE_SYSTEMS = {
Type.INCIDENT_START,
Type.INCIDENT_END,
Type.INCIDENT_RESTART,
Type.OTHER,
Type.INCIDENT_CHANGE,
Type.STATELESS,
Expand Down
2 changes: 1 addition & 1 deletion src/argus/incident/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def update_incident(self, validated_data: dict, incident: Incident):
if event_type in {Event.Type.INCIDENT_END, Event.Type.CLOSE}:
incident.end_time = timestamp
incident.save()
elif event_type == Event.Type.REOPEN:
elif event_type in {Event.Type.REOPEN, Event.Type.INCIDENT_RESTART}:
incident.end_time = INFINITY_REPR
incident.save()

Expand Down
Loading