A connection the sandbox opens, for the SSH gateway's port forwards (WebSocket)
A TCP connection the guest opens, from inside the sandbox, to host:port, and a WebSocket whose binary messages are its bytes both ways: what the SSH gateway makes of each connection a client's port forward asks for (ssh -L <port>:<the sandbox's forward socket>, a SOCKS proxy into the sandbox). Because the guest does the connecting, a service the sandbox binds on 127.0.0.1 is reached, a connection to the internet leaves as the sandbox's own and is counted as its egress, and the sandbox's egress rules decide it as they decide any connection it makes: what they refuse is refused, and nothing the sandbox cannot reach is reached (not the node, not the host's other addresses, not other sandboxes, not private ranges). A refusal comes before the upgrade: connect_failed with the guest's reason. The client's text message ForwardEof says it sends no more: the guest half-closes the connection, and what the peer still sends comes back. The server closes with 1000 when the peer closes, and when nothing passed either way for ssh_forwards.idle_seconds of GET /internal/node. A sandbox has at most ssh_forwards.per_sandbox of these open at once. Wakes the sandbox, and keeps it awake while open. Opened only with a session token of the forward scope, which the node's SSH gateway is given for each session (POST /internal/ssh/authorize), and a control plane for the sessions of a gateway in front of it: a project cannot have one (POST …/tokens gives forward to the operator alone).
Its messages are in Event streams and terminals.
Takes no key of a project, or a token of the sandbox with forward.
https://api.glac.ai/v1/sandboxes/{id}/connect認証
パスパラメーター
クエリパラメーター
ヘッダーパラメーター
Returns
101
The connection is a WebSocket from here on.
400
The request is not one this call takes. unknown_parameter: the query has a parameter this call does not take; websocket_expected: the request is not a WebSocket upgrade; invalid_field: host or port is missing or out of range.
- 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. needs_forward: it is not a sandbox token (a project's key, the operator's); token_scope: the sandbox token does not carry forward, which only the SSH gateway's sessions' do. 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.
- 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. sandbox_failed: the sandbox is failed; sandbox_too_old: the sandbox was made before the node could do this.
- 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.
502
connect_failed: the guest could not open the connection; the message has its reason (does not resolve, or [errno N]: 111 nothing listens or the sandbox's rules refused it, 113 or 101 no way there, 110 no answer within 10 seconds).
- 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
too_many_forwards: the sandbox has ssh_forwards.per_sandbox of these open already; one more when one ends. Retryable.
- 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.