Skip to content

TRITON-2546 Add additional types to CloudAPI for filtering packages and volumes#26

Merged
travispaul merged 7 commits intomainfrom
openapi-filter-types
May 6, 2026
Merged

TRITON-2546 Add additional types to CloudAPI for filtering packages and volumes#26
travispaul merged 7 commits intomainfrom
openapi-filter-types

Conversation

@travispaul
Copy link
Copy Markdown
Member

Add ListPackagesQuery and ListVolumesQuery types and some additional tests.

travispaul and others added 7 commits May 4, 2026 11:47
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>
@travispaul travispaul marked this pull request as ready for review May 6, 2026 02:33
@travispaul travispaul changed the title Add additional types to CloudAPI for filtering packages and volumes TRITON-2546 Add additional types to CloudAPI for filtering packages and volumes May 6, 2026
@travispaul travispaul merged commit ed1d70c into main May 6, 2026
5 checks passed
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