1use crate::{AdministrativeState, InterfaceName, StaticRoute};
4use std::error::Error;
5use std::future::Future;
6
7#[derive(Clone, Debug, Eq, PartialEq)]
9pub struct InterfaceConfiguration {
10 pub name: InterfaceName,
12 pub administrative_state: Option<AdministrativeState>,
14 pub description: Option<String>,
16}
17
18impl InterfaceConfiguration {
19 pub fn new(name: InterfaceName) -> Self {
21 Self {
22 name,
23 administrative_state: None,
24 description: None,
25 }
26 }
27
28 pub fn administrative_state(mut self, state: AdministrativeState) -> Self {
30 self.administrative_state = Some(state);
31 self
32 }
33
34 pub fn description(mut self, description: impl Into<String>) -> Self {
36 self.description = Some(description.into());
37 self
38 }
39}
40
41#[derive(Clone, Copy, Debug, Eq, PartialEq)]
43pub struct StaticRouteConfiguration {
44 pub route: StaticRoute,
46}
47
48impl StaticRouteConfiguration {
49 pub const fn new(route: StaticRoute) -> Self {
51 Self { route }
52 }
53}
54
55pub trait IacBackend<Resource: Sync>: Send + Sync {
61 type Error: Error + Send + Sync + 'static;
63 type Plan: Send;
65 type ApplyResult: Send;
67
68 #[allow(clippy::manual_async_fn)]
70 fn plan<'a>(
71 &'a self,
72 desired: &'a Resource,
73 ) -> impl Future<Output = Result<Self::Plan, Self::Error>> + Send + 'a;
74
75 #[allow(clippy::manual_async_fn)]
77 fn apply<'a>(
78 &'a self,
79 desired: &'a Resource,
80 ) -> impl Future<Output = Result<Self::ApplyResult, Self::Error>> + Send + 'a;
81}