-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathlambda_helpers.py
69 lines (63 loc) · 2.37 KB
/
lambda_helpers.py
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
class MockLambdaContext(object):
aws_request_id = 'a3de505e-f16b-42f4-b3e6-bcd2e4a73903'
log_stream_name = '2015/10/26/[$LATEST]c71058d852474b9895a0f221f73402ad'
invoked_function_arn = 'arn:aws:lambda:us-west-2:123456789012:function:ExampleCloudFormationStackName-ExampleLambdaFunctionResourceName-AULC3LB8Q02F'
client_context = None
log_group_name = '/aws/lambda/ExampleCloudFormationStackName-ExampleLambdaFunctionResourceName-AULC3LB8Q02F'
function_name = 'ExampleCloudFormationStackName-ExampleLambdaFunctionResourceName-AULC3LB8Q02F'
function_version = '$LATEST'
identity = {}
memory_limit_in_mb = 128
def get_remaining_time_in_millis(self):
v = int(10000)
print(type(v))
return v
class MockLambdaEvents(object):
cloudformation_creation = {
"StackId": "arn:aws:cloudformation:us-west-2:EXAMPLE/stack-name/guid",
"ResponseURL": "http://pre-signed-S3-url-for-response",
"ResourceProperties": {
"StackName": "stack-name",
"List": [
"1",
"2",
"3"
]
},
"RequestType": "Create",
"ResourceType": "Custom::TestResource",
"RequestId": "unique id for this create request",
"LogicalResourceId": "MyTestResource"
}
cloudformation_update = {
"StackId": "arn:aws:cloudformation:us-west-2:EXAMPLE/stack-name/guid",
"ResponseURL": "http://pre-signed-S3-url-for-response",
"ResourceProperties": {
"StackName": "stack-name",
"List": [
"1",
"2",
"3"
]
},
"RequestType": "Update",
"ResourceType": "Custom::TestResource",
"RequestId": "unique id for this create request",
"LogicalResourceId": "MyTestResource"
}
cloudformation_deletion = {
"StackId": "arn:aws:cloudformation:us-west-2:EXAMPLE/stack-name/guid",
"ResponseURL": "http://pre-signed-S3-url-for-response",
"ResourceProperties": {
"StackName": "stack-name",
"List": [
"1",
"2",
"3"
]
},
"RequestType": "Delete",
"ResourceType": "Custom::TestResource",
"RequestId": "unique id for this create request",
"LogicalResourceId": "MyTestResource"
}