1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::jcli::command::rest::v0::NodeCommand;
use assert_cmd::assert::OutputAssertExt;
use jortestkit::prelude::ProcessOutput;
use std::collections::BTreeMap;

pub struct Node {
    node_command: NodeCommand,
}

impl Node {
    pub fn new(node_command: NodeCommand) -> Self {
        Self { node_command }
    }

    pub fn stats<S: Into<String>>(self, host: S) -> BTreeMap<String, String> {
        self.node_command
            .stats(host)
            .build()
            .assert()
            .success()
            .get_output()
            .as_single_node_yaml()
    }
}