Source code for ace.centralize.models.alert
"""
Alert models for Centralize
Models for alerts and affected entities.
Based on the Alert GraphQL schema (CreateAlertsParamsInput, AddEntitiesToAlertParamsInput, etc.)
"""
from typing import List, Optional
from ace.centralize.models.base import ModelBase
[docs]
class AlertAffectedEntityParamsInput(ModelBase):
[docs]
def __init__(self, entity_type_id: str, entity_type_name: str, ids: List[int]):
self.entityTypeId = entity_type_id
self.entityTypeName = entity_type_name
self.ids = ids
[docs]
class CreateAlertsParamsInput(ModelBase):
"""Maps to CreateAlertsParamsInput in GraphQL schema."""
[docs]
def __init__(
self,
alert_type_guid: str,
entity_id: int,
affected_entities: Optional[List[AlertAffectedEntityParamsInput]] = None
):
self.alertTypeGuid = alert_type_guid
self.entityId = entity_id
if affected_entities is not None:
self.affectedEntities = affected_entities