Write a file
The body becomes the file's whole content, put in place at once: a reader sees the old content or the new, never half of each. The body passes on to the sandbox as it comes, a piece at a time: it has no limit of its own (the sandbox's disk is its limit), and the daemon holds a bounded piece of it, never the whole. A body that ends before its length (the caller went away) puts nothing in place. With offset the body is instead written into the file from that position on, in place, and the rest of the file stays as it is: that is how a file is written a piece at a time, and how a part of a file is changed; what came of a body that ended short is written. Directories above it that are missing are made. Idempotency-Key is not looked at. 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}/filesAuthorization
Path parameters
Query parameters
- offsetoptionalinteger
Write the body into the file from this byte on and leave what else the file holds. A file that is not there is made (with
mode; a file that is there keeps its own); a position past the file's end leaves zeros between. Left out: the body takes the place of the file's whole content.format: int64 · minimum: 0
Header parameters
Request bodyOCTET-STREAMoptional
The content, of any length, passed on as it comes.
Returns
204
Written.
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; malformed_request: the content ended before its length, or its chunks are not chunks.
- 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: also a new file in a directory that user cannot write, and a path under /proc or /sys. 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: something on the way to the path leads nowhere: a symbolic link to nothing.
- 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; read_only: the file system is mounted read-only; symlink_loop: the symbolic links on the way lead in a circle; file_busy: a program is running from the file, which cannot be written in place; not_a_regular_file: a pipe, a socket or a device is at the path; sandbox_too_old: offset was given, and the sandbox was made before the node could write at a position; 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.
413
No room. disk_full: the disk is full.
- 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.