Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ws-proxy/pkg/common/infoprovider.go
2500 views
1
// Copyright (c) 2020 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package common
6
7
import (
8
"context"
9
"time"
10
11
"github.com/gitpod-io/gitpod/ws-manager/api"
12
wsapi "github.com/gitpod-io/gitpod/ws-manager/api"
13
)
14
15
const (
16
// Used as key for storing the workspace port in the requests mux.Vars() map.
17
WorkspacePortIdentifier = "workspacePort"
18
19
// Used as key for storing the workspace ID in the requests mux.Vars() map.
20
WorkspaceIDIdentifier = "workspaceID"
21
22
DebugWorkspaceIdentifier = "debugWorkspace"
23
24
WorkspacePathPrefixIdentifier = "workspacePathPrefix"
25
26
WorkspaceInfoIdentifier = "workspaceInfo"
27
28
ForeignContentIdentifier = "foreignContent"
29
)
30
31
// WorkspaceCoords represents the coordinates of a workspace (port).
32
type WorkspaceCoords struct {
33
// The workspace ID
34
ID string
35
// The workspace port
36
Port string
37
// Debug workspace
38
Debug bool
39
// Foreign content
40
Foreign bool
41
}
42
43
// WorkspaceInfoProvider is an entity that is able to provide workspaces related information.
44
type WorkspaceInfoProvider interface {
45
// WorkspaceInfo returns the workspace information of a workspace using it's workspace ID
46
WorkspaceInfo(workspaceID string) *WorkspaceInfo
47
48
AcquireContext(ctx context.Context, workspaceID, port string) (context.Context, string, error)
49
ReleaseContext(id string)
50
}
51
52
// WorkspaceInfo is all the infos ws-proxy needs to know about a workspace.
53
type WorkspaceInfo struct {
54
WorkspaceID string
55
InstanceID string
56
URL string
57
58
IDEImage string
59
SupervisorImage string
60
61
// (parsed from URL)
62
IDEPublicPort string
63
64
IPAddress string
65
66
Ports []*api.PortSpec
67
68
Auth *wsapi.WorkspaceAuthentication
69
StartedAt time.Time
70
71
OwnerUserId string
72
SSHPublicKeys []string
73
IsRunning bool
74
75
IsEnabledSSHCA bool
76
IsManagedByMk2 bool
77
}
78
79