refactor cloudstack api