Skip to main content

inventory

Attribute Macro inventory 

Source
#[inventory]
Expand description

Registers an inventory function.

Exactly one #[cindy::inventory] should exist per binary. The function may be named in any way, can be sync or async, and may return either cindy::Inventory<V> or cindy::Result<cindy::Inventory<V>>.

#[cindy::wire]
struct MyVars {
    var_a: u64,
    var_b: String,
}

#[cindy::inventory]
async fn inventory() -> cindy::Result<cindy::Inventory<MyVars>> {
    Ok(cindy::Inventory {
        hosts: vec![
            cindy::Host {
                name: "host-01".into(),
                tags: cindy::tags!["env:production", "continent:eu", "router"],
                vars: MyVars { var_a: 42, var_b: "hello".to_string() },
            },
        ],
    })
}