1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! 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 use ;
pub use ;
pub use Transport;
pub use Request;