Source code for q2_sdk.hq.db.sec_alert_event

from argparse import _SubParsersAction
from functools import partial
from typing import List, Optional, Union

from q2_sdk.core.dynamic_imports import (
    api_ExecuteStoredProcedure as ExecuteStoredProcedure,
)
from q2_sdk.hq.table_row import TableRow

from .db_object import DbObject


[docs] class SecAlertEventRow(TableRow): SecAlertEventID: int ShortName: str EditDescUiTextElementID: int ReturnCodeEquals: bool NotifShortUiTextElementID: int NotifLongUiTextElementID: int VoiceUiTextElementID: int ToolTipUiTextElementID: int PropertyID: int IsCustomerBased: bool EnablePushNotification: bool
[docs] class SecAlertEvent(DbObject): GET_BY_NAME_KEY = "ShortName" NAME = "SecAlertEvent" REPRESENTATION_ROW_CLASS = SecAlertEventRow
[docs] def add_arguments(self, parser: _SubParsersAction): sub = parser.add_parser("get_sec_alert_events") sub.add_argument( "short_name", nargs="?", help="Q2_SecAlertEvent.ShortName (optional exact match)", ) sub.set_defaults(parser="get_sec_alert_events") sub.set_defaults(func=partial(self.get, serialize_for_cli=True))
[docs] async def get( self, short_name: Optional[str] = None, serialize_for_cli: bool = False, ) -> Union[List[SecAlertEventRow], str]: sql_params = [] if short_name is not None: if not isinstance(short_name, str) or not short_name.strip(): raise ValueError("short_name must be a non-empty string") sql_params.append( ExecuteStoredProcedure.SqlParam( ExecuteStoredProcedure.DataType.VarChar, "short_name", short_name, ) ) response = await self.call_hq( "sdk_GetSecAlertEvent", ExecuteStoredProcedure.SqlParameters(sql_params), ) if serialize_for_cli: response = self.serialize_for_cli( response, [ "SecAlertEventID", "ShortName", "ReturnCodeEquals", "IsCustomerBased", "EnablePushNotification", ], ) return response