GROOVY
package examples.docs.structure
import com.almworks.jira.structure.api.permissions.PermissionLevel
import com.almworks.jira.structure.api.StructureComponents
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin('com.almworks.jira.structure')
@PluginModule
StructureComponents structureComponents
def structureManager = structureComponents.getStructureManager()
def permission = PermissionLevel.valueOf("ADMIN")
def structures = structureManager.getArchivedStructures(permission)
structures.each { st ->
structureManager.deleteStructure(st.getId())
}