feat: implement workspace runtime selection

This commit is contained in:
2024-12-02 09:38:01 +00:00
parent daf9bab49f
commit a92f5e8189
11 changed files with 268 additions and 119 deletions

View File

@@ -10,6 +10,7 @@ import (
type createWorkspaceRequestBody struct {
ImageID string `json:"imageId"`
Runtime string `json:"runtime"`
}
type updateWorkspaceRequestBody struct {
@@ -79,6 +80,7 @@ func createWorkspace(c echo.Context, workspaceName string) error {
w, err := mgr.createWorkspace(c.Request().Context(), createWorkspaceOptions{
name: workspaceName,
imageID: body.ImageID,
runtime: body.Runtime,
})
if err != nil {
if errors.Is(err, errImageNotFound) {
@@ -164,3 +166,12 @@ func deleteWorkspacePortMapping(c echo.Context) error {
return c.NoContent(http.StatusOK)
}
func fetchWorkspaceRuntimes(c echo.Context) error {
mgr := workspaceManagerFrom(c)
runtimes, err := mgr.findAvailableWorkspaceRuntimes(c.Request().Context())
if err != nil {
return err
}
return c.JSON(http.StatusOK, runtimes)
}