feat: added webhook receiver to alertchannels #68
| @ -2,8 +2,14 @@ use async_trait::async_trait; | |||||||
| use serde::Serialize; | use serde::Serialize; | ||||||
| use serde_yaml::{Mapping, Value}; | use serde_yaml::{Mapping, Value}; | ||||||
| 
 | 
 | ||||||
| use crate::{interpret::{InterpretError, Outcome}, modules::monitoring::kube_prometheus::{prometheus::{Prometheus, PrometheusReceiver}, types::{AlertChannelConfig, AlertManagerChannelConfig}}, topology::{oberservability::monitoring::AlertReceiver, Url}}; | use crate::{ | ||||||
| 
 |     interpret::{InterpretError, Outcome}, | ||||||
|  |     modules::monitoring::kube_prometheus::{ | ||||||
|  |         prometheus::{Prometheus, PrometheusReceiver}, | ||||||
|  |         types::{AlertChannelConfig, AlertManagerChannelConfig}, | ||||||
|  |     }, | ||||||
|  |     topology::{Url, oberservability::monitoring::AlertReceiver}, | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone, Serialize)] | #[derive(Debug, Clone, Serialize)] | ||||||
| pub struct WebhookReceiver { | pub struct WebhookReceiver { | ||||||
| @ -12,7 +18,7 @@ pub struct WebhookReceiver { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[async_trait] | #[async_trait] | ||||||
| impl AlertReceiver<Prometheus> for WebhookReceiver{ | impl AlertReceiver<Prometheus> for WebhookReceiver { | ||||||
|     async fn install(&self, sender: &Prometheus) -> Result<Outcome, InterpretError> { |     async fn install(&self, sender: &Prometheus) -> Result<Outcome, InterpretError> { | ||||||
|         sender.install_receiver(self).await |         sender.install_receiver(self).await | ||||||
|     } |     } | ||||||
| @ -31,7 +37,6 @@ impl PrometheusReceiver for WebhookReceiver { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| #[async_trait] | #[async_trait] | ||||||
| impl AlertChannelConfig for WebhookReceiver { | impl AlertChannelConfig for WebhookReceiver { | ||||||
|     async fn get_config(&self) -> AlertManagerChannelConfig { |     async fn get_config(&self) -> AlertManagerChannelConfig { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user