-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract aziot-check JSON API into separate crate
this new crate is consumed by `iotedge check`, and ensures the two tools stay in-sync.
- Loading branch information
Showing
8 changed files
with
130 additions
and
84 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[workspace] | ||
members = [ | ||
"aziot", | ||
"aziot/aziot-check-common", | ||
|
||
"aziotd", | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "aziot-check-common" | ||
version = "0.1.0" | ||
authors = ["Azure IoT Edge Devs"] | ||
edition = "2018" | ||
|
||
|
||
[dependencies] | ||
anyhow = "1.0.34" | ||
serde = { version = "1", features = ["derive"] } | ||
serde_json = "1.0.59" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
#![deny(rust_2018_idioms)] | ||
#![warn(clippy::all, clippy::pedantic)] | ||
|
||
use std::collections::BTreeMap; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct CheckResultsSerializable { | ||
pub additional_info: serde_json::Value, | ||
pub checks: BTreeMap<String, CheckOutputSerializable>, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
#[serde(tag = "result")] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum CheckResultSerializable { | ||
Ok, | ||
Warning { details: Vec<String> }, | ||
Ignored, | ||
Skipped, | ||
Fatal { details: Vec<String> }, | ||
Error { details: Vec<String> }, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct CheckOutputSerializable { | ||
pub result: CheckResultSerializable, | ||
pub additional_info: serde_json::Value, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
#[serde(tag = "kind")] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum CheckOuputSerializableStreaming { | ||
AdditionalInfo(serde_json::Value), | ||
Section { | ||
name: String, | ||
}, | ||
Check { | ||
#[serde(flatten)] | ||
meta: CheckerMetaSerializable, | ||
#[serde(flatten)] | ||
output: CheckOutputSerializable, | ||
}, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct CheckerMetaSerializable { | ||
/// Unique human-readable identifier for the check. | ||
pub id: String, | ||
/// A brief description of what this check does. | ||
pub description: String, | ||
} | ||
|
||
/// Keys are section names | ||
pub type CheckListOutput = BTreeMap<String, Vec<CheckerMetaSerializable>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters