{{ message }}
feat(cli): add firewalls and elastic-ips commands (PD-6077)#91
Open
LanusseMorais wants to merge 2 commits into
Open
feat(cli): add firewalls and elastic-ips commands (PD-6077)#91LanusseMorais wants to merge 2 commits into
LanusseMorais wants to merge 2 commits into
Conversation
…rer infra (PD-6077)
Collaborator
Author
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
Adds the
firewallsandelastic-ipscommand groups (full CRUD + firewall assignments), built on the Go SDK.lsh firewalls—list,get,create,update,delete+assignments list/create/deletelsh elastic-ips—list,get,create,update,deletels/rmaliases, flat output for mutations,-o json/yaml/csv+--query+--profileeverywhere--statusenum onelastic-ips list;firewalls updaterequires--nameand/or a non-empty--rulesKnown limitations
elastic-ips createrequires--projectand--server— the API allocates the IP in the server's region--waitonelastic-ips createdeferred (API returns 202 withid: nil) — see PD-6077 commentsTesting
Clone & checkout
Build & unit tests
Try the commands (requires an authenticated profile —
./lsh login)Greptile Summary
This PR introduces complete CRUD command groups for
firewallsandelastic-ips(including firewall assignment management), backed by the Go SDK, with interactive TUI tables, enter-to-details drill-down, and thorough unit tests for all request-building paths.lsh firewalls—list,get,create,update,deletewith a rich enter-to-details view that expands per-rule fields; anassignmentssub-group (list,create,delete) rounds out the surface.lsh elastic-ips—list(with--statusenum validation),get,create,update,delete; the create path documents the 202/async limitation and defers--waitsupport.DetailFielder/DetailViewerinterfaces,RenderDetails,RunResourceTableOrdered, and a scrollable viewport inResourceDetailsModelare added to support the new resource detail views.Confidence Score: 4/5
Safe to merge once the elastic-IP TUI label issue (routing to the pre-existing "IP Addresses" title instead of "Elastic IPs") is addressed; all command logic, validation, and SDK wiring look correct.
The elastic-IP list and get commands render under the hardcoded "IP Addresses" / "IP Details" labels because isIPData fires first — every user who runs elastic-ips list or elastic-ips get sees the wrong resource name in the interactive view. This is a visible, reproducible UI regression introduced by the new ElasticIP.TableRow() returning address and family keys that trigger the legacy IP-address dispatch path.
internal/renderer/bubbletea.go — the isIPData dispatch runs before the DetailFielder check, swallowing elastic IPs into the old "IP Addresses" render path and showing incorrect titles.
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant User participant CLI as cobra Command participant Builder as buildXxxRequest participant SDK as latitudesh-go-sdk participant Renderer as utils.Render/RenderDetails User->>CLI: lsh firewalls list CLI->>Builder: buildListRequest(cmd) Builder-->>CLI: ListFirewallsRequest CLI->>SDK: client.Firewalls.List(ctx, filter, ...) SDK-->>CLI: []FirewallData CLI->>Renderer: utils.Render(firewalls.GetData()) Renderer->>Renderer: isIPData? → no Renderer->>Renderer: DetailFielder? → yes (Firewall) Renderer-->>User: TUI table (enter → rule details) User->>CLI: lsh firewalls get fw_x CLI->>SDK: client.Firewalls.Get(ctx, id, ...) SDK-->>CLI: FirewallData CLI->>Renderer: utils.RenderDetails(firewall.GetData()) Renderer->>Renderer: interactive + DetailFielder? → yes Renderer-->>User: Detail sheet (ID/Name/Project/Rules/Rule N) User->>CLI: lsh elastic-ips list --status active CLI->>Builder: buildListRequest(cmd) Builder-->>CLI: ListElasticIpsRequest (validated status) CLI->>SDK: client.ElasticIps.ListElasticIps(ctx, request, ...) SDK-->>CLI: []ElasticIPData CLI->>Renderer: utils.Render(ips.GetData()) Renderer->>Renderer: isIPData? → yes (address+family keys) Renderer-->>User: TUI table (title: "IP Addresses" ← wrong label)%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant User participant CLI as cobra Command participant Builder as buildXxxRequest participant SDK as latitudesh-go-sdk participant Renderer as utils.Render/RenderDetails User->>CLI: lsh firewalls list CLI->>Builder: buildListRequest(cmd) Builder-->>CLI: ListFirewallsRequest CLI->>SDK: client.Firewalls.List(ctx, filter, ...) SDK-->>CLI: []FirewallData CLI->>Renderer: utils.Render(firewalls.GetData()) Renderer->>Renderer: isIPData? → no Renderer->>Renderer: DetailFielder? → yes (Firewall) Renderer-->>User: TUI table (enter → rule details) User->>CLI: lsh firewalls get fw_x CLI->>SDK: client.Firewalls.Get(ctx, id, ...) SDK-->>CLI: FirewallData CLI->>Renderer: utils.RenderDetails(firewall.GetData()) Renderer->>Renderer: interactive + DetailFielder? → yes Renderer-->>User: Detail sheet (ID/Name/Project/Rules/Rule N) User->>CLI: lsh elastic-ips list --status active CLI->>Builder: buildListRequest(cmd) Builder-->>CLI: ListElasticIpsRequest (validated status) CLI->>SDK: client.ElasticIps.ListElasticIps(ctx, request, ...) SDK-->>CLI: []ElasticIPData CLI->>Renderer: utils.Render(ips.GetData()) Renderer->>Renderer: isIPData? → yes (address+family keys) Renderer-->>User: TUI table (title: "IP Addresses" ← wrong label)Reviews (2): Last reviewed commit: "refactor(cli): self-describing detail vi..." | Re-trigger Greptile