Metadata-Version: 2.1
Name: cloudwatch-alarms-to-teams
Version: 0.1.10
Summary: cloudwatch-alarms-to-teams
Home-page: https://github.com/1davidmichael/Cloudwatch-Alarms-to-Chat-Platforms
Author: David Michael<1.david.michael@gmail.com>
License: Apache-2.0
Project-URL: Source, https://github.com/1davidmichael/Cloudwatch-Alarms-to-Chat-Platforms
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Typing :: Typed
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: aws-cdk.aws-cloudwatch-actions (<2.0.0,>=1.114.0)
Requires-Dist: aws-cdk.aws-cloudwatch (<2.0.0,>=1.114.0)
Requires-Dist: aws-cdk.aws-lambda-event-sources (<2.0.0,>=1.114.0)
Requires-Dist: aws-cdk.aws-lambda-nodejs (<2.0.0,>=1.114.0)
Requires-Dist: aws-cdk.aws-lambda (<2.0.0,>=1.114.0)
Requires-Dist: aws-cdk.aws-sns (<2.0.0,>=1.114.0)
Requires-Dist: aws-cdk.core (<2.0.0,>=1.114.0)
Requires-Dist: constructs (<4.0.0,>=3.2.27)
Requires-Dist: jsii (<2.0.0,>=1.30.0)
Requires-Dist: publication (>=0.0.3)

# CloudWatch Alarm to Chat Platforms CDK Construct

This construct creates an SNS topic and Lambda used to translate CloudWatch alarms into notifications set to various chat platforms. Currently only Microsoft Teams is supported.

Example:

```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws_cdk.core as cdk
import aws_cdk.aws_s3 as s3
from aws_cdk.aws_lambda import Runtime
import aws_cdk.aws_lambda_python as _lambda
import aws_cdk.aws_cloudwatch as cloudwatch
import aws_cdk.aws_cloudwatch_actions as cw_actions
import cloudwatch_alarms_to_teams as notifications
import path as path
import aws_cdk.aws_events as events
import aws_cdk.aws_events_targets as targets
from aws_cdk.assert import count_resources

class TestCdkConstructStack(cdk.Stack):
    def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None):
        super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)

        failure_lambda = _lambda.PythonFunction(self, "FailureLambda",
            entry=path.join(__dirname, "..", "functions", "failureLambda"),
            runtime=Runtime.PYTHON_3_8
        )

        rule = events.Rule(self, "Schedule",
            schedule=events.Schedule.rate(cdk.Duration.minutes(1))
        )

        rule.add_target(targets.LambdaFunction(failure_lambda))

        errors = failure_lambda.metric_errors()

        errors.with(
            period=cdk.Duration.minutes(1)
        )

        alarm = errors.create_alarm(self, "Alarm",
            alarm_name="Example Lambda Alarm",
            alarm_description="This alarm will trigger when the lambda fails 2 out of 3 times in a given period",
            threshold=2,
            evaluation_periods=3,
            period=cdk.Duration.minutes(1)
        )

        notify = notifications.CloudwatchAlarmsToTeamsConstruct(self, "Notification",
            webhook_url="https://test.webhook.office.com/webhookb2/example-webhook-goes-here"
        )

        notify.add_alarm_to_teams_notification(alarm)
```

## Example Notification in Teams

![Example Image](images/example.png)

## API

For specific API usage see the [API Docs](https://github.com/1davidmichael/Cloudwatch-Alarms-to-Chat-Platforms/blob/main/API.md)


