use crate::core::Bmc;
use crate::core::NavProperty;
use crate::oem::supermicro::schema::kcs_interface::KcsInterface as KcsInterfaceSchema;
use crate::Error;
use crate::NvBmc;
use std::marker::PhantomData;
use std::sync::Arc;
#[doc(inline)]
pub use crate::oem::supermicro::schema::kcs_interface::Privilege;
pub struct KcsInterface<B: Bmc> {
data: Arc<KcsInterfaceSchema>,
_marker: PhantomData<B>,
}
impl<B: Bmc> KcsInterface<B> {
pub(crate) async fn new(
bmc: &NvBmc<B>,
nav: &NavProperty<KcsInterfaceSchema>,
) -> Result<Self, Error<B>> {
nav.get(bmc.as_ref())
.await
.map_err(Error::Bmc)
.map(|data| Self {
data,
_marker: PhantomData,
})
}
#[must_use]
pub fn raw(&self) -> Arc<KcsInterfaceSchema> {
self.data.clone()
}
#[must_use]
pub fn privilege(&self) -> Option<Privilege> {
self.data.privilege
}
}