security-client-rs 0.1.1

Async Kibana client for security operations and Fleet management
Documentation
//! An async client for Kibana security operations and Fleet management.
//!
//! The layout follows the official Elasticsearch Rust client: a [`Transport`]
//! owns the connection, credentials and limits; [`Kibana`] groups the API into
//! namespaces; every endpoint is a builder that is configured and then `send`s.
//!
//! ```no_run
//! use security_client_rs::{Kibana, http::{Credentials, Transport, TransportBuilder, Url}};
//! use security_client_rs::security::{QueryRule, Severity};
//!
//! # async fn run() -> security_client_rs::Result<()> {
//! let transport = TransportBuilder::new(Url::parse("https://kibana.example:5601").unwrap())
//!     .auth(Credentials::EncodedApiKey("base64-key".into()))
//!     .build()?;
//! let client = Kibana::new(transport).space("soc")?;
//!
//! let page = client.security().find_rules().per_page(100).send().await?.json().await?;
//! println!("{} rules", page.total);
//!
//! let rule = QueryRule::new("Failed logins", "Repeated failures", "event.outcome: failure")
//!     .severity(Severity::High);
//! let created = client.security().create_rule(&rule).send().await?.json().await?;
//! assert!(!created.enabled);
//! # Ok(())
//! # }
//! ```
//!
//! Space-scoped routes use the client's selected space ([`Kibana::space`]);
//! space administration, roles and status are always global. Requests are
//! never retried and redirects are never followed. Non-success statuses become
//! [`Error::Api`]. Routes without a named builder are available through
//! [`Kibana::request`].
//!
//! Module documentation covers the workflows: [`security`] for rule selectors
//! and imports, [`exceptions`] and [`cases`] for edits with concurrency tokens,
//! [`fleet`] for integration formats and asynchronous actions, and [`pagination`]
//! and [`poll`] for bounded traversal and waiting.
//!
//! # Errors and retries
//!
//! The client never retries, because whether a retry is safe depends on the
//! request:
//!
//! - Reads can be retried on 429, 502, 503 and transport failures, honoring
//!   [`Error::retry_after`], with backoff and an overall deadline.
//! - A mutation interrupted by a timeout or dropped connection, including while
//!   its response body is read, may or may not have been applied. Read the
//!   resource back by a stable identifier, such as a rule's `rule_id`, before
//!   trying again. A successful status on [`Error::Body`], [`Error::Decode`] or
//!   [`Error::ResponseTooLarge`] shows that Kibana answered, not what it did.
//! - On HTTP 409, read the resource again for its current version and reapply
//!   the change.
//!
//! The `recovery` example in the repository implements these patterns.

pub mod cases;
mod client;
mod error;
pub mod exceptions;
pub mod fleet;
pub mod http;
pub mod pagination;
pub mod poll;
mod request;
pub mod roles;
pub mod security;
pub mod spaces;

pub use client::{Kibana, Scope, SortOrder, Status};
pub use error::{DecodeError, Error, ImportError, ImportFailure, Result, TransportError};
pub use http::Transport;
pub use request::Request;