Skip to content

reverted and changes Alert Channel changes as per latest API v4 changes#890

Open
srbhaakamai wants to merge 3 commits intolinode:mainfrom
srbhaakamai:main
Open

reverted and changes Alert Channel changes as per latest API v4 changes#890
srbhaakamai wants to merge 3 commits intolinode:mainfrom
srbhaakamai:main

Conversation

@srbhaakamai
Copy link
Contributor

@srbhaakamai srbhaakamai commented Feb 10, 2026

📝 Description

What does this PR do and why is this change necessary?

✔️ How to Test

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

How do I run the relevant unit/integration tests?
srbha@blr-mpo40 linodego % export LINODE_TOKEN="" && export LINODE_API_VERSION="v4beta" && go test -count=1 ./test/integration -run "TestMonitorAlertDefinition" -v
=== RUN TestMonitorAlertDefinition_smoke
--- PASS: TestMonitorAlertDefinition_smoke (66.19s)
=== RUN TestMonitorAlertDefinitions_List
--- PASS: TestMonitorAlertDefinitions_List (1.37s)
=== RUN TestMonitorAlertDefinition_CreateWithIdempotency
--- PASS: TestMonitorAlertDefinition_CreateWithIdempotency (3.88s)
PASS
ok github.com/linode/linodego/test/integration 72.096s

📷 Preview

If applicable, include a screenshot or code snippet of this change. Otherwise, please remove this section.

Copilot AI review requested due to automatic review settings February 10, 2026 07:23
@srbhaakamai srbhaakamai requested a review from a team as a code owner February 10, 2026 07:23
@srbhaakamai srbhaakamai requested review from lgarber-akamai and psnoch-akamai and removed request for a team February 10, 2026 07:23
Copy link
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

Re-enables Monitor alert channel functionality and related integration tests, updating the Alert Channel model to match the latest API v4 shape.

Changes:

  • Re-enabled integration tests that depend on listing alert channels and selecting a channel ID dynamically.
  • Implemented AlertChannel types (including content/details blocks) and restored ListAlertChannels.
  • Added JSON unmarshalling for created/updated timestamps using parseabletime.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
test/integration/monitor_alert_definitions_test.go Re-enables alert channel listing tests and uses live channel discovery for alert definition creation.
monitor_alert_channels.go Restores alert channel API surface (types + ListAlertChannels) updated for API v4 response schema.

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

// endpoint := formatAPIPath("monitor/alert-channels")
// return getPaginatedResults[AlertChannel](ctx, c, endpoint, opts)
// }
type AlertNotificationType string
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Several exported types are missing GoDoc-style comments (comments starting with the identifier name). If this repo uses golint/golangci-lint, this will typically fail linting; even if not, adding brief comments improves API readability for library consumers.

Copilot uses AI. Check for mistakes.
EmailAlertNotification AlertNotificationType = "email"
)

type AlertChannelType string
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Several exported types are missing GoDoc-style comments (comments starting with the identifier name). If this repo uses golint/golangci-lint, this will typically fail linting; even if not, adding brief comments improves API readability for library consumers.

Copilot uses AI. Check for mistakes.
}

// AlertsInfo represents alert information for a channel
type AlertsInfo struct {
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Several exported types are missing GoDoc-style comments (comments starting with the identifier name). If this repo uses golint/golangci-lint, this will typically fail linting; even if not, adding brief comments improves API readability for library consumers.

Copilot uses AI. Check for mistakes.
Type string `json:"type"`
AlertCount int `json:"alert_count"`
}

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Several exported types are missing GoDoc-style comments (comments starting with the identifier name). If this repo uses golint/golangci-lint, this will typically fail linting; even if not, adding brief comments improves API readability for library consumers.

Suggested change
// EmailChannelContent represents the content for email alert channels.

Copilot uses AI. Check for mistakes.
}

// ChannelDetails represents the details block for an AlertChannel
type ChannelDetails struct {
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Several exported types are missing GoDoc-style comments (comments starting with the identifier name). If this repo uses golint/golangci-lint, this will typically fail linting; even if not, adding brief comments improves API readability for library consumers.

Copilot uses AI. Check for mistakes.
}

// EmailChannelDetails represents email-specific details for a channel
type EmailChannelDetails struct {
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Several exported types are missing GoDoc-style comments (comments starting with the identifier name). If this repo uses golint/golangci-lint, this will typically fail linting; even if not, adding brief comments improves API readability for library consumers.

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +54
var channelID int
var fetchedChannelLabel string
var fetchedChannelID int
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The test keeps three variables (channelID, fetchedChannelID, fetchedChannelLabel) but channelID and fetchedChannelID are always assigned to the same value. Consider storing the selected channel in a single local (e.g., selectedChannel) or asserting directly on channelID plus a single label value to reduce duplication and make the test intent clearer.

Copilot uses AI. Check for mistakes.
@yec-akamai yec-akamai self-requested a review February 11, 2026 14:31
@srbhaakamai srbhaakamai marked this pull request as draft February 12, 2026 06:19
@satkumar-akamai
Copy link

@srbhaakamai

  1. For the List Channels API, the content and details fields currently contain essentially the same data but with different structure. We have kept both fields for backward compatibility, but content will be removed from the response in the future.
    Please ensure that the test suites do not heavily depend on the content field.

  2. Please update the latest ENUM in Alert Status field in Alert Management APIs (provided in the api spec)

@srbhaakamai srbhaakamai marked this pull request as ready for review February 13, 2026 08:11
Copy link

@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.

Changes looks good as per API Spec.

Copy link
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.

Overall looks good. Can you fix the comments please?

@@ -208,33 +208,33 @@ func TestMonitorAlertDefinitions_List(t *testing.T) {
}

// TODO: Disable this test until we can query alert channels correctly.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you clean up the TODO comment as well?

Comment on lines 231 to 232
// TODO: use a fixed channel id for now until the alert channel has been fixed.
//// Get a channel ID to use
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you clean up the TODO comment as well?

@@ -48,27 +48,27 @@ func TestMonitorAlertDefinition_smoke(t *testing.T) {
assert.NoError(t, err)

// TODO: Use a fixed channel id for now until the alert channel has been fixed.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you clean up the TODO comment as well?

c.BaseURL = "https://api.linode.com/v4/"
}

// SetUpWithAPIVersion initializes the Linode client with a specific API version
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not necessary to have this function. Our integration test is default to use v4beta, and unit test does not check the api version though.


// ChannelContent represents the content block for an AlertChannel, which varies by channel type.
type ChannelContent struct {
Email *EmailChannelContent `json:"email,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

omitempty is not necessary if the field is read-only. Same for the rest fields.

Copy link
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 also run the integration test and re-generate the fixtures please?

Comment on lines +14 to +16
AlertDefinitionStatusProvisioning AlertDefinitionStatus = "provisioning"
AlertDefinitionStatusEnabling AlertDefinitionStatus = "enabling"
AlertDefinitionStatusDisabling AlertDefinitionStatus = "disabling"
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, is this already a change in the API response? I remember we didn't have these three status in the old response and they were represented by in_progress. If this is the case we will need to make changes to a wait_for function though.

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.

3 participants