Example #1
0
File: api.py Project: tpot/dwarf
def _route_flavors(dummy_tenant_id):
    """
    Route:  /v1.1/<dummy_tenant_id>/flavors
    Method: GET, POST
    """
    utils.show_request(bottle.request)

    # nova flavor-create
    if bottle.request.method == 'POST':
        body = json.load(bottle.request.body)
        return {'flavor': FLAVORS.create(body['flavor'])}

    # nova flavor-list (no details)
    return {'flavors': FLAVORS.list(detail=False)}