Skip to content

Commit d5e904c

Browse files
committed
[1/2] make client-side-versioned APIs versioned
1 parent 6510e87 commit d5e904c

File tree

22 files changed

+61
-13
lines changed

22 files changed

+61
-13
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/bootstrap-agent-client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! Interface for making API requests to a Bootstrap Agent
66
77
progenitor::generate_api!(
8-
spec = "../../openapi/bootstrap-agent.json",
8+
spec = "../../openapi/bootstrap-agent/bootstrap-agent-latest.json",
99
interface = Positional,
1010
inner_type = slog::Logger,
1111
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {

clients/installinator-client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! Interface for installinator to make API requests.
66
77
progenitor::generate_api!(
8-
spec = "../../openapi/installinator.json",
8+
spec = "../../openapi/installinator/installinator-latest.json",
99
interface = Positional,
1010
inner_type = slog::Logger,
1111
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {

clients/nexus-client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//! from within the control plane
77
88
progenitor::generate_api!(
9-
spec = "../../openapi/nexus-internal.json",
9+
spec = "../../openapi/nexus-internal/nexus-internal-latest.json",
1010
interface = Positional,
1111
derives = [schemars::JsonSchema, PartialEq],
1212
inner_type = slog::Logger,

clients/repo-depot-client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! Interface for Sled Agent's Repo Depot to make API requests.
66
77
progenitor::generate_api!(
8-
spec = "../../openapi/repo-depot.json",
8+
spec = "../../openapi/repo-depot/repo-depot-latest.json",
99
interface = Positional,
1010
inner_type = slog::Logger,
1111
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {

dev-tools/dropshot-apis/src/main.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ fn all_apis() -> anyhow::Result<ManagedApis> {
5353
let apis = vec![
5454
ManagedApiConfig {
5555
title: "Bootstrap Agent API",
56-
versions: Versions::new_lockstep(semver::Version::new(0, 0, 1)),
56+
versions: Versions::new_versioned(
57+
bootstrap_agent_api::supported_versions(),
58+
),
5759
metadata: ManagedApiMetadata {
5860
description: Some("Per-sled API for setup and teardown"),
5961
contact_url: Some("https://oxide.computer"),
@@ -172,7 +174,9 @@ fn all_apis() -> anyhow::Result<ManagedApis> {
172174
},
173175
ManagedApiConfig {
174176
title: "Installinator API",
175-
versions: Versions::new_lockstep(semver::Version::new(0, 0, 1)),
177+
versions: Versions::new_versioned(
178+
installinator_api::supported_versions(),
179+
),
176180
metadata: ManagedApiMetadata {
177181
description: Some(
178182
"API for installinator to fetch artifacts \
@@ -205,7 +209,9 @@ fn all_apis() -> anyhow::Result<ManagedApis> {
205209
},
206210
ManagedApiConfig {
207211
title: "Nexus internal API",
208-
versions: Versions::new_lockstep(semver::Version::new(0, 0, 1)),
212+
versions: Versions::new_versioned(
213+
nexus_internal_api::supported_versions(),
214+
),
209215
metadata: ManagedApiMetadata {
210216
description: Some("Nexus internal API"),
211217
contact_url: Some("https://oxide.computer"),
@@ -261,7 +267,9 @@ fn all_apis() -> anyhow::Result<ManagedApis> {
261267
},
262268
ManagedApiConfig {
263269
title: "Oxide TUF Repo Depot API",
264-
versions: Versions::new_lockstep(semver::Version::new(0, 0, 1)),
270+
versions: Versions::new_versioned(
271+
repo_depot_api::supported_versions(),
272+
),
265273
metadata: ManagedApiMetadata {
266274
description: Some("API for fetching update artifacts"),
267275
contact_url: Some("https://oxide.computer"),

installinator-api/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ workspace = true
1010
[dependencies]
1111
anyhow.workspace = true
1212
dropshot.workspace = true
13+
dropshot-api-manager-types.workspace = true
1314
hyper.workspace = true
1415
installinator-common.workspace = true
1516
omicron-common.workspace = true

installinator-api/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@ use dropshot::{
1414
HttpResponseHeaders, HttpResponseOk, HttpResponseUpdatedNoContent, Path,
1515
RequestContext, TypedBody,
1616
};
17+
use dropshot_api_manager_types::api_versions;
1718
use hyper::header;
1819
use installinator_common::EventReport;
1920
use omicron_uuid_kinds::MupdateUuid;
2021
use schemars::JsonSchema;
2122
use serde::Deserialize;
2223
use tufaceous_artifact::ArtifactHashId;
2324

25+
api_versions!([
26+
// Do not create new versions of this client-side versioned API.
27+
// https://github.com/oxidecomputer/omicron/issues/9290
28+
(1, INITIAL),
29+
]);
30+
2431
const PROGRESS_REPORT_MAX_BYTES: usize = 4 * 1024 * 1024;
2532

2633
#[derive(Debug, Deserialize, JsonSchema)]

nexus/internal-api/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ workspace = true
99

1010
[dependencies]
1111
dropshot.workspace = true
12+
dropshot-api-manager-types.workspace = true
1213
http.workspace = true
1314
nexus-types.workspace = true
1415
omicron-common.workspace = true
1516
omicron-uuid-kinds.workspace = true
1617
omicron-workspace-hack.workspace = true
17-
serde.workspace = true
1818
schemars.workspace = true
19+
serde.workspace = true
1920
uuid.workspace = true

nexus/internal-api/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use dropshot::{
99
HttpResponseUpdatedNoContent, Path, Query, RequestContext, ResultsPage,
1010
TypedBody,
1111
};
12+
use dropshot_api_manager_types::api_versions;
1213
use nexus_types::{
1314
external_api::{
1415
shared::ProbeInfo,
@@ -34,6 +35,12 @@ use schemars::JsonSchema;
3435
use serde::{Deserialize, Serialize};
3536
use uuid::Uuid;
3637

38+
api_versions!([
39+
// Do not create new versions of this client-side versioned API.
40+
// https://github.com/oxidecomputer/omicron/issues/9290
41+
(1, INITIAL),
42+
]);
43+
3744
#[dropshot::api_description]
3845
pub trait NexusInternalApi {
3946
type Context;

0 commit comments

Comments
 (0)