def directory_uploader(self, path: str): """Uploads directories by path Args: path (str): Path for directory to upload. """ if is_path_of_integration_directory(path): list_integrations = get_child_directories(path) for integration in list_integrations: self.integration_uploader(integration) elif is_path_of_script_directory(path): list_script = get_child_directories(path) for script in list_script: self.script_uploader(script) elif is_path_of_playbook_directory( path) or is_path_of_test_playbook_directory(path): list_playbooks = get_child_files(path) for playbook in list_playbooks: if playbook.endswith('.yml'): self.playbook_uploader(playbook) elif is_path_of_incident_field_directory(path): list_incident_fields = get_child_files(path) for incident_field in list_incident_fields: if incident_field.endswith('.json'): self.incident_field_uploader(incident_field) elif is_path_of_widget_directory(path): list_widgets = get_child_files(path) for widget in list_widgets: if widget.endswith('.json'): self.widget_uploader(widget) elif is_path_of_dashboard_directory(path): list_dashboards = get_child_files(path) for dashboard in list_dashboards: if dashboard.endswith('.json'): self.dashboard_uploader(dashboard) elif is_path_of_layout_directory(path): list_layouts = get_child_files(path) for layout in list_layouts: if layout.endswith('.json'): self.layout_uploader(layout) elif is_path_of_incident_type_directory(path): list_incident_types = get_child_files(path) for incident_type in list_incident_types: if incident_type.endswith('.json'): self.incident_type_uploader(incident_type) elif is_path_of_classifier_directory(path): list_classifiers = get_child_files(path) for classifiers in list_classifiers: if classifiers.endswith('.json'): self.classifier_uploader(classifiers)
def directory_uploader(self, path: str): """Uploads directories by path Args: path (str): Path for directory to upload. """ if is_path_of_integration_directory(path): # Upload unified integration files list_unified_integrations = get_child_files(path) for unified_integration in list_unified_integrations: file_type = find_type(unified_integration) if file_type == FileType.INTEGRATION: self.integration_uploader(unified_integration) # Upload spliced integration files list_integrations = get_child_directories(path) for integration in list_integrations: self.integration_uploader(integration) elif is_path_of_script_directory(path): # Upload unified scripts files list_unified_scripts = get_child_files(path) for unified_script in list_unified_scripts: file_type = find_type(unified_script) if file_type in (FileType.SCRIPT, FileType.TEST_SCRIPT): self.script_uploader(unified_script) # Upload spliced scripts list_script = get_child_directories(path) for script in list_script: self.script_uploader(script) elif is_path_of_playbook_directory( path) or is_path_of_test_playbook_directory(path): list_playbooks = get_child_files(path) for playbook in list_playbooks: if playbook.endswith('.yml'): self.playbook_uploader(playbook) elif is_path_of_incident_field_directory(path): list_incident_fields = get_child_files(path) for incident_field in list_incident_fields: if incident_field.endswith('.json'): self.incident_field_uploader(incident_field) elif is_path_of_widget_directory(path): list_widgets = get_child_files(path) for widget in list_widgets: if widget.endswith('.json'): self.widget_uploader(widget) elif is_path_of_dashboard_directory(path): list_dashboards = get_child_files(path) for dashboard in list_dashboards: if dashboard.endswith('.json'): self.dashboard_uploader(dashboard) elif is_path_of_layout_directory(path): list_layouts = get_child_files(path) for layout in list_layouts: if layout.endswith('.json'): self.layout_uploader(layout) elif is_path_of_incident_type_directory(path): list_incident_types = get_child_files(path) for incident_type in list_incident_types: if incident_type.endswith('.json'): self.incident_type_uploader(incident_type) elif is_path_of_classifier_directory(path): list_classifiers = get_child_files(path) for classifiers in list_classifiers: if classifiers.endswith('.json'): self.classifier_uploader(classifiers)