Skip to content

Commit

Permalink
Drop inner silo quota view
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zephraph committed Dec 5, 2023
1 parent 1894eb3 commit 9e51431
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 66 deletions.
25 changes: 0 additions & 25 deletions nexus/src/external_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down Expand Up @@ -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<Arc<ServerContext>>,
) -> Result<HttpResponseOk<SiloQuotas>, 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,
Expand Down
1 change: 0 additions & 1 deletion nexus/tests/output/nexus_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
84 changes: 44 additions & 40 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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",
Expand All @@ -13181,6 +13162,7 @@
"discoverable",
"identity_mode",
"name",
"quotas",
"tls_certificates"
]
},
Expand Down Expand Up @@ -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"
]
},
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 9e51431

Please sign in to comment.