Skip to content

Commit 0fea538

Browse files
committed
Added test with new Status and Alert Definition change
1 parent d40b96c commit 0fea538

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

linode_api4/objects/monitor.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,38 @@ class ChannelContent(JSONObject):
428428
# Other channel types like 'webhook', 'slack' could be added here as Optional fields.
429429

430430

431+
@dataclass
432+
class EmailDetails(JSONObject):
433+
"""
434+
Represents email-specific details for an alert channel.
435+
"""
436+
usernames: Optional[List[str]] = None
437+
recipient_type: Optional[str] = None
438+
439+
440+
@dataclass
441+
class ChannelDetails(JSONObject):
442+
"""
443+
Represents the details block for an AlertChannel, which varies by channel type.
444+
"""
445+
email: Optional[EmailDetails] = None
446+
447+
448+
@dataclass
449+
class AlertsReference(JSONObject):
450+
"""
451+
Represents a reference to alerts associated with an alert channel.
452+
453+
Fields:
454+
- url: str - API URL to fetch the alerts for this channel
455+
- type: str - Type identifier (e.g., 'alerts-definitions')
456+
- alert_count: int - Number of alerts associated with this channel
457+
"""
458+
url: str = ""
459+
_type: str = field(default="", metadata={"json_key": "type"})
460+
alert_count: int = 0
461+
462+
431463
class AlertChannel(Base):
432464
"""
433465
Represents an alert channel used to deliver notifications when alerts
@@ -450,7 +482,8 @@ class AlertChannel(Base):
450482
"label": Property(),
451483
"type": Property(),
452484
"channel_type": Property(),
453-
"alerts": Property(mutable=False, json_object=Alerts),
485+
"details": Property(mutable=False, json_object=ChannelDetails),
486+
"alerts": Property(mutable=False, json_object=AlertsReference),
454487
"content": Property(mutable=False, json_object=ChannelContent),
455488
"created": Property(is_datetime=True),
456489
"updated": Property(is_datetime=True),

test/integration/models/monitor/test_monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def wait_for_alert_ready(alert_id, service_type: str):
227227
interval = initial_timeout
228228
alert = client.load(AlertDefinition, alert_id, service_type)
229229
while (
230-
getattr(alert, "status", None) == "in progress"
230+
getattr(alert, "status", None) == "provisioning"
231231
and (time.time() - start) < timeout
232232
):
233233
time.sleep(interval)

0 commit comments

Comments
 (0)