Skip to content

Commit 2f7b115

Browse files
authored
TPT-4218: Update test and docs for ACLP alert channels (#767)
* doc and test * fix doc * update doc sample * update doc example
1 parent 1d391b3 commit 2f7b115

3 files changed

Lines changed: 72 additions & 56 deletions

File tree

docs/modules/monitor_alert_channel_list.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,28 @@ WARNING! This module makes use of beta endpoints and requires the C(api_version)
4747
```json
4848
[
4949
{
50-
"alerts": [
51-
{
52-
"id": 10000,
53-
"label": "High Memory Usage Plan Dedicated",
54-
"type": "alerts-definitions",
55-
"url": "/monitor/alerts-definitions/10000"
50+
"id": 123,
51+
"label": "alert notification channel",
52+
"type": "user",
53+
"channel_type": "email",
54+
"details": {
55+
"email": {
56+
"usernames": [
57+
"admin-user1",
58+
"admin-user2"
59+
],
60+
"recipient_type": "user"
61+
}
5662
},
57-
{
58-
"id": 10001,
59-
"label": "High Memory Usage Plan Shared",
60-
"type": "alerts-definitions",
61-
"url": "/monitor/alerts-definitions/10001"
62-
}
63-
],
64-
"channel_type": "email",
65-
"content": {
66-
"email": {
67-
"email_addresses": [
68-
"Users-with-read-write-access-to-resources"
69-
]
70-
}
71-
},
72-
"created": "2025-03-20T01:41:09",
73-
"created_by": "system",
74-
"id": 10000,
75-
"label": "Read-Write Channel",
76-
"type": "system",
77-
"updated": "2025-03-20T01:41:09",
78-
"updated_by": "system"
63+
"alerts": {
64+
"url": "/monitor/alert-channels/123/alerts",
65+
"type": "alerts-definitions",
66+
"alert_count": 0
67+
},
68+
"created": "2024-01-01T00:00:00",
69+
"updated": "2024-01-01T00:00:00",
70+
"created_by": "tester",
71+
"updated_by": "tester"
7972
}
8073
]
8174

plugins/module_utils/doc_fragments/alert_channels_list.py

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,28 @@
77

88
result_alert_channels_samples = ['''[
99
{
10-
"alerts": [
11-
{
12-
"id": 10000,
13-
"label": "High Memory Usage Plan Dedicated",
14-
"type": "alerts-definitions",
15-
"url": "/monitor/alerts-definitions/10000"
10+
"id": 123,
11+
"label": "alert notification channel",
12+
"type": "user",
13+
"channel_type": "email",
14+
"details": {
15+
"email": {
16+
"usernames": [
17+
"admin-user1",
18+
"admin-user2"
19+
],
20+
"recipient_type": "user"
21+
}
1622
},
17-
{
18-
"id": 10001,
19-
"label": "High Memory Usage Plan Shared",
20-
"type": "alerts-definitions",
21-
"url": "/monitor/alerts-definitions/10001"
22-
}
23-
],
24-
"channel_type": "email",
25-
"content": {
26-
"email": {
27-
"email_addresses": [
28-
"Users-with-read-write-access-to-resources"
29-
]
30-
}
31-
},
32-
"created": "2025-03-20T01:41:09",
33-
"created_by": "system",
34-
"id": 10000,
35-
"label": "Read-Write Channel",
36-
"type": "system",
37-
"updated": "2025-03-20T01:41:09",
38-
"updated_by": "system"
23+
"alerts": {
24+
"url": "/monitor/alert-channels/123/alerts",
25+
"type": "alerts-definitions",
26+
"alert_count": 0
27+
},
28+
"created": "2024-01-01T00:00:00",
29+
"updated": "2024-01-01T00:00:00",
30+
"created_by": "tester",
31+
"updated_by": "tester"
3932
}
4033
]
4134
''']
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
- name: monitor_services_alert_channel_list
2+
block:
3+
- name: List available alert channels
4+
linode.cloud.monitor_alert_channel_list:
5+
register: alert_channel_list
6+
7+
- name: Assert monitor_alert_channel_list response
8+
assert:
9+
that:
10+
- alert_channel_list.alert_channels | length > 0
11+
12+
- name: List system alert channels
13+
linode.cloud.monitor_alert_channel_list:
14+
filters:
15+
- name: label
16+
values: ["Read-Write Channel"]
17+
register: alert_channel_list_filter
18+
19+
- name: Assert alert_channel_list_filter response
20+
assert:
21+
that:
22+
- alert_channel_list_filter.alert_channels | length > 0
23+
- alert_channel_list_filter.alert_channels.0.label == 'Read-Write Channel'
24+
25+
environment:
26+
LINODE_UA_PREFIX: '{{ ua_prefix }}'
27+
LINODE_API_TOKEN: '{{ api_token }}'
28+
LINODE_API_URL: '{{ api_url }}'
29+
LINODE_API_VERSION: '{{ api_version }}'
30+
LINODE_CA: '{{ ca_file or "" }}'

0 commit comments

Comments
 (0)