use enum_dispatch::enum_dispatch;
use vector_lib::configurable::{configurable_component, NamedComponent};
pub use vector_lib::enrichment::{Condition, IndexHandle, Table};
use crate::config::{EnrichmentTableConfig, GlobalOptions};
pub mod file;
#[cfg(feature = "enrichment-tables-geoip")]
pub mod geoip;
#[cfg(feature = "enrichment-tables-mmdb")]
pub mod mmdb;
#[configurable_component]
#[derive(Clone, Debug)]
#[serde(tag = "type", rename_all = "snake_case")]
#[enum_dispatch(EnrichmentTableConfig)]
pub enum EnrichmentTables {
File(file::FileConfig),
#[cfg(feature = "enrichment-tables-geoip")]
Geoip(geoip::GeoipConfig),
#[cfg(feature = "enrichment-tables-mmdb")]
Mmdb(mmdb::MmdbConfig),
}
impl NamedComponent for EnrichmentTables {
fn get_component_name(&self) -> &'static str {
match self {
Self::File(config) => config.get_component_name(),
#[cfg(feature = "enrichment-tables-geoip")]
Self::Geoip(config) => config.get_component_name(),
#[cfg(feature = "enrichment-tables-mmdb")]
Self::Mmdb(config) => config.get_component_name(),
#[allow(unreachable_patterns)]
_ => unimplemented!(),
}
}
}