SandboxesFiles

Set a file mode

Set the permission bits of path, like chmod.

  • A final symlink is followed. The change is not recursive.
  • Only the owner or root can change a mode. Another user gets 403 permission_denied.
  • Needs write access to the sandbox.
  • Runs in the sandbox as the image user, or as user when set. Setting user needs write access to the sandbox.
  • Served at the access endpoint of the sandbox (access_endpoint of GET /v1/sandboxes/{sandboxId}), not at the API host.
  • A paused sandbox returns 409, unless resume=true. A sandbox that started before its files server existed returns 409 sandbox_update_required until it restarts.
  • A refused operation returns its code as the problem type.
  • A path that starts with ~ or ~/ names the home directory of the user that the operation runs as. ~name returns 422.
PUT
/v1/sandboxes/{sandboxId}/files/mode
AuthorizationBearer <token>

API key starting with tektona_. Create one at app-dev.tektona.ai under API Keys.

In: header

Path Parameters

sandboxId*string

Sandbox ID (ULID)

Query Parameters

resume?boolean

Wake a paused sandbox to serve this request

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

mode*integer

Permission bits as a decimal integer (493 is 0o755)

Formatint32
Range0 <= value <= 4095
path*string

File or directory; a final symlink is followed

Length1 <= length
user?string

Guest user to run as, by name or uid; defaults to the image user. Only the owner or root can change a mode

Match^[a-z_][a-z0-9_-]{0,31}$|^[0-9]{1,10}$

Response Body

application/json

application/problem+json

curl -X PUT "https://example.com/v1/sandboxes/string/files/mode" \  -H "Content-Type: application/json" \  -d '{    "mode": 0,    "path": "string"  }'
{  "entry": {    "gid": 0,    "group": "string",    "mode": 0,    "modified_at": "2019-08-24T14:15:22Z",    "name": "string",    "owner": "string",    "path": "string",    "size": 0,    "symlink_target": "string",    "type": "file",    "uid": 0  }}

Read file content GET

Stream the file bytes, at any size. - An unconditioned read of a file up to 1 MiB has a strong `ETag`. - A `Range` response has no `ETag`, unless `If-Range` carries the strong `ETag` of the file. Then the range comes with the `ETag`, and a file that changed meanwhile gets the whole file with 200. - `If-Range` with a date, a weak `ETag` or a file above 1 GiB always gets the whole file. See [Read files](https://docs.tektona.ai/files#read-files) in the guide.

Set a file owner PUT

Set the owner, the group, or both of `path`, like `chown`. - `owner` and `group` take a name from `/etc/passwd` or `/etc/group` of the sandbox, or a number. - An empty `owner` or `group` keeps it. Both empty, or an unknown name, returns 422 `invalid_argument`. - A final symlink is followed. The change is not recursive. - Only root can change the owner. The owner can change the group only to one of its own groups. Anything else gets 403 `permission_denied`. - Needs write access to the sandbox. - Runs in the sandbox as the image user, or as `user` when set. Setting `user` needs write access to the sandbox. - Served at the access endpoint of the sandbox (`access_endpoint` of `GET /v1/sandboxes/{sandboxId}`), not at the API host. - A paused sandbox returns 409, unless `resume=true`. A sandbox that started before its files server existed returns 409 `sandbox_update_required` until it restarts. - A refused operation returns its code as the problem type. - A path that starts with `~` or `~/` names the home directory of the user that the operation runs as. `~name` returns 422.