TRITON-2546 Add additional types to CloudAPI for filtering packages and volumes#26
Merged
travispaul merged 7 commits intomainfrom May 6, 2026
Merged
TRITON-2546 Add additional types to CloudAPI for filtering packages and volumes#26travispaul merged 7 commits intomainfrom
travispaul merged 7 commits intomainfrom
Conversation
The CloudAPI OpenAPI spec was missing query parameters for the list_packages, head_packages, and list_volumes endpoints. The original Node.js CloudAPI (sdc-cloudapi) accepts filter parameters on these endpoints and forwards them to PAPI and VOLAPI respectively, but the Rust Dropshot trait had no Query<> parameters, so the generated spec advertised no filtering capability. This matters for downstream consumers — notably terraform-provider-triton, which currently has to do client-side filtering because the Go client (generated from this spec) offers no server-side filter params. ListPackagesQuery (misc.rs) exposes the 10 fields that CloudAPI passes through to PAPI: name, memory, disk, swap, lwps, vcpus, version, group, flexible_disk, and brand. Internal PAPI params (active, owner_uuids, filter, limit, offset, sort, order) are intentionally excluded — CloudAPI sets those itself. ListVolumesQuery (volume.rs) exposes the 5 fields from the volumes endpoint: name, state, size, type, and predicate. State and type use String rather than their respective enums to match how the Node.js code passes them through without validation at the query-param level. Both follow the established ListMachinesQuery pattern (machine.rs:577). All fields are Option with #[serde(default)]. Generated artifacts updated: OpenAPI specs, Rust Progenitor clients (cloudapi-client, triton-gateway-client), and Go oapi-codegen client. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ListPackagesWithResponse, HeadPackagesWithResponse, and ListVolumesWithResponse now require a params argument after the query parameter structs were added in 9a49c19. Pass nil to preserve the existing no-filter behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verify deserialization of the new query parameter structs added in 9a49c19, covering all fields, empty queries, type/rename mappings, and passthrough string behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Go client tests: filter ListPackages by name and memory, HeadPackages with filter params, filter ListVolumes by name and state, and verify empty results for non-matching filters. Rust CLI tests: filter `triton packages` by --name, --memory, and positional key=value syntax; filter `triton volume list` by --name and --state; verify empty results for non-matching filters. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Go client: add tests for ListVolumes filtered by size, type, and predicate (krill expression). The predicate test constructs an eq expression matching a known volume name, verifying VOLAPI processes it correctly end-to-end. Rust CLI: add tests for `triton volume list` filtered by --size and --type. The CLI does not expose --predicate, so that is only covered by the Go client test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Exercises the ?brand= server-side query parameter on ListPackages, confirming that PAPI correctly filters packages by brand. The test finds a package with a non-nil brand, filters by it, and verifies the result set is both non-empty and smaller than the unfiltered set. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove serde_package.rs entirely — it only tested that serde deserializes Option<primitive> fields, which is testing the framework not our code. Trim serde_volume.rs to keep only the type→volume_type rename test, which guards a load-bearing #[serde(rename)] that would silently break query parameter parsing if removed. Change "JSON-encoded krill predicate expression" to "JSON-encoded predicate expression" in the doc comment and regenerate all downstream artifacts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nshalman
approved these changes
May 6, 2026
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.
Add
ListPackagesQueryandListVolumesQuerytypes and some additional tests.