use axiom_rs::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Auto-configure the client from the environment variable AXIOM_TOKEN:
let client = Client::new()?;
client
.ingest(
"DATASET_NAME",
vec![json!({
"foo": "bar",
})],
)
.await?;
let _res = client
.query(r#"['DATASET_NAME'] | where foo == "bar" | limit 100"#, None)
.await?;
Ok(())
}cargo add axiom-rsYou can use the Cargo features:
default-tls: Provides TLS support to connect over HTTPS. Enabled by default.native-tls: Enables TLS functionality provided bynative-tls.rustls-tls: Enables TLS functionality provided byrustls.tokio: Enables usage with thetokioruntime. Enabled by default.async-std: Enables usage with theasync-stdruntime.
Read documentation on axiom.co/docs/guides/rust.