[external api] Set a default empty array for VpcFirewallRuleUpdate#8175
Conversation
There was a problem hiding this comment.
I'm cool with this change to be consistent with other APIs but I would have assumed even without this change setting rules to [] in the request body would have worked. Did the previous configuration enforce a non-empty array?
Oh, I think I see it now. The Go SDK has omitempty on the rules attribute so setting [] serializes to null. The rules attribute isn't nullable in omicron so the omitempty will remain in the Go SDK. Now sending null in the request body will allow omicron to default rules to []. Do I have that right?
|
Sorry, meant to comment on Friday. Does this make it so you can nuke all your rules by posting |
Correct. This is how the UI code also does it. If you delete the last firewall rule in the UI the request body that's sent is
We could update the Go SDK to remove |
|
UPDATE: Had a chat in the Product sync about this and we'll be continuing the conversation. Just want to add a datapoint here. What we really need here is a |
In our attempt to make the Go SDK generator less hacky oxidecomputer/oxide.go#283, we had the unexpected side effect of breaking our
VpcFirewallRuleUpdateParamsstruct https://github.com/oxidecomputer/oxide.go/pull/283/files#diff-841a2b1b5f072b633551cac9c34c9732a722b415e297a1530b92d5988962062eR6810-R6811 due to Go's fun way of handling empty values. Using this API no longer allows us to delete the entirety of the firewall rules.This commit sets an empty array as the default for
rulesfollowing the pattern that other APIs use.https://github.com/oxidecomputer/omicron/blob/main/nexus/types/src/external_api/params.rs#L1163-L1177
cc @sudomateo