mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
* remove useless InfoProvider * close connection if visibility change * nit: fix typo * fn name typo fix --------- Co-authored-by: Filip Troníček <filip@gitpod.io>
78 lines
1.8 KiB
Go
78 lines
1.8 KiB
Go
// Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
// Licensed under the GNU Affero General Public License (AGPL).
|
|
// See License.AGPL.txt in the project root for license information.
|
|
|
|
package common
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/gitpod-io/gitpod/ws-manager/api"
|
|
wsapi "github.com/gitpod-io/gitpod/ws-manager/api"
|
|
)
|
|
|
|
const (
|
|
// Used as key for storing the workspace port in the requests mux.Vars() map.
|
|
WorkspacePortIdentifier = "workspacePort"
|
|
|
|
// Used as key for storing the workspace ID in the requests mux.Vars() map.
|
|
WorkspaceIDIdentifier = "workspaceID"
|
|
|
|
DebugWorkspaceIdentifier = "debugWorkspace"
|
|
|
|
WorkspacePathPrefixIdentifier = "workspacePathPrefix"
|
|
|
|
WorkspaceInfoIdentifier = "workspaceInfo"
|
|
|
|
ForeignContentIdentifier = "foreignContent"
|
|
)
|
|
|
|
// WorkspaceCoords represents the coordinates of a workspace (port).
|
|
type WorkspaceCoords struct {
|
|
// The workspace ID
|
|
ID string
|
|
// The workspace port
|
|
Port string
|
|
// Debug workspace
|
|
Debug bool
|
|
// Foreign content
|
|
Foreign bool
|
|
}
|
|
|
|
// WorkspaceInfoProvider is an entity that is able to provide workspaces related information.
|
|
type WorkspaceInfoProvider interface {
|
|
// WorkspaceInfo returns the workspace information of a workspace using it's workspace ID
|
|
WorkspaceInfo(workspaceID string) *WorkspaceInfo
|
|
|
|
AcquireContext(ctx context.Context, workspaceID, port string) (context.Context, string, error)
|
|
ReleaseContext(id string)
|
|
}
|
|
|
|
// WorkspaceInfo is all the infos ws-proxy needs to know about a workspace.
|
|
type WorkspaceInfo struct {
|
|
WorkspaceID string
|
|
InstanceID string
|
|
URL string
|
|
|
|
IDEImage string
|
|
SupervisorImage string
|
|
|
|
// (parsed from URL)
|
|
IDEPublicPort string
|
|
|
|
IPAddress string
|
|
|
|
Ports []*api.PortSpec
|
|
|
|
Auth *wsapi.WorkspaceAuthentication
|
|
StartedAt time.Time
|
|
|
|
OwnerUserId string
|
|
SSHPublicKeys []string
|
|
IsRunning bool
|
|
|
|
IsEnabledSSHCA bool
|
|
IsManagedByMk2 bool
|
|
}
|