Skip to content

fix(databases): preserve database firewall descriptions on append and remove (#1869) - #1923

Open
Kanika0306 wants to merge 1 commit into
digitalocean:mainfrom
Kanika0306:fix-db-firewall-description-loss
Open

Kanika0306 wants to merge 1 commit into
digitalocean:mainfrom
Kanika0306:fix-db-firewall-description-loss

Conversation

@Kanika0306

Copy link
Copy Markdown

Summary

Fixes #1869: Database firewall rule descriptions were erased when appending or removing rules via doctl databases firewalls append or doctl databases firewalls remove.

Cause

When reconstructing existing firewall rules prior to invoking UpdateFirewallRules, doctl copied UUID, ClusterUUID, Type, and Value, but omitted Description. Additionally, the vendored godo.DatabaseFirewallRule struct was missing the Description field (json:"description,omitempty").

Solution

  1. Added Description field to godo.DatabaseFirewallRule in the vendored godo package.
  2. Preserved Description in RunDatabaseFirewallRulesAppend: Copied firewallRule.Description = rule.Description during rule reconstruction.
  3. Preserved Description in RunDatabaseFirewallRulesRemove: Copied Description: rule.Description during rule reconstruction.
  4. Updated DatabaseFirewallRules displayer: Added Description to Cols(), ColMap(), and KV() so descriptions render in CLI output.
  5. Added Regression Tests: Added TestDatabaseFirewallRulesAppend and TestDatabaseFirewallRulesRemove to verify that existing firewall rule descriptions are preserved in the payload sent to DigitalOcean API.

Verification

Ran unit tests:

go test -v ./commands -run TestDatabaseFirewallRules

Copilot AI lite review requested due to automatic review settings August 24, 2026 17:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Kanika0306
Kanika0306 force-pushed the fix-db-firewall-description-loss branch from 2e36671 to 5dc7bd0 Compare August 24, 2026 19:18
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.

doctl databases firewalls append removes descriptions for existing rules

2 participants