From 0633fb10bfeeafb61182f38474b2f16144c4d6db Mon Sep 17 00:00:00 2001 From: "Andrew J. Stone" Date: Tue, 19 Dec 2023 20:38:37 +0000 Subject: [PATCH 1/2] Fix fake pagination for sled_list_uninitialized --- nexus/src/external_api/http_entrypoints.rs | 1 + openapi/nexus.json | 32 ++++++++++++++++++++++ 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..079a94a640 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -4659,6 +4659,7 @@ async fn rack_view( }] async fn sled_list_uninitialized( rqctx: RequestContext>, + _query_params: Query, ) -> Result>, HttpError> { let apictx = rqctx.context(); let handler = async { diff --git a/openapi/nexus.json b/openapi/nexus.json index 4c89706a1c..aa0cbd4a79 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -4022,6 +4022,35 @@ ], "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" + } + }, + { + "in": "query", + "name": "sort_by", + "schema": { + "$ref": "#/components/schemas/IdSortMode" + } + } + ], "responses": { "200": { "description": "successful operation", @@ -4039,6 +4068,9 @@ "5XX": { "$ref": "#/components/responses/Error" } + }, + "x-dropshot-pagination": { + "required": [] } } }, From 06a385178b6b5ac06ab7c46eee164f19212f2f0d Mon Sep 17 00:00:00 2001 From: "Andrew J. Stone" Date: Tue, 19 Dec 2023 21:59:22 +0000 Subject: [PATCH 2/2] review fixes --- nexus/src/external_api/http_entrypoints.rs | 9 ++++++++- openapi/nexus.json | 7 ------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nexus/src/external_api/http_entrypoints.rs b/nexus/src/external_api/http_entrypoints.rs index 079a94a640..3e38558760 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -4659,9 +4659,16 @@ async fn rack_view( }] async fn sled_list_uninitialized( rqctx: RequestContext>, - _query_params: Query, + 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 aa0cbd4a79..4dcfda7f78 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -4042,13 +4042,6 @@ "nullable": true, "type": "string" } - }, - { - "in": "query", - "name": "sort_by", - "schema": { - "$ref": "#/components/schemas/IdSortMode" - } } ], "responses": {