Skip to content

feat: add network update and report APIs; surface network_id on clusters and VMs#110

Merged
jdewinne merged 3 commits into
mainfrom
joshd/sc-137000/no-github-actions-for-cmx-network-update
Apr 28, 2026
Merged

feat: add network update and report APIs; surface network_id on clusters and VMs#110
jdewinne merged 3 commits into
mainfrom
joshd/sc-137000/no-github-actions-for-cmx-network-update

Conversation

@jdewinne
Copy link
Copy Markdown
Member

@jdewinne jdewinne commented Apr 27, 2026

Summary

  • updateNetwork(api, networkId, { policy?, collectReport? })PUT /network/{id}/update. Supports policy values open/airgap and toggling collect_report. Always sends policy, includes collect_report only when explicitly set, mirroring the upstream Go vendor client.
  • getNetworkReport(api, networkId, after?: Date)GET /network/{id}/report. Returns raw NetworkEventData[]. Optional after Date narrows to events newer than that timestamp (encoded as RFC3339).
  • getNetworkReportSummary(api, networkId)GET /network/{id}/report/summary. Returns aggregated stats with top domains/destinations. Two separate functions instead of a boolean flag — distinct return types, no narrowing at call sites, room for per-mode params (e.g., after on events).
  • Expose network_id on Cluster and VM, populated from createCluster / createClusterWithLicense / getClusterDetails and createVM / getVMDetails, so callers can drive network updates without an extra lookup.

Test plan

  • npm run build (clean)
  • npx jest src/networks.spec.ts src/clusters.spec.ts src/vms.spec.ts — 30/30 pass
  • networks.spec.ts covers: policy-only update, collect-report-only, both fields, StatusError on non-200; report event listing, after query param, empty events default, summary parsing with domains/destinations/sources, summary error body, and 4xx StatusError paths

Adds updateNetwork() supporting policy ("open"/"airgap") and
collect_report changes via PUT /network/{id}/update. createCluster,
createVM, and their poll/get helpers now return network_id so callers
can drive network updates without an extra lookup.
GET /network/{id}/report returns raw NetworkEventData[]; optional
`after` Date narrows to events newer than that timestamp (RFC3339).
GET /network/{id}/report/summary returns aggregated stats with top
domains and destinations. Mirrors the upstream Go SDK split.
@jdewinne jdewinne changed the title feat: add updateNetwork and surface network_id on clusters and VMs feat: add network update and report APIs; surface network_id on clusters and VMs Apr 27, 2026
@jdewinne jdewinne merged commit 5a95db9 into main Apr 28, 2026
1 check passed
@jdewinne jdewinne deleted the joshd/sc-137000/no-github-actions-for-cmx-network-update branch April 28, 2026 15:53
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.

2 participants