#NEWLINE# def create_trigger_type_db( trigger_type ) : #NEWLINE# #INDENT# '\n    Creates a trigger type db object in the db given trigger_type definition as dict.\n\n    :param trigger_type: Trigger type model.\n    :type trigger_type: ``dict``\n\n    :rtype: ``object``\n    ' #NEWLINE# trigger_type_api = TriggerTypeAPI ( ** trigger_type ) #NEWLINE# trigger_type_api . validate ( ) #NEWLINE# ref = ResourceReference . to_string_reference ( name = trigger_type_api . name , pack = trigger_type_api . pack ) #NEWLINE# trigger_type_db = get_trigger_type_db ( ref ) #NEWLINE# if ( not trigger_type_db ) : #NEWLINE# #INDENT# trigger_type_db = TriggerTypeAPI . to_model ( trigger_type_api ) #NEWLINE# LOG . debug ( 'verified trigger and formulated TriggerDB=%s' , trigger_type ) #NEWLINE# trigger_type_db = TriggerType . add_or_update ( trigger_type_db ) #NEWLINE# #UNINDENT# return trigger_type_db