-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlambda_function.py
More file actions
47 lines (38 loc) · 1.16 KB
/
Copy pathlambda_function.py
File metadata and controls
47 lines (38 loc) · 1.16 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
from moesif_aws_lambda import MoesifLogger
def identify_user(event, context):
return 'my_user_id'
def identify_company(event, context):
return 'my_company_id'
def get_api_version(event, context):
return '1.0.0'
def get_session_token(event, context):
return '23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f'
def get_metadata(event, context):
return { 'foo' : 'aws lambda', 'bar' : 'aws lambda metadata', }
def mask_event(eventmodel):
return eventmodel
def should_skip(event, context):
return "skip" in event['path']
moesif_options = {
'GET_METADATA': get_metadata,
'IDENTIFY_USER': identify_user,
'IDENTIFY_COMPANY': identify_company,
'GET_SESSION_TOKEN': get_session_token,
'GET_API_VERSION': get_api_version,
'MASK_EVENT_MODEL': mask_event,
'LOG_BODY': True,
'DEBUG': True,
'SKIP': should_skip,
}
@MoesifLogger(moesif_options)
def lambda_handler(event, context):
return {
'statusCode': 200,
'isBase64Encoded': False,
'body': {
'msg': 'Hello from Lambda!'
},
'headers': {
'Content-Type': 'application/json'
}
}