File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- ## cfn_wrapper .py
1+ ## cfn_resource .py
22
33This project is a decorator and validation system that takes the drudgery out
44of writing custom resources. You still have access to the context and event as
@@ -10,9 +10,9 @@ Templeton if you're looking to write your custom resources in Node.js.
1010
1111## Usage
1212
13- 1 . Copy ` cfn_wrapper .py` into the directory of your lambda function handler
14- 1 . Use the ` cfn_resource ` decorator to decorate your handler like in
15- ` example.py `
13+ 1 . Copy ` cfn_resource .py` into the directory of your lambda function handler.py
14+ 1 . Use the ` cfn_resource.Resource ` event decorators to decorate your handler
15+ like in ` example.py `
16161 . Zip up the contents and upload to Lambda
1717
1818Once the function is up, copy its ARN and use it as the ServiceToken for your
@@ -39,16 +39,24 @@ For more on how custom resources work, see the [AWS docs][docs]
3939
4040## Code Sample
4141
42+ For this example, you need to have your handler in Lambda set as
43+ ` filename.handler ` where filename has the below contents.
44+
4245```
43- import cfn_wrapper
46+ import cfn_resource
4447
4548# set `handler` as the entry point for Lambda
46- handler = cfn_wrapper .Resource()
49+ handler = cfn_resource .Resource()
4750
4851@handler.create
4952def create_thing(event, context):
5053 # do some stuff
5154 return {"PhysicalResourceId": "arn:aws:fake:myID"}
55+
56+ @handler.update
57+ def update_thing(event, context):
58+ # do some stuff
59+ return {"PhysicalResourceId": "arn:aws:fake:myID"}
5260```
5361
5462## License
You can’t perform that action at this time.
0 commit comments