Read a file
The file's bytes, or a part of them, of any length in one call. A file (or the part asked for) of up to 1 MiB is answered as it is; a longer one passes from the sandbox to the caller as it comes, a piece at a time, so that the daemon holds a bounded piece of it and never the whole: its length is said first (Content-Length: what the file holds when it is looked at, from offset, as far as length), and the connection is kept for the next request. A file that becomes shorter while it is read ends the answer short of that length, and the connection with it (409 file_changed where that is seen before anything was sent): read it again. Only a regular file is read: a pipe, a socket or a device is 409 not_a_regular_file. Paths are absolute. The operation is done as the user commands run as, or as user: what that user may not do is refused with 403, and what is created is that user's.
Takes files, or a token of the sandbox with files.
https://api.glac.ai/v1/sandboxes/{id}/files인증
경로 파라미터
쿼리 파라미터
헤더 파라미터
Returns
200
The bytes, always as application/octet-stream. Empty when offset is at or past the end.
400
The request is not one this call takes. missing_path: no path; invalid_path: a path that is not absolute, or one the file system does not take; name_too_long: a name in the path is longer than the file system takes (255 bytes); invalid_field: a field or query parameter has the wrong type or is out of range; unknown_parameter: the query has a parameter this call does not take; no_such_user: user is not a user of the sandbox.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.
401
missing_api_key, invalid_api_key, expired_api_key, invalid_token.
403
The credential may not do this. token_scope: the sandbox token lacks the scope; permission_denied: the user the operation was done as may not. spend_limit_reached: the sandbox is frozen because a spend limit was reached; it sleeps, with its data, until the limit is raised.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.
404
Something the request names does not exist. sandbox_not_found: no such sandbox; file_not_found: nothing at the path.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.
409
The state of something stands in the way. is_a_directory: the path is a directory; not_a_directory: something on the way is not a directory; symlink_loop: the symbolic links on the way lead in a circle; not_a_regular_file: the path leads to a pipe, a socket or a device; file_changed: a file longer than 1 MiB became shorter between the start of its read and the look at its length (try again); sandbox_failed: the sandbox is failed.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.
503
Not now, and nothing was done. body_memory_full: the node holds as much of the bodies of calls as it takes at once, and no room came within 5 seconds; try again in a moment.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.
default
Any other failure, in the same shape. internal (500): the node failed; the message says no more, and the node's log has the reason under the request's id. unavailable (503, retryable): no_capacity, every network slot of the node is in use; memory_full, a machine the call has to start (made, woken, booted from its disk, resumed, rolled back, built) does not fit in the host's memory beside what the machines that run on it are promised, and nothing paused or idle could be put to sleep to make room for it (memory of the node); drive_full, the call would have a template built and the node's data drive has no room for one (drive of the node); unavailable, the node is shutting down, the sandbox was still starting after 10 minutes, or it did not answer, or it is being moved to this node (with Retry-After: 1); fenced, the node's lease fences the sandbox (Node.lease). moved (409): the sandbox was moved to another node, which to names.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.