4242 force_default ,
4343 process_service_request ,
4444 handle_single_argument ,
45- generate_error_result
45+ generate_error_result ,
46+ args_to_params
4647 )
4748from ._payload import (
4849 simple_action_parameter ,
@@ -840,6 +841,61 @@ def provision(self: object, body: dict = None, **kwargs) -> Union[Dict[str, Unio
840841 body = body
841842 )
842843
844+ @force_default (defaults = ["parameters" , "body" ], default_types = ["dict" ])
845+ def set_workflow_definition_status (self : object ,
846+ body : dict = None ,
847+ parameters : dict = None ,
848+ ** kwargs
849+ ) -> Union [Dict [str , Union [int , dict ]], Result ]:
850+ """Enable or disable a workflow definition, or stop all executions for a definition.
851+
852+ When a definition is disabled it will not execute against any new trigger events.
853+
854+ Keyword arguments:
855+ action_name -- action to perform, 'enable', 'disable', or 'cancel'.
856+ body -- full body payload, not required if ids are provided as keyword.
857+ You must use body if you are going to specify action_parameters.
858+ {
859+ "ids": [
860+ "string"
861+ ]
862+ }
863+ ids -- IDs of workflow definitions to perform the action against. String or list of strings.
864+ parameters - full parameters payload, not required if action_name is provide as a keyword.
865+
866+ This method only supports keywords for providing arguments.
867+
868+ Returns: dict object containing API response.
869+
870+ HTTP Method: POST
871+
872+ Swagger URL
873+ https://assets.falcon.crowdstrike.com/support/api/swagger.html#/workflows/WorkflowDefinitionsAction
874+ """
875+ if not body :
876+ body = generic_payload_list (submitted_keywords = kwargs , payload_value = "ids" )
877+
878+ _allowed_actions = ['enable' , 'disable' , 'cancel' ]
879+ operation_id = "WorkflowDefinitionsStatus"
880+ parameter_payload = args_to_params (parameters , kwargs , Endpoints , operation_id )
881+ action_name = parameter_payload .get ("action_name" , "Not Specified" )
882+ # Only process allowed actions
883+ if action_name .lower () in _allowed_actions :
884+ returned = process_service_request (
885+ calling_object = self ,
886+ endpoints = Endpoints ,
887+ operation_id = operation_id ,
888+ body = body ,
889+ keywords = kwargs ,
890+ params = parameters ,
891+ body_validator = {"ids" : list } if self .validate_payloads else None ,
892+ body_required = ["ids" ] if self .validate_payloads else None
893+ )
894+ else :
895+ returned = generate_error_result ("Invalid value specified for action_name parameter." )
896+
897+ return returned
898+
843899 # These method names align to the operation IDs in the API but
844900 # do not conform to snake_case / PEP8 and are defined here for
845901 # backwards compatibility / ease of use purposes
@@ -851,6 +907,7 @@ def provision(self: object, body: dict = None, **kwargs) -> Union[Dict[str, Unio
851907 WorkflowDefinitionsExport = export_definition
852908 WorkflowDefinitionsImport = import_definition
853909 WorkflowDefinitionsUpdate = update_definition
910+ WorkflowDefinitionsStatus = set_workflow_definition_status
854911 WorkflowExecute = execute
855912 WorkflowExecuteInternal = execute_internal
856913 WorkflowMockExecute = mock_execute
0 commit comments