pub struct PatchRule<'a>(/* private fields */);Expand description
PATCH /api/detection_engine/rules
Implementations§
Source§impl<'a> PatchRule<'a>
impl<'a> PatchRule<'a>
Sourcepub fn into_request(self) -> Request<'a>
pub fn into_request(self) -> Request<'a>
Converts this builder to a raw request, preserving its configured route, scope, parameters, body, headers and timeout. Replacing the raw body does not reapply this builder’s identity, concurrency or typed-field checks. Existing construction errors remain errors and cannot be repaired through the raw request.
Sourcepub fn header(self, name: HeaderName, value: HeaderValue) -> Self
pub fn header(self, name: HeaderName, value: HeaderValue) -> Self
Sets a header on this request only. It replaces every value of the same name from the transport defaults or the body.
Sourcepub fn request_timeout(self, timeout: Duration) -> Self
pub fn request_timeout(self, timeout: Duration) -> Self
Overrides the transport timeout for this request.
Source§impl PatchRule<'_>
impl PatchRule<'_>
pub fn name(self, name: &str) -> Self
pub fn description(self, description: &str) -> Self
pub fn enabled(self, enabled: bool) -> Self
pub fn query(self, query: &str) -> Self
pub fn severity(self, severity: Severity) -> Self
pub fn risk_score(self, score: RiskScore) -> Self
Sourcepub fn exceptions_list(self, lists: Vec<ListReference>) -> Self
pub fn exceptions_list(self, lists: Vec<ListReference>) -> Self
Replaces every list association. An empty vector detaches all lists.
Sourcepub fn schedule(self, schedule: RuleSchedule) -> Self
pub fn schedule(self, schedule: RuleSchedule) -> Self
Changes how often the rule runs and how far back each run searches.
Sourcepub fn field(self, name: &str, value: impl Serialize) -> Self
pub fn field(self, name: &str, value: impl Serialize) -> Self
Sets any other patchable rule field. The selectors id and rule_id,
and risk_score, severity, interval and from, which have typed setters, fail
with Error::InvalidRequest; use unchecked_field
to send them anyway.
Errors are returned by send, before HTTP, even if later setters replace
the offending field.
use security_client_rs::{Error, Kibana, http::Transport, security::RuleSelector};
let client = Kibana::new(Transport::single_node("http://127.0.0.1:9")?);
let patch = client.security().patch_rule(RuleSelector::RuleId("failed-logins"));
let error = patch.field("rule_id", "another-rule").send().await.unwrap_err();
assert!(matches!(error, Error::InvalidRequest(_))); // No request is sent.Sourcepub fn unchecked_field(self, name: &str, value: impl Serialize) -> Self
pub fn unchecked_field(self, name: &str, value: impl Serialize) -> Self
Sets any field without checks, including one that replaces the selector and changes which rule is patched.