Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[installinator] convert artifact/progress API to a trait #6074

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
35 changes: 14 additions & 21 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = [
"clients/dns-service-client",
"clients/dpd-client",
"clients/gateway-client",
"clients/installinator-artifact-client",
"clients/installinator-client",
"clients/nexus-client",
"clients/oxide-client",
"clients/oximeter-client",
Expand All @@ -32,7 +32,7 @@ members = [
"gateway-test-utils",
"gateway",
"illumos-utils",
"installinator-artifactd",
"installinator-api",
"installinator-common",
"installinator",
"internal-dns-cli",
Expand Down Expand Up @@ -101,7 +101,7 @@ default-members = [
"clients/dns-service-client",
"clients/dpd-client",
"clients/gateway-client",
"clients/installinator-artifact-client",
"clients/installinator-client",
"clients/nexus-client",
"clients/oxide-client",
"clients/oximeter-client",
Expand All @@ -127,7 +127,7 @@ default-members = [
"gateway-test-utils",
"gateway",
"illumos-utils",
"installinator-artifactd",
"installinator-api",
"installinator-common",
"installinator",
"internal-dns-cli",
Expand Down Expand Up @@ -321,8 +321,8 @@ indent_write = "2.2.0"
indexmap = "2.2.6"
indicatif = { version = "0.17.8", features = ["rayon"] }
installinator = { path = "installinator" }
installinator-artifactd = { path = "installinator-artifactd" }
installinator-artifact-client = { path = "clients/installinator-artifact-client" }
installinator-api = { path = "installinator-api" }
installinator-client = { path = "clients/installinator-client" }
installinator-common = { path = "installinator-common" }
internal-dns = { path = "internal-dns" }
ipcc = { path = "ipcc" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "installinator-artifact-client"
name = "installinator-client"
version = "0.1.0"
edition = "2021"
license = "MPL-2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// 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/.

//! Interface for making API requests to installinator-artifactd.
//! Interface for installinator to make API requests.

progenitor::generate_api!(
spec = "../../openapi/installinator-artifactd.json",
spec = "../../openapi/installinator.json",
inner_type = slog::Logger,
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {
slog::debug!(log, "client request";
Expand Down
1 change: 1 addition & 0 deletions dev-tools/openapi-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dns-server-api.workspace = true
dropshot.workspace = true
fs-err.workspace = true
indent_write.workspace = true
installinator-api.workspace = true
nexus-internal-api.workspace = true
omicron-workspace-hack.workspace = true
openapiv3.workspace = true
Expand Down
35 changes: 23 additions & 12 deletions dev-tools/openapi-manager/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,34 @@ use openapiv3::OpenAPI;
pub fn all_apis() -> Vec<ApiSpec> {
vec![
ApiSpec {
title: "Internal DNS".to_string(),
version: "0.0.1".to_string(),
description: "API for the internal DNS server".to_string(),
title: "Internal DNS",
version: "0.0.1",
description: "API for the internal DNS server",
boundary: ApiBoundary::Internal,
api_description:
dns_server_api::dns_server_api::stub_api_description,
filename: "dns-server.json".to_string(),
filename: "dns-server.json",
extra_validation: None,
},
ApiSpec {
title: "Nexus internal API".to_string(),
version: "0.0.1".to_string(),
description: "Nexus internal API".to_string(),
title: "Installinator API",
version: "0.0.1",
description: "API for installinator to fetch artifacts \
and report progress",
boundary: ApiBoundary::Internal,
api_description:
installinator_api::installinator_api::stub_api_description,
filename: "installinator.json",
extra_validation: None,
},
ApiSpec {
title: "Nexus internal API",
version: "0.0.1",
description: "Nexus internal API",
boundary: ApiBoundary::Internal,
api_description:
nexus_internal_api::nexus_internal_api_mod::stub_api_description,
filename: "nexus-internal.json".to_string(),
filename: "nexus-internal.json",
extra_validation: None,
},
// Add your APIs here! Please keep this list sorted by filename.
Expand All @@ -40,13 +51,13 @@ pub fn all_apis() -> Vec<ApiSpec> {

pub struct ApiSpec {
/// The title.
pub title: String,
pub title: &'static str,

/// The version.
pub version: String,
pub version: &'static str,

/// The description string.
pub description: String,
pub description: &'static str,

/// Whether this API is internal or external.
pub boundary: ApiBoundary,
Expand All @@ -57,7 +68,7 @@ pub struct ApiSpec {
fn() -> Result<ApiDescription<StubContext>, ApiDescriptionBuildErrors>,

/// The JSON filename to write the API description to.
pub filename: String,
pub filename: &'static str,

/// Extra validation to perform on the OpenAPI spec, if any.
pub extra_validation: Option<fn(&OpenAPI) -> anyhow::Result<()>>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "installinator-artifactd"
name = "installinator-api"
version = "0.1.0"
edition = "2021"
license = "MPL-2.0"
Expand All @@ -9,24 +9,12 @@ workspace = true

[dependencies]
anyhow.workspace = true
async-trait.workspace = true
clap.workspace = true
dropshot.workspace = true
hyper.workspace = true
installinator-common.workspace = true
omicron-common.workspace = true
omicron-workspace-hack.workspace = true
schemars.workspace = true
serde.workspace = true
serde_json.workspace = true
slog.workspace = true
uuid.workspace = true

installinator-common.workspace = true
omicron-common.workspace = true
omicron-workspace-hack.workspace = true

[dev-dependencies]
expectorate.workspace = true
omicron-test-utils.workspace = true
openapiv3.workspace = true
openapi-lint.workspace = true
serde_json.workspace = true
subprocess.workspace = true
Loading
Loading