vector_vrl_functions/
lib.rs1#![deny(warnings)]
11
12use vrl::{compiler::Function, path::OwnedTargetPath};
13
14pub mod get_secret;
15pub mod remove_secret;
16pub mod set_secret;
17pub mod set_semantic_meaning;
18
19#[allow(clippy::large_enum_variant)]
20#[derive(Clone, Debug)]
21pub enum MetadataKey {
22 Legacy(String),
23 Query(OwnedTargetPath),
24}
25
26pub const LEGACY_METADATA_KEYS: [&str; 2] = ["datadog_api_key", "splunk_hec_token"];
27
28pub fn secret_functions() -> Vec<Box<dyn Function>> {
30 vec![
31 Box::new(set_semantic_meaning::SetSemanticMeaning) as _,
32 Box::new(get_secret::GetSecret) as _,
33 Box::new(remove_secret::RemoveSecret) as _,
34 Box::new(set_secret::SetSecret) as _,
35 ]
36}
37
38#[allow(clippy::disallowed_methods)]
40pub fn all() -> Vec<Box<dyn Function>> {
41 let functions = iter_all_without_vrl_stdlib().chain(vrl::stdlib::all());
42 functions.collect()
43}
44
45pub fn all_without_vrl_stdlib() -> Vec<Box<dyn Function>> {
47 let functions = iter_all_without_vrl_stdlib();
48 functions.collect()
49}
50
51fn iter_all_without_vrl_stdlib() -> impl Iterator<Item = Box<dyn Function>> {
52 let functions = secret_functions()
53 .into_iter()
54 .chain(enrichment::vrl_functions());
55
56 #[cfg(feature = "dnstap")]
57 let functions = functions.chain(dnstap_parser::vrl_functions());
58
59 #[cfg(feature = "vrl-metrics")]
60 let functions = functions.chain(vector_vrl_metrics::all());
61
62 functions
63}