Add guided node enrollment
This commit is contained in:
parent
678865bfdc
commit
ce3e029b3d
8 changed files with 490 additions and 18 deletions
|
|
@ -203,6 +203,14 @@ pub enum ControlRequest {
|
|||
reason: Option<String>,
|
||||
out: Option<PathBuf>,
|
||||
},
|
||||
NodeEnrollJoin {
|
||||
peer_card_path: PathBuf,
|
||||
admin_key_path: PathBuf,
|
||||
node_name: String,
|
||||
capabilities: Vec<String>,
|
||||
reason: Option<String>,
|
||||
out: Option<PathBuf>,
|
||||
},
|
||||
NodeEnrollSubmit {
|
||||
owner_node: String,
|
||||
request_id: Option<String>,
|
||||
|
|
@ -886,6 +894,15 @@ pub enum ControlResponse {
|
|||
out: Option<PathBuf>,
|
||||
note: String,
|
||||
},
|
||||
NodeEnrollmentJoined {
|
||||
peer: DiscoveredPeer,
|
||||
request: NodeEnrollmentRequest,
|
||||
out: Option<PathBuf>,
|
||||
owner_node_id: String,
|
||||
admin_key_id: String,
|
||||
accepted: bool,
|
||||
note: String,
|
||||
},
|
||||
NodeEnrollmentSubmitted {
|
||||
request_id: String,
|
||||
owner_node_id: String,
|
||||
|
|
@ -1817,8 +1834,8 @@ mod tests {
|
|||
use super::*;
|
||||
use serde_json::{Map, Value, json};
|
||||
|
||||
const CONTROL_REQUEST_VARIANTS: usize = 122;
|
||||
const CONTROL_RESPONSE_VARIANTS: usize = 114;
|
||||
const CONTROL_REQUEST_VARIANTS: usize = 123;
|
||||
const CONTROL_RESPONSE_VARIANTS: usize = 115;
|
||||
const PEER_CONTROL_REQUEST_VARIANTS: usize = 19;
|
||||
const PEER_CONTROL_RESPONSE_VARIANTS: usize = 20;
|
||||
const PIPE_WIRE_REQUEST_VARIANTS: usize = 3;
|
||||
|
|
@ -2518,6 +2535,19 @@ mod tests {
|
|||
request
|
||||
);
|
||||
|
||||
let request = ControlRequest::NodeEnrollJoin {
|
||||
peer_card_path: PathBuf::from("owner.peer.json"),
|
||||
admin_key_path: PathBuf::from("owner-admin.pub"),
|
||||
node_name: "workstation".to_owned(),
|
||||
capabilities: vec!["resource:ssh-proxy:local=ssh_proxy.connect".to_owned()],
|
||||
reason: Some("new machine".to_owned()),
|
||||
out: Some(PathBuf::from("enrollment.json")),
|
||||
};
|
||||
assert_eq!(
|
||||
decode_request(&encode_request(&request).expect("encode")).expect("decode"),
|
||||
request
|
||||
);
|
||||
|
||||
let request = ControlRequest::NodeEnrollSync {
|
||||
owner_node: "owner-laptop".to_owned(),
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue