balena-supervisor/test/data/device-api-responses.json
Christina Wang 4e206e9c1a
Complete POST /v1/purge unit tests
Connects-to: #1327
Signed-off-by: Christina Wang <christina@balena.io>
2021-02-18 12:25:44 +09:00

214 lines
5.3 KiB
JSON

{
"V1": {
"GET": {
"/healthy": {
"statusCode": 200,
"body": {},
"text": "OK"
},
"/healthy [2]": {
"statusCode": 500,
"body": {},
"text": "Unhealthy"
},
"/apps/2": {
"statusCode": 200,
"body": {
"appId": 2,
"containerId": "abc123",
"commit": "4e380136c2cf56cd64197d51a1ab263a",
"env": {},
"releaseId": 77777
}
},
"/apps/2 [Multiple containers running]": {
"statusCode": 400,
"body": {
"appId": 2,
"containerId": "abc123",
"commit": "4e380136c2cf56cd64197d51a1ab263a",
"env": {},
"releaseId": 77777
}
},
"/apps/2/stop": {
"statusCode": 200,
"body": {
"containerId": "abc123"
}
},
"/apps/2/stop [Multiple containers running]": {
"statusCode": 400,
"body": {
"containerId": "abc123"
}
},
"/device/host-config [Hostname only]": {
"statusCode": 200,
"body": { "network": { "hostname": "foobardevice" } }
},
"/device/host-config [Hostname and proxy]": {
"statusCode": 200,
"body": {
"network": {
"hostname": "foobardevice",
"proxy": {
"ip": "example.org",
"noProxy": ["152.10.30.4", "253.1.1.0/16"],
"port": 1080,
"type": "socks5",
"login": "foo",
"password": "bar"
}
}
}
}
},
"POST": {
"/restart": {
"statusCode": 200,
"body": {},
"text": "OK"
},
"/restart [Invalid Body]": {
"statusCode": 400,
"body": {},
"text": "Missing app id"
},
"/update [204 Response]": {
"statusCode": 204,
"body": {},
"text": "OK"
},
"/update [202 Response]": {
"statusCode": 202,
"body": {},
"text": "OK"
},
"/blink": {
"statusCode": 200,
"body": {},
"text": "OK"
},
"/regenerate-api-key": {
"statusCode": 200,
"body": {}
},
"/purge [200]": {
"statusCode": 200,
"body": { "Data": "OK", "Error": "" }
},
"/purge [400 Invalid/missing appId]": {
"statusCode": 400,
"text": "Invalid or missing appId"
},
"/purge [401 Out of scope]": {
"statusCode": 401,
"body": {
"status": "failed",
"message": "Application is not available"
}
}
},
"PATCH": {
"/host/device-config": {
"statusCode": 200,
"body": {},
"text": "OK"
}
}
},
"V2": {
"GET": {
"/device/vpn": {
"statusCode": 200,
"body": {
"status": "success",
"vpn": {
"enabled": true,
"connected": false
}
}
},
"/applications/1/state": {
"statusCode": 200,
"body": {
"local": {
"1": {
"services": {
"1111": {
"status": "Running",
"releaseId": 99999,
"download_progress": null
},
"2222": {
"status": "Running",
"releaseId": 99999,
"download_progress": null
}
}
}
},
"dependent": {},
"commit": "7fc9c5bea8e361acd49886fe6cc1e1cd"
}
},
"/applications/9000/state": {
"statusCode": 409,
"body": {
"status": "failed",
"message": "Application ID does not exist: 9000"
}
},
"/applications/123invalid/state": {
"statusCode": 400,
"body": {
"status": "failed",
"message": "Invalid application ID: 123invalid"
}
},
"/state/status?desc=single_application": {
"statusCode": 200,
"body": {
"status": "success",
"appState": "applied",
"overallDownloadProgress": null,
"containers": [
{
"appId": 1658654,
"status": "Running",
"serviceName": "main",
"imageId": 2885946,
"serviceId": 640681,
"containerId": "f93d386599d1b36e71272d46ad69770cff333842db04e2e4c64dda7b54da07c6",
"createdAt": "2020-11-13T20:29:44.143Z"
}
],
"images": [
{
"name": "registry2.balena-cloud.com/v2/e2bf6410ffc30850e96f5071cdd1dca8@sha256:e2e87a8139b8fc14510095b210ad652d7d5badcc64fdc686cbf749d399fba15e",
"appId": 1658654,
"serviceName": "main",
"imageId": 2885946,
"dockerImageId": "sha256:4502983d72e2c72bc292effad1b15b49576da3801356f47fd275ba274d409c1a",
"status": "Downloaded",
"downloadProgress": null
}
]
}
},
"/state/status?desc=no_applications": {
"statusCode": 200,
"body": {
"status": "success",
"appState": "applied",
"overallDownloadProgress": null,
"containers": [],
"images": []
}
}
},
"POST": {}
}
}