pub async fn delete_event(us: &UpgradeState, info: &UpgradeInfo, reg: &Region, conf: &Config) {
    // Webhooks defined in shipcat.conf for the region:
    debug!("Delete event: {:?}", info);
    for wh in &reg.webhooks {
        if let Ok(whc) = wh.get_configuration() {
            let res = match wh {
                Webhook::Audit(h) => audit::deletion(&us, &info, &h, whc).await,
            };
            if let Err(e) = res {
                warn!("Failed to notify about delete event: {}", e)
            }
        }
    }
    // slack notifies when we start the deletion only
    #[allow(clippy::single_match)] // no PartialEq for UpgradeState
    match us {
        UpgradeState::Started => {
            let color = "warning";
            let text = format!("deleting `{}` in `{}`", info.name, reg.name);
            let _ = slack::send(
                slack::Message {
                    text,
                    code: info.diff.clone(),
                    color: Some(String::from(color)),
                    version: Some(info.version.clone()),
                    mode: info.slackMode.clone(),
                    metadata: info.metadata.clone(),
                },
                &conf.owners,
            )
            .await;
        }
        _ => {}
    };
}
/// Throw events to configured webhooks
///
/// This is the new version for shipcat apply module
Throw events to configured webhooks
This is the new version for shipcat apply module
Throw events to configured webhooks This is the new version for shipcat apply module
pub async fn delete_event(us: &UpgradeState, info: &UpgradeInfo, reg: &Region, conf: &Config) {
    // Webhooks defined in shipcat.conf for the region:
    debug!("Delete event: {:?}", info);
    for wh in &reg.webhooks {
        if let Ok(whc) = wh.get_configuration() {
            let res = match wh {
                Webhook::Audit(h) => audit::deletion(&us, &info, &h, whc).await,
            };
            if let Err(e) = res {
                warn!("Failed to notify about delete event: {}", e)
            }
        }
    }
    // slack notifies when we start the deletion only
    #[allow(clippy::single_match)] // no PartialEq for UpgradeState
    match us {
        UpgradeState::Started => {
            let color = "warning";
            let text = format!("deleting `{}` in `{}`", info.name, reg.name);
            let _ = slack::send(
                slack::Message {
                    text,
                    code: info.diff.clone(),
                    color: Some(String::from(color)),
                    version: Some(info.version.clone()),
                    mode: info.slackMode.clone(),
                    metadata: info.metadata.clone(),
                },
                &conf.owners,
            )
            .await;
        }
        _ => {}
    };
}
pub async fn delete_event ( us : & UpgradeState , info : & UpgradeInfo , reg : & Region , conf : & Config ) { // Webhooks defined in shipcat.conf for the region: debug ! ( " " info ) ; for wh in & reg . webhooks { if let Ok ( whc ) = wh . get_configuration ( ) { let res = match wh { Webhook :: Audit ( h ) => audit :: deletion ( & us , & info , & h , whc ) . await , } ; if let Err ( e ) = res { warn ! ( " " e ) } } } // slack notifies when we start the deletion only # [ allow ( clippy single_match ) ] // no PartialEq for UpgradeState match us { UpgradeState :: Started => { let color = " " ; let text = format ! ( " " info name reg name ) ; let _ = slack :: send ( slack :: Message { text , code : info . diff . clone ( ) , color : Some ( String :: from ( color ) ) , version : Some ( info . version . clone ( ) ) , mode : info . slackMode . clone ( ) , metadata : info . metadata . clone ( ) , } , & conf . owners , ) . await ; } _ => { } } ; }
Throw events to configured webhooks
This is the new version for shipcat apply module
Throw events to configured webhooks This is the new version for shipcat apply module
us
&UpgradeState
info
&UpgradeInfo
reg
&Region
conf
&Config
us
&UpgradeState
info
&UpgradeInfo
reg
&Region
conf
&Config