Skip to content

Commit b626bf9

Browse files
committed
fixed further review comments
1 parent f1861cd commit b626bf9

3 files changed

Lines changed: 21 additions & 16 deletions

File tree

linode_api4/groups/monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def alert_channels(self, *filters) -> PaginatedList:
198198
supply optional filter expressions to restrict the results.
199199
200200
Examples:
201-
channels = client.monitor.get_alert_channels()
201+
channels = client.monitor.alert_channels()
202202
203203
.. note:: This endpoint is in beta and requires using the v4beta base URL.
204204

linode_api4/objects/monitor.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ class MetricType(StrEnum):
6969
histogram = "histogram"
7070
summary = "summary"
7171

72+
class CriteriaCondition(StrEnum):
73+
"""
74+
Enum for supported CriteriaCondition
75+
Currently, only ALL is supported.
76+
"""
77+
78+
all = "ALL"
79+
7280

7381
class MetricUnit(StrEnum):
7482
"""
@@ -207,12 +215,12 @@ class TriggerConditions(JSONObject):
207215
}
208216
209217
Fields:
210-
- criteria_condition: "ALL" or "ANY" (whether all rules must match or any)
218+
- criteria_condition: "ALL" (currently, only "ALL" is supported)
211219
- evaluation_period_seconds: seconds over which the rule(s) are evaluated
212220
- polling_interval_seconds: how often metrics are sampled (seconds)
213221
- trigger_occurrences: how many consecutive evaluation periods must match to trigger
214222
"""
215-
criteria_condition: Literal["ALL"] = "ALL"
223+
criteria_condition: CriteriaCondition = CriteriaCondition.all
216224
evaluation_period_seconds: int = 0
217225
polling_interval_seconds: int = 0
218226
trigger_occurrences: int = 0
@@ -234,7 +242,7 @@ class DimensionFilter(JSONObject):
234242
dimension_label: str = ""
235243
label: str = ""
236244
operator: str = ""
237-
value: Union[str, int, float, bool, None] = None
245+
value: str = None
238246

239247

240248
@dataclass
@@ -292,8 +300,6 @@ class AlertChannelEnvelope(JSONObject):
292300
type: str = ""
293301
url: str = ""
294302

295-
296-
@dataclass
297303
class AlertType(StrEnum):
298304
"""
299305
Enumeration of alert origin types used by alert definitions.
@@ -317,17 +323,17 @@ class AlertDefinition(DerivedBase):
317323
API Documentation: https://techdocs.akamai.com/linode-api/reference/get-alert-definition
318324
"""
319325

320-
api_endpoint = "/monitor/services/{service}/alert-definitions/{id}"
326+
api_endpoint = "/monitor/services/{service_type}/alert-definitions/{id}"
321327
derived_url_path = "alert-definitions"
322-
parent_id_name = "service"
328+
parent_id_name = "service_type"
323329
id_attribute = "id"
324330

325331
properties = {
326332
"id": Property(identifier=True),
333+
"service_type": Property(identifier=True),
327334
"label": Property(mutable=True),
328335
"severity": Property(mutable=True),
329336
"type": Property(AlertType),
330-
"service_type": Property(identifier=True),
331337
"status": Property(),
332338
"has_more_resources": Property(),
333339
"rule_criteria": Property(RuleCriteria),
@@ -371,7 +377,7 @@ class AlertChannel(Base):
371377
and is used by the SDK to list, load, and inspect channels.
372378
"""
373379

374-
api_endpoint = "/monitor/alert-channels/"
380+
api_endpoint = "/monitor/alert-channels/{id}"
375381

376382
properties = {
377383
"id": Property(identifier=True),

test/integration/models/monitor/test_monitor.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import time
2+
from test.integration.helpers import (
3+
get_test_label,
4+
send_request_when_resource_available,
5+
wait_for_condition,
6+
)
27

38
import pytest
49

@@ -11,12 +16,6 @@
1116
MonitorServiceToken,
1217
)
1318

14-
from test.integration.helpers import (
15-
get_test_label,
16-
send_request_when_resource_available,
17-
wait_for_condition,
18-
)
19-
2019

2120
# List all dashboards
2221
def test_get_all_dashboards(test_linode_client):

0 commit comments

Comments
 (0)