backend_dispatcher/
contracts.rs

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
use serde_json::Value;

use crate::{error::Error, types::BootParameters};

pub trait BackendTrait {
    async fn get_api_token(&self, site_name: &str) -> Result<String, Error> {
        Err(Error::Message(
            "Authentication command not implemented for this backend".to_string(),
        ))
    }

    // FIXME: Create a new type PowerStatus and return Result<PowerStatus, Error>
    async fn power_on_sync(&self, auth_token: &str, nodes: &[String]) -> Result<Value, Error> {
        Err(Error::Message(
            "Power on command not implemented for this backend".to_string(),
        ))
    }

    /* // FIXME: Create a new type PowerStatus and return Result<PowerStatus, Error>
    async fn power_off_sync(
        &self,
        auth_token: &str,
        nodes: &[String],
        force: bool,
    ) -> Result<Value, Error> {
        Err(Error::Message(
            "Power off command not implemented for this backend".to_string(),
        ))
    } */

    // FIXME: Create a new type PowerStatus and return Result<PowerStatus, Error>
    async fn power_reset_sync(
        &self,
        auth_token: &str,
        nodes: &[String],
        force: bool,
    ) -> Result<Value, Error> {
        Err(Error::Message(
            "Power reset command not implemented for this backend".to_string(),
        ))
    }

    /* async fn get_bootparameters(
        &self,
        auth_token: &str,
        nodes: &[String],
    ) -> Result<Vec<BootParameters>, Error> {
        Err(Error::Message(
            "Get boot parameters command not implemented for this backend".to_string(),
        ))
    } */

    /* async fn update_bootparameters(
        &self,
        auth_token: &str,
        boot_parameters: &BootParameters,
    ) -> Result<BootParameters, Error> {
        Err(Error::Message(
            "Update boot parameters command not implemented for this backend".to_string(),
        ))
    } */
}