Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ members = [
"illumos-utils",
"installinator-api",
"installinator-common",
"installinator-common/versions",
"installinator",
"internal-dns/cli",
"internal-dns/resolver",
Expand Down Expand Up @@ -227,6 +228,7 @@ default-members = [
"illumos-utils",
"installinator-api",
"installinator-common",
"installinator-common/versions",
"installinator",
"internal-dns/cli",
"internal-dns/resolver",
Expand Down Expand Up @@ -516,6 +518,7 @@ installinator = { path = "installinator" }
installinator-api = { path = "installinator-api" }
installinator-client = { path = "clients/installinator-client" }
installinator-common = { path = "installinator-common" }
installinator-common-versions = { path = "installinator-common/versions" }
internal-dns-resolver = { path = "internal-dns/resolver" }
internal-dns-types = { path = "internal-dns/types" }
ipcc = { path = "ipcc" }
Expand Down
1 change: 1 addition & 0 deletions installinator-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ anyhow.workspace = true
dropshot.workspace = true
dropshot-api-manager-types.workspace = true
hyper.workspace = true
installinator-common-versions.workspace = true
omicron-common.workspace = true
omicron-uuid-kinds.workspace = true
omicron-workspace-hack.workspace = true
Expand Down
11 changes: 2 additions & 9 deletions installinator-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ use dropshot::{
};
use dropshot_api_manager_types::api_versions;
use hyper::header;
use installinator_common_versions::latest;
use omicron_uuid_kinds::MupdateUuid;
use schemars::JsonSchema;
use serde::Deserialize;
use tufaceous_artifact::ArtifactHashId;
use update_engine::{NestedSpec, events::EventReport};

Expand All @@ -30,12 +29,6 @@ api_versions!([

const PROGRESS_REPORT_MAX_BYTES: usize = 4 * 1024 * 1024;

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ReportQuery {
/// A unique identifier for the update.
pub update_id: MupdateUuid,
}

#[dropshot::api_description]
pub trait InstallinatorApi {
type Context;
Expand Down Expand Up @@ -63,7 +56,7 @@ pub trait InstallinatorApi {
}]
async fn report_progress(
rqctx: RequestContext<Self::Context>,
path: Path<ReportQuery>,
path: Path<latest::report::ReportQuery>,
report: TypedBody<EventReport<NestedSpec>>,
) -> Result<HttpResponseUpdatedNoContent, HttpError>;
}
Expand Down
1 change: 1 addition & 0 deletions installinator-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ workspace = true
anyhow.workspace = true
camino.workspace = true
illumos-utils.workspace = true
installinator-common-versions.workspace = true
omicron-common.workspace = true
libc.workspace = true
schemars.workspace = true
Expand Down
1 change: 1 addition & 0 deletions installinator-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
mod block_size_writer;
mod progress;
mod raw_disk_writer;
pub mod report;

pub use block_size_writer::*;
pub use progress::*;
Expand Down
5 changes: 5 additions & 0 deletions installinator-common/src/report.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

pub use installinator_common_versions::latest::report::*;
14 changes: 14 additions & 0 deletions installinator-common/versions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "installinator-common-versions"
version = "0.1.0"
edition.workspace = true
license = "MPL-2.0"

[lints]
workspace = true

[dependencies]
omicron-uuid-kinds.workspace = true
omicron-workspace-hack.workspace = true
schemars.workspace = true
serde.workspace = true
7 changes: 7 additions & 0 deletions installinator-common/versions/src/initial/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! Version `INITIAL` of the Installinator API.

pub mod report;
15 changes: 15 additions & 0 deletions installinator-common/versions/src/initial/report.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! Report-related types for the Installinator API.

use omicron_uuid_kinds::MupdateUuid;
use schemars::JsonSchema;
use serde::Deserialize;

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ReportQuery {
/// A unique identifier for the update.
pub update_id: MupdateUuid,
}
9 changes: 9 additions & 0 deletions installinator-common/versions/src/latest.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! Re-exports of the latest versions of all published types.

pub mod report {
pub use crate::v1::report::ReportQuery;
}
34 changes: 34 additions & 0 deletions installinator-common/versions/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! Versioned types for the Installinator API.
//!
//! # Adding a new API version
//!
//! When adding a new API version N with added or changed types:
//!
//! 1. Create `<version_name>/mod.rs`, where `<version_name>` is the lowercase
//! form of the new version's identifier, as defined in the API trait's
//! `api_versions!` macro.
//!
//! 2. Add to the end of this list:
//!
//! ```rust,ignore
//! #[path = "<version_name>/mod.rs"]
//! pub mod vN;
//! ```
//!
//! 3. Add your types to the new module, mirroring the module structure from
//! earlier versions.
//!
//! 4. Update `latest.rs` with new and updated types from the new version.
//!
//! For more information, see the [detailed guide] and [RFD 619].
//!
//! [detailed guide]: https://github.com/oxidecomputer/dropshot-api-manager/blob/main/guides/new-version.md
//! [RFD 619]: https://rfd.shared.oxide.computer/rfd/619

pub mod latest;
#[path = "initial/mod.rs"]
pub mod v1;
2 changes: 1 addition & 1 deletion wicketd/src/artifacts/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use dropshot::RequestContext;
use dropshot::TypedBody;
use futures::TryStreamExt;
use installinator_api::InstallinatorApi;
use installinator_api::ReportQuery;
use installinator_api::body_to_artifact_response;
use installinator_common::report::ReportQuery;
use slog::Logger;
use slog::error;
use tufaceous_artifact::ArtifactHashId;
Expand Down
Loading