[][src]Crate watchrs

watchrs

The watchrs crate aids in monitoring and setting up alerts for AWS Batch Jobs.

Examples

Setting Up Alerts For Batch Job State Changes


use watchrs::Watcher;

let watcher = Watcher::default();
watcher
    .subscribe("youremail@here.com".to_owned(), None)
    .and_then(|(topic_arn, _)| {
        watcher
            .create_job_watcher_rule(
                "my_batch_job_rule".to_owned(),
                true,
                Some("watch failed jobs".to_owned()),
                Some(vec!["FAILED".to_owned(), "RUNNABLE".to_owned()]),
                Some(vec!["JOB_QUEUE_ARN".to_owned()]),
                Some(vec!["JOB_DEFINITION_NAME".to_owned()])
            )
            .map(|rule_name| (topic_arn, rule_name))
    })
      .and_then(|(topic_arn, rule_name)| {
           watcher.create_sns_target(rule_name, topic_arn)
    })
    .expect("failed to create alerting system");

Structs

Watcher

Used to create and operate on AWS resources related to monitoring Batch jobs.

Enums

WatchError

An enum whos varients describe the point of faliure during AWS calls. For now, the value captured by the enum only contains a short description of the error.