-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathlib.rs
More file actions
72 lines (67 loc) · 2.46 KB
/
lib.rs
File metadata and controls
72 lines (67 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// 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/.
//! Interface for making API requests to a Bootstrap Agent
progenitor::generate_api!(
spec = "../../openapi/bootstrap-agent/bootstrap-agent-2.0.0-632b71.json",
interface = Positional,
inner_type = slog::Logger,
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {
slog::debug!(log, "client request";
"method" => %request.method(),
"uri" => %request.url(),
"body" => ?&request.body(),
);
}),
post_hook = (|log: &slog::Logger, result: &Result<_, _>| {
slog::debug!(log, "client response"; "result" => ?result);
}),
derives = [schemars::JsonSchema],
crates = {
"omicron-uuid-kinds" = "*",
"oxnet" = "0.1.0",
},
replace = {
AllowedSourceIps = omicron_common::api::external::AllowedSourceIps,
ImportExportPolicy = omicron_common::api::external::ImportExportPolicy,
},
);
impl omicron_common::api::external::ClientError for types::Error {
fn message(&self) -> String {
self.message.clone()
}
}
impl From<types::Baseboard> for sled_hardware_types::Baseboard {
fn from(value: types::Baseboard) -> Self {
match value {
types::Baseboard::Gimlet { identifier, model, revision } => {
sled_hardware_types::Baseboard::new_gimlet(
identifier, model, revision,
)
}
types::Baseboard::Unknown => {
sled_hardware_types::Baseboard::unknown()
}
types::Baseboard::Pc { identifier, model } => {
sled_hardware_types::Baseboard::new_pc(identifier, model)
}
}
}
}
impl From<sled_hardware_types::Baseboard> for types::Baseboard {
fn from(value: sled_hardware_types::Baseboard) -> Self {
match value {
sled_hardware_types::Baseboard::Gimlet {
identifier,
model,
revision,
} => types::Baseboard::Gimlet { identifier, model, revision },
sled_hardware_types::Baseboard::Unknown => {
types::Baseboard::Unknown
}
sled_hardware_types::Baseboard::Pc { identifier, model } => {
types::Baseboard::Pc { identifier, model }
}
}
}
}