Skip to content

Commit

Permalink
remove the newtype uuid from the public API
Browse files Browse the repository at this point in the history
  • Loading branch information
ahl committed May 2, 2024
1 parent 50cd41c commit 7c2f706
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
13 changes: 8 additions & 5 deletions nexus/src/external_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ use omicron_common::api::external::{
http_pagination::data_page_params_for, AggregateBgpMessageHistory,
};
use omicron_common::bail_unless;
use omicron_uuid_kinds::SledUuid;
use omicron_uuid_kinds::GenericUuid;
use parse_display::Display;
use propolis_client::support::tungstenite::protocol::frame::coding::CloseCode;
use propolis_client::support::tungstenite::protocol::{
Expand Down Expand Up @@ -5214,7 +5214,7 @@ async fn sled_list_uninitialized(
/// The unique ID of a sled.
#[derive(Clone, Debug, Serialize, JsonSchema)]
pub struct SledId {
pub id: SledUuid,
pub id: Uuid,
}

/// Add sled to initialized rack
Expand All @@ -5236,7 +5236,10 @@ async fn sled_add(
let nexus = &apictx.nexus;
let handler = async {
let opctx = crate::context::op_context_for_external_api(&rqctx).await?;
let id = nexus.sled_add(&opctx, sled.into_inner()).await?;
let id = nexus
.sled_add(&opctx, sled.into_inner())
.await?
.into_untyped_uuid();
Ok(HttpResponseCreated(SledId { id }))
};
apictx.external_latencies.instrument_dropshot_handler(&rqctx, handler).await
Expand Down Expand Up @@ -5521,13 +5524,13 @@ async fn sled_physical_disk_list(

#[derive(Debug, Deserialize, JsonSchema)]
pub struct SystemMetricParams {
/// A silo ID. If unspecified, get aggregrate metrics across all silos.
/// A silo ID. If unspecified, get aggregate metrics across all silos.
pub silo_id: Option<Uuid>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct SiloMetricParams {
/// A project ID. If unspecified, get aggregrate metrics across all projects
/// A project ID. If unspecified, get aggregate metrics across all projects
/// in current silo.
pub project_id: Option<Uuid>,
}
Expand Down
17 changes: 8 additions & 9 deletions nexus/src/internal_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//! Handler functions (entrypoints) for HTTP APIs internal to the control plane
use super::params::{OximeterInfo, RackInitializationRequest};
use crate::external_api::http_entrypoints::SledId;
use crate::ServerContext;
use dropshot::endpoint;
use dropshot::ApiDescription;
Expand Down Expand Up @@ -52,11 +51,13 @@ use omicron_common::api::internal::nexus::RepairStartInfo;
use omicron_common::api::internal::nexus::SledInstanceState;
use omicron_common::update::ArtifactId;
use omicron_uuid_kinds::DownstairsKind;
use omicron_uuid_kinds::SledUuid;
use omicron_uuid_kinds::TypedUuid;
use omicron_uuid_kinds::UpstairsKind;
use omicron_uuid_kinds::UpstairsRepairKind;
use schemars::JsonSchema;
use serde::Deserialize;
use serde::Serialize;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::sync::Arc;
Expand Down Expand Up @@ -400,14 +401,7 @@ async fn cpapi_producers_post(
.await
}

#[derive(
Clone,
Copy,
Debug,
serde::Deserialize,
schemars::JsonSchema,
serde::Serialize,
)]
#[derive(Clone, Copy, Debug, Deserialize, JsonSchema, Serialize)]
pub struct CollectorIdPathParams {
/// The ID of the oximeter collector.
pub collector_id: Uuid,
Expand Down Expand Up @@ -1030,6 +1024,11 @@ async fn sled_list_uninitialized(
apictx.internal_latencies.instrument_dropshot_handler(&rqctx, handler).await
}

#[derive(Clone, Debug, Serialize, JsonSchema)]
pub struct SledId {
pub id: SledUuid,
}

/// Add sled to initialized rack
//
// TODO: In the future this should really be a PUT request, once we resolve
Expand Down
1 change: 0 additions & 1 deletion openapi/nexus-internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -4360,7 +4360,6 @@
]
},
"SledId": {
"description": "The unique ID of a sled.",
"type": "object",
"properties": {
"id": {
Expand Down
7 changes: 2 additions & 5 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -16215,7 +16215,8 @@
"type": "object",
"properties": {
"id": {
"$ref": "#/components/schemas/TypedUuidForSledKind"
"type": "string",
"format": "uuid"
}
},
"required": [
Expand Down Expand Up @@ -17575,10 +17576,6 @@
"items"
]
},
"TypedUuidForSledKind": {
"type": "string",
"format": "uuid"
},
"UninitializedSled": {
"description": "A sled that has not been added to an initialized rack yet",
"type": "object",
Expand Down

0 comments on commit 7c2f706

Please sign in to comment.