Skip to content

ACLP: Remove content field from list alert channels response#925

Open
shkaruna wants to merge 1 commit intolinode:mainfrom
shkaruna:cleanup/list-channels-content
Open

ACLP: Remove content field from list alert channels response#925
shkaruna wants to merge 1 commit intolinode:mainfrom
shkaruna:cleanup/list-channels-content

Conversation

@shkaruna
Copy link
Copy Markdown

@shkaruna shkaruna commented Mar 31, 2026

📝 Description

Remove content field from list alert channels response.
content field is replaced with details.
Ticket: DPS-41868

✔️ 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 unit tests:
    go test -v ./test/unit/... -run Alert
    === RUN TestListAlertChannels
    --- PASS: TestListAlertChannels (0.00s)
    === 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)
    PASS
    ok github.com/linode/linodego/test/unit 0.009s

Integration tests:

  1. Record:
    LINODE_TOKEN="Linode API token"
    ENABLE_CLOUD_FW=false make TEST_ARGS='-run "TestMonitorAlertChannels_List"' fixtures
  • Running fixtures
    cd ./test/integration &&
    LINODE_FIXTURE_MODE="record"
    LINODE_TOKEN=
    LINODE_API_VERSION="v4beta"
    LINODE_URL="https://api.linode.com/"
    GO111MODULE="on"
    go test -timeout=5h -v -run "TestMonitorAlertChannels_List"
    2026/03/31 15:27:20 [INFO] LINODE_FIXTURE_MODE record will be used for tests
    2026/03/31 15:27:20 [INFO] ENABLE_CLOUD_FW is false - skipping Cloud Firewall setup
    === RUN TestMonitorAlertChannels_List
    --- PASS: TestMonitorAlertChannels_List (2.98s)
    PASS
    ok github.com/linode/linodego/test/integration 2.995s
  • Sanitizing fixtures
  1. Play:
    make test-int

make test-int TEST_ARGS='-run "AlertChannels"'

cd test && make test-int TEST_TIMEOUT=5h
make[1]: Entering directory '/home/shkaruna/sdk/linodego/test'
2026/03/31 16:04:21 [INFO] LINODE_FIXTURE_MODE play will be used for tests
2026/03/31 16:04:21 [INFO] Fixture mode play - Test Linode Cloud Firewall not created
=== RUN TestMonitorAlertChannels_List
--- PASS: TestMonitorAlertChannels_List (0.00s)
PASS
ok github.com/linode/linodego/test/integration 0.010s
make[1]: Leaving directory '/home/shkaruna/sdk/linodego/test'

@shkaruna
Copy link
Copy Markdown
Author

@satkumar-akamai : Please review

@shkaruna shkaruna force-pushed the cleanup/list-channels-content branch 3 times, most recently from 5703d95 to 740ea0a Compare April 2, 2026 09:58
@shkaruna shkaruna marked this pull request as ready for review April 2, 2026 10:52
@shkaruna shkaruna requested review from a team as code owners April 2, 2026 10:52
@shkaruna shkaruna requested review from ckulinsk, Copilot and mgwoj and removed request for a team April 2, 2026 10:52
@shkaruna shkaruna marked this pull request as draft April 2, 2026 10:52
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

This PR updates the Monitor alert channels model/tests to align with the API change where the content field is no longer part of the list alert channels response and details is the supported replacement.

Changes:

  • Removed AlertChannel.Content and related content types from the SDK model.
  • Added/updated unit and integration assertions to validate details.email decoding.
  • Updated the integration fixture data for TestMonitorAlertChannels_List.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
monitor_alert_channels.go Removes the content field/types from AlertChannel, leaving details as the structured data source.
test/unit/monitor_alert_channels_test.go Adds a unit test ensuring details.email unmarshals correctly.
test/integration/monitor_alert_definitions_test.go Strengthens integration assertions to verify Details.Email and RecipientType are present.
test/integration/fixtures/TestMonitorAlertChannels_List.yaml Updates recorded list response fixture (now includes multiple channels), but still contains content fields.
Comments suppressed due to low confidence (1)

monitor_alert_channels.go:35

  • Removing the exported Content field from AlertChannel is a compile-time breaking change for any SDK consumers that referenced AlertChannel.Content. If the API is deprecating content but you want to preserve backwards compatibility, consider keeping Content as a deprecated field (and/or aliasing it to Details) so existing clients continue to build while migrating to Details.
// AlertChannel represents a Monitor Channel object.
type AlertChannel struct {
	Alerts      AlertsInfo            `json:"alerts"`
	ChannelType AlertNotificationType `json:"channel_type"`
	Details     ChannelDetails        `json:"details"`
	Created     *time.Time            `json:"-"`
	CreatedBy   string                `json:"created_by"`
	Updated     *time.Time            `json:"-"`
	UpdatedBy   string                `json:"updated_by"`
	ID          int                   `json:"id"`
	Label       string                `json:"label"`
	Type        AlertChannelType      `json:"type"`

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

@shkaruna shkaruna force-pushed the cleanup/list-channels-content branch from 740ea0a to 4178224 Compare April 2, 2026 12:07
Copy link
Copy Markdown

@satkumar-akamai satkumar-akamai left a comment

Choose a reason for hiding this comment

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

LGTM

@shkaruna shkaruna marked this pull request as ready for review April 2, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants