Files
Scanning the repository...
| Fileslibmotion_aws | |
|---|---|
| .. | |
| sam | |
| MotionSign.py | |
| README.md | |
| deploy.sh | |
| requirements.txt | |
| test.py |
README.mdMotionSign
Setup
To setup the codebase you need to set a python virtual environment, activate it and load the necessary packages.
$ cd lib/motion_aws/ $ virtualenv env --python=python3 $ source env/bin/activate $ pip install -r requirements.txtLambda
To deploy the lambda run the following command from the projects root directory.
You also need to ensure you have the following google API credential files in the motion_aws directory:
- client_secret.json
- credentials.json
$ cd lib/motion_aws/
zip the python file first
ensure you have activated your python environment
$ bash deploy.sh
upload the zipped file to the lambda function
$ cd lib/motion_aws/build/ $ aws lambda update-function-code --function-name MotionSign --zip-file fileb://MotionSign.zip
Using SAM
$ sam local invoke "MotionSign" -e event.json
API Gateway
The API Gateway is already setup to talk to the MotionSign lambda.
The endpoint to hit is: https://tawd2jtko1.execute-api.us-east-1.amazonaws.com/prod/MotionSign
You need to set the x-api-key: {api_key} name/value pair in the headers.
API Endpoints
URL: https://tawd2jtko1.execute-api.us-east-1.amazonaws.com/prod/MotionSign
DISPLAY
- Method: GET
- URL Params
- Required:
room_id=[integer]method_name=display
- Required:
RESERVED
- Method: GET
- URL Params
- Required:
room_id=[integer]reserved=[integer] # values = 1 or 0
- Required:
OCCUPIED
- Method: POST
- URL Params
- Required:
room_id=[integer]occupied=[integer] # values = 1 or 0
- Required: