Skip to content

Commit ff04227

Browse files
committed
well here's something
1 parent ec5caef commit ff04227

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ members = [
8787
"nexus/db-schema",
8888
"nexus/defaults",
8989
"nexus/external-api",
90+
"nexus/fm",
9091
"nexus/internal-api",
9192
"nexus/inventory",
9293
"nexus/lockstep-api",

nexus/fm/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ workspace = true
88

99
[dependencies]
1010
nexus-types.workspace = true
11+
chrono.workspace = true
12+
omicron-uuid-kinds.workspace = true
1113

1214
omicron-workspace-hack.workspace = true

nexus/fm/src/lib.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,37 @@
66
77
use nexus_types::fm;
88
use nexus_types::inventory;
9+
use omicron_uuid_kinds::OmicronZoneUuid;
10+
use omicron_uuid_kinds::SitrepUuid;
911

10-
pub struct DiagnosisInput<'a> {
12+
#[derive(Debug)]
13+
pub struct SitrepBuilder<'a> {
1114
inventory: &'a inventory::Collection,
1215
parent_sitrep: Option<&'a fm::Sitrep>,
16+
comment: String,
17+
}
18+
19+
impl<'a> SitrepBuilder<'a> {
20+
pub fn new(
21+
inventory: &'a inventory::Collection,
22+
parent_sitrep: Option<&'a fm::Sitrep>,
23+
) -> Self {
24+
SitrepBuilder { inventory, parent_sitrep, comment: String::new() }
25+
}
26+
27+
28+
29+
pub fn build(self, creator_id: OmicronZoneUuid) -> fm::Sitrep {
30+
fm::Sitrep {
31+
metadata: fm::SitrepMetadata {
32+
id: SitrepUuid::new_v4(),
33+
parent_sitrep_id: self.parent_sitrep.map(|s| s.metadata.id),
34+
inv_collection_id: self.inventory.id,
35+
creator_id,
36+
comment: self.comment,
37+
time_created: chrono::Utc::now(),
38+
},
39+
// TODO(eliza): draw the rest of the owl...
40+
}
41+
}
1342
}

0 commit comments

Comments
 (0)