forked from keetonian/lambda-to-slack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yml
More file actions
107 lines (100 loc) · 3.6 KB
/
template.yml
File metadata and controls
107 lines (100 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Metadata:
AWS::ServerlessRepo::Application:
Name: lambda-to-slack-multi
Description: Examine a log payload and post to a designated slack channel based on a matched string. Allows one lambda to be used to send messages to multiple slack channels (i.e. messages containing ERROR go to #errors, DEBUG to #debug, etc.)
Author: Chander Ganesan
SpdxLicenseId: MIT
# paths are relative to .aws-sam/build directory
LicenseUrl: LICENSE
ReadmeUrl: README.md
Labels: [serverless,slack,lambda]
HomePageUrl: https://github.com/chander/lambda-to-slack-multi
# Update the semantic version and run sam publish to publish a new version of your app
SemanticVersion: 0.0.6
# best practice is to use git tags for each release and link to the version tag as your source code URL
SourceCodeUrl: https://github.com/chander/lambda-to-slack-multi/tree/0.0.6
Parameters:
LogLevel:
Type: String
Description: Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc
Default: INFO
SlackUrl:
Description: Webhook URL for integration with Slack (for messages not matched by any other rules, leave empty to discard unmatched messages)
Type: String
Default: ''
SlackUrl01:
Default: ''
Description: Webhook URL for integration with Slack (using ContainsString01)
Type: String
ContainsString01:
Default: ''
Type: String
Description: A String that must appear in the message in order for SlackUrl01 to be used.
SlackUrl02:
Default: ''
Description: Webhook URL for integration with Slack (using ContainsString02)
Type: String
ContainsString02:
Default: ''
Type: String
Description: A String that must appear in the message in order for SlackUrl02 to be used.
SlackUrl03:
Default: ''
Description: Webhook URL for integration with Slack (using ContainsString03)
Type: String
ContainsString03:
Default: ''
Type: String
Description: A String that must appear in the message in order for SlackUrl03 to be used.
SlackUrl04:
Default: ''
Description: Webhook URL for integration with Slack (using ContainsString04)
Type: String
ContainsString04:
Default: ''
Type: String
Description: A String that must appear in the message in order for SlackUrl04 to be used.
SlackUrl05:
Default: ''
Description: Webhook URL for integration with Slack (using ContainsString05)
Type: String
ContainsString05:
Default: ''
Type: String
Description: A String that must appear in the message in order for SlackUrl05 to be used.
Globals:
Function:
Runtime: python3.7
Tracing: Active
Timeout: 60
Environment:
Variables:
LOG_LEVEL: !Ref LogLevel
Resources:
LambdaToSlack:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/
Handler: handlers.post_to_slack
Environment:
Variables:
SLACK_URL: !Ref SlackUrl
SLACK_URL01: !Ref SlackUrl01
SLACK_URL02: !Ref SlackUrl02
SLACK_URL03: !Ref SlackUrl03
SLACK_URL04: !Ref SlackUrl04
SLACK_URL05: !Ref SlackUrl05
CONTAINS_STRING01: !Ref ContainsString01
CONTAINS_STRING02: !Ref ContainsString02
CONTAINS_STRING03: !Ref ContainsString03
CONTAINS_STRING04: !Ref ContainsString04
CONTAINS_STRING05: !Ref ContainsString05
Outputs:
LambdaToSlackName:
Description: "Lambda Function Name"
Value: !Ref LambdaToSlack
LambdaToSlackArn:
Description: "Lambda Function ARN"
Value: !GetAtt LambdaToSlack.Arn