Allow clearing all records on an internal data group - #132
Open
mdkent wants to merge 1 commit into
Open
Conversation
The Records field on dataGroupDTO was tagged `json:"records,omitempty"`, so a PUT with an empty record set sent no `records` field at all and BigIP kept the existing entries. Drop omitempty so callers can clear records by passing an empty slice (which now serializes as `"records": []`). Mirrors the vendor patch in F5Networks/terraform-provider-bigip#1165.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dataGroupDTO.Recordsis currently taggedjson:"records,omitempty". In Go,omitemptydrops the field for bothniland[]DataGroupRecord{}, so a PUT to/ltm/data-group/internal/{name}with an empty record set sends norecordsfield at all — and BigIP keeps the existing records.omitemptyso callers can clear records on an existing data group by passing an empty slice ([]DataGroupRecord{}now serializes as"records": []).Context
This mirrors the vendor-side patch shipped in the terraform-provider-bigip repo to fix F5Networks/terraform-provider-bigip#1164. See F5Networks/terraform-provider-bigip#1165. Landing this upstream means the next
go mod vendorwon't revert the fix.Behavior change
Records: nilnow serializes as"records": nullinstead of being omitted. Most callers should send[]DataGroupRecord{}instead ofnilwhen they mean "no records." The terraform provider PR makes this change on its side.Records: []DataGroupRecord{}now serializes as"records": []— which is what BigIP needs to actually clear records.Test plan
go build .(passes locally)TestAccBigipLtmDataGroup_Update_ClearRecordscreates a data group with 2 records, applies an empty config, and asserts the BigIP record count drops to 0.