Ejemplo n.º 1
0
def _route_servers(dummy_tenant_id):
    """
    Route:  /v1.1/<dummy_tenant_id>/servers
    Method: GET, POST
    """
    utils.show_request(bottle.request)

    # nova boot
    if bottle.request.method == 'POST':
        body = json.load(bottle.request.body)
        return api_response.servers_boot(SERVERS.boot(body['server']))

    # nova list (no details)
    return api_response.servers_list(SERVERS.list(), details=False)
Ejemplo n.º 2
0
def _route_servers_id(dummy_tenant_id, server_id):
    """
    Route:  /v1.1/<dummy_tenant_id>/servers/<server_id>
    Method: GET, DELETE
    """
    utils.show_request(bottle.request)

    # nova delete <server_id>
    if bottle.request.method == 'DELETE':
        SERVERS.delete(server_id)
        return

    # nova list
    if server_id == 'detail':
        return api_response.servers_list(SERVERS.list())

    # nova show <server_id>
    return api_response.servers_show(SERVERS.show(server_id))