Skip to content

[ PUBLIC-API ] Added Start Workspace Route for Gitpod Public API #17851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions components/public-api-server/pkg/apiv1/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,32 @@ func (s *WorkspaceService) StopWorkspace(ctx context.Context, req *connect.Reque
return connect.NewResponse(&v1.StopWorkspaceResponse{}), nil
}

func (s *WorkspaceService) StartWorkspace(ctx context.Context, req *connect.Request[v1.StartWorkspaceRequest]) (*connect.Response[v1.StartWorkspaceResponse], error) {
workspaceID, err := validateWorkspaceID(ctx, req.Msg.GetWorkspaceId())
if err != nil {
return nil, err
}
conn, err := getConnection(ctx, s.connectionPool)
if err != nil {
return nil, err
}

if err != nil {
return nil, err
}

startWorkspaceResult, err := conn.StartWorkspace(ctx, workspaceID, &protocol.StartWorkspaceOptions{})

if err != nil {
return nil, err
}

return connect.NewResponse(&v1.StartWorkspaceResponse{
WorkspaceUrl: startWorkspaceResult.WorkspaceURL,
InstanceId: startWorkspaceResult.InstanceID,
}), nil
}

func (s *WorkspaceService) DeleteWorkspace(ctx context.Context, req *connect.Request[v1.DeleteWorkspaceRequest]) (*connect.Response[v1.DeleteWorkspaceResponse], error) {
workspaceID, err := validateWorkspaceID(ctx, req.Msg.GetWorkspaceId())
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ service WorkspacesService {
// CreateAndStartWorkspace creates a new workspace and starts it.
rpc CreateAndStartWorkspace(CreateAndStartWorkspaceRequest) returns (CreateAndStartWorkspaceResponse) {}

// StartWorkspace starts an existing user's workspace
rpc StartWorkspace(StartWorkspaceRequest) returns (StartWorkspaceResponse) {}

// StopWorkspace stops a running workspace (instance).
// Errors:
// NOT_FOUND: the workspace_id is unkown
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 49 additions & 40 deletions components/public-api/go/experimental/v1/workspaces.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading