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
[api] Add endpoint to list external subnets attached to an instance (#9755)
## Summary
Adds `GET /v1/instances/{instance}/external-subnets` which returns all
external subnets currently attached to the specified instance.
## Changes
**Datastore layer**
(`nexus/db-queries/src/db/datastore/external_subnet.rs`):
- Add `instance_lookup_external_subnets()` function
- Authz check (`Action::Read` on instance) performed in datastore, close
to the SQL query
- Results ordered by ID for deterministic output
- Filters to only return attached, non-deleted subnets
**App layer** (`nexus/src/app/external_subnet.rs`):
- Add `instance_list_external_subnets()` function
- Additional authz check for `Action::ListChildren` on project (external
subnets are project-scoped)
**HTTP layer** (`nexus/src/external_api/http_entrypoints.rs`):
- Add `instance_external_subnet_list` handler
- No pagination (expect small number of attached subnets per instance;
TODO to add max limit)
**Tests**:
- Add `test_instance_external_subnet_list_empty` integration test
- Add endpoint to `endpoints.rs` for `test_unauthorized` coverage
## Test plan
- [x] `cargo nextest run -p omicron-nexus -E
'test(=integration_tests::unauthorized::test_unauthorized)'`
- [x] `cargo nextest run -p omicron-nexus -E
'test(=integration_tests::external_subnets::test_instance_external_subnet_list_empty)'`
0 commit comments