Example #1
0
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 api_response.flavors_create(FLAVORS.create(body['flavor']))

    # nova flavor-list (no details)
    return api_response.flavors_list(FLAVORS.list(), details=False)
Example #2
0
def _route_flavors_id(dummy_tenant_id, flavor_id):
    """
    Route:  /v1.1/<dummy_tenant_id>/flavors/<flavor_id>
    Method: GET, DELETE
    """
    utils.show_request(bottle.request)

    # nova flavor-delete <flavor_id>
    if bottle.request.method == 'DELETE':
        FLAVORS.delete(flavor_id)
        return

    # nova flavor-list
    if flavor_id == 'detail':
        return api_response.flavors_list(FLAVORS.list())

    # nova flavor-show <flavor_id>
    return api_response.flavors_show(FLAVORS.show(flavor_id))