downtoearth package

Submodules

downtoearth.cli module

downtoearth creates terraform files from api configuration definitions.

downtoearth.cli.parse_args()[source]

Parse arguments.

downtoearth.cli.main()[source]

Build template and output to file.

downtoearth.default module

Define defaults used in downtoearth.

downtoearth.exceptions module

Exceptions for downtoearth.

These are helpers provided so that you can raise proper HTTP code errors from your API.

Usage:
from downtoearth.exceptions import NotFoundException raise NotFoundException(‘your princess is in another castle’)
exception downtoearth.exceptions.BadRequestException(msg)[source]

Bases: exceptions.Exception

exception downtoearth.exceptions.ConflictException(msg)[source]

Bases: exceptions.Exception

exception downtoearth.exceptions.InternalServerErrorException(msg)[source]

Bases: exceptions.Exception

exception downtoearth.exceptions.NotFoundException(msg)[source]

Bases: exceptions.Exception

exception downtoearth.exceptions.NotImplementedException(msg)[source]

Bases: exceptions.Exception

downtoearth.model module

downtoearth API model.

class downtoearth.model.ApiModel(args)[source]

Bases: object

downtoearth data model.

get_endpoints()[source]

Get all paths that contain methods.

get_api_template_variables()[source]

Get API template variables.

render_terraform()[source]

Return a rendered terraform template.

run_stage_deployments()[source]
run_terraform()[source]

Return a apply terraform after template rendered.

class downtoearth.model.UrlTree[source]

Bases: object

process_url(url, methods)[source]
traverse_tree(node, depth=0)[source]
get_endpoints()[source]
class downtoearth.model.UrlNode(url, methods=None, parent=None)[source]

Bases: object

prefix
url_name
full_url
get_endpoint_info(api_name)[source]
append_methods(methods)[source]
add_child(url, methods=None)[source]
is_leaf()[source]
is_root()[source]
get_child(value)[source]
has_child(value)[source]
is_variable()[source]

downtoearth.router module

Router helper for API’s using downtoearth.

class downtoearth.router.Router(route_map=None, param_order=None)[source]

Bases: object

Routing object for given route_map.

Parameters:
  • route_map (optional[dict]) –

    map of route to delegate ex.

    map = {
    “GET:/v1/book”: get_all, “POST:/v1/book”: post_book, “GET:/v1/book/{isbn}”: get_book, “PUT:/v1/book/{isbn}”: update_book, “DELETE:/v1/book/{isbn}”: remove_book

    }

  • param_order (optional[list]) – order of precedence for parameters This should include all three parameter types. ex. [‘path’, ‘querystring’, ‘body’] defaults to [‘path’, ‘body’, ‘querystring’]
DEFAULTS = {'param_order': ['path', 'body', 'querystring']}
add_full_route(route, delegate)[source]

Add route given route and delegate function.

Parameters:
  • route (str) – route in format “VERB:route/{variables}”
  • delegate (func) – function to call
add_route(verb, path, delegate)[source]

Add route given verb, path, delegate function.

Parameters:
  • verb (str) – HTTP verb ex. GET, POST
  • path (str) – path
  • delegate (func) – function to call
route_request(event, context)[source]

Route incoming request.

downtoearth.test module

downtoearth.version module

Package version will be written by setup.py.

Module contents