From 6783a5af9361a41840959fbb614d4bbd064b4f45 Mon Sep 17 00:00:00 2001 From: "Andrew J. Stone" Date: Tue, 19 Dec 2023 18:32:26 -0500 Subject: [PATCH] Fix fake pagination for sled_list_uninitialized (#4720) --- nexus/src/external_api/http_entrypoints.rs | 8 +++++++ openapi/nexus.json | 25 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/nexus/src/external_api/http_entrypoints.rs b/nexus/src/external_api/http_entrypoints.rs index 8a4aeaeff5..3e38558760 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -4659,8 +4659,16 @@ async fn rack_view( }] async fn sled_list_uninitialized( rqctx: RequestContext>, + query: Query>, ) -> Result>, HttpError> { let apictx = rqctx.context(); + // We don't actually support real pagination + let pag_params = query.into_inner(); + if let dropshot::WhichPage::Next(last_seen) = &pag_params.page { + return Err( + Error::invalid_value(last_seen.clone(), "bad page token").into() + ); + } let handler = async { let nexus = &apictx.nexus; let opctx = crate::context::op_context_for_external_api(&rqctx).await?; diff --git a/openapi/nexus.json b/openapi/nexus.json index 35586375e8..4131460149 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -4022,6 +4022,28 @@ ], "summary": "List uninitialized sleds in a given rack", "operationId": "sled_list_uninitialized", + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "Maximum number of items returned by a single call", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint32", + "minimum": 1 + } + }, + { + "in": "query", + "name": "page_token", + "description": "Token returned by previous call to retrieve the subsequent page", + "schema": { + "nullable": true, + "type": "string" + } + } + ], "responses": { "200": { "description": "successful operation", @@ -4039,6 +4061,9 @@ "5XX": { "$ref": "#/components/responses/Error" } + }, + "x-dropshot-pagination": { + "required": [] } } },