From 9d0d6ccf8a7112db72966a85e49dc690d28011d8 Mon Sep 17 00:00:00 2001 From: Alex Oladele Date: Wed, 29 Apr 2020 22:14:46 -0400 Subject: [PATCH] Add AWS lambda lib --- .gitignore | 2 +- .idea/groupme-facts-bot.iml | 2 +- .idea/misc.xml | 2 +- config.yaml | 39 +++++++++++++++++++++++++++++++++++++ event.json | 4 ++++ requirements.txt | 3 ++- service.py | 8 ++++++++ 7 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 config.yaml create mode 100644 event.json create mode 100644 service.py diff --git a/.gitignore b/.gitignore index 2327987..a129050 100644 --- a/.gitignore +++ b/.gitignore @@ -128,6 +128,6 @@ fabric.properties resouces/facts.txt -secrets.yaml +secrets.local resources/facts.txt diff --git a/.idea/groupme-facts-bot.iml b/.idea/groupme-facts-bot.iml index d5733cf..e98566c 100644 --- a/.idea/groupme-facts-bot.iml +++ b/.idea/groupme-facts-bot.iml @@ -4,7 +4,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index b5f1628..4c9fb1f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..282d3a6 --- /dev/null +++ b/config.yaml @@ -0,0 +1,39 @@ +region: us-east-1 + +function_name: avan_facts_bot +handler: service.handler +description: Random Avan facts vis groupme +runtime: python3.8 +# role: lambda_basic_execution + +# S3 upload requires appropriate role with s3:PutObject permission +# (ex. basic_s3_upload), a destination bucket, and the key prefix +# bucket_name: 'example-bucket' +# s3_key_prefix: 'path/to/file/' + +# if access key and secret are left blank, boto will use the credentials +# defined in the [default] section of ~/.aws/credentials. +aws_access_key_id: ${AWS_TOKEN_ID} +aws_secret_access_key: ${AWS_TOKEN} + +# dist_directory: dist +# timeout: 15 +# memory_size: 512 +# concurrency: 500 +# + +# Experimental Environment variables +environment_variables: + BOT_NAME: ${BOT_NAME} + GROUPME_KEY: ${GROUPME_KEY} + +# If `tags` is uncommented then tags will be set at creation or update +# time. During an update all other tags will be removed except the tags +# listed here. +#tags: +# tag_1: foo +# tag_2: bar + +# Build options +build: + source_directories: lib # a comma delimited list of directories in your project root that contains source to package. diff --git a/event.json b/event.json new file mode 100644 index 0000000..f5ac7c2 --- /dev/null +++ b/event.json @@ -0,0 +1,4 @@ +{ + "pi": 3.14, + "e": 2.718 +} diff --git a/requirements.txt b/requirements.txt index 140019e..129e358 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ GroupyAPI -pytest \ No newline at end of file +pytest +python-lambda \ No newline at end of file diff --git a/service.py b/service.py new file mode 100644 index 0000000..f04dba3 --- /dev/null +++ b/service.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- + + +def handler(event, context): + # Your code goes here! + e = event.get("e") + pi = event.get("pi") + return e + pi