diff --git a/nexus/external-api/src/lib.rs b/nexus/external-api/src/lib.rs index c3641f71d87..4002d52017f 100644 --- a/nexus/external-api/src/lib.rs +++ b/nexus/external-api/src/lib.rs @@ -86,6 +86,7 @@ api_versions!([ // | date-based version should be at the top of the list. // v // (next_yyyy_mm_dd_nn, IDENT), + (2026_07_03_00, BGP_ANNOUNCE_SET_LIST_RESULTS_PAGE), (2026_06_10_00, BGP_CONFIGURATION_UPDATE), (2026_06_08_00, INSTANCE_CPU_TYPE_TURIN_V2), (2026_06_05_00, EXTERNAL_JUMBO_FRAMES), @@ -5883,15 +5884,36 @@ pub trait NexusExternalApi { method = GET, path = "/v1/system/networking/bgp-announce-set", tags = ["system/networking"], + versions = VERSION_BGP_ANNOUNCE_SET_LIST_RESULTS_PAGE.., }] async fn networking_bgp_announce_set_list( rqctx: RequestContext, query_params: Query, ) -> Result< - HttpResponseOk>, + HttpResponseOk>, HttpError, >; + /// List BGP announce sets + #[endpoint { + operation_id = "networking_bgp_announce_set_list", + method = GET, + path = "/v1/system/networking/bgp-announce-set", + tags = ["system/networking"], + versions = ..VERSION_BGP_ANNOUNCE_SET_LIST_RESULTS_PAGE, + }] + async fn networking_bgp_announce_set_list_v2025_11_20_00( + rqctx: RequestContext, + query_params: Query, + ) -> Result< + HttpResponseOk>, + HttpError, + > { + let HttpResponseOk(page) = + Self::networking_bgp_announce_set_list(rqctx, query_params).await?; + Ok(HttpResponseOk(page.items.into_iter().map(Into::into).collect())) + } + /// Delete BGP announce set #[endpoint { method = DELETE, diff --git a/nexus/src/external_api/http_entrypoints.rs b/nexus/src/external_api/http_entrypoints.rs index 3214e1c459c..f6625f12a9f 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -4573,8 +4573,10 @@ impl NexusExternalApi for NexusExternalApiImpl { async fn networking_bgp_announce_set_list( rqctx: RequestContext, query_params: Query, - ) -> Result>, HttpError> - { + ) -> Result< + HttpResponseOk>, + HttpError, + > { let apictx = rqctx.context(); let handler = async { let nexus = &apictx.context.nexus; @@ -4584,13 +4586,18 @@ impl NexusExternalApi for NexusExternalApiImpl { let paginated_by = name_or_id_pagination(&pag_params, scan_params)?; let opctx = crate::context::op_context_for_external_api(&rqctx).await?; - let result = nexus + let items = nexus .bgp_announce_set_list(&opctx, &paginated_by) .await? .into_iter() - .map(|p| p.into()) + .map(Into::into) .collect(); - Ok(HttpResponseOk(result)) + + Ok(HttpResponseOk(ScanByNameOrId::results_page( + &query, + items, + &marker_for_name_or_id, + )?)) }; apictx .context diff --git a/nexus/types/versions/src/bgp_announce_set_list_results_page/mod.rs b/nexus/types/versions/src/bgp_announce_set_list_results_page/mod.rs new file mode 100644 index 00000000000..a26459836aa --- /dev/null +++ b/nexus/types/versions/src/bgp_announce_set_list_results_page/mod.rs @@ -0,0 +1,15 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +//! Version `BGP_ANNOUNCE_SET_LIST_RESULTS_PAGE` of the external Nexus API. +//! +//! Changes in this version: +//! +//! * `networking_bgp_announce_set_list` now returns a `ResultsPage` (with +//! `next_page` token) instead of a bare array, making it consistent with +//! the other paginated list endpoints. `BgpAnnounceSet` now derives +//! `ObjectIdentity` so it can be used with the standard pagination +//! machinery. + +pub mod networking; diff --git a/nexus/types/versions/src/bgp_announce_set_list_results_page/networking.rs b/nexus/types/versions/src/bgp_announce_set_list_results_page/networking.rs new file mode 100644 index 00000000000..e3c6cddbee5 --- /dev/null +++ b/nexus/types/versions/src/bgp_announce_set_list_results_page/networking.rs @@ -0,0 +1,31 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +use crate::v2025_11_20_00; +use api_identity::ObjectIdentity; +use omicron_common::api::external::{IdentityMetadata, ObjectIdentity}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +/// Represents a BGP announce set by id. The id can be used with other API calls +/// to view and manage the announce set. +#[derive( + ObjectIdentity, Clone, Debug, Deserialize, JsonSchema, Serialize, PartialEq, +)] +pub struct BgpAnnounceSet { + #[serde(flatten)] + pub identity: IdentityMetadata, +} + +impl From for BgpAnnounceSet { + fn from(old: v2025_11_20_00::networking::BgpAnnounceSet) -> Self { + Self { identity: old.identity } + } +} + +impl From for v2025_11_20_00::networking::BgpAnnounceSet { + fn from(new: BgpAnnounceSet) -> Self { + Self { identity: new.identity } + } +} diff --git a/nexus/types/versions/src/latest.rs b/nexus/types/versions/src/latest.rs index cf4becc0fa5..ddc0f1c61bf 100644 --- a/nexus/types/versions/src/latest.rs +++ b/nexus/types/versions/src/latest.rs @@ -267,7 +267,6 @@ pub mod networking { pub use crate::v2025_11_20_00::networking::AddressLotViewResponse; pub use crate::v2025_11_20_00::networking::AggregateBgpMessageHistory; pub use crate::v2025_11_20_00::networking::BgpAnnounceListSelector; - pub use crate::v2025_11_20_00::networking::BgpAnnounceSet; pub use crate::v2025_11_20_00::networking::BgpAnnounceSetCreate; pub use crate::v2025_11_20_00::networking::BgpAnnounceSetSelector; pub use crate::v2025_11_20_00::networking::BgpAnnouncement; @@ -303,6 +302,7 @@ pub mod networking { pub use crate::v2025_11_20_00::networking::SwitchVlanInterface; pub use crate::v2025_11_20_00::networking::SwitchVlanInterfaceConfig; pub use crate::v2025_11_20_00::networking::SwtichPortSettingsGroupCreate; + pub use crate::v2026_07_03_00::networking::BgpAnnounceSet; pub use crate::v2025_12_12_00::networking::BgpPeerState; diff --git a/nexus/types/versions/src/lib.rs b/nexus/types/versions/src/lib.rs index 0998a1a4d18..9105c35245b 100644 --- a/nexus/types/versions/src/lib.rs +++ b/nexus/types/versions/src/lib.rs @@ -95,3 +95,5 @@ pub mod v2026_06_05_00; pub mod v2026_06_08_00; #[path = "bgp_configuration_update/mod.rs"] pub mod v2026_06_10_00; +#[path = "bgp_announce_set_list_results_page/mod.rs"] +pub mod v2026_07_03_00; diff --git a/openapi/nexus/nexus-2026061000.0.0-9779e2.json.gitstub b/openapi/nexus/nexus-2026061000.0.0-9779e2.json.gitstub new file mode 100644 index 00000000000..924c037e31b --- /dev/null +++ b/openapi/nexus/nexus-2026061000.0.0-9779e2.json.gitstub @@ -0,0 +1 @@ +3a8796bc025128e4df2fe38ebc4404755823fa1d:openapi/nexus/nexus-2026061000.0.0-9779e2.json diff --git a/openapi/nexus/nexus-2026061000.0.0-9779e2.json b/openapi/nexus/nexus-2026070300.0.0-425ec9.json similarity index 99% rename from openapi/nexus/nexus-2026061000.0.0-9779e2.json rename to openapi/nexus/nexus-2026070300.0.0-425ec9.json index a71809018ae..4d13e4a03bb 100644 --- a/openapi/nexus/nexus-2026061000.0.0-9779e2.json +++ b/openapi/nexus/nexus-2026070300.0.0-425ec9.json @@ -7,7 +7,7 @@ "url": "https://oxide.computer", "email": "api@oxide.computer" }, - "version": "2026061000.0.0" + "version": "2026070300.0.0" }, "paths": { "/device/auth": { @@ -10829,11 +10829,7 @@ "content": { "application/json": { "schema": { - "title": "Array_of_BgpAnnounceSet", - "type": "array", - "items": { - "$ref": "#/components/schemas/BgpAnnounceSet" - } + "$ref": "#/components/schemas/BgpAnnounceSetResultsPage" } } } @@ -17398,6 +17394,27 @@ "name" ] }, + "BgpAnnounceSetResultsPage": { + "description": "A single page of results", + "type": "object", + "properties": { + "items": { + "description": "list of items on this page of results", + "type": "array", + "items": { + "$ref": "#/components/schemas/BgpAnnounceSet" + } + }, + "next_page": { + "nullable": true, + "description": "token used to fetch the next page of results (if any)", + "type": "string" + } + }, + "required": [ + "items" + ] + }, "BgpAnnouncement": { "description": "A BGP announcement tied to an address lot block.", "type": "object", diff --git a/openapi/nexus/nexus-latest.json b/openapi/nexus/nexus-latest.json index d5753ab6c18..0c2f7504563 120000 --- a/openapi/nexus/nexus-latest.json +++ b/openapi/nexus/nexus-latest.json @@ -1 +1 @@ -nexus-2026061000.0.0-9779e2.json \ No newline at end of file +nexus-2026070300.0.0-425ec9.json \ No newline at end of file