(instance, source_type, source_id, instance_field_call_dict)
| 914 | |
| 915 | |
| 916 | def get_instance_resource(instance, source_type, source_id, instance_field_call_dict): |
| 917 | response = [] |
| 918 | from system_manage.models.resource_mapping import ResourceMapping |
| 919 | |
| 920 | for target_type, call_list in instance_field_call_dict.items(): |
| 921 | target_id_list = reduce(lambda x, y: [*x, *y], [call(instance) for call in call_list], []) |
| 922 | if target_id_list: |
| 923 | for target_id in target_id_list: |
| 924 | response.append( |
| 925 | ResourceMapping( |
| 926 | source_type=source_type, target_type=target_type, source_id=source_id, target_id=target_id |
| 927 | ) |
| 928 | ) |
| 929 | return response |
| 930 | |
| 931 | |
| 932 | def save_workflow_mapping(workflow, source_type, source_id, other_resource_mapping=None): |
no test coverage detected