forked from twilio-labs/socless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
190 lines (168 loc) · 5.96 KB
/
serverless.yml
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# Socless core infrastructure and functions
service: socless
provider:
name: aws
runtime: python3.7
variableSyntax: "\\${{([ ~:a-zA-Z0-9._\\'\",\\-\\/\\(\\)]+?)}}"
stage: ${{opt:stage}}
region: ${{opt:region}}
role:
Fn::GetAtt: [LambdaExecutionRole, 'Arn']
versionFunctions: false
memorySize: 128
timeout: 10
environment:
SOCLESS_VAULT:
Ref: SoclessVault
SOCLESS_RESULTS_TABLE:
Ref: ExecutionResultsTable
vpc:
securityGroupIds:
- Fn::Sub: ${SoclessLambdaVpcSG.GroupId}
subnetIds:
- Ref: SoclessPrivateFunctionSubnet
plugins:
- serverless-package-python-functions
custom:
pkgPyFuncs:
buildDir: build
globalRequirements:
- ./functions/requirements.txt
resources:
- ${{file(resources/dynamodb.yml)}} # DynamoDB Tables
- ${{file(resources/iam.yml)}} # IAM Resources
- ${{file(resources/sfn.yml)}} # Step Functions Resources
- ${{file(resources/s3.yml)}} # S3 Resources
- ${{file(resources/kms.yml)}} # KMS Resources
- ${{file(resources/vpc.yml)}} # VPC Resources
- ${{file(resources/sg.yml)}} # Security Group resources
- ${{file(resources/apigateway.yml)}} # API Gateway
- Outputs:
MergeParallelOutput:
Description: Merges the output from a parallel state into a unified object
Value:
Fn::Sub: ${MergeParallelOutputLambdaFunction.Arn}
SaveMessageResponseToken:
Description: Save the task token created when the Socless Messages Response Activity state is used
Value:
Fn::Sub: ${SaveMessageResponseTokenLambdaFunction.Arn}
Counter:
Description: Simple counter functionality
Value:
Fn::Sub: ${CounterLambdaFunction.Arn}
SetInvestigationStatus:
Description: Set the internal status of an Socless investigation
Value:
Fn::Sub: ${SetInvestigationStatusLambdaFunction.Arn}
AddCustomMapping:
Description: Add a custom mapping to the CustomMappings Table
Value:
Fn::Sub: ${AddCustomMappingLambdaFunction.Arn}
QueryCustomMapping:
Description: Retrieve a custom mapping from the CustomMappings Table
Value:
Fn::Sub: ${QueryCustomMappingLambdaFunction.Arn}
CreateEvents:
Description: Create events from within a playbook
Value:
Fn::Sub: ${CreateEventsLambdaFunction.Arn}
CacheResults:
Description: Cache returned results
Value:
Fn::Sub: ${CacheResultsLambdaFunction.Arn}
package:
individually: true
functions:
MergeParallelOutput:
handler: lambda_function.lambda_handler
name: _socless_merge_parallel_output
description: Merges the output from a Parallel state into a unified object
package:
include:
- functions/merge_parallel_output
artifact: ${{self:custom.pkgPyFuncs.buildDir}}/${{self:functions.MergeParallelOutput.name}}.zip
SaveMessageResponseToken:
handler: lambda_function.lambda_handler
name: _socless_save_msg_resp_token
description: Save the task token created when the Socless Messages Response Activity state is used
environment:
AWAIT_MESSAGE_RESPONSE_ARN:
Ref: AwaitMessageResponseActivity
MESSAGE_RESPONSES_TABLE:
Ref: MessageResponsesTable
package:
include:
- functions/save_msg_resp_token
artifact: ${{self:custom.pkgPyFuncs.buildDir}}/${{self:functions.SaveMessageResponseToken.name}}.zip
Counter:
handler: lambda_function.lambda_handler
name: _socless_counter
description: Simple counter functionality
package:
include:
- functions/counter
artifact: ${{self:custom.pkgPyFuncs.buildDir}}/${{self:functions.Counter.name}}.zip
SetInvestigationStatus:
handler: lambda_function.lambda_handler
name: socless_set_investigation_status
environment:
SOCLESS_EVENTS_TABLE:
Ref: EventsTable
description: Socless integration to set an investigations status
package:
include:
- functions/set_investigation_status
artifact: ${{self:custom.pkgPyFuncs.buildDir}}/${{self:functions.SetInvestigationStatus.name}}.zip
Playground:
handler: lambda_function.lambda_handler
name: _socless_playground
description: Function for playing around with Socless' Configuration
package:
include:
- functions/playground
artifact: ${{self:custom.pkgPyFuncs.buildDir}}/${{self:functions.Playground.name}}.zip
AddCustomMapping:
handler: lambda_function.lambda_handler
name: socless_add_custom_mapping
description: Add a custom mapping to the CustomMappings Table
environment:
SOCLESS_CUSTOM_MAPPINGS_TABLE:
Ref: CustomMappingsTable
package:
include:
- functions/add_custom_mapping
artifact: ${{self:custom.pkgPyFuncs.buildDir}}/${{self:functions.AddCustomMapping.name}}.zip
QueryCustomMapping:
handler: lambda_function.lambda_handler
name: socless_query_custom_mapping
description: Retrieve a custom mapping from the CustomMappings Table
environment:
SOCLESS_CUSTOM_MAPPINGS_TABLE:
Ref: CustomMappingsTable
package:
include:
- functions/query_custom_mapping
artifact: ${{self:custom.pkgPyFuncs.buildDir}}/${{self:functions.QueryCustomMapping.name}}.zip
CreateEvents:
handler: lambda_function.lambda_handler
name: socless_create_events
description: Create events from within a playbook
memorySize: 512
timeout: 60
environment:
SOCLESS_EVENTS_TABLE:
Ref: EventsTable
SOCLESS_PLAYBOOKS_TABLE:
Ref: PlaybooksTable
package:
include:
- functions/create_events
artifact: ${{self:custom.pkgPyFuncs.buildDir}}/${{self:functions.CreateEvents.name}}.zip
CacheResults:
handler: lambda_function.lambda_handler
name: socless_cache_results
description: Cache return results
package:
include:
- functions/cache_results
artifact: ${{self:custom.pkgPyFuncs.buildDir}}/${{self:functions.CacheResults.name}}.zip