Skip to content
Get started

Update a rule

detectors.rules.update(strid, RuleUpdateParams**kwargs) -> RuleUpdateResponse
PATCH/api/detectors/{detectorId}/rules/{id}

Update a rule

ParametersExpand Collapse
detector_id: str
id: str
condition: Optional[str]
enabled: Optional[bool]
name: Optional[str]
notify: Optional[bool]
ReturnsExpand Collapse
class RuleUpdateResponse:
errors: List[Error]
code: int
minimum1000
message: str
messages: List[Message]
code: int
minimum1000
message: str
result: Result
id: str
condition: Condition
One of the following:
class LeafCondition:
leaf: Leaf
fact: str
op: Literal["eq", "neq", "in", 4 more]
One of the following:
"eq"
"neq"
"in"
"nin"
"contains"
"matches"
"between"
value: Union[str, float, bool, 2 more]
One of the following:
str
float
bool
List[str]
List[float]
class RefCondition:
ref: Ref
fact: str
op: Literal["eq", "neq", "in", "nin"]
One of the following:
"eq"
"neq"
"in"
"nin"
reference: str
class InRelationCondition:
in_relation: InRelation
args: List[object]
relation: str
class AllCondition:
all: List[Condition]
class AnyCondition:
any: List[Condition]
class NotCondition:
not_: Condition
class OnceCondition:
once: Condition
class HistoricallyCondition:
historically: Condition
class SinceCondition:
since: Since
left: Condition
right: Condition
class OnceWithinCondition:
once_within: OnceWithin
inner: Condition
window_secs: float
class HistoricallyForCondition:
historically_for: HistoricallyFor
inner: Condition
window_secs: float
boundary: Optional[Literal["weak", "strong"]]
One of the following:
"weak"
"strong"
class SinceWithinCondition:
since_within: SinceWithin
left: Condition
right: Condition
window_secs: float
class KeyedCondition:
keyed: Keyed
inner: Condition
key: str
detector_id: str
enabled: bool
name: str
notify: bool
priority: float
success: bool

Update a rule

import os
from rake import Rake

client = Rake(
    api_key=os.environ.get("RAKE_API_KEY"),  # This is the default and can be omitted
)
rule = client.detectors.rules.update(
    id="id",
    detector_id="detectorId",
)
print(rule.errors)
{
  "errors": [
    {
      "code": 1000,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message"
    }
  ],
  "result": {
    "id": "id",
    "condition": {
      "leaf": {
        "fact": "fact",
        "op": "eq",
        "value": "string"
      }
    },
    "detectorId": "detectorId",
    "enabled": true,
    "name": "name",
    "notify": true,
    "priority": 0
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message"
    }
  ],
  "result": {
    "id": "id",
    "condition": {
      "leaf": {
        "fact": "fact",
        "op": "eq",
        "value": "string"
      }
    },
    "detectorId": "detectorId",
    "enabled": true,
    "name": "name",
    "notify": true,
    "priority": 0
  },
  "success": true
}