Path: blob/main/components/public-api/go/experimental/v1/v1connect/workspaces.connect.go
2501 views
// Copyright (c) 2025 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34// Code generated by protoc-gen-connect-go. DO NOT EDIT.5//6// Source: gitpod/experimental/v1/workspaces.proto78package v1connect910import (11context "context"12errors "errors"13connect_go "github.com/bufbuild/connect-go"14v1 "github.com/gitpod-io/gitpod/components/public-api/go/experimental/v1"15http "net/http"16strings "strings"17)1819// This is a compile-time assertion to ensure that this generated file and the connect package are20// compatible. If you get a compiler error that this constant is not defined, this code was21// generated with a version of connect newer than the one compiled into your binary. You can fix the22// problem by either regenerating this code with an older version of connect or updating the connect23// version compiled into your binary.24const _ = connect_go.IsAtLeastVersion0_1_02526const (27// WorkspacesServiceName is the fully-qualified name of the WorkspacesService service.28WorkspacesServiceName = "gitpod.experimental.v1.WorkspacesService"29)3031// WorkspacesServiceClient is a client for the gitpod.experimental.v1.WorkspacesService service.32type WorkspacesServiceClient interface {33// ListWorkspaces enumerates all workspaces belonging to the authenticated user.34ListWorkspaces(context.Context, *connect_go.Request[v1.ListWorkspacesRequest]) (*connect_go.Response[v1.ListWorkspacesResponse], error)35// GetWorkspace returns a single workspace.36GetWorkspace(context.Context, *connect_go.Request[v1.GetWorkspaceRequest]) (*connect_go.Response[v1.GetWorkspaceResponse], error)37// StreamWorkspaceStatus returns workspace status once it changed.38StreamWorkspaceStatus(context.Context, *connect_go.Request[v1.StreamWorkspaceStatusRequest]) (*connect_go.ServerStreamForClient[v1.StreamWorkspaceStatusResponse], error)39// GetOwnerToken returns an owner token.40GetOwnerToken(context.Context, *connect_go.Request[v1.GetOwnerTokenRequest]) (*connect_go.Response[v1.GetOwnerTokenResponse], error)41// CreateAndStartWorkspace creates a new workspace and starts it.42CreateAndStartWorkspace(context.Context, *connect_go.Request[v1.CreateAndStartWorkspaceRequest]) (*connect_go.Response[v1.CreateAndStartWorkspaceResponse], error)43// StartWorkspace starts an existing workspace.44StartWorkspace(context.Context, *connect_go.Request[v1.StartWorkspaceRequest]) (*connect_go.Response[v1.StartWorkspaceResponse], error)45// StopWorkspace stops a running workspace (instance).46// Errors:47//48// NOT_FOUND: the workspace_id is unkown49// FAILED_PRECONDITION: if there's no running instance50StopWorkspace(context.Context, *connect_go.Request[v1.StopWorkspaceRequest]) (*connect_go.Response[v1.StopWorkspaceResponse], error)51// DeleteWorkspace deletes a workspace.52// When the workspace is running, it will be stopped as well.53// Deleted workspaces cannot be started again.54DeleteWorkspace(context.Context, *connect_go.Request[v1.DeleteWorkspaceRequest]) (*connect_go.Response[v1.DeleteWorkspaceResponse], error)55UpdatePort(context.Context, *connect_go.Request[v1.UpdatePortRequest]) (*connect_go.Response[v1.UpdatePortResponse], error)56// ListWorkspaceClasses enumerates all available workspace classes.57ListWorkspaceClasses(context.Context, *connect_go.Request[v1.ListWorkspaceClassesRequest]) (*connect_go.Response[v1.ListWorkspaceClassesResponse], error)58// GetDefaultWorkspaceImage returns the default workspace image from different sources.59GetDefaultWorkspaceImage(context.Context, *connect_go.Request[v1.GetDefaultWorkspaceImageRequest]) (*connect_go.Response[v1.GetDefaultWorkspaceImageResponse], error)60}6162// NewWorkspacesServiceClient constructs a client for the gitpod.experimental.v1.WorkspacesService63// service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for64// gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply65// the connect.WithGRPC() or connect.WithGRPCWeb() options.66//67// The URL supplied here should be the base URL for the Connect or gRPC server (for example,68// http://api.acme.com or https://acme.com/grpc).69func NewWorkspacesServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) WorkspacesServiceClient {70baseURL = strings.TrimRight(baseURL, "/")71return &workspacesServiceClient{72listWorkspaces: connect_go.NewClient[v1.ListWorkspacesRequest, v1.ListWorkspacesResponse](73httpClient,74baseURL+"/gitpod.experimental.v1.WorkspacesService/ListWorkspaces",75opts...,76),77getWorkspace: connect_go.NewClient[v1.GetWorkspaceRequest, v1.GetWorkspaceResponse](78httpClient,79baseURL+"/gitpod.experimental.v1.WorkspacesService/GetWorkspace",80opts...,81),82streamWorkspaceStatus: connect_go.NewClient[v1.StreamWorkspaceStatusRequest, v1.StreamWorkspaceStatusResponse](83httpClient,84baseURL+"/gitpod.experimental.v1.WorkspacesService/StreamWorkspaceStatus",85opts...,86),87getOwnerToken: connect_go.NewClient[v1.GetOwnerTokenRequest, v1.GetOwnerTokenResponse](88httpClient,89baseURL+"/gitpod.experimental.v1.WorkspacesService/GetOwnerToken",90opts...,91),92createAndStartWorkspace: connect_go.NewClient[v1.CreateAndStartWorkspaceRequest, v1.CreateAndStartWorkspaceResponse](93httpClient,94baseURL+"/gitpod.experimental.v1.WorkspacesService/CreateAndStartWorkspace",95opts...,96),97startWorkspace: connect_go.NewClient[v1.StartWorkspaceRequest, v1.StartWorkspaceResponse](98httpClient,99baseURL+"/gitpod.experimental.v1.WorkspacesService/StartWorkspace",100opts...,101),102stopWorkspace: connect_go.NewClient[v1.StopWorkspaceRequest, v1.StopWorkspaceResponse](103httpClient,104baseURL+"/gitpod.experimental.v1.WorkspacesService/StopWorkspace",105opts...,106),107deleteWorkspace: connect_go.NewClient[v1.DeleteWorkspaceRequest, v1.DeleteWorkspaceResponse](108httpClient,109baseURL+"/gitpod.experimental.v1.WorkspacesService/DeleteWorkspace",110opts...,111),112updatePort: connect_go.NewClient[v1.UpdatePortRequest, v1.UpdatePortResponse](113httpClient,114baseURL+"/gitpod.experimental.v1.WorkspacesService/UpdatePort",115opts...,116),117listWorkspaceClasses: connect_go.NewClient[v1.ListWorkspaceClassesRequest, v1.ListWorkspaceClassesResponse](118httpClient,119baseURL+"/gitpod.experimental.v1.WorkspacesService/ListWorkspaceClasses",120opts...,121),122getDefaultWorkspaceImage: connect_go.NewClient[v1.GetDefaultWorkspaceImageRequest, v1.GetDefaultWorkspaceImageResponse](123httpClient,124baseURL+"/gitpod.experimental.v1.WorkspacesService/GetDefaultWorkspaceImage",125opts...,126),127}128}129130// workspacesServiceClient implements WorkspacesServiceClient.131type workspacesServiceClient struct {132listWorkspaces *connect_go.Client[v1.ListWorkspacesRequest, v1.ListWorkspacesResponse]133getWorkspace *connect_go.Client[v1.GetWorkspaceRequest, v1.GetWorkspaceResponse]134streamWorkspaceStatus *connect_go.Client[v1.StreamWorkspaceStatusRequest, v1.StreamWorkspaceStatusResponse]135getOwnerToken *connect_go.Client[v1.GetOwnerTokenRequest, v1.GetOwnerTokenResponse]136createAndStartWorkspace *connect_go.Client[v1.CreateAndStartWorkspaceRequest, v1.CreateAndStartWorkspaceResponse]137startWorkspace *connect_go.Client[v1.StartWorkspaceRequest, v1.StartWorkspaceResponse]138stopWorkspace *connect_go.Client[v1.StopWorkspaceRequest, v1.StopWorkspaceResponse]139deleteWorkspace *connect_go.Client[v1.DeleteWorkspaceRequest, v1.DeleteWorkspaceResponse]140updatePort *connect_go.Client[v1.UpdatePortRequest, v1.UpdatePortResponse]141listWorkspaceClasses *connect_go.Client[v1.ListWorkspaceClassesRequest, v1.ListWorkspaceClassesResponse]142getDefaultWorkspaceImage *connect_go.Client[v1.GetDefaultWorkspaceImageRequest, v1.GetDefaultWorkspaceImageResponse]143}144145// ListWorkspaces calls gitpod.experimental.v1.WorkspacesService.ListWorkspaces.146func (c *workspacesServiceClient) ListWorkspaces(ctx context.Context, req *connect_go.Request[v1.ListWorkspacesRequest]) (*connect_go.Response[v1.ListWorkspacesResponse], error) {147return c.listWorkspaces.CallUnary(ctx, req)148}149150// GetWorkspace calls gitpod.experimental.v1.WorkspacesService.GetWorkspace.151func (c *workspacesServiceClient) GetWorkspace(ctx context.Context, req *connect_go.Request[v1.GetWorkspaceRequest]) (*connect_go.Response[v1.GetWorkspaceResponse], error) {152return c.getWorkspace.CallUnary(ctx, req)153}154155// StreamWorkspaceStatus calls gitpod.experimental.v1.WorkspacesService.StreamWorkspaceStatus.156func (c *workspacesServiceClient) StreamWorkspaceStatus(ctx context.Context, req *connect_go.Request[v1.StreamWorkspaceStatusRequest]) (*connect_go.ServerStreamForClient[v1.StreamWorkspaceStatusResponse], error) {157return c.streamWorkspaceStatus.CallServerStream(ctx, req)158}159160// GetOwnerToken calls gitpod.experimental.v1.WorkspacesService.GetOwnerToken.161func (c *workspacesServiceClient) GetOwnerToken(ctx context.Context, req *connect_go.Request[v1.GetOwnerTokenRequest]) (*connect_go.Response[v1.GetOwnerTokenResponse], error) {162return c.getOwnerToken.CallUnary(ctx, req)163}164165// CreateAndStartWorkspace calls gitpod.experimental.v1.WorkspacesService.CreateAndStartWorkspace.166func (c *workspacesServiceClient) CreateAndStartWorkspace(ctx context.Context, req *connect_go.Request[v1.CreateAndStartWorkspaceRequest]) (*connect_go.Response[v1.CreateAndStartWorkspaceResponse], error) {167return c.createAndStartWorkspace.CallUnary(ctx, req)168}169170// StartWorkspace calls gitpod.experimental.v1.WorkspacesService.StartWorkspace.171func (c *workspacesServiceClient) StartWorkspace(ctx context.Context, req *connect_go.Request[v1.StartWorkspaceRequest]) (*connect_go.Response[v1.StartWorkspaceResponse], error) {172return c.startWorkspace.CallUnary(ctx, req)173}174175// StopWorkspace calls gitpod.experimental.v1.WorkspacesService.StopWorkspace.176func (c *workspacesServiceClient) StopWorkspace(ctx context.Context, req *connect_go.Request[v1.StopWorkspaceRequest]) (*connect_go.Response[v1.StopWorkspaceResponse], error) {177return c.stopWorkspace.CallUnary(ctx, req)178}179180// DeleteWorkspace calls gitpod.experimental.v1.WorkspacesService.DeleteWorkspace.181func (c *workspacesServiceClient) DeleteWorkspace(ctx context.Context, req *connect_go.Request[v1.DeleteWorkspaceRequest]) (*connect_go.Response[v1.DeleteWorkspaceResponse], error) {182return c.deleteWorkspace.CallUnary(ctx, req)183}184185// UpdatePort calls gitpod.experimental.v1.WorkspacesService.UpdatePort.186func (c *workspacesServiceClient) UpdatePort(ctx context.Context, req *connect_go.Request[v1.UpdatePortRequest]) (*connect_go.Response[v1.UpdatePortResponse], error) {187return c.updatePort.CallUnary(ctx, req)188}189190// ListWorkspaceClasses calls gitpod.experimental.v1.WorkspacesService.ListWorkspaceClasses.191func (c *workspacesServiceClient) ListWorkspaceClasses(ctx context.Context, req *connect_go.Request[v1.ListWorkspaceClassesRequest]) (*connect_go.Response[v1.ListWorkspaceClassesResponse], error) {192return c.listWorkspaceClasses.CallUnary(ctx, req)193}194195// GetDefaultWorkspaceImage calls gitpod.experimental.v1.WorkspacesService.GetDefaultWorkspaceImage.196func (c *workspacesServiceClient) GetDefaultWorkspaceImage(ctx context.Context, req *connect_go.Request[v1.GetDefaultWorkspaceImageRequest]) (*connect_go.Response[v1.GetDefaultWorkspaceImageResponse], error) {197return c.getDefaultWorkspaceImage.CallUnary(ctx, req)198}199200// WorkspacesServiceHandler is an implementation of the gitpod.experimental.v1.WorkspacesService201// service.202type WorkspacesServiceHandler interface {203// ListWorkspaces enumerates all workspaces belonging to the authenticated user.204ListWorkspaces(context.Context, *connect_go.Request[v1.ListWorkspacesRequest]) (*connect_go.Response[v1.ListWorkspacesResponse], error)205// GetWorkspace returns a single workspace.206GetWorkspace(context.Context, *connect_go.Request[v1.GetWorkspaceRequest]) (*connect_go.Response[v1.GetWorkspaceResponse], error)207// StreamWorkspaceStatus returns workspace status once it changed.208StreamWorkspaceStatus(context.Context, *connect_go.Request[v1.StreamWorkspaceStatusRequest], *connect_go.ServerStream[v1.StreamWorkspaceStatusResponse]) error209// GetOwnerToken returns an owner token.210GetOwnerToken(context.Context, *connect_go.Request[v1.GetOwnerTokenRequest]) (*connect_go.Response[v1.GetOwnerTokenResponse], error)211// CreateAndStartWorkspace creates a new workspace and starts it.212CreateAndStartWorkspace(context.Context, *connect_go.Request[v1.CreateAndStartWorkspaceRequest]) (*connect_go.Response[v1.CreateAndStartWorkspaceResponse], error)213// StartWorkspace starts an existing workspace.214StartWorkspace(context.Context, *connect_go.Request[v1.StartWorkspaceRequest]) (*connect_go.Response[v1.StartWorkspaceResponse], error)215// StopWorkspace stops a running workspace (instance).216// Errors:217//218// NOT_FOUND: the workspace_id is unkown219// FAILED_PRECONDITION: if there's no running instance220StopWorkspace(context.Context, *connect_go.Request[v1.StopWorkspaceRequest]) (*connect_go.Response[v1.StopWorkspaceResponse], error)221// DeleteWorkspace deletes a workspace.222// When the workspace is running, it will be stopped as well.223// Deleted workspaces cannot be started again.224DeleteWorkspace(context.Context, *connect_go.Request[v1.DeleteWorkspaceRequest]) (*connect_go.Response[v1.DeleteWorkspaceResponse], error)225UpdatePort(context.Context, *connect_go.Request[v1.UpdatePortRequest]) (*connect_go.Response[v1.UpdatePortResponse], error)226// ListWorkspaceClasses enumerates all available workspace classes.227ListWorkspaceClasses(context.Context, *connect_go.Request[v1.ListWorkspaceClassesRequest]) (*connect_go.Response[v1.ListWorkspaceClassesResponse], error)228// GetDefaultWorkspaceImage returns the default workspace image from different sources.229GetDefaultWorkspaceImage(context.Context, *connect_go.Request[v1.GetDefaultWorkspaceImageRequest]) (*connect_go.Response[v1.GetDefaultWorkspaceImageResponse], error)230}231232// NewWorkspacesServiceHandler builds an HTTP handler from the service implementation. It returns233// the path on which to mount the handler and the handler itself.234//235// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf236// and JSON codecs. They also support gzip compression.237func NewWorkspacesServiceHandler(svc WorkspacesServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {238mux := http.NewServeMux()239mux.Handle("/gitpod.experimental.v1.WorkspacesService/ListWorkspaces", connect_go.NewUnaryHandler(240"/gitpod.experimental.v1.WorkspacesService/ListWorkspaces",241svc.ListWorkspaces,242opts...,243))244mux.Handle("/gitpod.experimental.v1.WorkspacesService/GetWorkspace", connect_go.NewUnaryHandler(245"/gitpod.experimental.v1.WorkspacesService/GetWorkspace",246svc.GetWorkspace,247opts...,248))249mux.Handle("/gitpod.experimental.v1.WorkspacesService/StreamWorkspaceStatus", connect_go.NewServerStreamHandler(250"/gitpod.experimental.v1.WorkspacesService/StreamWorkspaceStatus",251svc.StreamWorkspaceStatus,252opts...,253))254mux.Handle("/gitpod.experimental.v1.WorkspacesService/GetOwnerToken", connect_go.NewUnaryHandler(255"/gitpod.experimental.v1.WorkspacesService/GetOwnerToken",256svc.GetOwnerToken,257opts...,258))259mux.Handle("/gitpod.experimental.v1.WorkspacesService/CreateAndStartWorkspace", connect_go.NewUnaryHandler(260"/gitpod.experimental.v1.WorkspacesService/CreateAndStartWorkspace",261svc.CreateAndStartWorkspace,262opts...,263))264mux.Handle("/gitpod.experimental.v1.WorkspacesService/StartWorkspace", connect_go.NewUnaryHandler(265"/gitpod.experimental.v1.WorkspacesService/StartWorkspace",266svc.StartWorkspace,267opts...,268))269mux.Handle("/gitpod.experimental.v1.WorkspacesService/StopWorkspace", connect_go.NewUnaryHandler(270"/gitpod.experimental.v1.WorkspacesService/StopWorkspace",271svc.StopWorkspace,272opts...,273))274mux.Handle("/gitpod.experimental.v1.WorkspacesService/DeleteWorkspace", connect_go.NewUnaryHandler(275"/gitpod.experimental.v1.WorkspacesService/DeleteWorkspace",276svc.DeleteWorkspace,277opts...,278))279mux.Handle("/gitpod.experimental.v1.WorkspacesService/UpdatePort", connect_go.NewUnaryHandler(280"/gitpod.experimental.v1.WorkspacesService/UpdatePort",281svc.UpdatePort,282opts...,283))284mux.Handle("/gitpod.experimental.v1.WorkspacesService/ListWorkspaceClasses", connect_go.NewUnaryHandler(285"/gitpod.experimental.v1.WorkspacesService/ListWorkspaceClasses",286svc.ListWorkspaceClasses,287opts...,288))289mux.Handle("/gitpod.experimental.v1.WorkspacesService/GetDefaultWorkspaceImage", connect_go.NewUnaryHandler(290"/gitpod.experimental.v1.WorkspacesService/GetDefaultWorkspaceImage",291svc.GetDefaultWorkspaceImage,292opts...,293))294return "/gitpod.experimental.v1.WorkspacesService/", mux295}296297// UnimplementedWorkspacesServiceHandler returns CodeUnimplemented from all methods.298type UnimplementedWorkspacesServiceHandler struct{}299300func (UnimplementedWorkspacesServiceHandler) ListWorkspaces(context.Context, *connect_go.Request[v1.ListWorkspacesRequest]) (*connect_go.Response[v1.ListWorkspacesResponse], error) {301return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.ListWorkspaces is not implemented"))302}303304func (UnimplementedWorkspacesServiceHandler) GetWorkspace(context.Context, *connect_go.Request[v1.GetWorkspaceRequest]) (*connect_go.Response[v1.GetWorkspaceResponse], error) {305return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.GetWorkspace is not implemented"))306}307308func (UnimplementedWorkspacesServiceHandler) StreamWorkspaceStatus(context.Context, *connect_go.Request[v1.StreamWorkspaceStatusRequest], *connect_go.ServerStream[v1.StreamWorkspaceStatusResponse]) error {309return connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.StreamWorkspaceStatus is not implemented"))310}311312func (UnimplementedWorkspacesServiceHandler) GetOwnerToken(context.Context, *connect_go.Request[v1.GetOwnerTokenRequest]) (*connect_go.Response[v1.GetOwnerTokenResponse], error) {313return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.GetOwnerToken is not implemented"))314}315316func (UnimplementedWorkspacesServiceHandler) CreateAndStartWorkspace(context.Context, *connect_go.Request[v1.CreateAndStartWorkspaceRequest]) (*connect_go.Response[v1.CreateAndStartWorkspaceResponse], error) {317return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.CreateAndStartWorkspace is not implemented"))318}319320func (UnimplementedWorkspacesServiceHandler) StartWorkspace(context.Context, *connect_go.Request[v1.StartWorkspaceRequest]) (*connect_go.Response[v1.StartWorkspaceResponse], error) {321return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.StartWorkspace is not implemented"))322}323324func (UnimplementedWorkspacesServiceHandler) StopWorkspace(context.Context, *connect_go.Request[v1.StopWorkspaceRequest]) (*connect_go.Response[v1.StopWorkspaceResponse], error) {325return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.StopWorkspace is not implemented"))326}327328func (UnimplementedWorkspacesServiceHandler) DeleteWorkspace(context.Context, *connect_go.Request[v1.DeleteWorkspaceRequest]) (*connect_go.Response[v1.DeleteWorkspaceResponse], error) {329return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.DeleteWorkspace is not implemented"))330}331332func (UnimplementedWorkspacesServiceHandler) UpdatePort(context.Context, *connect_go.Request[v1.UpdatePortRequest]) (*connect_go.Response[v1.UpdatePortResponse], error) {333return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.UpdatePort is not implemented"))334}335336func (UnimplementedWorkspacesServiceHandler) ListWorkspaceClasses(context.Context, *connect_go.Request[v1.ListWorkspaceClassesRequest]) (*connect_go.Response[v1.ListWorkspaceClassesResponse], error) {337return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.ListWorkspaceClasses is not implemented"))338}339340func (UnimplementedWorkspacesServiceHandler) GetDefaultWorkspaceImage(context.Context, *connect_go.Request[v1.GetDefaultWorkspaceImageRequest]) (*connect_go.Response[v1.GetDefaultWorkspaceImageResponse], error) {341return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.WorkspacesService.GetDefaultWorkspaceImage is not implemented"))342}343344345