Skip to content

Latest commit

 

History

History
658 lines (465 loc) · 10.4 KB

demo.md

File metadata and controls

658 lines (465 loc) · 10.4 KB

API DOC

TOC

/config/addTask

AddTask adds a task to the Config

github.com/mh-cbon/backup/api.TestConfigAddTask

TestConfigAddTask add a task to the configuration.

[200] POST /config/addTask

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Data": {
        "Dest": "Dest",
        "Name": "Name",
        "Source": "Source"
    },
    "Errors": null,
    "Res": true
}

TOP


github.com/mh-cbon/backup/api.TestConfigAddTaskAlreadyExisting

TestConfigAddTask fail to add a task already existing.

[200] POST /config/addTask

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Errors": {
        "Name": "Task name already exists"
    },
    "Res": false
}

TOP


/config/read

Read loads the Config

github.com/mh-cbon/backup/api.TestConfigRead

TestConfigRead read the configuration.

[200] GET /config/read

Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Tasks": [
        {
            "Dest": "Dest",
            "Name": "Name",
            "Source": "Source"
        }
    ]
}

TOP


/config/rmTask

RmTask removes a task from the Config

github.com/mh-cbon/backup/api.TestConfigRmTask

TestConfigRmTask remove a task from the config.

[200] POST /config/rmTask

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Errors": null,
    "Res": true
}

TOP


github.com/mh-cbon/backup/api.TestConfigRmUnknownTask

TestConfigRmUnknownTask fail to remove unknown task.

[200] POST /config/rmTask

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Errors": {
        "Name": "Task not found"
    },
    "Res": false
}

TOP


/config/tasks

ListTasks lists configured tasks

github.com/mh-cbon/backup/api.TestConfigListTasks

TestConfigListTasks read configured tasks.

[200] GET /config/tasks

Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Data": [
        {
            "Dest": "Dest",
            "Name": "Name",
            "Source": "Source"
        }
    ],
    "Errors": null,
    "Res": true
}

TOP


/disksinfo

github.com/mh-cbon/backup/api.TestDiskInfo

TestDiskInfo lists available partitions on the computer.

[200] GET /disksinfo

Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Data": [
        {
            "IsRemovable": false,
            "Label": "fake",
            "MountPath": "",
            "Path": "",
            "Size": "",
            "SpaceLeft": ""
        }
    ],
    "Errors": null,
    "Res": true
}

TOP


github.com/mh-cbon/backup/api.TestDiskInfoFailure

TestDiskInfoFailure fail to read the computer partition list.

[200] GET /disksinfo

Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Errors": "DiskInfo loading failed Disk info was not loaded ",
    "Res": false
}

TOP


/tasks/list

github.com/mh-cbon/backup/api.TestTaskList

TestTaskList returns a list of active tasks.

[200] GET /tasks/list

Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Data": [
        {
            "Dest": "",
            "ETA": "",
            "EndDate": "",
            "Failure": null,
            "Messages": null,
            "Name": "xxxx",
            "Percent": "",
            "Source": "",
            "StartDate": "",
            "Started": false
        }
    ],
    "Errors": null,
    "Res": true
}

TOP


/tasks/start

github.com/mh-cbon/backup/api.TestListRunningTasks

TestListRunningTasks liasts running tasks.

[200] POST /tasks/start

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Data": {
        "Dest": "Dest",
        "ETA": "",
        "EndDate": "",
        "Failure": null,
        "Messages": null,
        "Name": "Name",
        "Percent": "",
        "Source": "Source",
        "StartDate": "",
        "Started": true
    },
    "Errors": null,
    "Res": true
}

TOP


github.com/mh-cbon/backup/api.TestStartTaskAlreadyStarted

TestStartTaskAlreadyStarted fails to start the same task twice.

[200] POST /tasks/start

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Errors": "Task was not started: Task not started \"Name\"",
    "Res": false
}

TOP


github.com/mh-cbon/backup/api.TestStartUnknownTask

TestStartUnknownTask fails to start an unknown task.

[200] POST /tasks/start

Request Body
{
    "Dest": "",
    "Name": "nop nop",
    "Source": ""
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Errors": {
        "Name": "Task not found"
    },
    "Res": false
}

TOP


github.com/mh-cbon/backup/api.TestTaskStart

TestTaskStart starts a task.

[200] POST /tasks/start

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Data": {
        "Dest": "Dest",
        "ETA": "",
        "EndDate": "",
        "Failure": null,
        "Messages": null,
        "Name": "Name",
        "Percent": "",
        "Source": "Source",
        "StartDate": "",
        "Started": true
    },
    "Errors": null,
    "Res": true
}

TOP


/tasks/stop

github.com/mh-cbon/backup/api.TestStopTaskNotStarted

TestStopTaskNotStarted fails to stop a task not yet started.

[200] POST /tasks/stop

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Errors": "Task was not found: Task not stopped \"Name\"",
    "Res": false
}

TOP


github.com/mh-cbon/backup/api.TestStopUnknownTask

TestStopUnknownTask fails to stop unknown task.

[200] POST /tasks/stop

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Errors": "Task was not found: Task not stopped \"Name\"",
    "Res": false
}

TOP


github.com/mh-cbon/backup/api.TestTaskStop

TestTaskStop stop a task.

[200] POST /tasks/stop

Request Body
{
    "Dest": "Dest",
    "Name": "Name",
    "Source": "Source"
}
Response Headers
Key Value
Content-Type [text/plain; charset=utf-8]
Response Body
{
    "Data": {
        "Dest": "Dest",
        "ETA": "",
        "EndDate": "",
        "Failure": null,
        "Messages": null,
        "Name": "Name",
        "Percent": "",
        "Source": "Source",
        "StartDate": "",
        "Started": false
    },
    "Errors": null,
    "Res": true
}

TOP