Rename a script

    Rename a script # noqa: E501

    :param name: Get status of a driver with this name
    :type name: str
    :param rename: The data needed to save this script
    :type rename: dict | bytes

    :rtype: Response

def rename_driver_script(name, rename=None):  # noqa: E501
    """Rename a script

    Rename a script # noqa: E501

    :param name: Get status of a driver with this name
    :type name: str
    :param rename: The data needed to save this script
    :type rename: dict | bytes

    :rtype: Response
    """
    if connexion.request.is_json:
        rename = Rename.from_dict(connexion.request.get_json())  # noqa: E501

    response = errorIfUnauthorized(role='developer')
    if response:
        return response
    else:
        response = ApitaxResponse()

    driver: Driver = LoadedDrivers.getDriver(name)
    if not driver.renameDriverScript(rename.original.name, rename.new.name):
        return ErrorResponse(status=500, message='Cannot rename to an existing file.')

    return Response(status=200, body=response.getResponseBody())