security_client_rs/lib.rs
1//! An async client for Kibana security operations and Fleet management.
2//!
3//! The layout follows the official Elasticsearch Rust client: a [`Transport`]
4//! owns the connection, credentials and limits; [`Kibana`] groups the API into
5//! namespaces; every endpoint is a builder that is configured and then `send`s.
6//!
7//! ```no_run
8//! use security_client_rs::{Kibana, http::{Credentials, Transport, TransportBuilder, Url}};
9//! use security_client_rs::security::{QueryRule, Severity};
10//!
11//! # async fn run() -> security_client_rs::Result<()> {
12//! let transport = TransportBuilder::new(Url::parse("https://kibana.example:5601").unwrap())
13//! .auth(Credentials::EncodedApiKey("base64-key".into()))
14//! .build()?;
15//! let client = Kibana::new(transport).space("soc")?;
16//!
17//! let page = client.security().find_rules().per_page(100).send().await?.json().await?;
18//! println!("{} rules", page.total);
19//!
20//! let rule = QueryRule::new("Failed logins", "Repeated failures", "event.outcome: failure")
21//! .severity(Severity::High);
22//! let created = client.security().create_rule(&rule).send().await?.json().await?;
23//! assert!(!created.enabled);
24//! # Ok(())
25//! # }
26//! ```
27//!
28//! Space-scoped routes use the client's selected space ([`Kibana::space`]);
29//! space administration, roles and status are always global. Requests are
30//! never retried and redirects are never followed. Non-success statuses become
31//! [`Error::Api`]. Routes without a named builder are available through
32//! [`Kibana::request`].
33//!
34//! Module documentation covers the workflows: [`security`] for rule selectors
35//! and imports, [`exceptions`] and [`cases`] for edits with concurrency tokens,
36//! [`fleet`] for integration formats and asynchronous actions, and [`pagination`]
37//! and [`poll`] for bounded traversal and waiting.
38
39pub mod cases;
40mod client;
41mod error;
42pub mod exceptions;
43pub mod fleet;
44pub mod http;
45pub mod pagination;
46pub mod poll;
47mod request;
48pub mod roles;
49pub mod security;
50pub mod spaces;
51
52pub use client::{Kibana, Scope, SortOrder, Status};
53pub use error::{DecodeError, Error, ImportError, ImportFailure, Result, TransportError};
54pub use http::Transport;
55pub use request::Request;