Skip to content

Commit

Permalink
fix(RD-1157): Updated lambda for catch AWS Health alert
Browse files Browse the repository at this point in the history
  • Loading branch information
Julia Aghamyan committed Jul 24, 2023
1 parent 246d4eb commit 8cd2081
Showing 1 changed file with 55 additions and 22 deletions.
77 changes: 55 additions & 22 deletions modules/security-hub/src/teams/lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,7 @@ def payload(account,resources,types,recommendation,description,id,resource_type)
}
]
if recommendation == "" :
recommendation_item = {}
else :
recommendation_item = {
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": recommendation["Text"],
"url": recommendation["Url"]
}
]
}

payload = {
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": "contentUrl",
"content": {
content = {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"title": "Security Hub Scan",
Expand Down Expand Up @@ -83,10 +64,62 @@ def payload(account,resources,types,recommendation,description,id,resource_type)
"url": "https://eu-central-1.console.aws.amazon.com/securityhub/home?region=eu-central-1#/findings?search=WorkflowStatus=%5Coperator%5C%3AEQUALS%5C%3ANEW"
}
]
},
recommendation_item
}
]
}

else :
content = {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"title": "Security Hub Scan",
"version": "1.2",
"msteams": {
"width": "Full"
},
"body": [
{
"type": "TextBlock",
"text": str(types),
"size": "Large",
"weight": "Bolder",
"style": "heading"
},
{
"type": "Container",
"items": items
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": recommendation["Text"],
"url": recommendation["Url"]
}
]
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": "Security Hub Url",
"url": "https://eu-central-1.console.aws.amazon.com/securityhub/home?region=eu-central-1#/findings?search=WorkflowStatus=%5Coperator%5C%3AEQUALS%5C%3ANEW"
}
]
}
]
}

payload = {
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": "contentUrl",
"content": content

}
]
}
Expand Down

0 comments on commit 8cd2081

Please sign in to comment.