{ "info": { "author": "Ryan Scott Brown", "author_email": "sb@ryansb.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6" ], "description": "## cfn_resource.py\n\nThis project is a decorator and validation system that takes the drudgery out\nof writing custom resources. You still have access to the context and event as\nnormal, but the decorator handles serializing your response and communicating\nresults to CloudFormation.\n\nSee [cfn-lambda](https://github.com/andrew-templeton/cfn-lambda) from Andrew\nTempleton if you're looking to write your custom resources in Node.js.\n\n## Usage\n\n1. Copy `cfn_resource.py` into the directory of your lambda function handler.py\n1. Use the `cfn_resource.Resource` event decorators to decorate your handler\n like in `example.py`\n1. Zip up the contents and upload to Lambda\n\nOnce the function is up, copy its ARN and use it as the ServiceToken for your\n[custom resource][rsrc]. For more on the requests you may receive, see\n[this document][reqdocs]\n\n```json\n{\n \"AWSTemplateFormatVersion\": \"2010-09-09\",\n \"Resources\": {\n \"FakeThing\": {\n \"Type\": \"Custom::MyResource\",\n \"Properties\": {\n \"ServiceToken\": \"arn:aws:lambda:SOME-REGION:ACCOUNT:function:FunctionName\",\n \"OtherThing\": \"foobar\",\n \"AnotherThing\": 2\n }\n }\n }\n}\n```\n\nFor more on how custom resources work, see the [AWS docs][docs]\n\n## Code Sample\n\nFor this example, you need to have your handler in Lambda set as\n`filename.handler` where filename has the below contents.\n\n```\nimport cfn_resource\n\n# set `handler` as the entry point for Lambda\nhandler = cfn_resource.Resource()\n\n@handler.create\ndef create_thing(event, context):\n # do some stuff\n return {\"PhysicalResourceId\": \"arn:aws:fake:myID\"}\n\n@handler.update\ndef update_thing(event, context):\n # do some stuff\n return {\"PhysicalResourceId\": \"arn:aws:fake:myID\"}\n```\n\n## Running Tests\n\nTo run the tests locally, you need Python 2.7 and `pip`. Ideally, you should\nuse a virtualenv.\n\n```\n$ pip install -r test-requirements.txt\n$ py.test\n```\n\nThe tests use `mock` and `py.test` and will give you a terminal coverage\nreport. Currently the tests cover ~90% of the (very small) codebase.\n\n## License\n\nThis code is released under the MIT software license, see LICENSE.txt for\ndetails. No warranty of any kind is included, and the copyright notice must be\nincluded in redistributions.\n\n[rsrc]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html\n[docs]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html\n[reqdocs]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref-requests.html\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ryansb/cfn-wrapper-python", "keywords": "cloudformation aws cloud custom resource amazon", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cfn_resource", "package_url": "https://pypi.org/project/cfn_resource/", "platform": "", "project_url": "https://pypi.org/project/cfn_resource/", "project_urls": { "Homepage": "https://github.com/ryansb/cfn-wrapper-python" }, "release_url": "https://pypi.org/project/cfn_resource/0.2.3/", "requires_dist": null, "requires_python": "", "summary": "Wrapper decorators for building CloudFormation custom resources", "version": "0.2.3" }, "last_serial": 2963141, "releases": { "0.2.1": [ { "comment_text": "built for Linux-4.2.8-200.fc22.x86_64-x86_64-with-glibc2.3", "digests": { "md5": "1b6f6bdbd4f6c01e11cc2f8eafc85b34", "sha256": "da6e727a19dc9f600981027ef469643c46dc8ebcb26695a47f5cd66f6478f372" }, "downloads": -1, "filename": "cfn_resource-0.2.1.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "1b6f6bdbd4f6c01e11cc2f8eafc85b34", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 4767, "upload_time": "2016-01-29T17:43:24", "url": "https://files.pythonhosted.org/packages/eb/e8/26ec9572455cf59207f8b0f552748d84d01305480bedcc56ccf8296b2d79/cfn_resource-0.2.1.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "2307abb50dc0be3840200abaa5a21ce9", "sha256": "d581e51d0a3d4c969a55485ce02de7bc55b2bbe2e7c1e6873628f96ba5d8e9ac" }, "downloads": -1, "filename": "cfn_resource-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2307abb50dc0be3840200abaa5a21ce9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4591, "upload_time": "2016-01-29T17:38:21", "url": "https://files.pythonhosted.org/packages/eb/0e/23b4c160ceba62254b0f8adb658902a2fb19176710d126115fed344ef433/cfn_resource-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "61fc7472a550de51be47981944fcce1e", "sha256": "48b4e46000fab859ad29bc7c4c763575d5384eff78070f05d614892efecb51c0" }, "downloads": -1, "filename": "cfn_resource-0.2.2.tar.gz", "has_sig": false, "md5_digest": "61fc7472a550de51be47981944fcce1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4902, "upload_time": "2016-01-29T17:50:43", "url": "https://files.pythonhosted.org/packages/c7/aa/5a82724feb5166285a2220703159d2f2c7affd6496eae6d14c828dd2788d/cfn_resource-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "0b9ecd61cb7592ce22658ce58c05300c", "sha256": "6326f20197f33c1238f327841b8e219203acd7411315549643eb4870e17f1923" }, "downloads": -1, "filename": "cfn_resource-0.2.3.tar.gz", "has_sig": false, "md5_digest": "0b9ecd61cb7592ce22658ce58c05300c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4888, "upload_time": "2017-06-20T20:35:47", "url": "https://files.pythonhosted.org/packages/f0/98/313292b9764a98824e613367bd5b7e061c93c77985d277ee324823b8c43a/cfn_resource-0.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0b9ecd61cb7592ce22658ce58c05300c", "sha256": "6326f20197f33c1238f327841b8e219203acd7411315549643eb4870e17f1923" }, "downloads": -1, "filename": "cfn_resource-0.2.3.tar.gz", "has_sig": false, "md5_digest": "0b9ecd61cb7592ce22658ce58c05300c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4888, "upload_time": "2017-06-20T20:35:47", "url": "https://files.pythonhosted.org/packages/f0/98/313292b9764a98824e613367bd5b7e061c93c77985d277ee324823b8c43a/cfn_resource-0.2.3.tar.gz" } ] }