Skip to content

Commit

Permalink
Add server endpoints to mock server (#3)
Browse files Browse the repository at this point in the history
* Add server endpoints to mock server
* Clear pre-filled default data
  • Loading branch information
dirkaholic authored Nov 27, 2019
1 parent 12b32c9 commit b7eebe1
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 60 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ A HTTP server based on [JSON Server](https://github.com/typicode/json-server) th
| `GET /vswitch/{vswitch-id}` | [get-vswitch-vswitch-id](https://robot.your-server.de/doc/webservice/de.html#get-vswitch-vswitch-id) |
| `POST /vswitch/{vswitch-id}` | [post-vswitch-vswitch-id](https://robot.your-server.de/doc/webservice/de.html#post-vswitch-vswitch-id) |
| `DELETE /vswitch/{vswitch-id}` | [delete-vswitch-vswitch-id](https://robot.your-server.de/doc/webservice/de.html#delete-vswitch-vswitch-id) |
| `GET /server/{server-ip}` | [get-server-server-ip](https://robot.your-server.de/doc/webservice/de.html#get-server-server-ip) |
| `POST /server/{server-ip}` | [post-server-server-ip](https://robot.your-server.de/doc/webservice/de.html#post-server-server-ip) |


## Authentication
Expand Down
58 changes: 4 additions & 54 deletions src/db.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,8 @@
{
"vswitch": [],
"rescue": [
{
"id": "123.123.123.123",
"server_ip": "123.123.123.123",
"server_number": 321,
"os": [
"linux",
"freebsd",
"vkvm"
],
"arch": [
64,
32
],
"active": false,
"password": null,
"authorized_key": [],
"host_key": []
},
{
"id": "124.124.124.124",
"server_ip": "124.124.124.124",
"server_number": 69,
"os": "linux",
"arch": 64,
"active": true,
"password": "qwertz",
"authorized_key": [
{
"key": {
"fingerprint": "fi:ng:er:pr:in:t0:00:00:00:00:00:00:00:00:00:00",
"name": "admin",
"size": 4096,
"type": "RSA"
}
}
],
"host_key": []
}
],
"reset": [
{
"id": "123.123.123.123",
"server_ip": "123.123.123.123",
"server_number": 111,
"type": [
"power",
"hw",
"man"
],
"operating_status": "running"
}
],
"rescue": [],
"reset": [],
"firewall_template": [],
"firewall": []
"firewall": [],
"server": []
}
3 changes: 2 additions & 1 deletion src/ids.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"firewall": "server_ip",
"rescue": "server_ip",
"reset": "server_ip"
"reset": "server_ip",
"server": "server_ip"
}
4 changes: 3 additions & 1 deletion src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
"/firewall": "/firewall",
"/firewall/:id": "/firewall/:id",
"/vswitch": "/vswitch",
"/vswitch/:id": "/vswitch/:id"
"/vswitch/:id": "/vswitch/:id",
"/server": "/server",
"/server/:id": "/server/:id"
}
33 changes: 29 additions & 4 deletions test/resources.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"vswitch": {
"data": {
"name":"my vSwitch",
"vlan":4000,
"cancelled":"false"
"name": "my vSwitch",
"vlan": 4000,
"cancelled": "false"
}
},
"reset": {
Expand Down Expand Up @@ -69,7 +69,7 @@
},
"rescue": {
"id": "server_ip",
"data": {
"data": {
"server_ip": "123.123.123.123",
"server_number": "123",
"os": [
Expand All @@ -83,5 +83,30 @@
],
"active": "false"
}
},
"server": {
"id": "server_ip",
"data": {
"server_ip": "123.123.123.123",
"server_number": 321,
"server_name": "server1",
"product": "DS 3000",
"dc": "NBG1-DC1",
"traffic": "5 TB",
"flatrate": "true",
"status": "ready",
"throttled": "true",
"cancelled": "false",
"paid_until": "2010-09-02",
"ip": [
"123.123.123.123"
],
"subnet": [
{
"ip": "2a01:4f8:111:4221::",
"mask": "64"
}
]
}
}
}

0 comments on commit b7eebe1

Please sign in to comment.