-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathapp.py
More file actions
37 lines (31 loc) · 988 Bytes
/
app.py
File metadata and controls
37 lines (31 loc) · 988 Bytes
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
#Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#SPDX-License-Identifier: MIT-0
import json
import boto3
def lambda_handler(event, context):
# Do some stuff here and validate that you've been successful
valid = {
"valid": True,
"reason": "The plugin works!"
}
# Extract duration and taskToken from the incoming event
taskToken = event["detail"]["taskToken"]
eventToSend = {
"Source": "video.plugin.PythonMinimalPlugin",
"DetailType": 'plugin-complete',
"EventBusName": "default",
"Detail": json.dumps({"TaskToken": taskToken,"Message":valid})
}
try:
eventBridgeClient = boto3.client('events')
eventBridgeClient.put_events(Entries=[eventToSend])
return {
"statusCode": 200,
"body": "Success!"
}
except Exception as e:
print(e)
return {
"statusCode": 500,
"body": "Error!"
}