mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
bug 8373: Added new API listEventTypes
This commit is contained in:
parent
197dc6cf6e
commit
5a6664ab12
@ -497,5 +497,7 @@ public interface ManagementService {
|
||||
* @return Pair<List<? extends Host>, List<Long>> List of all Hosts in VM's cluster and list of HostIds with enough capacity
|
||||
*/
|
||||
Pair<List<? extends Host>, List<Long>> listHostsForMigrationOfVM(UserVm vm, Long startIndex, Long pageSize);
|
||||
|
||||
String[] listEventTypes();
|
||||
|
||||
}
|
||||
|
||||
@ -163,6 +163,7 @@ listZones=com.cloud.api.commands.ListZonesByCmd;15
|
||||
|
||||
#### events commands
|
||||
listEvents=com.cloud.api.commands.ListEventsCmd;15
|
||||
listEventTypes=com.cloud.api.commands.ListEventTypesCmd;15
|
||||
|
||||
#### alerts commands
|
||||
listAlerts=com.cloud.api.commands.ListAlertsCmd;3
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package com.cloud.server;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigInteger;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
@ -4761,4 +4762,23 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] listEventTypes(){
|
||||
Object eventObj = new EventTypes();
|
||||
Class<EventTypes> c = EventTypes.class;
|
||||
Field[] fields = c.getDeclaredFields();
|
||||
String[] eventTypes = new String[fields.length];
|
||||
try {
|
||||
int i = 0;
|
||||
for(Field field : fields){
|
||||
eventTypes[i++] = field.get(eventObj).toString();
|
||||
}
|
||||
return eventTypes;
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_logger.error("Error while listing Event Types", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
s_logger.error("Error while listing Event Types", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user