Docs
SSH ›

Enable template ssh

PUT/v1/templates/{id}/ssh

Turns SSH on for every sandbox made from the template from now on: each has its port opened as it is made, as PUT /v1/sandboxes/{id}/ssh would, and GET /v1/sandboxes/{id}/ssh says where to connect. A port that cannot be opened then does not fail the create: SSH is on, and PUT /v1/sandboxes/{id}/ssh opens it. A sandbox already made is not changed, and no key is let in: that is POST /v1/templates/{id}/ssh/keys. Asked again, it changes nothing.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const template = await agental.templates.get("tpl_0123456789abcdef");
  4. await template.sshOn();
Answer200 OK · TemplateSsh
  1. {
  2. "enabled": boolean,
  3. "enabledAt": string | null,
  4. "keys": [{
  5. "id": string,
  6. "fingerprint": string,
  7. "type": string,
  8. "comment": string | null,
  9. }],
  10. }

SSH is turned on as a sandbox is made.

Path

idrequired
string
e.g. "tpl_0123456789abcdef"

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Returns

200 SSH is turned on as a sandbox is made.

TemplateSsh3 fields
enabled
boolean
Whether a sandbox made from the template has SSH turned on as it is made, as PUT /v1/sandboxes/{id}/ssh would: GET /v1/sandboxes/{id}/ssh then says where to connect.
enabledAt
stringnull
keys
SshKey[]4 fields
The public keys let in to a sandbox's machine as it is made, as POST /v1/sandboxes/{id}/ssh/keys would, in the order they were added.
More At most 50.
id
string
What the key is named by when it is removed: the SHA-256 of the key, written so that it can stand in a path.
fingerprint
string
The same, as ssh-keygen -l prints it.
type
string
comment
stringnull
What follows the key on its line.
More Null when nothing does.

Errors and other answers

403key_action_forbidden the key does not take the action ssh, or it is limited to some sandboxes and not to this template. Nothing was changed.
404 Not found.
501ssh_endpoint_not_configured sandboxes here are not logged in to over SSH. GET /v1/policy says so as ssh. Nothing was changed.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.