Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion nexus/external-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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<Self::Context>,
query_params: Query<PaginatedByNameOrId>,
) -> Result<
HttpResponseOk<Vec<latest::networking::BgpAnnounceSet>>,
HttpResponseOk<ResultsPage<latest::networking::BgpAnnounceSet>>,
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<Self::Context>,
query_params: Query<PaginatedByNameOrId>,
) -> Result<
HttpResponseOk<Vec<v2025_11_20_00::networking::BgpAnnounceSet>>,
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,
Expand Down
17 changes: 12 additions & 5 deletions nexus/src/external_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4573,8 +4573,10 @@ impl NexusExternalApi for NexusExternalApiImpl {
async fn networking_bgp_announce_set_list(
rqctx: RequestContext<ApiContext>,
query_params: Query<PaginatedByNameOrId>,
) -> Result<HttpResponseOk<Vec<networking::BgpAnnounceSet>>, HttpError>
{
) -> Result<
HttpResponseOk<ResultsPage<networking::BgpAnnounceSet>>,
HttpError,
> {
let apictx = rqctx.context();
let handler = async {
let nexus = &apictx.context.nexus;
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions nexus/types/versions/src/bgp_announce_set_list_results_page/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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<v2025_11_20_00::networking::BgpAnnounceSet> for BgpAnnounceSet {
fn from(old: v2025_11_20_00::networking::BgpAnnounceSet) -> Self {
Self { identity: old.identity }
}
}

impl From<BgpAnnounceSet> for v2025_11_20_00::networking::BgpAnnounceSet {
fn from(new: BgpAnnounceSet) -> Self {
Self { identity: new.identity }
}
}
2 changes: 1 addition & 1 deletion nexus/types/versions/src/latest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions nexus/types/versions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions openapi/nexus/nexus-2026061000.0.0-9779e2.json.gitstub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3a8796bc025128e4df2fe38ebc4404755823fa1d:openapi/nexus/nexus-2026061000.0.0-9779e2.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://oxide.computer",
"email": "api@oxide.computer"
},
"version": "2026061000.0.0"
"version": "2026070300.0.0"
},
"paths": {
"/device/auth": {
Expand Down Expand Up @@ -10829,11 +10829,7 @@
"content": {
"application/json": {
"schema": {
"title": "Array_of_BgpAnnounceSet",
"type": "array",
"items": {
"$ref": "#/components/schemas/BgpAnnounceSet"
}
"$ref": "#/components/schemas/BgpAnnounceSetResultsPage"
}
}
}
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion openapi/nexus/nexus-latest.json
Loading