Skip to content

Commit aff73fc

Browse files
[6/6] [nexus] convert external API to trait (#6373)
At long last, here's the last OpenAPI document converted into a trait: the Nexus external API. This is a fairly large change, but with all the prerequisites in place the conversion is overall pretty mechanical. I did need to move some types around, but the bulk of the PR is just adding the very large external API trait. This PR also adds a `.git-blame-ignore-revs` entry corresponding to #6372, so that the indent doesn't ruin blame in the GitHub web view. (You can configure this locally as well with `git config blame.ignoreRevsFile .git-blame-ignore-revs`.) In a subsequent PR I'll remove the old instructions. Depends on: * #6355 * #6364 * #6369 * #6370 * #6372 Co-authored-by: David Crespo <david.crespo@oxidecomputer.com>
1 parent 648507d commit aff73fc

25 files changed

+3525
-2298
lines changed

.git-blame-ignore-revs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Whitespace-only changes
2+
d01ba56c2127789d85723793380a7378394583f1

Cargo.lock

+21-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ members = [
6464
"nexus/db-model",
6565
"nexus/db-queries",
6666
"nexus/defaults",
67+
"nexus/external-api",
6768
"nexus/internal-api",
6869
"nexus/inventory",
6970
"nexus/macros-common",
@@ -186,6 +187,7 @@ default-members = [
186187
"nexus/db-model",
187188
"nexus/db-queries",
188189
"nexus/defaults",
190+
"nexus/external-api",
189191
"nexus/internal-api",
190192
"nexus/inventory",
191193
"nexus/macros-common",
@@ -425,6 +427,7 @@ nexus-db-fixed-data = { path = "nexus/db-fixed-data" }
425427
nexus-db-model = { path = "nexus/db-model" }
426428
nexus-db-queries = { path = "nexus/db-queries" }
427429
nexus-defaults = { path = "nexus/defaults" }
430+
nexus-external-api = { path = "nexus/external-api" }
428431
nexus-inventory = { path = "nexus/inventory" }
429432
nexus-internal-api = { path = "nexus/internal-api" }
430433
nexus-macros-common = { path = "nexus/macros-common" }

dev-tools/openapi-manager/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ fs-err.workspace = true
2121
gateway-api.workspace = true
2222
indent_write.workspace = true
2323
installinator-api.workspace = true
24+
nexus-external-api.workspace = true
2425
nexus-internal-api.workspace = true
2526
omicron-workspace-hack.workspace = true
2627
openapiv3.workspace = true

dev-tools/openapi-manager/src/spec.rs

+10
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ pub fn all_apis() -> Vec<ApiSpec> {
7979
filename: "installinator.json",
8080
extra_validation: None,
8181
},
82+
ApiSpec {
83+
title: "Oxide Region API",
84+
version: "20240821.0",
85+
description: "API for interacting with the Oxide control plane",
86+
boundary: ApiBoundary::External,
87+
api_description:
88+
nexus_external_api::nexus_external_api_mod::stub_api_description,
89+
filename: "nexus.json",
90+
extra_validation: Some(nexus_external_api::validate_api),
91+
},
8292
ApiSpec {
8393
title: "Nexus internal API",
8494
version: "0.0.1",

nexus/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ macaddr.workspace = true
4747
# integration tests.
4848
nexus-client.workspace = true
4949
nexus-config.workspace = true
50+
nexus-external-api.workspace = true
5051
nexus-internal-api.workspace = true
5152
nexus-networking.workspace = true
5253
nexus-saga-recovery.workspace = true

nexus/external-api/Cargo.toml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "nexus-external-api"
3+
version = "0.1.0"
4+
edition = "2021"
5+
license = "MPL-2.0"
6+
7+
[lints]
8+
workspace = true
9+
10+
[dependencies]
11+
anyhow.workspace = true
12+
dropshot.workspace = true
13+
http.workspace = true
14+
hyper.workspace = true
15+
ipnetwork.workspace = true
16+
nexus-types.workspace = true
17+
omicron-common.workspace = true
18+
omicron-workspace-hack.workspace = true
19+
openapiv3.workspace = true
20+
openapi-manager-types.workspace = true
21+
oximeter-types.workspace = true
22+
oxql-types.workspace = true
File renamed without changes.

0 commit comments

Comments
 (0)