2424
2525public interface AlertService {
2626 public static class AlertType {
27- private static Set <AlertType > defaultAlertTypes = new HashSet <AlertType >();
27+ private static final Set <AlertType > defaultAlertTypes = new HashSet <>();
2828 private final String name ;
2929 private final short type ;
30+ private final boolean repetitionAllowed ;
3031
31- private AlertType (short type , String name , boolean isDefault ) {
32+ private AlertType (short type , String name , boolean isDefault , boolean repetitionAllowed ) {
3233 this .name = name ;
3334 this .type = type ;
35+ this .repetitionAllowed = repetitionAllowed ;
3436 if (isDefault ) {
3537 defaultAlertTypes .add (this );
3638 }
3739 }
3840
41+ private AlertType (short type , String name , boolean isDefault ) {
42+ this (type , name , isDefault , false );
43+ }
44+
3945 public static final AlertType ALERT_TYPE_MEMORY = new AlertType (Capacity .CAPACITY_TYPE_MEMORY , "ALERT.MEMORY" , true );
4046 public static final AlertType ALERT_TYPE_CPU = new AlertType (Capacity .CAPACITY_TYPE_CPU , "ALERT.CPU" , true );
4147 public static final AlertType ALERT_TYPE_STORAGE = new AlertType (Capacity .CAPACITY_TYPE_STORAGE , "ALERT.STORAGE" , true );
@@ -45,36 +51,36 @@ private AlertType(short type, String name, boolean isDefault) {
4551 public static final AlertType ALERT_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = new AlertType (Capacity .CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET , "ALERT.NETWORK.IPV6SUBNET" , true );
4652 public static final AlertType ALERT_TYPE_PRIVATE_IP = new AlertType (Capacity .CAPACITY_TYPE_PRIVATE_IP , "ALERT.NETWORK.PRIVATEIP" , true );
4753 public static final AlertType ALERT_TYPE_SECONDARY_STORAGE = new AlertType (Capacity .CAPACITY_TYPE_SECONDARY_STORAGE , "ALERT.STORAGE.SECONDARY" , true );
48- public static final AlertType ALERT_TYPE_HOST = new AlertType ((short )7 , "ALERT.COMPUTE.HOST" , true );
49- public static final AlertType ALERT_TYPE_USERVM = new AlertType ((short )8 , "ALERT.USERVM" , true );
50- public static final AlertType ALERT_TYPE_DOMAIN_ROUTER = new AlertType ((short )9 , "ALERT.SERVICE.DOMAINROUTER" , true );
51- public static final AlertType ALERT_TYPE_CONSOLE_PROXY = new AlertType ((short )10 , "ALERT.SERVICE.CONSOLEPROXY" , true );
54+ public static final AlertType ALERT_TYPE_HOST = new AlertType ((short )7 , "ALERT.COMPUTE.HOST" , true , true );
55+ public static final AlertType ALERT_TYPE_USERVM = new AlertType ((short )8 , "ALERT.USERVM" , true , true );
56+ public static final AlertType ALERT_TYPE_DOMAIN_ROUTER = new AlertType ((short )9 , "ALERT.SERVICE.DOMAINROUTER" , true , true );
57+ public static final AlertType ALERT_TYPE_CONSOLE_PROXY = new AlertType ((short )10 , "ALERT.SERVICE.CONSOLEPROXY" , true , true );
5258 public static final AlertType ALERT_TYPE_ROUTING = new AlertType ((short )11 , "ALERT.NETWORK.ROUTING" , true );
53- public static final AlertType ALERT_TYPE_STORAGE_MISC = new AlertType ((short )12 , "ALERT.STORAGE.MISC" , true );
59+ public static final AlertType ALERT_TYPE_STORAGE_MISC = new AlertType ((short )12 , "ALERT.STORAGE.MISC" , true , true );
5460 public static final AlertType ALERT_TYPE_USAGE_SERVER = new AlertType ((short )13 , "ALERT.USAGE" , true );
55- public static final AlertType ALERT_TYPE_MANAGEMENT_NODE = new AlertType ((short )14 , "ALERT.MANAGEMENT" , true );
61+ public static final AlertType ALERT_TYPE_MANAGEMENT_NODE = new AlertType ((short )14 , "ALERT.MANAGEMENT" , true , true );
5662 public static final AlertType ALERT_TYPE_DOMAIN_ROUTER_MIGRATE = new AlertType ((short )15 , "ALERT.NETWORK.DOMAINROUTERMIGRATE" , true );
5763 public static final AlertType ALERT_TYPE_CONSOLE_PROXY_MIGRATE = new AlertType ((short )16 , "ALERT.SERVICE.CONSOLEPROXYMIGRATE" , true );
5864 public static final AlertType ALERT_TYPE_USERVM_MIGRATE = new AlertType ((short )17 , "ALERT.USERVM.MIGRATE" , true );
5965 public static final AlertType ALERT_TYPE_VLAN = new AlertType ((short )18 , "ALERT.NETWORK.VLAN" , true );
60- public static final AlertType ALERT_TYPE_SSVM = new AlertType ((short )19 , "ALERT.SERVICE.SSVM" , true );
66+ public static final AlertType ALERT_TYPE_SSVM = new AlertType ((short )19 , "ALERT.SERVICE.SSVM" , true , true );
6167 public static final AlertType ALERT_TYPE_USAGE_SERVER_RESULT = new AlertType ((short )20 , "ALERT.USAGE.RESULT" , true );
6268 public static final AlertType ALERT_TYPE_STORAGE_DELETE = new AlertType ((short )21 , "ALERT.STORAGE.DELETE" , true );
6369 public static final AlertType ALERT_TYPE_UPDATE_RESOURCE_COUNT = new AlertType ((short )22 , "ALERT.RESOURCE.COUNT" , true );
6470 public static final AlertType ALERT_TYPE_USAGE_SANITY_RESULT = new AlertType ((short )23 , "ALERT.USAGE.SANITY" , true );
6571 public static final AlertType ALERT_TYPE_DIRECT_ATTACHED_PUBLIC_IP = new AlertType ((short )24 , "ALERT.NETWORK.DIRECTPUBLICIP" , true );
6672 public static final AlertType ALERT_TYPE_LOCAL_STORAGE = new AlertType ((short )25 , "ALERT.STORAGE.LOCAL" , true );
67- public static final AlertType ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = new AlertType ((short )26 , "ALERT.RESOURCE.EXCEED" , true );
73+ public static final AlertType ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = new AlertType ((short )26 , "ALERT.RESOURCE.EXCEED" , true , true );
6874 public static final AlertType ALERT_TYPE_SYNC = new AlertType ((short )27 , "ALERT.TYPE.SYNC" , true );
69- public static final AlertType ALERT_TYPE_UPLOAD_FAILED = new AlertType ((short )28 , "ALERT.UPLOAD.FAILED" , true );
70- public static final AlertType ALERT_TYPE_OOBM_AUTH_ERROR = new AlertType ((short )29 , "ALERT.OOBM.AUTHERROR" , true );
71- public static final AlertType ALERT_TYPE_HA_ACTION = new AlertType ((short )30 , "ALERT.HA.ACTION" , true );
72- public static final AlertType ALERT_TYPE_CA_CERT = new AlertType ((short )31 , "ALERT.CA.CERT" , true );
75+ public static final AlertType ALERT_TYPE_UPLOAD_FAILED = new AlertType ((short )28 , "ALERT.UPLOAD.FAILED" , true , true );
76+ public static final AlertType ALERT_TYPE_OOBM_AUTH_ERROR = new AlertType ((short )29 , "ALERT.OOBM.AUTHERROR" , true , true );
77+ public static final AlertType ALERT_TYPE_HA_ACTION = new AlertType ((short )30 , "ALERT.HA.ACTION" , true , true );
78+ public static final AlertType ALERT_TYPE_CA_CERT = new AlertType ((short )31 , "ALERT.CA.CERT" , true , true );
7379 public static final AlertType ALERT_TYPE_VM_SNAPSHOT = new AlertType ((short )32 , "ALERT.VM.SNAPSHOT" , true );
7480 public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType ((short )33 , "ALERT.VR.PUBLIC.IFACE.MTU" , true );
7581 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_VPN_GATEWAY_OBSOLETE_PARAMETERS = new AlertType ((short )34 , "ALERT.S2S.VPN.GATEWAY.OBSOLETE.PARAMETERS" , true );
82+ public static final AlertType ALERT_TYPE_EXTENSION_PATH_NOT_READY = new AlertType ((short )33 , "ALERT.TYPE.EXTENSION.PATH.NOT.READY" , true , true );
83+ public static final AlertType ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS = new AlertType ((short )34 , "ALERT.S2S.VPN.GATEWAY.OBSOLETE.PARAMETERS" , true , true );
7884 public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType (Capacity .CAPACITY_TYPE_BACKUP_STORAGE , "ALERT.STORAGE.BACKUP" , true );
7985 public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType (Capacity .CAPACITY_TYPE_OBJECT_STORAGE , "ALERT.STORAGE.OBJECT" , true );
8086
@@ -86,6 +92,10 @@ public String getName() {
8692 return name ;
8793 }
8894
95+ public boolean isRepetitionAllowed () {
96+ return repetitionAllowed ;
97+ }
98+
8999 private static AlertType getAlertType (short type ) {
90100 for (AlertType alertType : defaultAlertTypes ) {
91101 if (alertType .getType () == type ) {
@@ -109,7 +119,7 @@ public static AlertType generateAlert(short type, String name) {
109119 if (defaultAlert != null && !defaultAlert .getName ().equalsIgnoreCase (name )) {
110120 throw new InvalidParameterValueException ("There is a default alert having type " + type + " and name " + defaultAlert .getName ());
111121 } else {
112- return new AlertType (type , name , false );
122+ return new AlertType (type , name , false , false );
113123 }
114124 }
115125 }
0 commit comments