Path: blob/main/components/ws-proxy/pkg/common/infoprovider.go
2500 views
// Copyright (c) 2020 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.34package common56import (7"context"8"time"910"github.com/gitpod-io/gitpod/ws-manager/api"11wsapi "github.com/gitpod-io/gitpod/ws-manager/api"12)1314const (15// Used as key for storing the workspace port in the requests mux.Vars() map.16WorkspacePortIdentifier = "workspacePort"1718// Used as key for storing the workspace ID in the requests mux.Vars() map.19WorkspaceIDIdentifier = "workspaceID"2021DebugWorkspaceIdentifier = "debugWorkspace"2223WorkspacePathPrefixIdentifier = "workspacePathPrefix"2425WorkspaceInfoIdentifier = "workspaceInfo"2627ForeignContentIdentifier = "foreignContent"28)2930// WorkspaceCoords represents the coordinates of a workspace (port).31type WorkspaceCoords struct {32// The workspace ID33ID string34// The workspace port35Port string36// Debug workspace37Debug bool38// Foreign content39Foreign bool40}4142// WorkspaceInfoProvider is an entity that is able to provide workspaces related information.43type WorkspaceInfoProvider interface {44// WorkspaceInfo returns the workspace information of a workspace using it's workspace ID45WorkspaceInfo(workspaceID string) *WorkspaceInfo4647AcquireContext(ctx context.Context, workspaceID, port string) (context.Context, string, error)48ReleaseContext(id string)49}5051// WorkspaceInfo is all the infos ws-proxy needs to know about a workspace.52type WorkspaceInfo struct {53WorkspaceID string54InstanceID string55URL string5657IDEImage string58SupervisorImage string5960// (parsed from URL)61IDEPublicPort string6263IPAddress string6465Ports []*api.PortSpec6667Auth *wsapi.WorkspaceAuthentication68StartedAt time.Time6970OwnerUserId string71SSHPublicKeys []string72IsRunning bool7374IsEnabledSSHCA bool75IsManagedByMk2 bool76}777879