Skip to content

feat: add ACLP monitor list entities method#923

Merged
yec-akamai merged 2 commits intolinode:mainfrom
shkaruna:feat/aclp-list-entities
Apr 9, 2026
Merged

feat: add ACLP monitor list entities method#923
yec-akamai merged 2 commits intolinode:mainfrom
shkaruna:feat/aclp-list-entities

Conversation

@shkaruna
Copy link
Copy Markdown
Contributor

@shkaruna shkaruna commented Mar 30, 2026

📝 Description

  1. Update ACLP monitor AlertDefinition struct. Add scope & region fields.
  2. Add entity envelope in AlertDefinition for GET, POST and PUT API responses.
`"entities":` { // empty dict for region and account scope alert
"url":"/monitor/services/{service_type}/alert-definitions/{id}/entities",
 "count": integer,
 "has_more_resources": boolean
   }
  1. Add new method to list entities.
    API: GET /monitor/services/{service_type}/alert-definitions/{id}/entities
  2. Add unit & integration tests.

JIRA: DPS-41869

✔️ How to Test

What are the steps to reproduce the issue or verify the changes?
Not Applicable

How do I run the relevant unit/integration tests?

Prerequisites
Go 1.19+ installed
Valid Linode API token with monitor permissions
Export LINODE_TOKEN environment variable for integration tests

Unit tests:

  1. Run all the unit tests:
    make test-unit
  2. Run Monitor alert definition unit tests:
    go test -v ./test/unit/... -run MonitorAlertDefinition
    Output:
    === RUN TestCreateMonitorAlertDefinition
    --- PASS: TestCreateMonitorAlertDefinition (0.00s)
    === RUN TestCreateMonitorAlertDefinitionWithIdempotency
    --- PASS: TestCreateMonitorAlertDefinitionWithIdempotency (0.00s)
    === RUN TestGetMonitorAlertDefinition
    --- PASS: TestGetMonitorAlertDefinition (0.00s)
    === RUN TestListMonitorAlertDefinitions
    --- PASS: TestListMonitorAlertDefinitions (0.00s)
    === RUN TestUpdateMonitorAlertDefinition
    --- PASS: TestUpdateMonitorAlertDefinition (0.00s)
    === RUN TestUpdateMonitorAlertDefinition_LabelOnly
    --- PASS: TestUpdateMonitorAlertDefinition_LabelOnly (0.00s)
    === RUN TestDeleteMonitorAlertDefinition
    --- PASS: TestDeleteMonitorAlertDefinition (0.00s)
    === RUN TestListMonitorAlertDefinitionEntities
    --- PASS: TestListMonitorAlertDefinitionEntities (0.00s)
    PASS
    ok github.com/linode/linodego/test/unit (cached)

Integration tests:
Verified with Production PAT & devcloud PAT.

  1. Play:
    make test-int
    make test-int TEST_ARGS='-run "Alert"'
    cd test && make test-int TEST_TIMEOUT=5h
    make[1]: Entering directory '/home/shkaruna/sdk/linodego/test'
    2026/04/08 12:08:47 [INFO] LINODE_FIXTURE_MODE play will be used for tests
    2026/04/08 12:08:47 [INFO] Fixture mode play - Test Linode Cloud Firewall not created
    === RUN TestMonitorAlertDefinition_smoke
    --- PASS: TestMonitorAlertDefinition_smoke (0.00s)
    === RUN TestMonitorAlertDefinitions_List
    --- PASS: TestMonitorAlertDefinitions_List (0.00s)
    === RUN TestMonitorAlertChannels_List
    --- PASS: TestMonitorAlertChannels_List (0.00s)
    === RUN TestMonitorAlertDefinition_CreateWithIdempotency
    --- PASS: TestMonitorAlertDefinition_CreateWithIdempotency (0.00s)
    === RUN TestMonitorAlertDefinitionEntities_List
    --- PASS: TestMonitorAlertDefinitionEntities_List (0.00s)
    PASS
    ok github.com/linode/linodego/test/integration 0.015s
    make[1]: Leaving directory '/home/shkaruna/sdk/linodego/test'

  2. Record
    export LINODE_TOKEN="Linode API token"
    ENABLE_CLOUD_FW=false make TEST_ARGS='-run "Alert"' fixtures

@shkaruna
Copy link
Copy Markdown
Contributor Author

@satkumar-akamai : Please review

@shkaruna shkaruna force-pushed the feat/aclp-list-entities branch from bcbc126 to 1aaff02 Compare April 2, 2026 10:38
@shkaruna shkaruna force-pushed the feat/aclp-list-entities branch from 1aaff02 to 10b45df Compare April 2, 2026 13:50
@shkaruna shkaruna marked this pull request as ready for review April 7, 2026 06:56
@shkaruna shkaruna requested review from a team as code owners April 7, 2026 06:56
@shkaruna shkaruna requested review from Copilot, dawiddzhafarov and mawilk90 and removed request for a team April 7, 2026 06:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for listing entities associated with an ACLP monitor alert definition and updates the alert definition model/tests to reflect new API fields.

Changes:

  • Extended AlertDefinition to include scope, regions, and an entities envelope.
  • Added a new client method to fetch the paginated entities list for an alert definition.
  • Updated unit tests, integration tests, and integration fixtures to match the new/updated API shapes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
monitor_alert_definitions.go Adds new scope/entities types & fields and introduces an entities-list client method.
test/unit/monitor_alert_definitions_test.go Updates mocked API payloads and assertions; adds a unit test for listing entities.
test/integration/monitor_alert_definitions_test.go Adds a (currently skipped) integration test stub for listing alert definition entities.
test/integration/fixtures/TestMonitorAlertDefinition.yaml Updates recorded fixture interactions/responses for monitor alert definition integration coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shkaruna shkaruna force-pushed the feat/aclp-list-entities branch from 10b45df to dcb1300 Compare April 7, 2026 07:38
@mawilk90 mawilk90 requested a review from yec-akamai April 7, 2026 10:48
@yec-akamai yec-akamai added community-contribution for contributions made by a non-DX author new-feature for new features in the changelog. labels Apr 7, 2026
Copy link
Copy Markdown
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit test passed. will run integration test once API in prod

@shkaruna shkaruna force-pushed the feat/aclp-list-entities branch from dcb1300 to 2e6efe5 Compare April 8, 2026 06:47
@shkaruna shkaruna force-pushed the feat/aclp-list-entities branch from 2e6efe5 to 532472a Compare April 8, 2026 09:26
@shkaruna shkaruna force-pushed the feat/aclp-list-entities branch 4 times, most recently from e86b98d to 831e457 Compare April 8, 2026 17:19
Copy link
Copy Markdown
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you address the conflict before merging?

Add entity envelope in AlertDefinition GET, POST and PUT API responses. Add new method to list entities. Update tests.
@shkaruna shkaruna force-pushed the feat/aclp-list-entities branch from 831e457 to 68a5ffc Compare April 9, 2026 03:56
@yec-akamai yec-akamai merged commit ad25985 into linode:main Apr 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution for contributions made by a non-DX author new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants