diff --git a/docs/modules/monitor_alert_channel_list.md b/docs/modules/monitor_alert_channel_list.md index 0d4d84af..98250835 100644 --- a/docs/modules/monitor_alert_channel_list.md +++ b/docs/modules/monitor_alert_channel_list.md @@ -47,21 +47,10 @@ WARNING! This module makes use of beta endpoints and requires the C(api_version) ```json [ { - "alerts": [ - { - "id": 10000, - "label": "High Memory Usage Plan Dedicated", - "type": "alerts-definitions", - "url": "/monitor/alerts-definitions/10000" - }, - { - "id": 10001, - "label": "High Memory Usage Plan Shared", - "type": "alerts-definitions", - "url": "/monitor/alerts-definitions/10001" - } - ], + "id": 10000, + "label": "Read-Write Channel", "channel_type": "email", + "type": "system", "content": { "email": { "email_addresses": [ @@ -69,15 +58,23 @@ WARNING! This module makes use of beta endpoints and requires the C(api_version) ] } }, + "details": { + "email": { + "usernames": [], + "recipient_type": "read_write_users" + } + }, + "alerts": { + "url": "/monitor/alert-channels/10000/alerts", + "type": "alerts-definitions", + "alert_count": 8 + }, "created": "2025-03-20T01:41:09", - "created_by": "system", - "id": 10000, - "label": "Read-Write Channel", - "type": "system", "updated": "2025-03-20T01:41:09", + "created_by": "system", "updated_by": "system" } - ] + ] ``` - See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-alert-channels) for a list of returned fields diff --git a/plugins/module_utils/doc_fragments/alert_channels_list.py b/plugins/module_utils/doc_fragments/alert_channels_list.py index 3ef3c7cc..0f98419b 100644 --- a/plugins/module_utils/doc_fragments/alert_channels_list.py +++ b/plugins/module_utils/doc_fragments/alert_channels_list.py @@ -7,21 +7,10 @@ result_alert_channels_samples = ['''[ { - "alerts": [ - { - "id": 10000, - "label": "High Memory Usage Plan Dedicated", - "type": "alerts-definitions", - "url": "/monitor/alerts-definitions/10000" - }, - { - "id": 10001, - "label": "High Memory Usage Plan Shared", - "type": "alerts-definitions", - "url": "/monitor/alerts-definitions/10001" - } - ], + "id": 10000, + "label": "Read-Write Channel", "channel_type": "email", + "type": "system", "content": { "email": { "email_addresses": [ @@ -29,13 +18,21 @@ ] } }, + "details": { + "email": { + "usernames": [], + "recipient_type": "read_write_users" + } + }, + "alerts": { + "url": "/monitor/alert-channels/10000/alerts", + "type": "alerts-definitions", + "alert_count": 8 + }, "created": "2025-03-20T01:41:09", - "created_by": "system", - "id": 10000, - "label": "Read-Write Channel", - "type": "system", "updated": "2025-03-20T01:41:09", + "created_by": "system", "updated_by": "system" } -] + ] '''] diff --git a/tests/integration/targets/monitor_services_alert_channel_list/tasks/main.yaml b/tests/integration/targets/monitor_services_alert_channel_list/tasks/main.yaml new file mode 100644 index 00000000..e3a0d866 --- /dev/null +++ b/tests/integration/targets/monitor_services_alert_channel_list/tasks/main.yaml @@ -0,0 +1,30 @@ +- name: monitor_services_alert_channel_list + block: + - name: List available alert channels + linode.cloud.monitor_alert_channel_list: + register: alert_channel_list + + - name: Assert monitor_alert_channel_list response + assert: + that: + - alert_channel_list.alert_channels | length > 0 + + - name: List system alert channels + linode.cloud.monitor_alert_channel_list: + filters: + - name: label + values: ["Read-Write Channel"] + register: alert_channel_list_filter + + - name: Assert alert_channel_list_filter response + assert: + that: + - alert_channel_list_filter.alert_channels | length > 0 + - alert_channel_list_filter.alert_channels.0.label == 'Read-Write Channel' + + environment: + LINODE_UA_PREFIX: '{{ ua_prefix }}' + LINODE_API_TOKEN: '{{ api_token }}' + LINODE_API_URL: '{{ api_url }}' + LINODE_API_VERSION: '{{ api_version }}' + LINODE_CA: '{{ ca_file or "" }}'