architect-functions

Runtime helpers for Architect provisioned AWS Lambda functions


License
Apache-2.0
Install
pip install architect-functions==0.2.0

Documentation

architect-functions-python

Python runtime support for Architect provisioned AWS Lambda functions

Install

cd path/to/lambda
pip install --target ./vendor architect-functions

API

# example lambda function
import json
import arc

def handler():
  return {'body': json.dump(arc.reflect())}

arc

arc.reflect returns a dict of the the current AWS resources.

Example output:

{
  "events": {
    "ping": "arn:aws:sns:us-east-1:555:TestStaging-PingTopic-11111111111",
  },
  "queues": {
    "continuum": "https://sqs.us-east-1.amazonaws.com/555/TestStaging-ContinuumQueue-8888888888"
  },
  "static": {
    "bucket": "teststaging-staticbucket-11111111",
    "fingerprint": "false"
  },
  "tables": {
    "noises": "TestStaging-NoisesTable-111111111"
  },
  "ws": {
    "https": "https://xxx.execute-api.us-east-1.amazonaws.com/production/@connections",
    "wss": "wss://xxx.execute-api.us-east-1.amazonaws.com/production"
  }
}

arc.http

  • arc.http.session_read()
  • arc.http.session_write()

arc.ws

  • arc.ws.send(id, payload)

arc.events

  • arc.events.publish(name, payload)

arc.queues

  • arc.queues.publish(name, payload)

arc.tables

  • arc.tables.name(tablename)

Testing

for i in `ls tests/test_*`; do python3 $i; done

Releasing

python3 setup.py sdist
twine upload dist/*