[−][src]Struct watchrs::Watcher
Used to create and operate on AWS resources related to monitoring Batch jobs.
At the moment the Watcher
struct only takes in a AWS region to indicate
where to operate in.
Methods
impl Watcher
[src]
pub fn subscribe(
&self,
email: String,
topic_arn: Option<String>
) -> Result<(String, String), WatchError>
[src]
&self,
email: String,
topic_arn: Option<String>
) -> Result<(String, String), WatchError>
Creates a topic when topic_arn
is None and suscribes to it using the email provided.
The method will skip the topic creation step whenever the topic_arn
field is_some()
.
subscribe
will return back a tuple of the form (topic_arn, subscribtion_arn).
let mut watcher = Watcher::default(); let email = "emailtosubscribe@example.com".to_owned(); let (topic_arn, subscription_arn) = watcher.subscribe(email, None).unwrap();
pub fn unsubscribe(
&self,
subscription_arn: String,
delete_topic: bool,
topic_arn: Option<String>
) -> Result<(), WatchError>
[src]
&self,
subscription_arn: String,
delete_topic: bool,
topic_arn: Option<String>
) -> Result<(), WatchError>
Unsubscribes an email from a topic using the subscription_arn. The topic will
also be deleted when the deleted_topic
is set. If the deleted flag is set the
topic arn must be Some
. Keep in mind that deleting a topic will also delete
all of its subscriptions.
let mut watcher = Watcher::default(); watcher.unsubscribe("validsubscriptionarn".to_owned(), false, None).unwrap();
pub fn create_job_watcher_rule(
&self,
rule_name: String,
enable: bool,
rule_description: Option<String>,
statuses: Option<Vec<String>>,
job_queues: Option<Vec<String>>,
job_names: Option<Vec<String>>
) -> Result<String, WatchError>
[src]
&self,
rule_name: String,
enable: bool,
rule_description: Option<String>,
statuses: Option<Vec<String>>,
job_queues: Option<Vec<String>>,
job_names: Option<Vec<String>>
) -> Result<String, WatchError>
Creates a Cloudwatch Event Rule that watches for AWS Batch job state changes.
You can create a more restrictive filter expression by using the status, job_queues, or
job_name fields. The rule created will contain these fields in a details struct. An example of
a details
field looks like below. You can get more info on creating rule expressions for
batch jobs here.
Event Detail
"detail": {
"jobName": "event-test",
"jobId": "4c7599ae-0a82-49aa-ba5a-4727fcce14a8",
"jobQueue": "arn:aws:batch:us-east-1:aws_account_id:job-queue/HighPriority",
}
Example
let mut watcher = Watcher::default(); watcher.create_job_watcher_rule( "my_batch_job_rule".to_owned(), true, Some("watch failed jobs".to_owned()), Some(vec!["FAILED".to_owned()]), None, None).unwrap();
pub fn create_sns_target(
&self,
rule_name: String,
topic_arn: String
) -> Result<(), WatchError>
[src]
&self,
rule_name: String,
topic_arn: String
) -> Result<(), WatchError>
Creates a Cloudwatch Event Target pointed to the SNS topic with the provided arn.
The method will also attach the rule, rule_name
to the event target.
let mut watcher = Watcher::default(); let subscription_arn = "validsubscriptionarn".to_owned(); watcher.create_sns_target( "my_batch_job_rule".to_owned(), "watchrs_topic_arn".to_owned() ).unwrap();
pub fn set_region(&mut self, region: Region)
[src]
Sets the AWS region a Watcher
instance should operate in. The default region
is us-east-1. More information on supported services and AWS regions
can be found here.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same for T
type Output = T
Should always be Self