infra-io 0.1.0

Traits to be developed by Mesa backends
Documentation
use serde_json::Value;

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

pub trait Authentication {
    async fn get_api_token(&self, _site_name: &str) -> Result<String, Error>;
}

pub trait Power {
    // FIXME: Create a new type PowerStatus and return Result<PowerStatus, Error>
    async fn power_off_sync(&self, _nodes: &[String], _force: bool) -> Result<Value, Error>;

    // FIXME: Create a new type PowerStatus and return Result<PowerStatus, Error>
    async fn power_on_sync(&self, _nodes: &[String]) -> Result<Value, Error>;

    // FIXME: Create a new type PowerStatus and return Result<PowerStatus, Error>
    async fn power_reset_sync(&self, _nodes: &[String], _force: bool) -> Result<Value, Error>;
}

pub trait Boot {
    async fn get_bootparameters(&self, _nodes: &[String]) -> Result<Vec<BootParameters>, Error>;

    async fn update_bootparameters(
        &self,
        _boot_parameter: &BootParameters,
    ) -> Result<Vec<Value>, Error>;
}