From 9e51431b5ecd210a95c119b89d5c3206810a06a9 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Tue, 5 Dec 2023 14:39:27 -0500 Subject: [PATCH] Drop inner silo quota view There will be a follow up PR to add capacity/utilization to the API both at the silo and system levels. Given that, and the general lack of actionability of quotas to silo users, I've just dropped the quota view from the API. --- nexus/src/external_api/http_entrypoints.rs | 25 ------- nexus/tests/output/nexus_tags.txt | 1 - openapi/nexus.json | 84 +++++++++++----------- 3 files changed, 44 insertions(+), 66 deletions(-) diff --git a/nexus/src/external_api/http_entrypoints.rs b/nexus/src/external_api/http_entrypoints.rs index d4843e8684..88a749554d 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -268,8 +268,6 @@ pub(crate) fn external_api() -> NexusApiDescription { api.register(networking_bgp_announce_set_list)?; api.register(networking_bgp_announce_set_delete)?; - api.register(quotas_view)?; - // Fleet-wide API operations api.register(silo_list)?; api.register(silo_create)?; @@ -513,29 +511,6 @@ async fn policy_update( apictx.external_latencies.instrument_dropshot_handler(&rqctx, handler).await } -/// View the resource quotas of the user's current silo -#[endpoint { - method = GET, - path = "/v1/quotas", - tags = ["silos"], -}] -async fn quotas_view( - rqctx: RequestContext>, -) -> Result, HttpError> { - let apictx = rqctx.context(); - let handler = async { - let nexus = &apictx.nexus; - let opctx = crate::context::op_context_for_external_api(&rqctx).await?; - let authz_silo = - opctx.authn.silo_required().internal_context("listing quotas")?; - let silo_lookup = nexus.silo_lookup(&opctx, authz_silo.id().into())?; - let quotas = nexus.silo_quotas_view(&opctx, &silo_lookup).await?; - - Ok(HttpResponseOk(quotas.into())) - }; - apictx.external_latencies.instrument_dropshot_handler(&rqctx, handler).await -} - /// Lists resource quotas for all silos #[endpoint { method = GET, diff --git a/nexus/tests/output/nexus_tags.txt b/nexus/tests/output/nexus_tags.txt index 2dcadeec8a..50d23981e6 100644 --- a/nexus/tests/output/nexus_tags.txt +++ b/nexus/tests/output/nexus_tags.txt @@ -99,7 +99,6 @@ group_list GET /v1/groups group_view GET /v1/groups/{group_id} policy_update PUT /v1/policy policy_view GET /v1/policy -quotas_view GET /v1/quotas user_list GET /v1/users API operations found with tag "snapshots" diff --git a/openapi/nexus.json b/openapi/nexus.json index 6e933bc458..d904064fee 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -3197,33 +3197,6 @@ } } }, - "/v1/quotas": { - "get": { - "tags": [ - "silos" - ], - "summary": "View the resource quotas of the user's current silo", - "operationId": "quotas_view", - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SiloQuotas" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, "/v1/snapshots": { "get": { "tags": [ @@ -13168,6 +13141,14 @@ "name": { "$ref": "#/components/schemas/Name" }, + "quotas": { + "description": "Initial quotas for the new Silo", + "allOf": [ + { + "$ref": "#/components/schemas/SiloQuotasCreate" + } + ] + }, "tls_certificates": { "description": "Initial TLS certificates to be used for the new Silo's console and API endpoints. These should be valid for the Silo's DNS name(s).", "type": "array", @@ -13181,6 +13162,7 @@ "discoverable", "identity_mode", "name", + "quotas", "tls_certificates" ] }, @@ -13211,22 +13193,40 @@ "format": "int64" }, "memory": { - "type": "integer", - "format": "int64" + "$ref": "#/components/schemas/ByteCount" }, "silo_id": { "type": "string", "format": "uuid" }, "storage": { + "$ref": "#/components/schemas/ByteCount" + } + }, + "required": [ + "cpus", + "memory", + "silo_id", + "storage" + ] + }, + "SiloQuotasCreate": { + "type": "object", + "properties": { + "cpus": { "type": "integer", "format": "int64" + }, + "memory": { + "$ref": "#/components/schemas/ByteCount" + }, + "storage": { + "$ref": "#/components/schemas/ByteCount" } }, "required": [ "cpus", "memory", - "silo_id", "storage" ] }, @@ -13255,23 +13255,27 @@ "type": "object", "properties": { "cpus": { + "nullable": true, "type": "integer", "format": "int64" }, "memory": { - "type": "integer", - "format": "int64" + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/ByteCount" + } + ] }, "storage": { - "type": "integer", - "format": "int64" + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/ByteCount" + } + ] } - }, - "required": [ - "cpus", - "memory", - "storage" - ] + } }, "SiloResultsPage": { "description": "A single page of results",