コード例 #1
0
ファイル: endpoints.py プロジェクト: byronshilly/mateo
def delete_user():
    body = rebar.validated_body

    user = _get_user(body['id'])
    if not user:
        raise errors.NotFound(msg=ResponseMessages.USER_DOESNT_EXIST)

    # Will return true if successful
    if not _delete_user(body['id']):
        raise errors.InternalError(msg=ResponseMessages.COULDNT_DELETE_USER)

    return "", 204 
コード例 #2
0
ファイル: endpoints.py プロジェクト: byronshilly/mateo
def delete_listing():
    body = rebar.validated_body

    listing = _get_listing(body['id'])
    if not listing:
        raise errors.NotFound(msg=ResponseMessages.LISTING_DOESNT_EXIST)

    # Will return true if successful
    if not _delete_listing(body['id']):
        raise errors.InternalError(msg=ResponseMessages.COULDNT_DELETE_LISTING)

    return "", 204
コード例 #3
0
def delete_game():
    body = rebar.validated_body

    game = _get_game(body['id'])
    if not game:
        raise errors.NotFound(msg=ResponseMessages.GAME_DOESNT_EXIST)

    # Will return true if successful
    if not _delete_game(body['id']):
        raise errors.InternalError(msg=ResponseMessages.COULDNT_DELETE_GAME)

    return "", 204
コード例 #4
0
def delete_shipment():
    body = rebar.validated_body

    shipment = _get_shipment(body['id'])
    if not shipment:
        raise errors.NotFound(msg=ResponseMessages.SHIPMENT_DOESNT_EXIST)

    # Will return true if successful
    if not _delete_shipment(body['id']):
        raise errors.InternalError(
            msg=ResponseMessages.COULDNT_DELETE_SHIPMENT)

    return "", 204
コード例 #5
0
def network_copy(device_id):
    body = flask_rebar.get_validated_body()

    to_host_device = body["toHost"]

    payload = {"from_host_id": device_id, "to_host_device": to_host_device}

    function_name = f"{constants.STAGE}-vdo-ops-network_copy"
    response = lambda_client.invoke(FunctionName=function_name,
                                    Payload=json.dumps(payload))
    if "FunctionError" in response:
        raise errors.InternalError(response["FunctionError"])
    return {"success": "successfully copied network settings"}, 202