-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathtemplate.yaml
More file actions
118 lines (107 loc) · 3.7 KB
/
template.yaml
File metadata and controls
118 lines (107 loc) · 3.7 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
108
109
110
111
112
113
114
115
116
117
118
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
video-plugin-plugin_tester
SAM Template for Plugin Tester stack, which triggers plugin
the same way the production system could.
Parameters:
pluginTitle:
Description: Identifier for this plugin
Type: String
Default: PythonMinimalPlugin
eventHook:
Description: Identifier for this plugin
Type: String
Default: postValidate
Resources:
PluginTaskSuccessFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: code/
Handler: app.handler
Runtime: nodejs18.x
Timeout: 3
Tracing: Active
Environment:
Variables:
PluginLifecycleWorkflow: !Ref PluginLifecycleWorkflow
Policies:
- Statement:
- Effect: Allow
Resource: !Ref PluginLifecycleWorkflow
Action:
- states:sendTaskSuccess
PluginSuccessRule:
Type: AWS::Events::Rule
Properties:
EventBusName: default
EventPattern:
source:
- prefix: video.plugin
detail-type:
- prefix: plugin-complete
State: ENABLED
Targets:
- Arn: !GetAtt PluginTaskSuccessFunction.Arn
Id: PluginSuccessRuleLambdaTarget
PluginSuccessRulePermission:
Type: AWS::Lambda::Permission
Properties:
FunctionName: !Ref PluginTaskSuccessFunction
Action: "lambda:InvokeFunction"
Principal: "events.amazonaws.com"
SourceArn: !GetAtt PluginSuccessRule.Arn
PluginLifecycleWorkflow:
Type: AWS::Serverless::StateMachine # More info about State Machine Resource: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-statemachine.html
Properties:
DefinitionSubstitutions:
pluginTitle: !Ref pluginTitle
eventHook: !Ref eventHook
DefinitionUri: workflow/statemachine.asl.json
Tracing:
Enabled: True
Policies: # Find out more about SAM policy templates: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-policy-templates.html
- EventBridgePutEventsPolicy:
EventBusName: "default"
- AWSXRayDaemonWriteAccess
PluginEventRegistry:
Type: AWS::EventSchemas::Registry
Properties:
Description: Tracks events for the video plugin platform
PluginTesterWorkflowTriggerEventSchema:
Type: AWS::EventSchemas::Schema
Properties:
RegistryName: !GetAtt PluginEventRegistry.RegistryName
SchemaName: PluginTesterWorkflowTriggerEventSchema
Description: 'Event used to trigger the plugin tester workflow'
Type: JSONSchemaDraft4
Content: >
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"eventHook": {
"type": "string"
},
"pluginTitle": {
"type": "string"
}
},
"required": [
"eventHook",
"pluginTitle"
]
}
Outputs:
PluginLifecycleWorkflow:
Description: PluginLifecycleWorkflow Step Function Workflow ARN
Value: !GetAtt PluginLifecycleWorkflow.Arn
PluginSuccessEventRuleName:
Description: Name of the EventBridge rule triggering our success function.
Value: !Ref PluginSuccessRule
PluginEventRegistryName:
Description: Name of the event registry for tracking video plugin platform events
Value: !GetAtt PluginEventRegistry.RegistryName
PluginTesterWorkflowTriggerEventSchemaName:
Description: Name of the plugin tester workflow trigger event schema.
Value: !GetAtt PluginTesterWorkflowTriggerEventSchema.SchemaName