class EventRoleInfo: class Meta: unknown = EXCLUDE role_id: UUID = field(metadata={"data_key": "id"}) role_name: str = field(metadata={"data_key": "name"}) version: int bound_by: str bound_at: datetime = field( metadata={'marshmallow_field': MilliTimestampField()})
class EventPolicyInfo: class Meta: unknown = EXCLUDE policy_id: str = field(metadata={"data_key": "id"}) policy_name: str = field(metadata={"data_key": "name"}) version: int attached_by: str attached_at: datetime = field( metadata={'marshmallow_field': MilliTimestampField()}) enabled: bool
class EventV2(Resource): class Meta: unknown = EXCLUDE event_id: UUID = field(metadata={"data_key": "id"}) external_id: Optional[str] org_id: UUID org_name: str event_type: str = field(metadata={ "data_key": "type", "validate": validate.OneOf(EventV2Type.choices()) }) sub_type: str = field( metadata={"validate": validate.OneOf(EventV2Subtype.choices())}) severity: str = field( metadata={"validate": validate.OneOf(EventV2Severity.choices())}) action: str message: str result: str created_at: datetime = field( metadata={'marshmallow_field': MilliTimestampField()}) user_principal: EventUserPrincipal workload_principal: Optional[EventWorkloadPrincipal] role: Optional[List[EventRoleInfo]] trustscore: Optional[EventTrustScore] service: Optional[EventServiceInfo] policy: Optional[EventPolicyInfo] channel: Optional[EventChannelInfo] link: Optional[EventLinkInfo] Schema: ClassVar[Type[Schema]] = Schema @property def name(self) -> str: return self.id @property def id(self) -> str: return str(self.event_id) # noinspection PyUnusedLocal @pre_load def _remove_empty_fields(self, data, many, **kwargs): if data["user_principal"]["device"]["id"] == "": del data["user_principal"]["device"]["id"] if data["user_principal"]["user"]["roles"] is None: data["user_principal"]["user"]["roles"] = list() return data
class EventV2(Resource): class Meta: unknown = EXCLUDE event_id: UUID = field(metadata={"data_key": "id"}) external_id: Optional[str] org_id: UUID org_name: str event_type: str = field(metadata={ "data_key": "type", "validate": validate.OneOf(EventV2Type.choices()) }) sub_type: str = field( metadata={"validate": validate.OneOf(EventV2Subtype.choices())}) severity: str = field( metadata={"validate": validate.OneOf(EventV2Severity.choices())}) action: str message: str result: str created_at: datetime = field( metadata={'marshmallow_field': MilliTimestampField()}) user_principal: EventUserPrincipal workload_principal: Optional[EventWorkloadPrincipal] role: Optional[List[EventRoleInfo]] trustscore: Optional[EventTrustScore] service: Optional[EventServiceInfo] policy: Optional[EventPolicyInfo] channel: Optional[EventChannelInfo] link: Optional[EventLinkInfo] Schema: ClassVar[Type[Schema]] = Schema @property def name(self) -> str: return self.id @property def id(self) -> str: return str(self.event_id)