use crate::{AdministrativeState, InterfaceName, StaticRoute};
use std::error::Error;
use std::future::Future;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct InterfaceConfiguration {
pub name: InterfaceName,
pub administrative_state: Option<AdministrativeState>,
pub description: Option<String>,
}
impl InterfaceConfiguration {
pub fn new(name: InterfaceName) -> Self {
Self {
name,
administrative_state: None,
description: None,
}
}
pub fn administrative_state(mut self, state: AdministrativeState) -> Self {
self.administrative_state = Some(state);
self
}
pub fn description(mut self, description: impl Into<String>) -> Self {
self.description = Some(description.into());
self
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct StaticRouteConfiguration {
pub route: StaticRoute,
}
impl StaticRouteConfiguration {
pub const fn new(route: StaticRoute) -> Self {
Self { route }
}
}
pub trait IacBackend<Resource: Sync>: Send + Sync {
type Error: Error + Send + Sync + 'static;
type Plan: Send;
type ApplyResult: Send;
#[allow(clippy::manual_async_fn)]
fn plan<'a>(
&'a self,
desired: &'a Resource,
) -> impl Future<Output = Result<Self::Plan, Self::Error>> + Send + 'a;
#[allow(clippy::manual_async_fn)]
fn apply<'a>(
&'a self,
desired: &'a Resource,
) -> impl Future<Output = Result<Self::ApplyResult, Self::Error>> + Send + 'a;
}