1616 "TriggerConditions" ,
1717 "AlertChannel" ,
1818 "AlertDefinition" ,
19- "AlertChannelEnvelope" ,
2019 "Alert" ,
20+ "Alerts" ,
2121]
2222
2323
@@ -285,21 +285,15 @@ class RuleCriteria(JSONObject):
285285
286286
287287@dataclass
288- class AlertChannelEnvelope (JSONObject ):
288+ class Alert (JSONObject ):
289289 """
290- Represents a single alert channel entry returned inside alert definition
291- responses.
292-
293- This envelope type is used when an AlertDefinition includes a list of
294- alert channels. It contains lightweight information about the channel so
295- that callers can display or reference the channel without performing an
296- additional API lookup.
290+ Represents an alert definition reference within an AlertChannel.
297291
298292 Fields:
299- - id: int - Unique identifier of the alert channel .
300- - label: str - Human-readable name for the channel .
301- - type: str - Channel type (e.g. 'webhook' , 'email', 'pagerduty ').
302- - url: str - Destination URL or address associated with the channel .
293+ - id: int - Unique identifier of the alert definition .
294+ - label: str - Human-readable name for the alert definition .
295+ - type: str - Type of the alert (e.g., 'alerts-definitions ').
296+ - url: str - API URL for the alert definition .
303297 """
304298
305299 id : int = 0
@@ -308,6 +302,18 @@ class AlertChannelEnvelope(JSONObject):
308302 url : str = ""
309303
310304
305+ @dataclass
306+ class Alerts (JSONObject ):
307+ """
308+ Represents a collection of alert definitions within an AlertChannel.
309+
310+ Fields:
311+ - items: List[Alert] - List of alert definitions.
312+ """
313+
314+ items : List [Alert ] = field (default_factory = list )
315+
316+
311317class AlertType (StrEnum ):
312318 """
313319 Enumeration of alert origin types used by alert definitions.
@@ -346,8 +352,10 @@ class AlertDefinition(DerivedBase):
346352 "status" : Property (mutable = True ),
347353 "has_more_resources" : Property (mutable = True ),
348354 "rule_criteria" : Property (mutable = True , json_object = RuleCriteria ),
349- "trigger_conditions" : Property (mutable = True , json_object = TriggerConditions ),
350- "alert_channels" : Property (mutable = True , json_object = AlertChannelEnvelope ),
355+ "trigger_conditions" : Property (
356+ mutable = True , json_object = TriggerConditions
357+ ),
358+ "alert_channels" : Property (mutable = True , json_object = Alerts ),
351359 "created" : Property (is_datetime = True ),
352360 "updated" : Property (is_datetime = True ),
353361 "updated_by" : Property (),
@@ -377,24 +385,6 @@ class ChannelContent(JSONObject):
377385 # Other channel types like 'webhook', 'slack' could be added here as Optional fields.
378386
379387
380- @dataclass
381- class Alert (JSONObject ):
382- """
383- Represents an alert definition reference within an AlertChannel.
384-
385- Fields:
386- - id: int - Unique identifier of the alert definition.
387- - label: str - Human-readable name for the alert definition.
388- - type: str - Type of the alert (e.g., 'alerts-definitions').
389- - url: str - API URL for the alert definition.
390- """
391-
392- id : int = 0
393- label : str = ""
394- type : str = ""
395- url : str = ""
396-
397-
398388class AlertChannel (Base ):
399389 """
400390 Represents an alert channel used to deliver notifications when alerts
@@ -417,8 +407,8 @@ class AlertChannel(Base):
417407 "label" : Property (),
418408 "type" : Property (),
419409 "channel_type" : Property (),
420- "alerts" : Property (),
421- "content" : Property (),
410+ "alerts" : Property (mutable = False , json_object = Alerts ),
411+ "content" : Property (mutable = False , json_object = ChannelContent ),
422412 "created" : Property (is_datetime = True ),
423413 "updated" : Property (is_datetime = True ),
424414 "created_by" : Property (),
0 commit comments