sasvi.alerts
Public surface for the alerts feature layer.
Re-exports the alert and alerting-event models, the scenario-fired event and
disposition input/result types, the audit-trail and scorecard records, and
the AlertsService / AlertingEventsService handles so callers
can import them from sasvi.alerts without reaching into private submodules.
The bound alert handles: Alert and AlertingEvent.
Alert joins an alert's Data Hub document to its Alerts-service record
and exposes its actions, dispositions, scorecard, audit trail and
scenario-fired events. AlertingEvent is one alerting event, and binds
the alert it raised.
Alert Objects
class Alert(Document)
Bound alert object with alert-specific actions on top of Document.
Arguments:
runtime- Document runtime that owns the alert-backed document state.alerts_api- Generated alerts namespace used for follow-on calls.documents- Document lookup service used by related alert helpers.alert_rep- Optional generated alert payload.
scenario_fired_events
audit
Alert-service audit trail (actions, action types, versions). history
stays the inherited Data Hub document trail of the alerts record.
alert_raw
@property
def alert_raw() -> AlertRep | None
The generated Alerts-service payload, when this alert carries one.
An alert reached through the Alerts API is backed by an AlertRep;
one reached only through Data Hub is not. Use raw for the Data
Hub document, which is always present.
Returns:
The AlertRep this alert was built from, or None.
alert_id
@property
def alert_id() -> str
The alert's unique identifier (its document id).
disposition_note
@property
def disposition_note() -> str | None
The note recorded with the alert's current disposition.
disposition_reason_code
@property
def disposition_reason_code() -> str | None
The reason code recorded with the alert's current disposition.
disposition_time_stamp
@property
def disposition_time_stamp() -> str | None
The timestamp at which the alert was last dispositioned.
linked_object_id
@property
def linked_object_id() -> str | None
The document id of the object linked by the alert's disposition, if any.
linked_object_type
@property
def linked_object_type() -> str | None
The entity type of the object linked by the alert's disposition, if any.
queue_id
@property
def queue_id() -> str | None
The identifier of the queue the alert currently sits in.
alert_status_id
@property
def alert_status_id() -> str | None
The identifier of the alert's current workflow status.
current_score
@property
def current_score() -> int | None
The alert's current score.
alert_disposition_id
@property
def alert_disposition_id() -> str | None
The identifier of the disposition currently applied to the alert.
alert_disposition_resolution_code
@property
def alert_disposition_resolution_code() -> str | None
The resolution code of the disposition currently applied to the alert.
current_alerting_event_id
@property
def current_alerting_event_id() -> str | None
The identifier of the alert's current alerting event.
assigned_user_id
@property
def assigned_user_id() -> str | None
The identifier of the user the alert is assigned to, if any.
checkout_user_id
@property
def checkout_user_id() -> str | None
The identifier of the user who currently has the alert checked out, if any.
actionable_entity_type
@property
def actionable_entity_type() -> str | None
The entity type of the alert's actionable (primary) object.
actionable_entity_id
@property
def actionable_entity_id() -> str | None
The document id of the alert's actionable (primary) object.
refresh
def refresh() -> Alert
Refresh both the backing document snapshot and alert payload.
Returns:
This alert, with both snapshots replaced.
Raises:
DocumentOperationError- If the Data Hub document no longer exists or its read fails.AlertOperationError- If the Alerts service rejects the alert read; a 404 leavesalert_rawasNone.
refresh_async
async def refresh_async() -> Alert
Asynchronously refresh both the backing document and alert payload.
Returns:
This alert, with both snapshots replaced.
Raises:
DocumentOperationError- If the Data Hub document no longer exists or its read fails.AlertOperationError- If the Alerts service rejects the alert read; a 404 leavesalert_rawasNone.
update
def update(mapping: Mapping[str, Any]) -> Alert
Update alert fields from a mapping.
The alert record is re-read after the write, so queue_id,
alert_status_id and the other alert fields reflect it.
Arguments:
mapping- Alert/document field names mapped to replacement values.
Returns:
The updated bound alert.
update_async
async def update_async(mapping: Mapping[str, Any]) -> Alert
Asynchronously update alert fields from a mapping.
The alert record is re-read after the write, so queue_id,
alert_status_id and the other alert fields reflect it.
Arguments:
mapping- Alert/document field names mapped to replacement values.
Returns:
The updated bound alert.
update_fields
def update_fields(**changes: Any) -> Alert
Update alert fields from keyword arguments.
Arguments:
**changes- Alert/document field names mapped to replacement values.
Returns:
The updated bound alert.
update_fields_async
async def update_fields_async(**changes: Any) -> Alert
Asynchronously update alert fields from keyword arguments.
Arguments:
**changes- Alert/document field names mapped to replacement values.
Returns:
The updated bound alert.
raw_dict
def raw_dict() -> JsonObject
Return the Data Hub document payload as a deep-copied dictionary.
This follows raw, so the shape is the same whether or not the
alert carries an AlertRep. Use alert_raw_dict for the
Alerts-service payload.
Returns:
The document payload as a plain dictionary.
alert_raw_dict
def alert_raw_dict() -> JsonObject | None
Return the Alerts-service payload as a deep-copied dictionary.
Returns:
The AlertRep payload as a plain dictionary, or None when
this alert carries none.
to_dict
def to_dict() -> JsonObject
Return a compact JSON-serializable snapshot of the alert wrapper.
perform_action
def perform_action(
*,
action_type: str,
body: Any | None = None,
leave_checked_out_to_user_for_reactivate: bool = False
) -> object | None
Perform an alert action: ASSIGNMENT, CHECKIN, CHECKOUT or REACTIVATE.
Arguments:
action_type- One of the four action codes the Alerts API publishes.body- Optional explicit action payload. When omitted, the SDK creates a minimalActionRequest.leave_checked_out_to_user_for_reactivate- Forwarded flag used by reactivate flows.
Returns:
The underlying service response payload.
Raises:
AlertOperationError- Ifaction_typeis not a published code (nothing is sent) or the Alerts service rejects the action;AlertConflictErrorwhen the alert's state blocks it, for example because another user holds the checkout.
perform_action_async
async def perform_action_async(
*,
action_type: str,
body: Any | None = None,
leave_checked_out_to_user_for_reactivate: bool = False
) -> object | None
Asynchronously perform an alert action.
Arguments:
action_type- One of the four action codes the Alerts API publishes:ASSIGNMENT,CHECKIN,CHECKOUTorREACTIVATE.body- Optional explicit action payload. When omitted, the SDK creates a minimalActionRequest.leave_checked_out_to_user_for_reactivate- Forwarded flag used by reactivate flows.
Returns:
The underlying service response payload.
Raises:
AlertOperationError- Ifaction_typeis not a published code (nothing is sent) or the Alerts service rejects the action;AlertConflictErrorwhen the alert's state blocks it, for example because another user holds the checkout.
disposition_options
def disposition_options() -> builtins.list[AlertDispositionOption]
Return the alert dispositions currently applicable to this alert.
disposition_options_async
async def disposition_options_async() -> builtins.list[AlertDispositionOption]
Asynchronously return the alert dispositions currently applicable to this alert.
current_alerting_event
def current_alerting_event() -> AlertingEvent | None
Return the alert's current alerting event when the alert payload exposes it.
Returns:
The bound alerting event, or None when the alert names none or
the service no longer has it.
Raises:
AlertOperationError- If the Alerts service rejects the event read.
current_alerting_event_async
async def current_alerting_event_async() -> AlertingEvent | None
Asynchronously return the alert's current alerting event when the payload exposes it.
Returns:
The bound alerting event, or None when the alert names none or
the service no longer has it.
Raises:
AlertOperationError- If the Alerts service rejects the event read.
scorecard
def scorecard(*, include_labels: bool = False) -> AlertScorecard
Explain the alert's current score: range, description, per-entity scenarios.
Arguments:
include_labels- Whether to ask the service to resolve display labels on the scenario-fired events in the card.
Returns:
The scorecard with its scenario-fired events bound to this alert.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- If the Alerts service rejects the request or returns no scorecard.
scorecard_async
async def scorecard_async(*, include_labels: bool = False) -> AlertScorecard
Asynchronously explain the alert's current score.
Arguments:
include_labels- Whether to ask the service to resolve display labels on the scenario-fired events in the card.
Returns:
The scorecard with its scenario-fired events bound to this alert.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- If the Alerts service rejects the request or returns no scorecard.
disposition
def disposition(*,
disposition_id: str | None = None,
resolution_code: str | None = None,
body: Any | None = None,
note: str | None = None,
reason_code: str | None = None,
document_fields: Mapping[str, Any] | None = None,
scenario_fired_event_dispositions: Iterable[
AlertScenarioDispositionInput
| ScenarioFiredEventDispositionRep
| Mapping[str, Any]
| tuple[str, str]
| tuple[str, str, str | None]
| tuple[str, str, str | None, str | None]]
| None = None,
modified_override: bool = False) -> AlertDispositionResult
Apply a disposition to the alert.
Arguments:
disposition_id- Disposition identifier to apply. When no matching id exists for the alert, the SDK treats the value as a resolution code and resolves the applicable disposition automatically.resolution_code- Optional resolution code to resolve to an applicable disposition id.body- Optional explicit disposition request payload.note- Optional disposition note for prompted dispositions.reason_code- Optional disposition reason code for prompted dispositions.document_fields- Optional document field payload for prompted document-creation dispositions. Values are serialized using the request's document-validation metadata when available.scenario_fired_event_dispositions- Optional per-SFE productivity inputs for dispositions that prompt for scenario results.modified_override- WhenTrue, set the request'smodifiedOverrideflag to bypass the server's optimistic-lock check on the alert.
Returns:
The disposition response wrapped in AlertDispositionResult.
Raises:
DispositionPromptRequiredError- If the disposition prompts for an input the call did not supply;missingnames each one and nothing is sent.AlertOperationError- If no applicable disposition matches, the request template or the explicitbodycannot be used, or the Alerts service rejects the decision;AlertConflictErrorwhen the alert changed since it was read or its state blocks the disposition.
disposition_async
async def disposition_async(
*,
disposition_id: str | None = None,
resolution_code: str | None = None,
body: Any | None = None,
note: str | None = None,
reason_code: str | None = None,
document_fields: Mapping[str, Any] | None = None,
scenario_fired_event_dispositions: Iterable[
AlertScenarioDispositionInput
| ScenarioFiredEventDispositionRep
| Mapping[str, Any]
| tuple[str, str]
| tuple[str, str, str | None]
| tuple[str, str, str | None, str | None]]
| None = None,
modified_override: bool = False) -> AlertDispositionResult
Asynchronously apply a disposition to this alert.
The coroutine twin of disposition: it reads the applicable
dispositions and the request template, sends the decision and reloads
the alert's document with awaited requests.
Arguments:
disposition_id- Disposition identifier to apply. When no matching id exists for the alert, the SDK treats the value as a resolution code and resolves the applicable disposition automatically.resolution_code- Optional resolution code to resolve to an applicable disposition id.body- Optional explicit disposition request payload.note- Optional disposition note for prompted dispositions.reason_code- Optional disposition reason code for prompted dispositions.document_fields- Optional document field payload for prompted document-creation dispositions.scenario_fired_event_dispositions- Optional per-SFE productivity inputs for dispositions that prompt for scenario results.modified_override- WhenTrue, set the request'smodifiedOverrideflag to bypass the optimistic-lock check.
Returns:
The disposition response wrapped in AlertDispositionResult.
Raises:
DispositionPromptRequiredError- If the disposition prompts for an input the call did not supply; nothing is sent.AlertOperationError- If no applicable disposition matches, the request template or the explicitbodycannot be used, or the Alerts service rejects the decision;AlertConflictErrorwhen the alert changed since it was read or its state blocks the disposition.
AlertingEvent Objects
class AlertingEvent(RawBackedHandle)
Bound alerting event returned immediately after alert creation.
Arguments:
alerts_api- Generated Alerts API namespace used for follow-up calls.datahub_api- Generated Data Hub API namespace used for bound alert hydration.documents- Bound document collection used for hydration helpers.snapshot- Raw alerting-event payload.
id
@property
def id() -> str | None
The alerting event's unique identifier.
alert_id
@property
def alert_id() -> str | None
The identifier of the alert produced from this event, once available.
domain_id
@property
def domain_id() -> str | None
The identifier of the domain this alerting event belongs to.
actionable_entity_type
@property
def actionable_entity_type() -> str | None
The entity type of the event's actionable (primary) object.
actionable_entity_id
@property
def actionable_entity_id() -> str | None
The document id of the event's actionable (primary) object.
actionable_entity_label
@property
def actionable_entity_label() -> str | None
The human-readable label of the event's actionable object.
score
@property
def score() -> int | None
The overall score reported for this alerting event.
alert_origin_code
@property
def alert_origin_code() -> str | None
The origin code describing how this alerting event was produced.
alert_type_code
@property
def alert_type_code() -> str | None
The code describing the type of alert this event produces.
alert_trigger_text
@property
def alert_trigger_text() -> str | None
The trigger text summarizing why this alerting event fired.
recommended_queue_id
@property
def recommended_queue_id() -> str | None
The identifier of the queue recommended for the resulting alert.
scenario_fired_events
@property
def scenario_fired_events() -> builtins.list[ScenarioFiredEvent]
The scenario-fired events bound to this alerting event.
refresh
def refresh() -> AlertingEvent
Reload this alerting event from the Alerts API.
Returns:
This event, updated in place.
Raises:
AlertNotFoundError- If the alerting event does not exist (yet).AlertOperationError- If the event has no id or the Alerts service rejects the request.
refresh_async
async def refresh_async() -> AlertingEvent
Asynchronously reload this alerting event from the Alerts API.
Returns:
This event, updated in place.
Raises:
AlertNotFoundError- If the alerting event does not exist (yet).AlertOperationError- If the event has no id or the Alerts service rejects the request.
scorecard
def scorecard(*, include_labels: bool = False) -> AlertScorecard
Explain this alerting event's score: range, description, per-entity scenarios.
Arguments:
include_labels- Whether to ask the service to resolve display labels on the scenario-fired events in the card.
Returns:
The scorecard with its scenario-fired events bound to this event.
Raises:
AlertNotFoundError- If the alerting event does not exist.AlertOperationError- If the event has no id or the Alerts service rejects the request.
scorecard_async
async def scorecard_async(*, include_labels: bool = False) -> AlertScorecard
Asynchronously explain this alerting event's score.
Arguments:
include_labels- Whether to ask the service to resolve display labels on the scenario-fired events in the card.
Returns:
The scorecard with its scenario-fired events bound to this event.
Raises:
AlertNotFoundError- If the alerting event does not exist.AlertOperationError- If the event has no id or the Alerts service rejects the request.
scores
def scores() -> builtins.list[AlertingScore]
List the score calculations recorded for this alerting event.
Returns:
Score records, including which scenario-fired events counted or were suppressed.
Raises:
AlertNotFoundError- If the alerting event does not exist.AlertOperationError- If the event has no id or the Alerts service rejects the request.
scores_async
async def scores_async() -> builtins.list[AlertingScore]
Asynchronously list the score calculations recorded for this event.
Returns:
Score records, including which scenario-fired events counted or were suppressed.
Raises:
AlertNotFoundError- If the alerting event does not exist.AlertOperationError- If the event has no id or the Alerts service rejects the request.
alert
def alert(*,
wait: bool = True,
timeout: float = 10.0,
poll_interval: float = 0.5) -> Alert | None
Resolve the final alert associated with this alerting event.
Arguments:
wait- Whether to poll for an alert id when one is not present yet.timeout- Maximum number of seconds to wait for alert creation. Must not be negative.poll_interval- Seconds between refresh polls while waiting. Must be greater than zero. The last sleep is cut to what is left oftimeout.
Returns:
The bound alert, or None when no alert is available yet.
Raises:
AlertNotFoundError- If the event is still not visible whentimeoutexpires (or at once withwait=False).AlertOperationError- If the event has no id or the Alerts service rejects a request; raised immediately, without polling on.ValidationError- Ifwaitis set andpoll_intervalis not greater than zero ortimeoutis negative.
alert_async
async def alert_async(*,
wait: bool = True,
timeout: float = 10.0,
poll_interval: float = 0.5) -> Alert | None
Asynchronously resolve the final alert associated with this event.
Polls with asyncio.sleep so it does not block an event loop.
Arguments:
wait- Whether to poll for an alert id when one is not present yet.timeout- Maximum number of seconds to wait for alert creation. Must not be negative.poll_interval- Seconds between refresh polls while waiting. Must be greater than zero. The last sleep is cut to what is left oftimeout.
Returns:
The bound alert, or None when no alert is available yet.
Raises:
AlertNotFoundError- If the event is still not visible whentimeoutexpires (or at once withwait=False).AlertOperationError- If the event has no id or the Alerts service rejects a request; raised immediately, without polling on.ValidationError- Ifwaitis set andpoll_intervalis not greater than zero ortimeoutis negative.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the alerting event wrapper.
The alert audit trail: history actions, action types and versions.
Holds AlertAuditManager, reached as alert.audit, and the records
it returns: AlertHistoryAction, AlertHistoryActionDetail,
AlertHistoryActionType and AlertVersionSummary.
AlertHistoryActionDetail Objects
class AlertHistoryActionDetail(RawBackedHandle)
One detail block of an alert history action, such as a table of changed values.
The payload comes from a history action's items or details list and
looks like::
{"type": "tableItem", "action": ..., "headings": [...], "rows": [...]}
Arguments:
raw- Detail block payload.
kind
@property
def kind() -> str | None
The block's discriminator, for example "tableItem".
title
@property
def title() -> str | None
The block's display title (the service's action text).
headings
@property
def headings() -> builtins.list[str]
Column headings of a tabular block, in display order.
rows
@property
def rows() -> builtins.list[builtins.list[JsonValue]]
Rows of a tabular block with each cell flattened to its value.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the detail block.
AlertHistoryAction Objects
class AlertHistoryAction(RawBackedHandle)
One entry of the alert-service audit trail of an alert.
Arguments:
raw- History action payload, either a collection item fromGET /alerts/{id}/history/actionsor the generatedDetailedHistoryActionfrom the by-key endpoint.
action_sk
@property
def action_sk() -> str | None
The action's surrogate key, usable with alert.audit.action(action_sk=...).
VI 11.1 does not put the key in the item body (live-verified on
2026-09-13); it only appears as the last segment of the self link
(.../history/actions/{sk}), so the link is read when no key field
is present. Actions without a detail record (CHECKOUT/CHECKIN
rows carry neither links nor items) have no key, and None here
means there is nothing more to fetch for them.
action_type
@property
def action_type() -> str | None
The action type code, for example "CHECKOUT" or "DISPOSITION".
action
@property
def action() -> str | None
The human-readable description of the action.
object_type
@property
def object_type() -> str | None
The type of the object the action was performed on.
object_id
@property
def object_id() -> str | None
The identifier of the object the action was performed on.
object_version
@property
def object_version() -> int | None
The object version the action produced, when reported.
created_by
@property
def created_by() -> str | None
The user who performed the action.
created_at
@property
def created_at() -> str | None
The timestamp the action was recorded at.
details
@property
def details() -> builtins.list[AlertHistoryActionDetail]
Detail blocks describing what the action changed.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the history action.
AlertHistoryActionType Objects
class AlertHistoryActionType(RawBackedHandle)
One action type the alert-service audit trail can contain.
Arguments:
raw- GeneratedHistoryActionTypepayload or an equivalent mapping.
name
@property
def name() -> str | None
The action type code passed to alert.audit.actions(action_type=...).
label
@property
def label() -> str | None
The display label of the action type.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the action type.
AlertVersionSummary Objects
class AlertVersionSummary(RawBackedHandle)
Summary of one version of an alert as kept by the Alerts service.
Arguments:
raw- GeneratedAlertVersionSummaryReppayload or an equivalent mapping.
alert_id
@property
def alert_id() -> str | None
The identifier of the alert this version belongs to.
version
@property
def version() -> int | None
The version number of the alert.
status_id
@property
def status_id() -> str | None
The alert status identifier at this version.
created_at
@property
def created_at() -> str | None
The timestamp this version was created at.
disposition_id
@property
def disposition_id() -> str | None
The disposition identifier recorded at this version.
resolution_code
@property
def resolution_code() -> str | None
The disposition resolution code recorded at this version.
score
@property
def score() -> int | None
The alert score at this version.
updated_at
@property
def updated_at() -> str | None
The timestamp this version was last updated at.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the version summary.
AlertAuditManager Objects
class AlertAuditManager()
Alert-service audit trail of one alert: history actions, action types, and versions.
This is the trail the Alerts service keeps for an alert (check-outs,
assignments, dispositions, scenario ratings). The inherited
alert.history manager reports the Data Hub document trail of the
alerts record instead; the two are different services with different
records.
Arguments:
alerts_api- Generated Alerts API namespace used for the calls.alert_id- Identifier of the alert whose trail is read.
actions
def actions(
*,
start: int = 0,
limit: int = 10,
action_type: str | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[AlertHistoryAction]
List one page of the alert's history actions.
Arguments:
start- Zero-based page offset.limit- Maximum number of actions to return.action_type- Optional action type code to keep (seeaction_types).sort_by- Alerts API sort expression.
Returns:
History actions on the page, newest first by default.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- If the Alerts service rejects the request.
actions_async
async def actions_async(
*,
start: int = 0,
limit: int = 10,
action_type: str | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[AlertHistoryAction]
Asynchronously list one page of the alert's history actions.
Arguments:
start- Zero-based page offset.limit- Maximum number of actions to return.action_type- Optional action type code to keep (seeaction_types).sort_by- Alerts API sort expression.
Returns:
History actions on the page, newest first by default.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- If the Alerts service rejects the request.
actions_all
def actions_all(
*,
batch_size: int = 100,
action_type: str | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[AlertHistoryAction]
List the alert's whole history, paging until the service is exhausted.
Arguments:
batch_size- Page size per request; must be greater than 0.action_type- Optional action type code to keep.sort_by- Alerts API sort expression.
Returns:
Every matching history action.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- Ifbatch_sizeis not greater than 0 or the Alerts service rejects a page.
actions_all_async
async def actions_all_async(
*,
batch_size: int = 100,
action_type: str | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[AlertHistoryAction]
Asynchronously list the alert's whole history, paging until exhausted.
Arguments:
batch_size- Page size per request; must be greater than 0.action_type- Optional action type code to keep.sort_by- Alerts API sort expression.
Returns:
Every matching history action.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- Ifbatch_sizeis not greater than 0 or the Alerts service rejects a page.
action
def action(*, action_sk: int | str) -> AlertHistoryAction | None
Fetch one history action with its detail blocks.
Arguments:
action_sk- The action's surrogate key, as reported byAlertHistoryAction.action_sk.
Returns:
The detailed action, or None when no action has that key.
Raises:
AlertOperationError- Ifaction_skis not an integer key or the Alerts service rejects the request.
action_async
async def action_async(*, action_sk: int | str) -> AlertHistoryAction | None
Asynchronously fetch one history action with its detail blocks.
Arguments:
action_sk- The action's surrogate key, as reported byAlertHistoryAction.action_sk.
Returns:
The detailed action, or None when no action has that key.
Raises:
AlertOperationError- Ifaction_skis not an integer key or the Alerts service rejects the request.
action_types
def action_types() -> builtins.list[AlertHistoryActionType]
List the action types the alert's history can contain.
Returns:
Action types with their codes and labels.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- If the Alerts service rejects the request.
action_types_async
async def action_types_async() -> builtins.list[AlertHistoryActionType]
Asynchronously list the action types the alert's history can contain.
Returns:
Action types with their codes and labels.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- If the Alerts service rejects the request.
versions
def versions() -> builtins.list[AlertVersionSummary]
List the alert's version summaries as kept by the Alerts service.
Returns:
One summary per alert version.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- If the Alerts service rejects the request.
versions_async
async def versions_async() -> builtins.list[AlertVersionSummary]
Asynchronously list the alert's version summaries.
Returns:
One summary per alert version.
Raises:
AlertNotFoundError- If the alert does not exist.AlertOperationError- If the Alerts service rejects the request.
Alert dispositions: the per-event input, the request, and the result.
Holds AlertScenarioDispositionInput; the rules that fill a disposition
request from the service's template and the caller's inputs, and refuse it
when a prompted input is missing; and the result wrappers
AlertDispositionResult and DispositionResponseRecord.
AlertScenarioDispositionInput Objects
@dataclass(frozen=True, slots=True)
class AlertScenarioDispositionInput()
Python-friendly input for one scenario-fired-event disposition.
scenario_fired_event
resolution_code
comment
reason_code
scenario_fired_event_id
@property
def scenario_fired_event_id() -> str
The scenario-fired-event id this disposition targets.
Raises:
AlertOperationError- If the input holds aScenarioFiredEventthat has no id.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the disposition input.
raw_dict
def raw_dict() -> JsonObject
Return the generated payload shape sent to the Alerts service.
DispositionResponseRecord Objects
class DispositionResponseRecord()
Normalized view over a SAS DispositionResponseRep payload.
Wraps the generated disposition-response item with clean
X | None field types so IDE autocomplete works and repr() is
readable. Drop down to raw for the typed generated model.
raw
@property
def raw() -> DispositionResponseRep
The underlying generated SAS DispositionResponseRep model.
version
@property
def version() -> int | None
The response version reported by the disposition service.
alert
@property
def alert() -> AlertRep | None
The updated alert representation returned with the disposition response.
message
@property
def message() -> str | None
The service message describing the disposition outcome, if any.
alert_changed
@property
def alert_changed() -> bool | None
Whether the disposition changed the alert's server-side state.
success
@property
def success() -> bool | None
Whether the disposition was applied successfully.
alert_id
@property
def alert_id() -> str | None
The identifier of the alert this disposition response is for.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the disposition response.
AlertDispositionResult Objects
class AlertDispositionResult(RawBackedHandle)
Single-alert view over a disposition response collection.
item
@property
def item() -> DispositionResponseRecord | None
The disposition-response record for this alert, or None when absent.
Returns a handwritten DispositionResponseRecord wrapper. Drop
down to .raw for the generated DispositionResponseRep model when
needed.
alert
@property
def alert() -> Alert
The bound alert the disposition was applied to.
success
@property
def success() -> bool | None
Whether the disposition was applied successfully.
message
@property
def message() -> str | None
The service message describing the disposition outcome, if any.
alert_changed
@property
def alert_changed() -> bool | None
Whether the disposition changed the alert's server-side state.
alert_id
@property
def alert_id() -> str | None
The identifier of the dispositioned alert.
disposition_id
@property
def disposition_id() -> str | None
The identifier of the disposition applied to the alert.
resolution_code
@property
def resolution_code() -> str | None
The resolution code of the disposition applied to the alert.
reason_code
@property
def reason_code() -> str | None
The reason code recorded with the alert's disposition.
note
@property
def note() -> str | None
The note recorded with the alert's disposition.
linked_object_id
@property
def linked_object_id() -> str | None
The document id of the object linked by the disposition, if any.
linked_object_type
@property
def linked_object_type() -> str | None
The entity type of the object linked by the disposition, if any.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the disposition result.
Inputs a caller builds to ingest or create alerts.
Holds ObjectRef, ScenarioFiredEventInput and
ContributingObjectInput, and the checks that turn them, or a mapping
with the wire keys, into the request the Alerts service takes. Nothing here
sends a request.
ObjectRef Objects
@dataclass(frozen=True, slots=True)
class ObjectRef()
Reference to a Visual Investigator object by type and document id.
entity_type_name
document_id
from_document
@classmethod
def from_document(cls, document: Document) -> ObjectRef
Create an ObjectRef from a bound document.
Arguments:
document- Bound document whose type and id should be captured.
Returns:
A lightweight object reference for alert payloads.
to_dict
def to_dict() -> dict[str, str]
Return the lightweight reference payload used by alert helpers.
ScenarioFiredEventInput Objects
@dataclass(frozen=True, slots=True)
class ScenarioFiredEventInput()
Input model for creating scenario-fired events during alert creation.
scenario_id
scenario_name
scenario_fired_entity
score
minimum_score
maximum_score
value
value_type
message
recommended_queue_id
scenario_fired_event_id
contributing_objects
for_entity
@classmethod
def for_entity(
cls,
*,
scenario_id: str,
entity: Document | ObjectRef | tuple[str, str],
scenario_name: str | None = None,
score: int | None = None,
minimum_score: int = 0,
maximum_score: int = 100,
value: str | int | float | bool | date | datetime | None = None,
value_type: ScenarioFiredEventRepValueType | str | None = None,
message: str | None = None,
recommended_queue_id: str | None = None,
scenario_fired_event_id: str | None = None,
contributing_objects: Iterable[ContributingObjectInput | Document
| ObjectRef | tuple[str, str]] = ()
) -> ScenarioFiredEventInput
Build a scenario-fired-event input tied to a specific entity.
Arguments:
scenario_id- Scenario identifier.entity- Bound document,ObjectRef, or(type, id)tuple for the fired entity.scenario_name- Optional display name for the scenario.score- Optional scenario score.minimum_score- Minimum possible score.maximum_score- Maximum possible score.value- Optional scenario value payload.value_type- Optional explicit value type.message- Optional message/trigger text.recommended_queue_id- Optional recommended queue id.scenario_fired_event_id- Optional explicit scenario-fired-event id.contributing_objects- Optional contributing-object inputs.
Returns:
A normalized scenario-fired-event input model.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the input helper.
raw_dict
def raw_dict() -> JsonObject
Return the generated payload shape sent to the Alerts service.
ContributingObjectInput Objects
@dataclass(frozen=True, slots=True)
class ContributingObjectInput()
Input model for attaching a contributing object to a new scenario-fired event.
object_ref
workspace
triggering
from_document
@classmethod
def from_document(cls,
document: Document,
*,
workspace: bool = True,
triggering: bool = False) -> ContributingObjectInput
Create a contributing-object input from a bound document.
Arguments:
document- Bound document to reference.workspace- Whether the object should appear in workspace context.triggering- Whether the object should be marked as the triggering contributor.
Returns:
A normalized contributing-object input model.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the contributing-object input.
raw_dict
def raw_dict() -> JsonObject
Return the generated payload shape sent to the Alerts service.
Records the Alerts service returns about a scenario-fired event.
Holds the productivity options (ProductivityRatingOption,
ScenarioProductivityOption) and the detail record
(ScenarioFiredEventDetail).
ProductivityRatingOption Objects
@dataclass(frozen=True, slots=True)
class ProductivityRatingOption()
One productivity rating choice exposed for a scenario-fired event.
code
label
prompt_for_reason
reason_reference_list_name
reason_productivity_mapping
resolution_code
@property
def resolution_code() -> str
The resolution code sent to VI for this productivity rating.
reasons
def reasons() -> builtins.list[ReferenceListItemRecord]
Return parsed reason choices for this productivity option.
When the domain provides a reason/productivity mapping, the returned items are filtered to the reasons applicable to this option's resolution code. Otherwise the full reference-list item collection is returned. Archived items are always left out.
Returns:
The reason items; empty when the domain names no reason list or the list does not exist.
Raises:
DocumentOperationError- If the Data Hub service rejects the reference-list read.
reasons_async
async def reasons_async() -> builtins.list[ReferenceListItemRecord]
Asynchronously return parsed reason choices for this productivity option.
Filters the reasons as reasons does.
Returns:
The reason items; empty when the domain names no reason list or the list does not exist.
Raises:
DocumentOperationError- If the Data Hub service rejects the reference-list read.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the productivity option.
ScenarioProductivityOption Objects
class ScenarioProductivityOption(RawBackedHandle)
Curated scenario-disposition option for one scenario-fired event.
Arguments:
raw- Raw disposition-option payload returned by the Alerts service.
id
@property
def id() -> str | None
The scenario disposition's identifier (alias of disposition_id).
disposition_id
@property
def disposition_id() -> str | None
The scenario disposition's identifier.
disposition_definition_id
@property
def disposition_definition_id() -> str | None
The identifier of the disposition definition this option derives from.
scenario_id
@property
def scenario_id() -> str | None
The identifier of the scenario this disposition option applies to.
scenario_name
@property
def scenario_name() -> str | None
The display name of the scenario this disposition option applies to.
resolution_code
@property
def resolution_code() -> str | None
The disposition resolution code selected when applying this option.
display_order
@property
def display_order() -> int | None
The relative ordering position VI uses when presenting this option.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the scenario productivity option.
ScenarioFiredEventDetail Objects
class ScenarioFiredEventDetail(RawBackedHandle)
Full detail of one scenario-fired event from the by-id endpoint.
Unlike the alert-scoped ScenarioFiredEvent snapshot, this record
carries the scenario description and origin, score statistics, message
template, context window, replication settings, and contributing-object
references. It is read-only.
Arguments:
raw- GeneratedScenarioFiredEventFlatReppayload or an equivalent mapping.
id
@property
def id() -> str | None
The scenario-fired event's unique identifier.
alerting_event_id
@property
def alerting_event_id() -> str | None
The identifier of the alerting event the event belongs to.
alert_id
@property
def alert_id() -> str | None
The identifier of the alert the event belongs to, when reported.
scenario_id
@property
def scenario_id() -> str | None
The identifier of the scenario that fired.
scenario_name
@property
def scenario_name() -> str | None
The name of the scenario that fired.
scenario_description
@property
def scenario_description() -> str | None
The description of the scenario that fired.
scenario_origin_code
@property
def scenario_origin_code() -> str | None
The origin code of the scenario, for example an external system marker.
rule_id
@property
def rule_id() -> str | None
The identifier of the rule that produced the event.
deployment_id
@property
def deployment_id() -> str | None
The identifier of the scenario deployment that produced the event.
score
@property
def score() -> int | None
The score the event contributed.
minimum_score
@property
def minimum_score() -> int | None
The minimum score the scenario can contribute.
maximum_score
@property
def maximum_score() -> int | None
The maximum score the scenario can contribute.
mean_score
@property
def mean_score() -> int | None
The mean score the scenario contributes.
weight
@property
def weight() -> int | None
The weight applied to the event's score.
message_template_text
@property
def message_template_text() -> str | None
The message template the scenario renders for analysts.
message_values
@property
def message_values() -> dict[str, object] | None
The values substituted into the message template, when reported.
recommended_queue_id
@property
def recommended_queue_id() -> str | None
The identifier of the queue the scenario recommends.
recommended_queue_name
@property
def recommended_queue_name() -> str | None
The name of the queue the scenario recommends.
context_relationship_name
@property
def context_relationship_name() -> str | None
The relationship the scenario evaluated for context.
context_start_time_stamp
@property
def context_start_time_stamp() -> str | None
The start of the context window the scenario evaluated.
context_end_time_stamp
@property
def context_end_time_stamp() -> str | None
The end of the context window the scenario evaluated.
replicate_flag
@property
def replicate_flag() -> bool | None
Whether the scenario replicates the fired-on entity into the alert.
replication_policy
@property
def replication_policy() -> str | None
The replication policy code applied to the event.
scenario_fired_entity_type
@property
def scenario_fired_entity_type() -> str | None
The entity type the scenario fired on.
scenario_fired_entity_id
@property
def scenario_fired_entity_id() -> str | None
The document id of the entity the scenario fired on.
scenario_fired_entity_label
@property
def scenario_fired_entity_label() -> str | None
The display label of the entity the scenario fired on.
value
@property
def value() -> object | None
The typed value the scenario reported, normalised across value fields.
value_type
@property
def value_type() -> str | None
The declared type of value, for example "NUMERIC".
current_disposition_resolution_code
@property
def current_disposition_resolution_code() -> str | None
The resolution code of the event's current disposition.
current_disposition_resolution_label
@property
def current_disposition_resolution_label() -> str | None
The resolution label of the event's current disposition.
current_disposition_comment
@property
def current_disposition_comment() -> str | None
The comment recorded with the event's current disposition.
display_flag
@property
def display_flag() -> bool | None
Whether VI shows this event on the alert, so a rater should judge it.
duplicated_flag
@property
def duplicated_flag() -> bool | None
Whether the event was flagged as a duplicate of an earlier event.
duplicated_from_id
@property
def duplicated_from_id() -> str | None
The identifier of the event this one duplicates, when flagged.
creation_time_stamp
@property
def creation_time_stamp() -> str | None
The timestamp the event was created at.
modified_time_stamp
@property
def modified_time_stamp() -> str | None
The timestamp the event was last modified at.
created_by
@property
def created_by() -> str | None
The user or process that created the event.
modified_by
@property
def modified_by() -> str | None
The user or process that last modified the event.
contributing_object_refs
@property
def contributing_object_refs() -> builtins.list[ObjectRef]
References to the objects that contributed to the event.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the event detail.
The scenario-fired-event handle and the manager that lists it.
ScenarioFiredEvent refreshes itself, reads its contributing and
replicated objects and its details, and rates its productivity, checking the
parent alert out and back in around that write.
ScenarioFiredEventsManager, reached as
alert.scenario_fired_events, lists and finds the events of one alert.
ScenarioFiredEvent Objects
class ScenarioFiredEvent(RawBackedHandle)
Bound scenario-fired event attached to an alert.
Arguments:
alerts_api- Generated Alerts API namespace used for follow-up calls.documents- Bound document collection used for hydration helpers.alert_id- Parent alert identifier when the event is already attached to an alert.domain_id- Optional domain identifier used for productivity metadata lookups.snapshot- Raw scenario-fired-event payload.
id
@property
def id() -> str | None
The scenario-fired event's unique identifier.
scenario_id
@property
def scenario_id() -> str | None
The identifier of the scenario that fired this event.
scenario_name
@property
def scenario_name() -> str | None
The display name of the scenario that fired this event.
scenario_fired_entity_type
@property
def scenario_fired_entity_type() -> str | None
The entity type of the object the scenario fired against.
scenario_fired_entity_id
@property
def scenario_fired_entity_id() -> str | None
The document id of the object the scenario fired against.
scenario_fired_entity_label
@property
def scenario_fired_entity_label() -> str | None
The human-readable label of the object the scenario fired against.
score
@property
def score() -> int | None
The score the scenario assigned when it fired.
display_flag
@property
def display_flag() -> bool
Whether VI displays this event in the analyst UI.
value_type
@property
def value_type() -> str | None
The declared type (TEXT, NUMERIC, BOOLEAN, TIMESTAMP) of the event value.
value
@property
def value() -> object | None
The scenario-fired event's value, normalized to a native Python type.
current_disposition_resolution_code
@property
def current_disposition_resolution_code() -> str | None
The resolution code of the event's current disposition, if dispositioned.
current_disposition_resolution_label
@property
def current_disposition_resolution_label() -> str | None
The human-readable label of the event's current disposition resolution.
current_disposition_comment
@property
def current_disposition_comment() -> str | None
The analyst comment recorded with the event's current disposition.
current_reason_code
@property
def current_reason_code() -> str | None
The reason code recorded with the event's current disposition.
current_reason_label
@property
def current_reason_label() -> str | None
The human-readable label of the event's current disposition reason.
current_productive_user_id
@property
def current_productive_user_id() -> str | None
The id of the user who last set this event's productivity outcome.
current_productive_user_name
@property
def current_productive_user_name() -> str | None
The name of the user who last set this event's productivity outcome.
current_productive_time_stamp
@property
def current_productive_time_stamp() -> str | None
The timestamp at which this event's productivity outcome was last set.
productivity_rating
@property
def productivity_rating() -> str | None
The event's productivity outcome (alias of the current resolution code).
productivity_rating_label
@property
def productivity_rating_label() -> str | None
The human-readable label of the event's productivity outcome.
productivity_comment
@property
def productivity_comment() -> str | None
The analyst comment recorded with the event's productivity outcome.
productivity_reason_code
@property
def productivity_reason_code() -> str | None
The reason code recorded with the event's productivity outcome.
productivity_reason_label
@property
def productivity_reason_label() -> str | None
The human-readable label of the event's productivity reason.
refresh_async
async def refresh_async() -> ScenarioFiredEvent
Asynchronously reload this scenario-fired event from its parent alert.
Returns:
This event, with its snapshot replaced.
Raises:
AlertOperationError- If the event has no id or is not attached to an alert, or the Alerts service rejects a read;AlertNotFoundErrorwhen the alert's listing does not contain the event.
refresh
def refresh() -> ScenarioFiredEvent
Reload this scenario-fired event from its parent alert.
Returns:
This event, with its snapshot replaced.
Raises:
AlertOperationError- If the event has no id or is not attached to an alert, or the Alerts service rejects a read;AlertNotFoundErrorwhen the alert's listing does not contain the event.
get_contributing_objects
def get_contributing_objects(*, limit: int = 50) -> builtins.list[Document]
Resolve contributing objects to bound documents.
Arguments:
limit- Maximum number of contributing objects to request from the alerts service.
Returns:
Bound documents for contributing objects that can be hydrated.
Raises:
AlertOperationError- If the event has no id or the Alerts service rejects the request.
get_contributing_objects_async
async def get_contributing_objects_async(*,
limit: int = 50
) -> builtins.list[Document]
Asynchronously resolve contributing objects to bound documents.
Arguments:
limit- Maximum number of contributing objects to request from the alerts service.
Returns:
Bound documents for contributing objects that can be hydrated.
Raises:
AlertOperationError- If the event has no id or the Alerts service rejects the request.
get_replicated_objects
def get_replicated_objects(*, limit: int = 50) -> builtins.list[Document]
Resolve the objects replicated into the alert for this event to bound documents.
Arguments:
limit- Maximum number of replicated objects to request from the alerts service.
Returns:
Bound documents for replicated objects that can be hydrated.
Raises:
AlertOperationError- If the event has no id or the Alerts service rejects the request.
get_replicated_objects_async
async def get_replicated_objects_async(*,
limit: int = 50
) -> builtins.list[Document]
Asynchronously resolve the objects replicated into the alert for this event.
Arguments:
limit- Maximum number of replicated objects to request from the alerts service.
Returns:
Bound documents for replicated objects that can be hydrated.
Raises:
AlertOperationError- If the event has no id or the Alerts service rejects the request.
details
def details(*, include_labels: bool = False) -> ScenarioFiredEventDetail
Fetch the full detail record of this event from the by-id endpoint.
The result is a separate read-only record; the alert-scoped snapshot
this wrapper holds is left untouched (use refresh for that).
Arguments:
include_labels- Whether to ask the service to resolve display labels.
Returns:
The event's detail record.
Raises:
AlertNotFoundError- If the event does not exist.AlertOperationError- If the event has no id or the Alerts service rejects the request.
details_async
async def details_async(*,
include_labels: bool = False
) -> ScenarioFiredEventDetail
Asynchronously fetch the full detail record of this event.
Arguments:
include_labels- Whether to ask the service to resolve display labels.
Returns:
The event's detail record.
Raises:
AlertNotFoundError- If the event does not exist.AlertOperationError- If the event has no id or the Alerts service rejects the request.
rate_productivity
def rate_productivity(
*,
resolution_code: str,
reason_code: str | None = None,
comment: str | None = None,
alert_disposition_id: str | None = None) -> ScenarioFiredEvent
Record a productivity/disposition outcome for this event.
Arguments:
resolution_code- Resolution code required by the alerting workflow.reason_code- Optional reason code paired with the resolution.comment- Optional analyst comment stored with the rating.alert_disposition_id- Optional disposition identifier when the endpoint requires it.
Returns:
The updated bound scenario-fired event.
Raises:
AlertOperationError- If the event has no id, or the Alerts service rejects the checkout, the rating or the check-in;AlertNotCheckedOutErrorwhen another user holds the parent alert's checkout (nothing is sent);AlertConflictErrorwhen the service refuses the write for the alert's state;AlertNotFoundErrorwhen the refresh that follows the rating does not find the event.
rate_productivity_async
async def rate_productivity_async(
*,
resolution_code: str,
reason_code: str | None = None,
comment: str | None = None,
alert_disposition_id: str | None = None) -> ScenarioFiredEvent
Asynchronously record a productivity/disposition outcome for this event.
Checks the parent alert out and back in around the rating, as
rate_productivity does.
Arguments:
resolution_code- Resolution code required by the alerting workflow.reason_code- Optional reason code paired with the resolution.comment- Optional analyst comment stored with the rating.alert_disposition_id- Optional disposition identifier when the endpoint requires it.
Returns:
The updated bound scenario-fired event.
Raises:
AlertOperationError- If the event has no id, or the Alerts service rejects the checkout, the rating or the check-in;AlertNotCheckedOutErrorwhen another user holds the parent alert's checkout (nothing is sent);AlertConflictErrorwhen the service refuses the write for the alert's state;AlertNotFoundErrorwhen the refresh that follows the rating does not find the event.
productivity_options
def productivity_options() -> builtins.list[ProductivityRatingOption]
Return the productivity rating choices exposed by VI for this event.
Returns:
The productive, unproductive and indeterminate options, with the domain's reason-code settings when the domain can be read.
Raises:
AlertOperationError- If the Alerts service rejects the domain read.DocumentOperationError- If reading the parent alert's document to find its domain fails.
productivity_options_async
async def productivity_options_async(
) -> builtins.list[ProductivityRatingOption]
Asynchronously return the productivity rating choices VI exposes for this event.
Returns:
The productive, unproductive and indeterminate options, with the
domain's reason-code settings when the domain can be read. Use
reasons_async() on an option to read its reason codes.
Raises:
AlertOperationError- If the Alerts service rejects the domain read.DocumentOperationError- If reading the parent alert's document to find its domain fails.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the scenario-fired event.
ScenarioFiredEventsManager Objects
class ScenarioFiredEventsManager()
Collection helper for scenario-fired events on one alert.
Arguments:
alert- Bound parent alert.alerts_api- Generated Alerts API namespace used for follow-up calls.documents- Bound document collection used for hydration helpers.
list
def list(*,
start: int = 0,
limit: int = 50,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
_force_api: bool = False) -> builtins.list[ScenarioFiredEvent]
List scenario-fired events for the parent alert.
Arguments:
start- Zero-based page offset.limit- Maximum number of events to return.sort_by- Alerts API sort expression.filter_- Optional Alerts API filter expression._force_api- Internal. Bypass the current-event shortcut and query the Alerts API so events across all alerting events are returned.
Returns:
Bound scenario-fired-event wrappers.
Raises:
AlertOperationError- If the Alerts service rejects a read.
list_async
async def list_async(
*,
start: int = 0,
limit: int = 50,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
_force_api: bool = False) -> builtins.list[ScenarioFiredEvent]
Asynchronously list scenario-fired events for the parent alert.
Arguments:
start- Zero-based page offset.limit- Maximum number of events to return.sort_by- Alerts API sort expression.filter_- Optional Alerts API filter expression._force_api- Internal. Bypass the current-event shortcut and query the Alerts API so events across all alerting events are returned.
Returns:
Bound scenario-fired-event wrappers.
Raises:
AlertOperationError- If the Alerts service rejects a read.
get
def get(*, scenario_fired_event_id: str) -> ScenarioFiredEvent | None
Fetch one scenario-fired event by id.
Arguments:
scenario_fired_event_id- Scenario-fired-event identifier.
Returns:
The bound event, or None when no matching event exists.
Raises:
AlertOperationError- If the Alerts service rejects a read.
get_async
async def get_async(*,
scenario_fired_event_id: str) -> ScenarioFiredEvent | None
Asynchronously fetch one scenario-fired event by id.
Arguments:
scenario_fired_event_id- Scenario-fired-event identifier.
Returns:
The bound event, or None when no matching event exists.
Raises:
AlertOperationError- If the Alerts service rejects a read.
Alert scores and scorecards.
Holds AlertingScore, and AlertScorecard with its per-entity
EntityScenarioScore. Both Alert and AlertingEvent
return them.
AlertingScore Objects
class AlertingScore(RawBackedHandle)
One score calculation recorded for an alerting event.
Arguments:
raw- GeneratedScoreReppayload or an equivalent mapping.
id
@property
def id() -> str | None
The score record's identifier.
alerting_event_id
@property
def alerting_event_id() -> str | None
The identifier of the alerting event the score belongs to.
score
@property
def score() -> int | None
The calculated score.
scenario_fired_event_ids
@property
def scenario_fired_event_ids() -> builtins.list[str]
Identifiers of the scenario-fired events that contributed to the score.
suppressed_scenario_fired_event_ids
@property
def suppressed_scenario_fired_event_ids() -> builtins.list[str]
Identifiers of the scenario-fired events suppressed from the score.
calculated
@property
def calculated() -> bool | None
Whether the score was calculated by the service rather than received.
created_at
@property
def created_at() -> str | None
The timestamp the score was recorded at.
created_by
@property
def created_by() -> str | None
The user or process that recorded the score.
updated_at
@property
def updated_at() -> str | None
The timestamp the score was last modified at.
updated_by
@property
def updated_by() -> str | None
The user or process that last modified the score.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the score.
EntityScenarioScore Objects
class EntityScenarioScore(RawBackedHandle)
Scorecard block for one entity: the scenario-fired events that scored it.
Arguments:
raw- GeneratedEntityScenariosReppayload or an equivalent mapping.alerts_api- Generated Alerts API namespace used to bind the events.documents- Bound document collection used for hydration helpers.alert_id- Identifier of the alert the scorecard belongs to, when known.alerting_event_id- Identifier of the scored alerting event, when known.domain_id- Domain identifier used for productivity metadata lookups.
entity_id
@property
def entity_id() -> str | None
The document id of the scored entity.
entity_label
@property
def entity_label() -> str | None
The display label of the scored entity.
entity_type
@property
def entity_type() -> str | None
The entity type of the scored entity.
scenarios
@property
def scenarios() -> builtins.list[ScenarioFiredEvent]
The scenario-fired events that scored this entity, as bound events.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the entity block.
AlertScorecard Objects
class AlertScorecard(RawBackedHandle)
Explanation of an alert score: range, description, and per-entity scenarios.
Arguments:
raw- GeneratedScoreCardReppayload or an equivalent mapping.alerts_api- Generated Alerts API namespace used to bind the events.documents- Bound document collection used for hydration helpers.alert_id- Identifier of the alert the scorecard belongs to, when known.alerting_event_id- Identifier of the scored alerting event, when known.domain_id- Domain identifier used for productivity metadata lookups.
score
@property
def score() -> int | None
The overall score the card explains.
range_low
@property
def range_low() -> int | None
The lower bound of the score range.
range_high
@property
def range_high() -> int | None
The upper bound of the score range.
description
@property
def description() -> str | None
The service's textual description of the score.
entity_scenarios
@property
def entity_scenarios() -> builtins.list[EntityScenarioScore]
Per-entity blocks listing the scenario-fired events that scored each entity.
to_dict
def to_dict() -> JsonObject
Return a JSON-serializable snapshot of the scorecard.
The alert service entry points.
AlertsService (client.alerts) gets, ingests, creates and lists
alerts, with request previews. AlertingEventsService
(client.alerts.events) gets and lists alerting events.
AlertingEventsService Objects
class AlertingEventsService()
Read alerting events across alerts, mounted as client.alerts.events.
Arguments:
alerts_api- Generated alerts namespace used for event operations.datahub_api- Generated Data Hub namespace used to hydrate bound alerts.documents- Shared document collection used for hydration helpers.
list
def list(*,
start: int = 0,
limit: int = 10,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
alert_id: str | None = None,
domain_id: str | None = None,
actionable_entity_id: str | None = None,
actionable_entity_type: str | None = None,
min_score: int | None = None,
max_score: int | None = None,
deep: bool = False,
include_labels: bool = False) -> builtins.list[AlertingEvent]
List alerting events with optional alert, domain, entity, and score filters.
Arguments:
start- Zero-based page offset.limit- Maximum number of events to return.sort_by- Alerts API sort expression.filter_- Optional raw Alerts API filter expression, combined with the typed filters below.alert_id- Optional alert id filter.domain_id- Optional domain id filter.actionable_entity_id- Optional actionable-entity id filter.actionable_entity_type- Optional actionable-entity type filter.min_score- Optional inclusive minimum score.max_score- Optional inclusive maximum score.deep- Whether to ask the service for the deep (nested) representation.include_labels- Whether to resolve display labels on the nested scenario-fired events.
Returns:
Bound alerting events matching the supplied filters.
Raises:
AlertOperationError- If the Alerts service rejects the request.
list_async
async def list_async(
*,
start: int = 0,
limit: int = 10,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
alert_id: str | None = None,
domain_id: str | None = None,
actionable_entity_id: str | None = None,
actionable_entity_type: str | None = None,
min_score: int | None = None,
max_score: int | None = None,
deep: bool = False,
include_labels: bool = False) -> builtins.list[AlertingEvent]
Asynchronously list alerting events with optional filters.
Arguments:
start- Zero-based page offset.limit- Maximum number of events to return.sort_by- Alerts API sort expression.filter_- Optional raw Alerts API filter expression, combined with the typed filters below.alert_id- Optional alert id filter.domain_id- Optional domain id filter.actionable_entity_id- Optional actionable-entity id filter.actionable_entity_type- Optional actionable-entity type filter.min_score- Optional inclusive minimum score.max_score- Optional inclusive maximum score.deep- Whether to ask the service for the deep (nested) representation.include_labels- Whether to resolve display labels on the nested scenario-fired events.
Returns:
Bound alerting events matching the supplied filters.
Raises:
AlertOperationError- If the Alerts service rejects the request.
list_all
def list_all(*,
batch_size: int = 100,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
alert_id: str | None = None,
domain_id: str | None = None,
actionable_entity_id: str | None = None,
actionable_entity_type: str | None = None,
min_score: int | None = None,
max_score: int | None = None,
deep: bool = False,
include_labels: bool = False) -> builtins.list[AlertingEvent]
List all matching alerting events by paging until the service is exhausted.
Arguments:
batch_size- Page size per request; must be greater than 0.sort_by- Alerts API sort expression.filter_- Optional raw Alerts API filter expression, combined with the typed filters below.alert_id- Optional alert id filter.domain_id- Optional domain id filter.actionable_entity_id- Optional actionable-entity id filter.actionable_entity_type- Optional actionable-entity type filter.min_score- Optional inclusive minimum score.max_score- Optional inclusive maximum score.deep- Whether to ask the service for the deep (nested) representation.include_labels- Whether to resolve display labels on the nested scenario-fired events.
Returns:
All matching alerting events accumulated across result pages.
Raises:
AlertOperationError- Ifbatch_sizeis not greater than 0 or the Alerts service rejects a page.
list_all_async
async def list_all_async(
*,
batch_size: int = 100,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
alert_id: str | None = None,
domain_id: str | None = None,
actionable_entity_id: str | None = None,
actionable_entity_type: str | None = None,
min_score: int | None = None,
max_score: int | None = None,
deep: bool = False,
include_labels: bool = False) -> builtins.list[AlertingEvent]
Asynchronously list all matching alerting events by paging until exhausted.
Arguments:
batch_size- Page size per request; must be greater than 0.sort_by- Alerts API sort expression.filter_- Optional raw Alerts API filter expression, combined with the typed filters below.alert_id- Optional alert id filter.domain_id- Optional domain id filter.actionable_entity_id- Optional actionable-entity id filter.actionable_entity_type- Optional actionable-entity type filter.min_score- Optional inclusive minimum score.max_score- Optional inclusive maximum score.deep- Whether to ask the service for the deep (nested) representation.include_labels- Whether to resolve display labels on the nested scenario-fired events.
Returns:
All matching alerting events accumulated across result pages.
Raises:
AlertOperationError- Ifbatch_sizeis not greater than 0 or the Alerts service rejects a page.
get
def get(*, event_id: str, include_labels: bool = True) -> AlertingEvent | None
Fetch one alerting event by id.
Arguments:
event_id- Alerting-event identifier.include_labels- Whether to resolve display labels on the nested scenario-fired events.
Returns:
The bound event, or None when no event has that id.
Raises:
AlertOperationError- If the Alerts service rejects the request.
get_async
async def get_async(*,
event_id: str,
include_labels: bool = True) -> AlertingEvent | None
Asynchronously fetch one alerting event by id.
Arguments:
event_id- Alerting-event identifier.include_labels- Whether to resolve display labels on the nested scenario-fired events.
Returns:
The bound event, or None when no event has that id.
Raises:
AlertOperationError- If the Alerts service rejects the request.
AlertsService Objects
class AlertsService()
Service for fetching, listing, creating, and ingesting alerts.
Arguments:
alerts_api- Generated alerts namespace used for alert operations.datahub_api- Generated Data Hub namespace used to hydrate alert-backed documents.documents- Optional shared document collection for hydration and follow-on calls.
events
Alerting events across alerts (client.alerts.events).
get
def get(*, alert_id: str) -> Alert | None
Fetch an alert by id.
Arguments:
alert_id- Alert identifier.
Returns:
A bound alert, or None when the alert does not exist.
Raises:
AlertOperationError- If the Alerts service rejects the read with anything but a 404.DocumentOperationError- If the Data Hub read of the alert's document fails with anything but a 404.
get_async
async def get_async(*, alert_id: str) -> Alert | None
Asynchronously fetch an alert by id.
Arguments:
alert_id- Alert identifier.
Returns:
A bound alert, or None when the alert does not exist.
Raises:
AlertOperationError- If the Alerts service rejects the read with anything but a 404.DocumentOperationError- If the Data Hub read of the alert's document fails with anything but a 404.
ingest_async
async def ingest_async(
*,
layout: Literal["flat", "nested"],
body: AlertingDataFlatRep | AlertingDataNestedRep | Mapping[str, Any],
generate_ids: bool = False) -> builtins.list[AlertingEvent]
Ingest raw alerting-event payloads asynchronously.
Arguments:
layout- Payload layout variant,"flat"or"nested".body- Raw or generated alerting-data payload.generate_ids- Whether the service should generate missing ids.
Returns:
The created alerting events as bound AlertingEvent objects.
Raises:
AlertOperationError- Iflayoutandbodydisagree, the body is neither a mapping nor a generated model, or the Alerts service rejects the ingest.
ingest
def ingest(*,
layout: Literal["flat", "nested"],
body: AlertingDataFlatRep | AlertingDataNestedRep
| Mapping[str, Any],
generate_ids: bool = False) -> builtins.list[AlertingEvent]
Ingest raw alerting-event payloads and bind the created alerting events.
Arguments:
layout- Payload layout variant,"flat"or"nested".body- Raw or generated alerting-data payload.generate_ids- Whether the service should generate missing ids.
Returns:
Created alerting events as bound AlertingEvent objects.
Raises:
AlertOperationError- Iflayoutandbodydisagree, the body is neither a mapping nor a generated model, or the Alerts service rejects the ingest.
ingest_preview
def ingest_preview(*,
layout: Literal["flat", "nested"],
body: AlertingDataFlatRep | AlertingDataNestedRep
| Mapping[str, Any],
generate_ids: bool = False) -> RequestPreview
Preview the HTTP request ingest would fire, without sending it.
Arguments:
layout- Payload layout variant,"flat"or"nested".body- Raw or generated alerting-data payload.generate_ids- Whether the service should generate missing ids.
Returns:
A RequestPreview with .to_curl() and .to_httpx()
renderers.
Raises:
AlertOperationError- Iflayoutandbodydisagree, or the body is neither a mapping nor a generated model.
create_async
async def create_async(
*,
domain_id: str,
actionable_entity: Document | ObjectRef | tuple[str, str],
scenario_fired_events: Iterable[ScenarioFiredEventInput] = (),
score: int | None = None,
recommended_queue_id: str | None = None,
alert_trigger_text: str | None = None,
alert_origin_code: str = "SCENARIO",
alert_type_code: str = "DEFAULT",
generate_ids: bool = False,
alerting_event_id: str | None = None,
**legacy_kwargs: Any) -> AlertingEvent
Create one alert asynchronously and return its alerting event handle.
An entity has at most one active alert per domain. When the entity
already has one in domain_id, the service updates that alert
instead of creating another: the new event becomes its current event
and the alert keeps its id. Add a disposition to the domain before
you create alerts in it, or they cannot be closed.
Arguments:
domain_id- Target alert domain id.actionable_entity- Bound document,ObjectRef, or(type, id)tuple for the entity that should receive the alert.scenario_fired_events- Scenario-fired events to attach to the alert.score- Optional overall alert score.recommended_queue_id- Optional recommended queue id.alert_trigger_text- Optional analyst-facing trigger text.alert_origin_code- Alert origin code sent to the service.alert_type_code- Alert type code sent to the service.generate_ids- Whether the service should generate missing ids.alerting_event_id- Optional explicit alerting-event id.**legacy_kwargs- Rejected legacy keyword arguments kept only so the SDK can raise a clear compatibility error.
Returns:
The created bound alerting event.
Raises:
AlertOperationError- Ifdomain_idis empty, a scenario-fired event has noscenario_id, the legacycontributing_objectskeyword is passed, or the Alerts service rejects the creation;AlertCreationFailedErrorwhen the service created no alerting event or more than one.TypeError- If an unexpected keyword argument is passed.
create
def create(*,
domain_id: str,
actionable_entity: Document | ObjectRef | tuple[str, str],
scenario_fired_events: Iterable[ScenarioFiredEventInput] = (),
score: int | None = None,
recommended_queue_id: str | None = None,
alert_trigger_text: str | None = None,
alert_origin_code: str = "SCENARIO",
alert_type_code: str = "DEFAULT",
generate_ids: bool = False,
alerting_event_id: str | None = None,
**legacy_kwargs: Any) -> AlertingEvent
Create one alert and return its alerting event handle.
An entity has at most one active alert per domain. When the entity
already has one in domain_id, the service updates that alert
instead of creating another: the new event becomes its current event
and the alert keeps its id. Add a disposition to the domain before
you create alerts in it, or they cannot be closed.
Arguments:
domain_id- Target alert domain id.actionable_entity- Bound document,ObjectRef, or(type, id)tuple for the entity that should receive the alert.scenario_fired_events- Scenario-fired events to attach to the alert.score- Optional overall alert score.recommended_queue_id- Optional recommended queue id.alert_trigger_text- Optional analyst-facing trigger text.alert_origin_code- Alert origin code sent to the service.alert_type_code- Alert type code sent to the service.generate_ids- Whether the service should generate missing ids.alerting_event_id- Optional explicit alerting-event id.**legacy_kwargs- Rejected legacy keyword arguments kept only so the SDK can raise a clear compatibility error.
Returns:
The created bound alerting event.
Raises:
AlertOperationError- Ifdomain_idis empty, a scenario-fired event has noscenario_id, the legacycontributing_objectskeyword is passed, or the Alerts service rejects the creation;AlertCreationFailedErrorwhen the service created no alerting event or more than one.TypeError- If an unexpected keyword argument is passed.
create_preview
def create_preview(*,
domain_id: str,
actionable_entity: Document | ObjectRef | tuple[str, str],
scenario_fired_events: Iterable[ScenarioFiredEventInput] = (
),
score: int | None = None,
recommended_queue_id: str | None = None,
alert_trigger_text: str | None = None,
alert_origin_code: str = "SCENARIO",
alert_type_code: str = "DEFAULT",
generate_ids: bool = False,
alerting_event_id: str | None = None,
**legacy_kwargs: Any) -> RequestPreview
Preview the HTTP request create would fire, without sending it.
Arguments:
domain_id- Target alert domain id.actionable_entity- Bound document,ObjectRef, or(type, id)tuple for the entity that should receive the alert.scenario_fired_events- Scenario-fired events to attach to the alert.score- Optional overall alert score.recommended_queue_id- Optional recommended queue id.alert_trigger_text- Optional analyst-facing trigger text.alert_origin_code- Alert origin code sent to the service.alert_type_code- Alert type code sent to the service.generate_ids- Whether the service should generate missing ids.alerting_event_id- Optional explicit alerting-event id.**legacy_kwargs- Rejected legacy keyword arguments kept only so the SDK can raise a clear compatibility error.
Returns:
A RequestPreview with .to_curl() and .to_httpx()
renderers.
Raises:
AlertOperationError- Ifdomain_idis empty, a scenario-fired event has noscenario_id, or the legacycontributing_objectskeyword is passed.TypeError- If an unexpected keyword argument is passed.
list
def list(*,
start: int = 0,
limit: int = 10,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
queue_id: str | None = None,
status_id: str | None = None,
min_score: int | None = None,
max_score: int | None = None,
assigned_user_id: str | None = None,
checkout_user_id: str | None = None,
actionable_entity_id: str | None = None,
actionable_entity_type: str | None = None) -> builtins.list[Alert]
List alerts with optional score, queue, user, and entity filters.
Arguments:
start- Zero-based offset of the first alert.limit- Most alerts to return in this page.sort_by- Alerts API sort expression,<field>:ascendingor<field>:descending. Defaults to newest first.filter_- Raw Alerts API filter expression, AND-ed with the filters the other arguments build.queue_id- Only alerts in this queue (queueId).status_id- Only alerts with this status id (alertStatusId).min_score- Only alerts whose current score is at least this.max_score- Only alerts whose current score is at most this.assigned_user_id- Only alerts assigned to this user id.checkout_user_id- Only alerts checked out by this user id.actionable_entity_id- Only alerts on the entity with this id.actionable_entity_type- Only alerts on entities of this type.
Returns:
Bound alert wrappers matching the supplied filters.
Raises:
AlertOperationError- When the Alerts service rejects the request.DocumentOperationError- When Data Hub rejects the read of the listed alerts' documents.
list_async
async def list_async(
*,
start: int = 0,
limit: int = 10,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
queue_id: str | None = None,
status_id: str | None = None,
min_score: int | None = None,
max_score: int | None = None,
assigned_user_id: str | None = None,
checkout_user_id: str | None = None,
actionable_entity_id: str | None = None,
actionable_entity_type: str | None = None) -> builtins.list[Alert]
Asynchronously list alerts with optional filters.
Arguments:
start- Zero-based offset of the first alert.limit- Most alerts to return in this page.sort_by- Alerts API sort expression,<field>:ascendingor<field>:descending. Defaults to newest first.filter_- Raw Alerts API filter expression, AND-ed with the filters the other arguments build.queue_id- Only alerts in this queue (queueId).status_id- Only alerts with this status id (alertStatusId).min_score- Only alerts whose current score is at least this.max_score- Only alerts whose current score is at most this.assigned_user_id- Only alerts assigned to this user id.checkout_user_id- Only alerts checked out by this user id.actionable_entity_id- Only alerts on the entity with this id.actionable_entity_type- Only alerts on entities of this type.
Returns:
Bound alert wrappers matching the supplied filters.
Raises:
AlertOperationError- When the Alerts service rejects the request.DocumentOperationError- When Data Hub rejects the read of the listed alerts' documents.
list_preview
def list_preview(*,
start: int = 0,
limit: int = 10,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
queue_id: str | None = None,
status_id: str | None = None,
min_score: int | None = None,
max_score: int | None = None,
assigned_user_id: str | None = None,
checkout_user_id: str | None = None,
actionable_entity_id: str | None = None,
actionable_entity_type: str | None = None) -> RequestPreview
Preview the HTTP request list would fire, without sending it.
Only the Alerts request is previewed; list follows it with a
Data Hub read of the listed alerts' documents.
Arguments:
start- Zero-based offset of the first alert.limit- Most alerts to return in this page.sort_by- Alerts API sort expression,<field>:ascendingor<field>:descending. Defaults to newest first.filter_- Raw Alerts API filter expression, AND-ed with the filters the other arguments build.queue_id- Only alerts in this queue (queueId).status_id- Only alerts with this status id (alertStatusId).min_score- Only alerts whose current score is at least this.max_score- Only alerts whose current score is at most this.assigned_user_id- Only alerts assigned to this user id.checkout_user_id- Only alerts checked out by this user id.actionable_entity_id- Only alerts on the entity with this id.actionable_entity_type- Only alerts on entities of this type.
Returns:
A RequestPreview with .to_curl() and .to_httpx()
renderers.
list_all
def list_all(
*,
batch_size: int = 100,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
queue_id: str | None = None,
status_id: str | None = None,
min_score: int | None = None,
max_score: int | None = None,
assigned_user_id: str | None = None,
checkout_user_id: str | None = None,
actionable_entity_id: str | None = None,
actionable_entity_type: str | None = None) -> builtins.list[Alert]
List all matching alerts by paging until the service is exhausted.
Arguments:
batch_size- Page size used for repeated list requests.sort_by- Alerts API sort expression.filter_- Optional raw Alerts API filter expression.queue_id- Optional queue id filter.status_id- Optional status id filter.min_score- Optional inclusive minimum score.max_score- Optional inclusive maximum score.assigned_user_id- Optional assigned-user filter.checkout_user_id- Optional checkout-user filter.actionable_entity_id- Optional actionable-entity id filter.actionable_entity_type- Optional actionable-entity type filter.
Returns:
All matching alerts accumulated across result pages.
Raises:
AlertOperationError- Ifbatch_sizeis not greater than 0 or the Alerts service rejects a page.
list_all_async
async def list_all_async(
*,
batch_size: int = 100,
sort_by: str = "creationTimeStamp:descending",
filter_: str | None = None,
queue_id: str | None = None,
status_id: str | None = None,
min_score: int | None = None,
max_score: int | None = None,
assigned_user_id: str | None = None,
checkout_user_id: str | None = None,
actionable_entity_id: str | None = None,
actionable_entity_type: str | None = None) -> builtins.list[Alert]
Asynchronously list all matching alerts, paging exhaustively.
Arguments:
batch_size- Page size used for repeated list requests.sort_by- Alerts API sort expression.filter_- Optional raw Alerts API filter expression.queue_id- Optional queue id filter.status_id- Optional status id filter.min_score- Optional inclusive minimum score.max_score- Optional inclusive maximum score.assigned_user_id- Optional assigned-user filter.checkout_user_id- Optional checkout-user filter.actionable_entity_id- Optional actionable-entity id filter.actionable_entity_type- Optional actionable-entity type filter.
Returns:
All matching alerts accumulated across result pages.
Raises:
AlertOperationError- Ifbatch_sizeis not greater than 0 or the Alerts service rejects a page.
Public alerts surface.
Re-exports the curated public types from the private sasvi.alerts
submodules that define them. Everything that should appear in user code lives
here and in sasvi.alerts.__init__.