You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add read-only unifi port-forwards list and unifi port-forwards show <name-or-id> commands with text, JSON, and schema support.
Why
Port-forward exposure and WAN/interface scoping currently require controller UI inspection. This makes those controls auditable and scriptable.
Safety
The legacy resource is decoded into a narrow typed record. Unknown vendor fields are discarded, and regression fixtures inject secret-like fields and verify they never appear in output.
Checks
env -u UNIFI_API_KEY -u UNIFI_HOST make check
Live read-only validation against a UniFi controller, including WAN-scoped TCP 32400 forwarding
This one is in good shape. I confirmed the field mapping against a real record on my controller rather than trusting the mock: I created a disabled port forward, read it back, and deleted it, and every field your struct allowlists came back exactly as you typed it, log included via the serde default. One formatting fix and I will take it.
port-forwards show builds its rows from row.as_object(), and serde_json here is built without preserve_order, so the map is a BTreeMap. The result is alphabetical fields and a literal null for anything absent. On that real record:
destination 192.0.2.10
destination port 32400
enabled false
external port 32400
id <redacted>
interface wan
logging false
name temp-probe
protocol tcp
source any
source port null
Elsewhere the codebase prints - for absent values in a fixed, meaningful order. networks show in #5 is a good model: an explicit array of label and value pairs. The list output is already fine as it is.
Worth noting for context: the empty result on my controller is honest rather than a dead endpoint. rest/portforward still answers 200 on Network 10.5.67 and there is no v2 replacement, unlike the firewall case in #6.
These four PRs overlap in client.rs and mock_server.rs, so whichever lands first makes the others conflict. That is my sequencing problem more than yours: I am landing #5 first, and if you would rather not chase rebases across three branches, say so and I will resolve the conflicts on merge.
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
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.
What
Add read-only
unifi port-forwards listandunifi port-forwards show <name-or-id>commands with text, JSON, and schema support.Why
Port-forward exposure and WAN/interface scoping currently require controller UI inspection. This makes those controls auditable and scriptable.
Safety
The legacy resource is decoded into a narrow typed record. Unknown vendor fields are discarded, and regression fixtures inject secret-like fields and verify they never appear in output.
Checks
env -u UNIFI_API_KEY -u UNIFI_HOST make check