Skip to main content

Crate security_client_rs

Crate security_client_rs 

Source
Expand description

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 sends.

use security_client_rs::{Kibana, http::{Credentials, Transport, TransportBuilder, Url}};
use security_client_rs::security::{QueryRule, Severity};

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);

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.

Re-exports§

pub use http::Transport;

Modules§

cases
Cases and their comments. Updates use optimistic concurrency through case versions.
exceptions
Detection exception lists and items. Single lists are scoped to a Kibana space; Agnostic lists are shared across spaces. Referenced value-list contents are managed separately and are not included in exception exports.
fleet
Agent policies, integration packages, package policies, and enrolled agents.
http
The HTTP transport and wire types shared by every endpoint.
pagination
Streams over paginated collections.
poll
Deadlines for waiting on asynchronous Kibana work, such as Fleet actions.
roles
Kibana role administration. Role routes are global even on a scoped client.
security
Security detection rules. These are distinct from generic Kibana alerting rules.
spaces
Kibana space administration. Space routes are global even on a scoped client.

Structs§

DecodeError
A response body that did not match the expected type.
ImportError
ImportFailure
One object that failed during an HTTP-successful rule or exception import.
Kibana
The Kibana client. API groups are reached through namespace methods such as security, each returning request builders.
Request
A request to any Kibana route, created by Kibana::request.
Status
GET /api/status
TransportError
A connection, TLS, timeout, or body-streaming failure.

Enums§

Error
Responses that fail keep their status and headers. Bodies may contain operational data, so neither Display nor Debug prints them, nor any response value quoted by a decoding error; read Error::body or DecodeError::inner deliberately.
Scope
Whether a route is resolved inside the client’s selected space.
SortOrder
Result ordering for search endpoints.

Type Aliases§

Result