Skip to content

Commit

Permalink
Add alert filter support to consume
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mz06 committed Oct 25, 2024
1 parent 38d00ef commit 3b67a66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/pytmv1/api/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def consume(
consumer: Callable[[Union[SaeAlert, TiAlert]], None],
start_time: Optional[str] = None,
end_time: Optional[str] = None,
op: QueryOp = QueryOp.AND,
**fields: str,
) -> Result[ConsumeLinkableResp]:
"""Retrieves and consume workbench alerts.
Expand All @@ -134,6 +136,11 @@ def consume(
time range (yyyy-MM-ddThh:mm:ssZ).
Defaults to the time the request is made.
:type end_time: Optional[str]
:param op: Operator to apply between fields (ie: ... OR ...).
:type op: QueryOp
:param fields: Field/value used to filter result (i.e:fileName="1.sh"),
check Vision One API documentation for full list of supported fields.
:type fields: Dict[str, str]
:rtype: Result[ConsumeLinkableResp]:
"""
return self._core.send_linkable(
Expand All @@ -147,4 +154,5 @@ def consume(
"orderBy": "createdDateTime desc",
}
),
headers=utils.tmv1_filter(op, fields),
)
2 changes: 1 addition & 1 deletion src/pytmv1/model/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
Status,
)

CFG = ConfigDict(alias_generator=to_camel, populate_by_name=True)
CFG = ConfigDict(alias_generator=to_camel, populate_by_name=True, protected_namespaces=())


class BaseModel(PydanticBaseModel):
Expand Down

0 comments on commit 3b67a66

Please sign in to comment.