Skip to content
Diego Rubin edited this page Jun 18, 2021 · 1 revision

Lifeguard Core Wiki

Built in Actions

Send Email

from lifeguard import NORMAL, PROBLEM
from lifeguard.actions.email import send_email
from lifeguard.validations import ValidationResponse, validation

@validation(
    "example validation",
    actions=[send_email],
    schedule={"every": {"minutes": 1}},
    settings= {
        "email": {
            "subject": "[Lifeguard] - Example Validation",
            "receivers": [{"name": "Name User", "email": "name_user@example.com"}],
            "send_in": [PROBLEM],
            "remove_from_sent_list_when": [NORMAL],
        }
    }
)
def simple_validation():
    return ValidationResponse("example_validation", NORMAL, {})

Parameters:

  • subject: Subject of email;
  • receivers: List of email receivers;
  • send_in: The email gonna be send after validation returns a status in list. The validation gonna be added to a list and it would be removed only after changing status;
  • remove_from_sent_list_when: When the validation returns a status in this list the validation gonna be removed from list of not send alert.
Clone this wiki locally