From 712ce3de2196dcb91a9f83dff562860ec7c8f4f7 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Fri, 30 Aug 2024 21:17:51 -0500 Subject: [PATCH 1/2] remove unused name_or_id query param on bgp announce set list --- nexus/external-api/src/lib.rs | 4 +--- nexus/src/external_api/http_entrypoints.rs | 4 +--- nexus/types/src/external_api/params.rs | 7 ------- openapi/nexus.json | 8 -------- 4 files changed, 2 insertions(+), 21 deletions(-) diff --git a/nexus/external-api/src/lib.rs b/nexus/external-api/src/lib.rs index 2c8ec38c7e..0a45c48a43 100644 --- a/nexus/external-api/src/lib.rs +++ b/nexus/external-api/src/lib.rs @@ -1565,9 +1565,7 @@ pub trait NexusExternalApi { }] async fn networking_bgp_announce_set_list( rqctx: RequestContext, - query_params: Query< - PaginatedByNameOrId, - >, + query_params: Query, ) -> Result>, HttpError>; /// Delete BGP announce set diff --git a/nexus/src/external_api/http_entrypoints.rs b/nexus/src/external_api/http_entrypoints.rs index a297eaa533..41c3a10d09 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -3139,9 +3139,7 @@ impl NexusExternalApi for NexusExternalApiImpl { async fn networking_bgp_announce_set_list( rqctx: RequestContext, - query_params: Query< - PaginatedByNameOrId, - >, + query_params: Query, ) -> Result>, HttpError> { let apictx = rqctx.context(); let handler = async { diff --git a/nexus/types/src/external_api/params.rs b/nexus/types/src/external_api/params.rs index 691f36534d..bf01b962dc 100644 --- a/nexus/types/src/external_api/params.rs +++ b/nexus/types/src/external_api/params.rs @@ -1675,13 +1675,6 @@ pub struct BgpAnnounceSetCreate { pub announcement: Vec, } -/// Optionally select a BGP announce set by a name or id. -#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] -pub struct OptionalBgpAnnounceSetSelector { - /// A name or id to use when s electing BGP port settings - pub name_or_id: Option, -} - /// Select a BGP announce set by a name or id. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] pub struct BgpAnnounceSetSelector { diff --git a/openapi/nexus.json b/openapi/nexus.json index ac437b7c97..291a064cc8 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -6554,14 +6554,6 @@ "minimum": 1 } }, - { - "in": "query", - "name": "name_or_id", - "description": "A name or id to use when s electing BGP port settings", - "schema": { - "$ref": "#/components/schemas/NameOrId" - } - }, { "in": "query", "name": "page_token", From 18ad7309d0b498cee69f35a36c756c54454495cb Mon Sep 17 00:00:00 2001 From: David Crespo Date: Tue, 10 Sep 2024 15:34:44 -0500 Subject: [PATCH 2/2] name_or_id -> announce_set --- nexus/db-queries/src/db/datastore/bgp.rs | 4 ++-- nexus/external-api/output/nexus_tags.txt | 4 ++-- nexus/external-api/src/lib.rs | 4 ++-- .../background/tasks/sync_switch_configuration.rs | 2 +- nexus/types/src/external_api/params.rs | 8 ++++---- openapi/nexus.json | 12 ++++++------ 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/nexus/db-queries/src/db/datastore/bgp.rs b/nexus/db-queries/src/db/datastore/bgp.rs index fdb9629543..cd26016ea6 100644 --- a/nexus/db-queries/src/db/datastore/bgp.rs +++ b/nexus/db-queries/src/db/datastore/bgp.rs @@ -444,7 +444,7 @@ impl DataStore { .transaction(&conn, |conn| { let err = err.clone(); async move { - let name_or_id = sel.name_or_id.clone(); + let name_or_id = sel.announce_set.clone(); let announce_id: Uuid = match name_or_id { NameOrId::Id(id) => announce_set_dsl::bgp_announce_set @@ -700,7 +700,7 @@ impl DataStore { use db::schema::bgp_config::dsl as bgp_config_dsl; let conn = self.pool_connection_authorized(opctx).await?; - let name_or_id = sel.name_or_id.clone(); + let name_or_id = sel.announce_set.clone(); let err = OptionalError::new(); self.transaction_retry_wrapper("bgp_delete_announce_set") diff --git a/nexus/external-api/output/nexus_tags.txt b/nexus/external-api/output/nexus_tags.txt index 3024eb8ac4..cb9d283bad 100644 --- a/nexus/external-api/output/nexus_tags.txt +++ b/nexus/external-api/output/nexus_tags.txt @@ -181,10 +181,10 @@ networking_allow_list_view GET /v1/system/networking/allow-li networking_bfd_disable POST /v1/system/networking/bfd-disable networking_bfd_enable POST /v1/system/networking/bfd-enable networking_bfd_status GET /v1/system/networking/bfd-status -networking_bgp_announce_set_delete DELETE /v1/system/networking/bgp-announce-set/{name_or_id} +networking_bgp_announce_set_delete DELETE /v1/system/networking/bgp-announce-set/{announce_set} networking_bgp_announce_set_list GET /v1/system/networking/bgp-announce-set networking_bgp_announce_set_update PUT /v1/system/networking/bgp-announce-set -networking_bgp_announcement_list GET /v1/system/networking/bgp-announce-set/{name_or_id}/announcement +networking_bgp_announcement_list GET /v1/system/networking/bgp-announce-set/{announce_set}/announcement networking_bgp_config_create POST /v1/system/networking/bgp networking_bgp_config_delete DELETE /v1/system/networking/bgp networking_bgp_config_list GET /v1/system/networking/bgp diff --git a/nexus/external-api/src/lib.rs b/nexus/external-api/src/lib.rs index 0a45c48a43..c877b92bb6 100644 --- a/nexus/external-api/src/lib.rs +++ b/nexus/external-api/src/lib.rs @@ -1571,7 +1571,7 @@ pub trait NexusExternalApi { /// Delete BGP announce set #[endpoint { method = DELETE, - path = "/v1/system/networking/bgp-announce-set/{name_or_id}", + path = "/v1/system/networking/bgp-announce-set/{announce_set}", tags = ["system/networking"], }] async fn networking_bgp_announce_set_delete( @@ -1584,7 +1584,7 @@ pub trait NexusExternalApi { /// Get originated routes for a specified BGP announce set #[endpoint { method = GET, - path = "/v1/system/networking/bgp-announce-set/{name_or_id}/announcement", + path = "/v1/system/networking/bgp-announce-set/{announce_set}/announcement", tags = ["system/networking"], }] async fn networking_bgp_announcement_list( diff --git a/nexus/src/app/background/tasks/sync_switch_configuration.rs b/nexus/src/app/background/tasks/sync_switch_configuration.rs index f86bb1a782..fae97233c3 100644 --- a/nexus/src/app/background/tasks/sync_switch_configuration.rs +++ b/nexus/src/app/background/tasks/sync_switch_configuration.rs @@ -568,7 +568,7 @@ impl BackgroundTask for SwitchPortSettingsManager { .bgp_announcement_list( opctx, ¶ms::BgpAnnounceSetSelector { - name_or_id: bgp_config + announce_set: bgp_config .bgp_announce_set_id .into(), }, diff --git a/nexus/types/src/external_api/params.rs b/nexus/types/src/external_api/params.rs index bf01b962dc..015c216f61 100644 --- a/nexus/types/src/external_api/params.rs +++ b/nexus/types/src/external_api/params.rs @@ -1678,15 +1678,15 @@ pub struct BgpAnnounceSetCreate { /// Select a BGP announce set by a name or id. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] pub struct BgpAnnounceSetSelector { - /// A name or id to use when selecting BGP port settings - pub name_or_id: NameOrId, + /// Name or ID of the announce set + pub announce_set: NameOrId, } /// List BGP announce set with an optional name or id. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] pub struct BgpAnnounceListSelector { - /// A name or id to use when selecting BGP config. - pub name_or_id: Option, + /// Name or ID of the announce set + pub announce_set: Option, } /// Selector used for querying imported BGP routes. diff --git a/openapi/nexus.json b/openapi/nexus.json index 291a064cc8..6b0ca3449e 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -6634,7 +6634,7 @@ } } }, - "/v1/system/networking/bgp-announce-set/{name_or_id}": { + "/v1/system/networking/bgp-announce-set/{announce_set}": { "delete": { "tags": [ "system/networking" @@ -6644,8 +6644,8 @@ "parameters": [ { "in": "path", - "name": "name_or_id", - "description": "A name or id to use when selecting BGP port settings", + "name": "announce_set", + "description": "Name or ID of the announce set", "required": true, "schema": { "$ref": "#/components/schemas/NameOrId" @@ -6665,7 +6665,7 @@ } } }, - "/v1/system/networking/bgp-announce-set/{name_or_id}/announcement": { + "/v1/system/networking/bgp-announce-set/{announce_set}/announcement": { "get": { "tags": [ "system/networking" @@ -6675,8 +6675,8 @@ "parameters": [ { "in": "path", - "name": "name_or_id", - "description": "A name or id to use when selecting BGP port settings", + "name": "announce_set", + "description": "Name or ID of the announce set", "required": true, "schema": { "$ref": "#/components/schemas/NameOrId"