{"id":23421222,"url":"https://github.com/nhsdigital/spine-core-aws-common","last_synced_at":"2025-03-17T16:11:05.185Z","repository":{"id":39492334,"uuid":"376865805","full_name":"NHSDigital/spine-core-aws-common","owner":"NHSDigital","description":"Common code used across Spine projects in AWS","archived":false,"fork":false,"pushed_at":"2025-01-15T10:19:48.000Z","size":523,"stargazers_count":12,"open_issues_count":9,"forks_count":9,"subscribers_count":11,"default_branch":"develop","last_synced_at":"2025-03-02T13:11:46.927Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NHSDigital.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-14T15:09:50.000Z","updated_at":"2025-01-15T09:51:33.000Z","dependencies_parsed_at":"2025-01-13T15:32:50.951Z","dependency_job_id":"c8477902-ded9-4744-90ab-a848ca467fce","html_url":"https://github.com/NHSDigital/spine-core-aws-common","commit_stats":{"total_commits":206,"total_committers":17,"mean_commits":"12.117647058823529","dds":0.6699029126213591,"last_synced_commit":"d9b6d56f33803c6cc0afb9c12f5ed8cf4e7c9f8e"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fspine-core-aws-common","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fspine-core-aws-common/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fspine-core-aws-common/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fspine-core-aws-common/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NHSDigital","download_url":"https://codeload.github.com/NHSDigital/spine-core-aws-common/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066180,"owners_count":20392406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-23T02:14:28.036Z","updated_at":"2025-03-17T16:11:05.153Z","avatar_url":"https://github.com/NHSDigital.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spine-core-aws-common\n\nCommon code used across Spine projects in AWS\n\n## Installation\n\nSimply add the pre-built package to your python environment.\n\nThe latest version can be obtained with the following curl command if your system has it present:\n\n```\npackage_version=$(curl -SL https://github.com/NHSDigital/spine-core-aws-common/releases/latest | grep -Po 'Release v\\K(\\d+.\\d+.\\d+)' | head -n1)\n```\n\nOr you can set a specific version:\n\n```\npackage_version=\"0.2.3\"\n```\n\nAlternatively the main page of this repo will display the latest version i.e. 0.2.3, and previous versions can be searched, which you can substitute in place of `${package_version}` in the below commands.\n\n### PIP\n\n```\npip install https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl\n```\n\n### requirements.txt\n\n```\nhttps://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl\n```\n\n### Poetry\n\n```\npoetry add https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl\n```\n\n## Usage\n\nTBC\n\nQuick example\n\n```python\nfrom spine_aws_common import LambdaApplication\n\nclass MyApp(LambdaApplication):\n    def initialise(self):\n        # initialise\n        return\n\n    def start(self):\n        # do actual work\n        # to set response for the lambda\n        self.response = '{\"my new response\":true}'\n        return\n\n# create instance of class in global space\n# this ensures initial setup of logging/config is only done on cold start\napp = MyApp(additional_log_config='/path/to/mylogconfig.cfg')\n\ndef lambda_handler(event, context):\n    return app.main(event, context)\n```\n\nAPI Gateway example\n\n```python\nfrom spine_aws_common import APIGatewayApplication\nfrom aws_lambda_powertools.event_handler.api_gateway import Response\n\nclass MyApp(APIGatewayApplication):\n    def get_hello(self):\n        return Response(\n            status_code=200, content_type=\"application/json\", body='{\"hello\":\"world\"}'\n        )\n\n    def get_id(self, _id):\n        response_dict = {\"id\": _id}\n        return Response(\n            status_code=200,\n            content_type=\"application/json\",\n            body=json.dumps(response_dict),\n        )\n\n    def configure_routes(self):\n        self._add_route(self.get_hello, \"/hello\")\n        self._add_route(self.get_id, \"/id/\u003c_id\u003e\")\n\n# create instance of class in global space\n# this ensures initial setup of logging/config is only done on cold start\napp = MyApp(additional_log_config='/path/to/mylogconfig.cfg')\n\ndef lambda_handler(event, context):\n    return app.main(event, context)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhsdigital%2Fspine-core-aws-common","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhsdigital%2Fspine-core-aws-common","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhsdigital%2Fspine-core-aws-common/lists"}