@@ -522,6 +522,38 @@ def determine_target_type_uri(self, req):
522
522
uri = '/' .join (target_type_uri ).lstrip ('/' )
523
523
return self ._add_prefix_target_type_uri (uri )
524
524
525
+ def determine_cadf_action (self , req , target_type_uri = None ):
526
+ """
527
+ determine the CADF action of a request
528
+
529
+ :param req: the request
530
+ :param target_type_uri: (optional) the target type URI of the request path if already known.
531
+ will attempt to determine otherwise
532
+ :return: the CADF action of unknown
533
+ """
534
+ cadf_action = taxonomy .UNKNOWN
535
+
536
+ try :
537
+ # get the target type URI from request path if still unknown
538
+ if common .is_none_or_unknown (target_type_uri ):
539
+ target_type_uri = self .determine_target_type_uri (req )
540
+
541
+ # lookup action in custom mapping if one exists
542
+ if self .custom_action_config :
543
+ custom_cadf_action = self ._cadf_action_from_custom_action_config (target_type_uri , req .method , cadf_action )
544
+ if not common .is_none_or_unknown (custom_cadf_action ):
545
+ cadf_action = custom_cadf_action
546
+
547
+ # if nothing was found, return cadf action based on request method and path
548
+ if common .is_none_or_unknown (cadf_action ):
549
+ cadf_action = self ._cadf_action_from_method_and_target_type_uri (req .method , target_type_uri )
550
+
551
+ except Exception as e :
552
+ self .logger .debug ("error while determining cadf action: {0}" .format (str (e )))
553
+
554
+ finally :
555
+ return cadf_action
556
+
525
557
def get_swift_account_container_object_id_from_path (self , path ):
526
558
path_regex = re .compile (
527
559
r'/\S+AUTH_(?P<account_id>\S*?)(\/+?|$)'
0 commit comments