Session workspaces
Create and delete the workspaces of a session, which the session starts, stops and deletes.
Last updated
On this page
Description and operation
General
The workspaces of a session are managed workspaces. They are created in the session and stay in it for their whole life. Each one reaches the environment of the session. A session can hold any number of workspaces, for example one for each component of an application.
| Item | Managed workspace |
|---|---|
| Created | In the session. |
| Started and stopped | With the session. A managed workspace cannot be started or stopped on its own. |
| Deleted | In the session, or when the session ends. |
session field | The name of the session. |
A standalone workspace, created outside a session, cannot join a session later. See Workspace types.
Sandboxes
A sandbox created with session is a managed workspace that ends with the session. See Sandboxes.
Quota
Each workspace counts against the owner's quota as a standalone workspace does. See Quota and limits.
Tasks
Create a workspace in a session
Reason for the task: Give the session a workspace that reaches the services of its environment.
Job set-up
- Access: you.
- References:
POST /v1/sessions/{id}/workspaces.
Procedure
Create the workspace. Called from a session,
workspace_createcreates it in that session.kl.sessions.create_workspace(session="dev", workspace="backend", quota_gb=20)await kl.sessions.createWorkspace({ session: "dev", workspace: "backend", quotaGb: 20 });if _, err := kl.Sessions.CreateWorkspace(kloudlite.CreateSessionWorkspace{Session: "dev", CreateWorkspace: kloudlite.CreateWorkspace{Workspace: "backend", QuotaGb: 20}}); err != nil { log.Fatal(err)}kl.sessions.create_workspace(session: "dev", workspace: "backend", quota_gb: 20)kl.sessions().createWorkspace("dev", new Kloudlite.CreateWorkspace().workspace("backend").quotaGb(20));kloudlite sessions create-workspace backend --session dev --quota-gb 20
Close-out
- Make sure that the session's workspaces include the new workspace.
Delete a workspace in a session
Reason for the task: Remove a workspace that the session no longer needs.
Job set-up
- Access: you.
- References:
DELETE /v1/sessions/{id}/workspaces/{workspace}.
The workspace is deleted, and its intercepts in this session are released. Its snapshots remain.
Procedure
Delete the workspace.
kl.sessions.delete_workspace(session="dev", workspace="backend")await kl.sessions.deleteWorkspace({ session: "dev", workspace: "backend" });if err := kl.Sessions.DeleteWorkspace(kloudlite.DeleteSessionWorkspace{Session: "dev", Workspace: "backend"}); err != nil { log.Fatal(err)}kl.sessions.delete_workspace(session: "dev", workspace: "backend")kl.sessions().deleteWorkspace("dev", "backend");kloudlite sessions delete-workspace backend --session dev
Close-out
- Make sure that the session's workspaces no longer include the workspace.
Troubleshooting
| Symptom | Possible cause | Corrective action |
|---|---|---|
409 with backend is managed by session dev; use the session | The call starts, stops or deletes a workspace that belongs to a session. | Control it through its session: stop the session, or delete the workspace in the session. |
404 with not found | The session or workspace does not exist, or is not yours. | Check the name. Use team/name for a team. |