@@ -232,13 +232,15 @@ impl DeploymentInfo {
232
232
pub enum AlertType {
233
233
Threshold ,
234
234
Anomaly ,
235
+ Forecast ,
235
236
}
236
237
237
238
impl Display for AlertType {
238
239
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
239
240
match self {
240
241
AlertType :: Threshold => write ! ( f, "threshold" ) ,
241
242
AlertType :: Anomaly => write ! ( f, "anomaly" ) ,
243
+ AlertType :: Forecast => write ! ( f, "forecast" ) ,
242
244
}
243
245
}
244
246
}
@@ -1358,6 +1360,8 @@ pub enum AlertError {
1358
1360
InvalidQueryParameter ,
1359
1361
#[ error( "{0}" ) ]
1360
1362
ArrowError ( #[ from] ArrowError ) ,
1363
+ #[ error( "Upgrade to Parseable Enterprise for {0} type alerts" ) ]
1364
+ NotPresentInOSS ( String ) ,
1361
1365
}
1362
1366
1363
1367
impl actix_web:: ResponseError for AlertError {
@@ -1382,6 +1386,7 @@ impl actix_web::ResponseError for AlertError {
1382
1386
Self :: InvalidAlertQuery => StatusCode :: BAD_REQUEST ,
1383
1387
Self :: InvalidQueryParameter => StatusCode :: BAD_REQUEST ,
1384
1388
Self :: ArrowError ( _) => StatusCode :: INTERNAL_SERVER_ERROR ,
1389
+ Self :: NotPresentInOSS ( _) => StatusCode :: BAD_REQUEST ,
1385
1390
}
1386
1391
}
1387
1392
@@ -1462,7 +1467,12 @@ impl AlertManagerTrait for Alerts {
1462
1467
}
1463
1468
AlertType :: Anomaly => {
1464
1469
return Err ( anyhow:: Error :: msg (
1465
- "Get Parseable Enterprise for Anomaly alerts" ,
1470
+ AlertError :: NotPresentInOSS ( "anomaly" . into ( ) ) . to_string ( ) ,
1471
+ ) ) ;
1472
+ }
1473
+ AlertType :: Forecast => {
1474
+ return Err ( anyhow:: Error :: msg (
1475
+ AlertError :: NotPresentInOSS ( "forecast" . into ( ) ) . to_string ( ) ,
1466
1476
) ) ;
1467
1477
}
1468
1478
} ;
0 commit comments