-
Notifications
You must be signed in to change notification settings - Fork 81
ACLP Alerting get_channles() API changes and Added Enum for 'Status' #645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
d40b96c
0fea538
7ec2a66
c0338dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -428,6 +428,38 @@ class ChannelContent(JSONObject): | |
| # Other channel types like 'webhook', 'slack' could be added here as Optional fields. | ||
|
|
||
|
|
||
| @dataclass | ||
| class EmailDetails(JSONObject): | ||
| """ | ||
| Represents email-specific details for an alert channel. | ||
| """ | ||
| usernames: Optional[List[str]] = None | ||
| recipient_type: Optional[str] = None | ||
|
|
||
|
|
||
| @dataclass | ||
| class ChannelDetails(JSONObject): | ||
| """ | ||
| Represents the details block for an AlertChannel, which varies by channel type. | ||
| """ | ||
| email: Optional[EmailDetails] = None | ||
|
|
||
|
|
||
| @dataclass | ||
| class AlertsReference(JSONObject): | ||
| """ | ||
| Represents a reference to alerts associated with an alert channel. | ||
|
|
||
| Fields: | ||
| - url: str - API URL to fetch the alerts for this channel | ||
| - type: str - Type identifier (e.g., 'alerts-definitions') | ||
| - alert_count: int - Number of alerts associated with this channel | ||
| """ | ||
| url: str = "" | ||
| _type: str = field(default="", metadata={"json_key": "type"}) | ||
| alert_count: int = 0 | ||
|
|
||
|
|
||
| class AlertChannel(Base): | ||
| """ | ||
| Represents an alert channel used to deliver notifications when alerts | ||
|
|
@@ -450,7 +482,8 @@ class AlertChannel(Base): | |
| "label": Property(), | ||
| "type": Property(), | ||
| "channel_type": Property(), | ||
| "alerts": Property(mutable=False, json_object=Alerts), | ||
| "details": Property(mutable=False, json_object=ChannelDetails), | ||
| "alerts": Property(mutable=False, json_object=AlertsReference), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can you align the naming in python-sdk and linodego? It will be helpful for future maintenance. I remember in linodego you name the struct as |
||
| "content": Property(mutable=False, json_object=ChannelContent), | ||
| "created": Property(is_datetime=True), | ||
| "updated": Property(is_datetime=True), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,7 +227,7 @@ def wait_for_alert_ready(alert_id, service_type: str): | |
| interval = initial_timeout | ||
| alert = client.load(AlertDefinition, alert_id, service_type) | ||
| while ( | ||
| getattr(alert, "status", None) == "in progress" | ||
| getattr(alert, "status", None) == "provisioning" | ||
|
||
| and (time.time() - start) < timeout | ||
| ): | ||
| time.sleep(interval) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a trailing whitespace after the opening docstring quotes. This should be removed to maintain consistent documentation formatting.