1919import java .util .HashSet ;
2020import java .util .Set ;
2121
22- import com .cloud .capacity .Capacity ;
2322import com .cloud .exception .InvalidParameterValueException ;
2423
2524public interface AlertService {
26- public static class AlertType {
27- private static Set <AlertType > defaultAlertTypes = new HashSet <AlertType >();
25+ class AlertType {
26+ private static Set <AlertType > defaultAlertTypes = new HashSet <>();
2827 private final String name ;
2928 private final short type ;
3029
@@ -36,15 +35,13 @@ private AlertType(short type, String name, boolean isDefault) {
3635 }
3736 }
3837
39- public static final AlertType ALERT_TYPE_MEMORY = new AlertType (Capacity .CAPACITY_TYPE_MEMORY , "ALERT.MEMORY" , true );
40- public static final AlertType ALERT_TYPE_CPU = new AlertType (Capacity .CAPACITY_TYPE_CPU , "ALERT.CPU" , true );
41- public static final AlertType ALERT_TYPE_STORAGE = new AlertType (Capacity .CAPACITY_TYPE_STORAGE , "ALERT.STORAGE" , true );
42- public static final AlertType ALERT_TYPE_STORAGE_ALLOCATED = new AlertType (Capacity .CAPACITY_TYPE_STORAGE_ALLOCATED , "ALERT.STORAGE.ALLOCATED" , true );
43- public static final AlertType ALERT_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = new AlertType (Capacity .CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP , "ALERT.NETWORK.PUBLICIP" ,
44- true );
45- public static final AlertType ALERT_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = new AlertType (Capacity .CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET , "ALERT.NETWORK.IPV6SUBNET" , true );
46- public static final AlertType ALERT_TYPE_PRIVATE_IP = new AlertType (Capacity .CAPACITY_TYPE_PRIVATE_IP , "ALERT.NETWORK.PRIVATEIP" , true );
47- public static final AlertType ALERT_TYPE_SECONDARY_STORAGE = new AlertType (Capacity .CAPACITY_TYPE_SECONDARY_STORAGE , "ALERT.STORAGE.SECONDARY" , true );
38+ public static final AlertType ALERT_TYPE_MEMORY = new AlertType ((short )0 , "ALERT.MEMORY" , true );
39+ public static final AlertType ALERT_TYPE_CPU = new AlertType ((short )1 , "ALERT.CPU" , true );
40+ public static final AlertType ALERT_TYPE_STORAGE = new AlertType ((short )2 , "ALERT.STORAGE" , true );
41+ public static final AlertType ALERT_TYPE_STORAGE_ALLOCATED = new AlertType ((short )3 , "ALERT.STORAGE.ALLOCATED" , true );
42+ public static final AlertType ALERT_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = new AlertType ((short )4 , "ALERT.NETWORK.PUBLICIP" , true );
43+ public static final AlertType ALERT_TYPE_PRIVATE_IP = new AlertType ((short )5 , "ALERT.NETWORK.PRIVATEIP" , true );
44+ public static final AlertType ALERT_TYPE_SECONDARY_STORAGE = new AlertType ((short )6 , "ALERT.STORAGE.SECONDARY" , true );
4845 public static final AlertType ALERT_TYPE_HOST = new AlertType ((short )7 , "ALERT.COMPUTE.HOST" , true );
4946 public static final AlertType ALERT_TYPE_USERVM = new AlertType ((short )8 , "ALERT.USERVM" , true );
5047 public static final AlertType ALERT_TYPE_DOMAIN_ROUTER = new AlertType ((short )9 , "ALERT.SERVICE.DOMAINROUTER" , true );
@@ -73,9 +70,12 @@ private AlertType(short type, String name, boolean isDefault) {
7370 public static final AlertType ALERT_TYPE_VM_SNAPSHOT = new AlertType ((short )32 , "ALERT.VM.SNAPSHOT" , true );
7471 public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType ((short )33 , "ALERT.VR.PUBLIC.IFACE.MTU" , true );
7572 public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType ((short )34 , "ALERT.VR.PRIVATE.IFACE.MTU" , true );
76- public static final AlertType ALERT_TYPE_EXTENSION_PATH_NOT_READY = new AlertType ((short )33 , "ALERT.TYPE.EXTENSION.PATH.NOT.READY" , true );
77- public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType (Capacity .CAPACITY_TYPE_BACKUP_STORAGE , "ALERT.STORAGE.BACKUP" , true );
78- public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType (Capacity .CAPACITY_TYPE_OBJECT_STORAGE , "ALERT.STORAGE.OBJECT" , true );
73+ public static final AlertType ALERT_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = new AlertType ((short )35 , "ALERT.NETWORK.IPV6SUBNET" , true );
74+ public static final AlertType ALERT_TYPE_EXTENSION_PATH_NOT_READY = new AlertType ((short )36 , "ALERT.TYPE.EXTENSION.PATH.NOT.READY" , true );
75+ public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType ((short )37 , "ALERT.STORAGE.BACKUP" , true );
76+ public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType ((short )38 , "ALERT.STORAGE.OBJECT" , true );
77+ // Note: Add next Alert Type before this. Always check the 'main' branch and keep the next number for the Alert Type to avoid conflicts.
78+ // Do not use Capacity Type to define the Alert Type.
7979
8080 public short getType () {
8181 return type ;
0 commit comments