Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-protocol/go/gitpod-service.go
2498 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
//go:generate ./generate-mock.sh
6
7
package protocol
8
9
import (
10
"context"
11
"encoding/json"
12
"errors"
13
"fmt"
14
"io"
15
"net/http"
16
"sync"
17
"time"
18
19
"github.com/sourcegraph/jsonrpc2"
20
21
"github.com/sirupsen/logrus"
22
)
23
24
// APIInterface wraps the
25
type APIInterface interface {
26
io.Closer
27
28
GetOwnerToken(ctx context.Context, workspaceID string) (res string, err error)
29
AdminBlockUser(ctx context.Context, req *AdminBlockUserRequest) (err error)
30
GetLoggedInUser(ctx context.Context) (res *User, err error)
31
UpdateLoggedInUser(ctx context.Context, user *User) (res *User, err error)
32
GetAuthProviders(ctx context.Context) (res []*AuthProviderInfo, err error)
33
GetOwnAuthProviders(ctx context.Context) (res []*AuthProviderEntry, err error)
34
UpdateOwnAuthProvider(ctx context.Context, params *UpdateOwnAuthProviderParams) (err error)
35
DeleteOwnAuthProvider(ctx context.Context, params *DeleteOwnAuthProviderParams) (err error)
36
GetConfiguration(ctx context.Context) (res *Configuration, err error)
37
GetGitpodTokenScopes(ctx context.Context, tokenHash string) (res []string, err error)
38
GetToken(ctx context.Context, query *GetTokenSearchOptions) (res *Token, err error)
39
DeleteAccount(ctx context.Context) (err error)
40
GetClientRegion(ctx context.Context) (res string, err error)
41
GetWorkspaces(ctx context.Context, options *GetWorkspacesOptions) (res []*WorkspaceInfo, err error)
42
GetWorkspaceOwner(ctx context.Context, workspaceID string) (res *UserInfo, err error)
43
GetWorkspaceUsers(ctx context.Context, workspaceID string) (res []*WorkspaceInstanceUser, err error)
44
GetWorkspace(ctx context.Context, id string) (res *WorkspaceInfo, err error)
45
GetIDEOptions(ctx context.Context) (res *IDEOptions, err error)
46
IsWorkspaceOwner(ctx context.Context, workspaceID string) (res bool, err error)
47
CreateWorkspace(ctx context.Context, options *CreateWorkspaceOptions) (res *WorkspaceCreationResult, err error)
48
StartWorkspace(ctx context.Context, id string, options *StartWorkspaceOptions) (res *StartWorkspaceResult, err error)
49
StopWorkspace(ctx context.Context, id string) (err error)
50
DeleteWorkspace(ctx context.Context, id string) (err error)
51
SetWorkspaceDescription(ctx context.Context, id string, desc string) (err error)
52
ControlAdmission(ctx context.Context, id string, level *AdmissionLevel) (err error)
53
UpdateWorkspaceUserPin(ctx context.Context, id string, action *PinAction) (err error)
54
SendHeartBeat(ctx context.Context, options *SendHeartBeatOptions) (err error)
55
WatchWorkspaceImageBuildLogs(ctx context.Context, workspaceID string) (err error)
56
IsPrebuildDone(ctx context.Context, pwsid string) (res bool, err error)
57
SetWorkspaceTimeout(ctx context.Context, workspaceID string, duration time.Duration) (res *SetWorkspaceTimeoutResult, err error)
58
GetWorkspaceTimeout(ctx context.Context, workspaceID string) (res *GetWorkspaceTimeoutResult, err error)
59
GetOpenPorts(ctx context.Context, workspaceID string) (res []*WorkspaceInstancePort, err error)
60
OpenPort(ctx context.Context, workspaceID string, port *WorkspaceInstancePort) (res *WorkspaceInstancePort, err error)
61
ClosePort(ctx context.Context, workspaceID string, port float32) (err error)
62
UpdateGitStatus(ctx context.Context, workspaceID string, status *WorkspaceInstanceRepoStatus) (err error)
63
GetWorkspaceEnvVars(ctx context.Context, workspaceID string) (res []*EnvVar, err error)
64
SetEnvVar(ctx context.Context, variable *UserEnvVarValue) (err error)
65
DeleteEnvVar(ctx context.Context, variable *UserEnvVarValue) (err error)
66
HasSSHPublicKey(ctx context.Context) (res bool, err error)
67
GetSSHPublicKeys(ctx context.Context) (res []*UserSSHPublicKeyValue, err error)
68
AddSSHPublicKey(ctx context.Context, value *SSHPublicKeyValue) (res *UserSSHPublicKeyValue, err error)
69
DeleteSSHPublicKey(ctx context.Context, id string) (err error)
70
GetGitpodTokens(ctx context.Context) (res []*APIToken, err error)
71
GenerateNewGitpodToken(ctx context.Context, options *GenerateNewGitpodTokenOptions) (res string, err error)
72
DeleteGitpodToken(ctx context.Context, tokenHash string) (err error)
73
RegisterGithubApp(ctx context.Context, installationID string) (err error)
74
TakeSnapshot(ctx context.Context, options *TakeSnapshotOptions) (res string, err error)
75
WaitForSnapshot(ctx context.Context, snapshotId string) (err error)
76
GetSnapshots(ctx context.Context, workspaceID string) (res []*string, err error)
77
GuessGitTokenScopes(ctx context.Context, params *GuessGitTokenScopesParams) (res *GuessedGitTokenScopes, err error)
78
TrackEvent(ctx context.Context, event *RemoteTrackMessage) (err error)
79
GetSupportedWorkspaceClasses(ctx context.Context) (res []*SupportedWorkspaceClass, err error)
80
81
// Teams
82
GetTeam(ctx context.Context, teamID string) (*Team, error)
83
GetTeams(ctx context.Context) ([]*Team, error)
84
CreateTeam(ctx context.Context, teamName string) (*Team, error)
85
DeleteTeam(ctx context.Context, teamID string) error
86
GetTeamMembers(ctx context.Context, teamID string) ([]*TeamMemberInfo, error)
87
JoinTeam(ctx context.Context, teamID string) (*Team, error)
88
GetGenericInvite(ctx context.Context, teamID string) (*TeamMembershipInvite, error)
89
ResetGenericInvite(ctx context.Context, teamID string) (*TeamMembershipInvite, error)
90
SetTeamMemberRole(ctx context.Context, teamID, userID string, role TeamMemberRole) error
91
RemoveTeamMember(ctx context.Context, teamID, userID string) error
92
93
// Organization
94
GetOrgSettings(ctx context.Context, orgID string) (*OrganizationSettings, error)
95
96
GetDefaultWorkspaceImage(ctx context.Context, params *GetDefaultWorkspaceImageParams) (res *GetDefaultWorkspaceImageResult, err error)
97
98
// Projects
99
CreateProject(ctx context.Context, options *CreateProjectOptions) (*Project, error)
100
DeleteProject(ctx context.Context, projectID string) error
101
GetTeamProjects(ctx context.Context, teamID string) ([]*Project, error)
102
103
WorkspaceUpdates(ctx context.Context, workspaceID string) (<-chan *WorkspaceInstance, error)
104
105
// GetIDToken doesn't actually do anything, it just authorises
106
GetIDToken(ctx context.Context) (err error)
107
}
108
109
// FunctionName is the name of an RPC function
110
type FunctionName string
111
112
const (
113
// FunctionGetOwnerToken is the name of the getOwnerToken function
114
FunctionGetOwnerToken FunctionName = "getOwnerToken"
115
// FunctionAdminBlockUser is the name of the adminBlockUser function
116
FunctionAdminBlockUser FunctionName = "adminBlockUser"
117
// FunctionGetLoggedInUser is the name of the getLoggedInUser function
118
FunctionGetLoggedInUser FunctionName = "getLoggedInUser"
119
// FunctionUpdateLoggedInUser is the name of the updateLoggedInUser function
120
FunctionUpdateLoggedInUser FunctionName = "updateLoggedInUser"
121
// FunctionGetAuthProviders is the name of the getAuthProviders function
122
FunctionGetAuthProviders FunctionName = "getAuthProviders"
123
// FunctionGetOwnAuthProviders is the name of the getOwnAuthProviders function
124
FunctionGetOwnAuthProviders FunctionName = "getOwnAuthProviders"
125
// FunctionUpdateOwnAuthProvider is the name of the updateOwnAuthProvider function
126
FunctionUpdateOwnAuthProvider FunctionName = "updateOwnAuthProvider"
127
// FunctionDeleteOwnAuthProvider is the name of the deleteOwnAuthProvider function
128
FunctionDeleteOwnAuthProvider FunctionName = "deleteOwnAuthProvider"
129
// FunctionGetConfiguration is the name of the getConfiguration function
130
FunctionGetConfiguration FunctionName = "getConfiguration"
131
// FunctionGetGitpodTokenScopes is the name of the GetGitpodTokenScopes function
132
FunctionGetGitpodTokenScopes FunctionName = "getGitpodTokenScopes"
133
// FunctionGetToken is the name of the getToken function
134
FunctionGetToken FunctionName = "getToken"
135
// FunctionDeleteAccount is the name of the deleteAccount function
136
FunctionDeleteAccount FunctionName = "deleteAccount"
137
// FunctionGetClientRegion is the name of the getClientRegion function
138
FunctionGetClientRegion FunctionName = "getClientRegion"
139
// FunctionGetWorkspaces is the name of the getWorkspaces function
140
FunctionGetWorkspaces FunctionName = "getWorkspaces"
141
// FunctionGetWorkspaceOwner is the name of the getWorkspaceOwner function
142
FunctionGetWorkspaceOwner FunctionName = "getWorkspaceOwner"
143
// FunctionGetWorkspaceUsers is the name of the getWorkspaceUsers function
144
FunctionGetWorkspaceUsers FunctionName = "getWorkspaceUsers"
145
// FunctionGetWorkspace is the name of the getWorkspace function
146
FunctionGetWorkspace FunctionName = "getWorkspace"
147
// FunctionGetIDEOptions is the name of the getIDEOptions function
148
FunctionGetIDEOptions FunctionName = "getIDEOptions"
149
// FunctionIsWorkspaceOwner is the name of the isWorkspaceOwner function
150
FunctionIsWorkspaceOwner FunctionName = "isWorkspaceOwner"
151
// FunctionCreateWorkspace is the name of the createWorkspace function
152
FunctionCreateWorkspace FunctionName = "createWorkspace"
153
// FunctionStartWorkspace is the name of the startWorkspace function
154
FunctionStartWorkspace FunctionName = "startWorkspace"
155
// FunctionStopWorkspace is the name of the stopWorkspace function
156
FunctionStopWorkspace FunctionName = "stopWorkspace"
157
// FunctionDeleteWorkspace is the name of the deleteWorkspace function
158
FunctionDeleteWorkspace FunctionName = "deleteWorkspace"
159
// FunctionSetWorkspaceDescription is the name of the setWorkspaceDescription function
160
FunctionSetWorkspaceDescription FunctionName = "setWorkspaceDescription"
161
// FunctionControlAdmission is the name of the controlAdmission function
162
FunctionControlAdmission FunctionName = "controlAdmission"
163
// FunctionUpdateWorkspaceUserPin is the name of the updateWorkspaceUserPin function
164
FunctionUpdateWorkspaceUserPin FunctionName = "updateWorkspaceUserPin"
165
// FunctionSendHeartBeat is the name of the sendHeartBeat function
166
FunctionSendHeartBeat FunctionName = "sendHeartBeat"
167
// FunctionWatchWorkspaceImageBuildLogs is the name of the watchWorkspaceImageBuildLogs function
168
FunctionWatchWorkspaceImageBuildLogs FunctionName = "watchWorkspaceImageBuildLogs"
169
// FunctionIsPrebuildDone is the name of the isPrebuildDone function
170
FunctionIsPrebuildDone FunctionName = "isPrebuildDone"
171
// FunctionSetWorkspaceTimeout is the name of the setWorkspaceTimeout function
172
FunctionSetWorkspaceTimeout FunctionName = "setWorkspaceTimeout"
173
// FunctionGetWorkspaceTimeout is the name of the getWorkspaceTimeout function
174
FunctionGetWorkspaceTimeout FunctionName = "getWorkspaceTimeout"
175
// FunctionGetOpenPorts is the name of the getOpenPorts function
176
FunctionGetOpenPorts FunctionName = "getOpenPorts"
177
// FunctionOpenPort is the name of the openPort function
178
FunctionOpenPort FunctionName = "openPort"
179
// FunctionClosePort is the name of the closePort function
180
FunctionClosePort FunctionName = "closePort"
181
// FunctionSetEnvVar is the name of the setEnvVar function
182
FunctionSetEnvVar FunctionName = "setEnvVar"
183
// FunctionDeleteEnvVar is the name of the deleteEnvVar function
184
FunctionDeleteEnvVar FunctionName = "deleteEnvVar"
185
// FunctionHasSSHPublicKey is the name of the hasSSHPublicKey function
186
FunctionHasSSHPublicKey FunctionName = "hasSSHPublicKey"
187
// FunctionGetSSHPublicKeys is the name of the getSSHPublicKeys function
188
FunctionGetSSHPublicKeys FunctionName = "getSSHPublicKeys"
189
// FunctionAddSSHPublicKey is the name of the addSSHPublicKey function
190
FunctionAddSSHPublicKey FunctionName = "addSSHPublicKey"
191
// FunctionDeleteSSHPublicKey is the name of the deleteSSHPublicKey function
192
FunctionDeleteSSHPublicKey FunctionName = "deleteSSHPublicKey"
193
// FunctionGetGitpodTokens is the name of the getGitpodTokens function
194
FunctionGetGitpodTokens FunctionName = "getGitpodTokens"
195
// FunctionGenerateNewGitpodToken is the name of the generateNewGitpodToken function
196
FunctionGenerateNewGitpodToken FunctionName = "generateNewGitpodToken"
197
// FunctionDeleteGitpodToken is the name of the deleteGitpodToken function
198
FunctionDeleteGitpodToken FunctionName = "deleteGitpodToken"
199
// FunctionRegisterGithubApp is the name of the registerGithubApp function
200
FunctionRegisterGithubApp FunctionName = "registerGithubApp"
201
// FunctionTakeSnapshot is the name of the takeSnapshot function
202
FunctionTakeSnapshot FunctionName = "takeSnapshot"
203
// FunctionGetSnapshots is the name of the getSnapshots function
204
FunctionGetSnapshots FunctionName = "getSnapshots"
205
// FunctionGuessGitTokenScopes is the name of the guessGitTokenScopes function
206
FunctionGuessGitTokenScope FunctionName = "guessGitTokenScopes"
207
// FunctionTrackEvent is the name of the trackEvent function
208
FunctionTrackEvent FunctionName = "trackEvent"
209
// FunctionGetSupportedWorkspaceClasses is the name of the getSupportedWorkspaceClasses function
210
FunctionGetSupportedWorkspaceClasses FunctionName = "getSupportedWorkspaceClasses"
211
212
// Teams
213
// FunctionGetTeam is the name of the getTeam function
214
FunctionGetTeam FunctionName = "getTeam"
215
// FunctionGetTeams is the name of the getTeams function
216
FunctionGetTeams FunctionName = "getTeams"
217
// FunctionCreateTeam is the name of the createTeam function
218
FunctionCreateTeam FunctionName = "createTeam"
219
// FunctionJoinTeam is the name of the joinTeam function
220
FunctionJoinTeam FunctionName = "joinTeam"
221
// FunctionGetTeamMembers is the name of the getTeamMembers function
222
FunctionGetTeamMembers FunctionName = "getTeamMembers"
223
// FunctionGetGenericInvite is the name of the getGenericInvite function
224
FunctionGetGenericInvite FunctionName = "getGenericInvite"
225
// FunctionResetGenericInvite is the name of the resetGenericInvite function
226
FunctionResetGenericInvite FunctionName = "resetGenericInvite"
227
// FunctionSetTeamMemberRole is the name of the setTeamMemberRole function
228
FunctionSetTeamMemberRole FunctionName = "setTeamMemberRole"
229
// FunctionRemoveTeamMember is the name of the removeTeamMember function
230
FunctionRemoveTeamMember FunctionName = "removeTeamMember"
231
// FunctionDeleteTeam is the name of the deleteTeam function
232
FunctionDeleteTeam FunctionName = "deleteTeam"
233
234
// Organizations
235
// FunctionGetOrgSettings is the name of the getOrgSettings function
236
FunctionGetOrgSettings FunctionName = "getOrgSettings"
237
238
// FunctionGetDefaultWorkspaceImage is the name of the getDefaultWorkspaceImage function
239
FunctionGetDefaultWorkspaceImage FunctionName = "getDefaultWorkspaceImage"
240
241
// Projects
242
FunctionCreateProject FunctionName = "createProject"
243
FunctionDeleteProject FunctionName = "deleteProject"
244
FunctionGetTeamProjects FunctionName = "getTeamProjects"
245
246
// FunctionOnInstanceUpdate is the name of the onInstanceUpdate callback function
247
FunctionOnInstanceUpdate = "onInstanceUpdate"
248
249
FunctionGetIDToken FunctionName = "getIDToken"
250
)
251
252
var errNotConnected = errors.New("not connected to Gitpod server")
253
254
// ConnectToServerOpts configures the server connection
255
type ConnectToServerOpts struct {
256
Context context.Context
257
Token string
258
Cookie string
259
Origin string
260
Log *logrus.Entry
261
ReconnectionHandler func()
262
CloseHandler func(error)
263
ExtraHeaders map[string]string
264
}
265
266
// ConnectToServer establishes a new websocket connection to the server
267
func ConnectToServer(endpoint string, opts ConnectToServerOpts) (*APIoverJSONRPC, error) {
268
if opts.Context == nil {
269
opts.Context = context.Background()
270
}
271
272
reqHeader := http.Header{}
273
reqHeader.Set("Origin", opts.Origin)
274
275
for k, v := range opts.ExtraHeaders {
276
reqHeader.Set(k, v)
277
}
278
if opts.Token != "" {
279
reqHeader.Set("Authorization", "Bearer "+opts.Token)
280
}
281
282
if opts.Cookie != "" {
283
reqHeader.Set("Cookie", opts.Cookie)
284
}
285
286
ws := NewReconnectingWebsocket(endpoint, reqHeader, opts.Log)
287
ws.ReconnectionHandler = opts.ReconnectionHandler
288
go func() {
289
err := ws.Dial(opts.Context)
290
if opts.CloseHandler != nil {
291
opts.CloseHandler(err)
292
}
293
}()
294
295
var res APIoverJSONRPC
296
res.log = opts.Log
297
res.C = jsonrpc2.NewConn(opts.Context, ws, jsonrpc2.HandlerWithError(res.handler))
298
return &res, nil
299
}
300
301
// APIoverJSONRPC makes JSON RPC calls to the Gitpod server is the APIoverJSONRPC message type
302
type APIoverJSONRPC struct {
303
C jsonrpc2.JSONRPC2
304
log *logrus.Entry
305
306
mu sync.RWMutex
307
workspaceSubs map[string]map[chan *WorkspaceInstance]struct{}
308
}
309
310
// Close closes the connection
311
func (gp *APIoverJSONRPC) Close() (err error) {
312
if gp == nil {
313
err = errNotConnected
314
return
315
}
316
e1 := gp.C.Close()
317
if e1 != nil {
318
return e1
319
}
320
return nil
321
}
322
323
// WorkspaceUpdates subscribes to workspace instance updates until the context is canceled
324
func (gp *APIoverJSONRPC) WorkspaceUpdates(ctx context.Context, workspaceID string) (<-chan *WorkspaceInstance, error) {
325
if gp == nil {
326
return nil, errNotConnected
327
}
328
chn := make(chan *WorkspaceInstance)
329
330
gp.mu.Lock()
331
if gp.workspaceSubs == nil {
332
gp.workspaceSubs = make(map[string]map[chan *WorkspaceInstance]struct{})
333
}
334
if sub, ok := gp.workspaceSubs[workspaceID]; ok {
335
sub[chn] = struct{}{}
336
} else {
337
gp.workspaceSubs[workspaceID] = map[chan *WorkspaceInstance]struct{}{chn: {}}
338
}
339
gp.mu.Unlock()
340
341
go func() {
342
<-ctx.Done()
343
344
gp.mu.Lock()
345
delete(gp.workspaceSubs[workspaceID], chn)
346
close(chn)
347
gp.mu.Unlock()
348
}()
349
350
return chn, nil
351
}
352
353
func (gp *APIoverJSONRPC) handler(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.Request) (result interface{}, err error) {
354
if gp == nil {
355
err = errNotConnected
356
return
357
}
358
if req.Method != FunctionOnInstanceUpdate {
359
return
360
}
361
362
var instance WorkspaceInstance
363
err = json.Unmarshal(*req.Params, &instance)
364
if err != nil {
365
gp.log.WithError(err).WithField("raw", string(*req.Params)).Error("cannot unmarshal instance update")
366
return
367
}
368
369
gp.mu.RLock()
370
defer gp.mu.RUnlock()
371
for chn := range gp.workspaceSubs[instance.WorkspaceID] {
372
select {
373
case chn <- &instance:
374
default:
375
}
376
}
377
for chn := range gp.workspaceSubs[""] {
378
select {
379
case chn <- &instance:
380
default:
381
}
382
}
383
384
return
385
}
386
387
func (gp *APIoverJSONRPC) GetOwnerToken(ctx context.Context, workspaceID string) (res string, err error) {
388
if gp == nil {
389
err = errNotConnected
390
return
391
}
392
var _params []interface{}
393
_params = append(_params, workspaceID)
394
395
var _result string
396
err = gp.C.Call(ctx, "getOwnerToken", _params, &_result)
397
if err != nil {
398
return "", err
399
}
400
res = _result
401
return
402
}
403
404
// AdminBlockUser calls adminBlockUser on the server
405
func (gp *APIoverJSONRPC) AdminBlockUser(ctx context.Context, message *AdminBlockUserRequest) (err error) {
406
if gp == nil {
407
err = errNotConnected
408
return
409
}
410
var _params []interface{}
411
_params = append(_params, message)
412
413
var _result interface{}
414
err = gp.C.Call(ctx, "adminBlockUser", _params, &_result)
415
if err != nil {
416
return err
417
}
418
return
419
}
420
421
// AdminVerifyUser calls adminVerifyUser on the server
422
func (gp *APIoverJSONRPC) AdminVerifyUser(ctx context.Context, userId string) (err error) {
423
if gp == nil {
424
err = errNotConnected
425
return
426
}
427
var _params []interface{}
428
_params = append(_params, userId)
429
430
var _result interface{}
431
err = gp.C.Call(ctx, "adminVerifyUser", _params, &_result)
432
if err != nil {
433
return err
434
}
435
return
436
}
437
438
// GetLoggedInUser calls getLoggedInUser on the server
439
func (gp *APIoverJSONRPC) GetLoggedInUser(ctx context.Context) (res *User, err error) {
440
if gp == nil {
441
err = errNotConnected
442
return
443
}
444
var _params []interface{}
445
446
var result User
447
err = gp.C.Call(ctx, "getLoggedInUser", _params, &result)
448
if err != nil {
449
return
450
}
451
res = &result
452
453
return
454
}
455
456
// UpdateLoggedInUser calls updateLoggedInUser on the server
457
func (gp *APIoverJSONRPC) UpdateLoggedInUser(ctx context.Context, user *User) (res *User, err error) {
458
if gp == nil {
459
err = errNotConnected
460
return
461
}
462
var _params []interface{}
463
464
_params = append(_params, user)
465
466
var result User
467
err = gp.C.Call(ctx, "updateLoggedInUser", _params, &result)
468
if err != nil {
469
return
470
}
471
res = &result
472
473
return
474
}
475
476
// GetAuthProviders calls getAuthProviders on the server
477
func (gp *APIoverJSONRPC) GetAuthProviders(ctx context.Context) (res []*AuthProviderInfo, err error) {
478
if gp == nil {
479
err = errNotConnected
480
return
481
}
482
var _params []interface{}
483
484
var result []*AuthProviderInfo
485
err = gp.C.Call(ctx, "getAuthProviders", _params, &result)
486
if err != nil {
487
return
488
}
489
res = result
490
491
return
492
}
493
494
// GetOwnAuthProviders calls getOwnAuthProviders on the server
495
func (gp *APIoverJSONRPC) GetOwnAuthProviders(ctx context.Context) (res []*AuthProviderEntry, err error) {
496
if gp == nil {
497
err = errNotConnected
498
return
499
}
500
var _params []interface{}
501
502
var result []*AuthProviderEntry
503
err = gp.C.Call(ctx, "getOwnAuthProviders", _params, &result)
504
if err != nil {
505
return
506
}
507
res = result
508
509
return
510
}
511
512
// UpdateOwnAuthProvider calls updateOwnAuthProvider on the server
513
func (gp *APIoverJSONRPC) UpdateOwnAuthProvider(ctx context.Context, params *UpdateOwnAuthProviderParams) (err error) {
514
if gp == nil {
515
err = errNotConnected
516
return
517
}
518
var _params []interface{}
519
520
_params = append(_params, params)
521
522
err = gp.C.Call(ctx, "updateOwnAuthProvider", _params, nil)
523
if err != nil {
524
return
525
}
526
527
return
528
}
529
530
// DeleteOwnAuthProvider calls deleteOwnAuthProvider on the server
531
func (gp *APIoverJSONRPC) DeleteOwnAuthProvider(ctx context.Context, params *DeleteOwnAuthProviderParams) (err error) {
532
if gp == nil {
533
err = errNotConnected
534
return
535
}
536
var _params []interface{}
537
538
_params = append(_params, params)
539
540
err = gp.C.Call(ctx, "deleteOwnAuthProvider", _params, nil)
541
if err != nil {
542
return
543
}
544
545
return
546
}
547
548
// GetConfiguration calls getConfiguration on the server
549
func (gp *APIoverJSONRPC) GetConfiguration(ctx context.Context) (res *Configuration, err error) {
550
if gp == nil {
551
err = errNotConnected
552
return
553
}
554
var _params []interface{}
555
556
var result Configuration
557
err = gp.C.Call(ctx, "getConfiguration", _params, &result)
558
if err != nil {
559
return
560
}
561
res = &result
562
563
return
564
}
565
566
// GetGitpodTokenScopes calls getGitpodTokenScopes on the server
567
func (gp *APIoverJSONRPC) GetGitpodTokenScopes(ctx context.Context, tokenHash string) (res []string, err error) {
568
if gp == nil {
569
err = errNotConnected
570
return
571
}
572
var _params []interface{}
573
574
_params = append(_params, tokenHash)
575
576
var result []string
577
err = gp.C.Call(ctx, "getGitpodTokenScopes", _params, &result)
578
if err != nil {
579
return
580
}
581
res = result
582
583
return
584
}
585
586
// GetToken calls getToken on the server
587
func (gp *APIoverJSONRPC) GetToken(ctx context.Context, query *GetTokenSearchOptions) (res *Token, err error) {
588
if gp == nil {
589
err = errNotConnected
590
return
591
}
592
var _params []interface{}
593
594
_params = append(_params, query)
595
596
var result Token
597
err = gp.C.Call(ctx, "getToken", _params, &result)
598
if err != nil {
599
return
600
}
601
res = &result
602
603
return
604
}
605
606
// DeleteAccount calls deleteAccount on the server
607
func (gp *APIoverJSONRPC) DeleteAccount(ctx context.Context) (err error) {
608
if gp == nil {
609
err = errNotConnected
610
return
611
}
612
var _params []interface{}
613
614
err = gp.C.Call(ctx, "deleteAccount", _params, nil)
615
if err != nil {
616
return
617
}
618
619
return
620
}
621
622
// GetClientRegion calls getClientRegion on the server
623
func (gp *APIoverJSONRPC) GetClientRegion(ctx context.Context) (res string, err error) {
624
if gp == nil {
625
err = errNotConnected
626
return
627
}
628
var _params []interface{}
629
630
var result string
631
err = gp.C.Call(ctx, "getClientRegion", _params, &result)
632
if err != nil {
633
return
634
}
635
res = result
636
637
return
638
}
639
640
// GetWorkspaces calls getWorkspaces on the server
641
func (gp *APIoverJSONRPC) GetWorkspaces(ctx context.Context, options *GetWorkspacesOptions) (res []*WorkspaceInfo, err error) {
642
if gp == nil {
643
err = errNotConnected
644
return
645
}
646
var _params []interface{}
647
648
_params = append(_params, options)
649
650
var result []*WorkspaceInfo
651
err = gp.C.Call(ctx, "getWorkspaces", _params, &result)
652
if err != nil {
653
return
654
}
655
res = result
656
657
return
658
}
659
660
// GetWorkspaceOwner calls getWorkspaceOwner on the server
661
func (gp *APIoverJSONRPC) GetWorkspaceOwner(ctx context.Context, workspaceID string) (res *UserInfo, err error) {
662
if gp == nil {
663
err = errNotConnected
664
return
665
}
666
var _params []interface{}
667
668
_params = append(_params, workspaceID)
669
670
var result UserInfo
671
err = gp.C.Call(ctx, "getWorkspaceOwner", _params, &result)
672
if err != nil {
673
return
674
}
675
res = &result
676
677
return
678
}
679
680
// GetWorkspaceUsers calls getWorkspaceUsers on the server
681
func (gp *APIoverJSONRPC) GetWorkspaceUsers(ctx context.Context, workspaceID string) (res []*WorkspaceInstanceUser, err error) {
682
if gp == nil {
683
err = errNotConnected
684
return
685
}
686
var _params []interface{}
687
688
_params = append(_params, workspaceID)
689
690
var result []*WorkspaceInstanceUser
691
err = gp.C.Call(ctx, "getWorkspaceUsers", _params, &result)
692
if err != nil {
693
return
694
}
695
res = result
696
697
return
698
}
699
700
// GetWorkspace calls getWorkspace on the server
701
func (gp *APIoverJSONRPC) GetWorkspace(ctx context.Context, id string) (res *WorkspaceInfo, err error) {
702
if gp == nil {
703
err = errNotConnected
704
return
705
}
706
var _params []interface{}
707
708
_params = append(_params, id)
709
710
var result WorkspaceInfo
711
err = gp.C.Call(ctx, "getWorkspace", _params, &result)
712
if err != nil {
713
return
714
}
715
res = &result
716
717
return
718
}
719
720
// GetIDEOptions calls getIDEOptions on the server
721
func (gp *APIoverJSONRPC) GetIDEOptions(ctx context.Context) (res *IDEOptions, err error) {
722
if gp == nil {
723
err = errNotConnected
724
return
725
}
726
var _params []interface{}
727
728
var result IDEOptions
729
err = gp.C.Call(ctx, "getIDEOptions", _params, &result)
730
if err != nil {
731
return
732
}
733
734
res = &result
735
736
return
737
}
738
739
// IsWorkspaceOwner calls isWorkspaceOwner on the server
740
func (gp *APIoverJSONRPC) IsWorkspaceOwner(ctx context.Context, workspaceID string) (res bool, err error) {
741
if gp == nil {
742
err = errNotConnected
743
return
744
}
745
var _params []interface{}
746
747
_params = append(_params, workspaceID)
748
749
var result bool
750
err = gp.C.Call(ctx, "isWorkspaceOwner", _params, &result)
751
if err != nil {
752
return
753
}
754
res = result
755
756
return
757
}
758
759
// CreateWorkspace calls createWorkspace on the server
760
func (gp *APIoverJSONRPC) CreateWorkspace(ctx context.Context, options *CreateWorkspaceOptions) (res *WorkspaceCreationResult, err error) {
761
if gp == nil {
762
err = errNotConnected
763
return
764
}
765
var _params []interface{}
766
767
_params = append(_params, options)
768
769
var result WorkspaceCreationResult
770
err = gp.C.Call(ctx, "createWorkspace", _params, &result)
771
if err != nil {
772
return
773
}
774
res = &result
775
776
return
777
}
778
779
// StartWorkspace calls startWorkspace on the server
780
func (gp *APIoverJSONRPC) StartWorkspace(ctx context.Context, id string, options *StartWorkspaceOptions) (res *StartWorkspaceResult, err error) {
781
if gp == nil {
782
err = errNotConnected
783
return
784
}
785
var _params []interface{}
786
787
_params = append(_params, id)
788
_params = append(_params, options)
789
790
var result StartWorkspaceResult
791
err = gp.C.Call(ctx, "startWorkspace", _params, &result)
792
if err != nil {
793
return
794
}
795
res = &result
796
797
return
798
}
799
800
// StopWorkspace calls stopWorkspace on the server
801
func (gp *APIoverJSONRPC) StopWorkspace(ctx context.Context, id string) (err error) {
802
if gp == nil {
803
err = errNotConnected
804
return
805
}
806
var _params []interface{}
807
808
_params = append(_params, id)
809
810
err = gp.C.Call(ctx, "stopWorkspace", _params, nil)
811
if err != nil {
812
return
813
}
814
815
return
816
}
817
818
// DeleteWorkspace calls deleteWorkspace on the server
819
func (gp *APIoverJSONRPC) DeleteWorkspace(ctx context.Context, id string) (err error) {
820
if gp == nil {
821
err = errNotConnected
822
return
823
}
824
var _params []interface{}
825
826
_params = append(_params, id)
827
828
err = gp.C.Call(ctx, "deleteWorkspace", _params, nil)
829
if err != nil {
830
return
831
}
832
833
return
834
}
835
836
// SetWorkspaceDescription calls setWorkspaceDescription on the server
837
func (gp *APIoverJSONRPC) SetWorkspaceDescription(ctx context.Context, id string, desc string) (err error) {
838
if gp == nil {
839
err = errNotConnected
840
return
841
}
842
var _params []interface{}
843
844
_params = append(_params, id)
845
_params = append(_params, desc)
846
847
err = gp.C.Call(ctx, "setWorkspaceDescription", _params, nil)
848
if err != nil {
849
return
850
}
851
852
return
853
}
854
855
// ControlAdmission calls controlAdmission on the server
856
func (gp *APIoverJSONRPC) ControlAdmission(ctx context.Context, id string, level *AdmissionLevel) (err error) {
857
if gp == nil {
858
err = errNotConnected
859
return
860
}
861
var _params []interface{}
862
863
_params = append(_params, id)
864
_params = append(_params, level)
865
866
err = gp.C.Call(ctx, "controlAdmission", _params, nil)
867
if err != nil {
868
return
869
}
870
871
return
872
}
873
874
// WatchWorkspaceImageBuildLogs calls watchWorkspaceImageBuildLogs on the server
875
func (gp *APIoverJSONRPC) WatchWorkspaceImageBuildLogs(ctx context.Context, workspaceID string) (err error) {
876
if gp == nil {
877
err = errNotConnected
878
return
879
}
880
var _params []interface{}
881
882
_params = append(_params, workspaceID)
883
884
err = gp.C.Call(ctx, "watchWorkspaceImageBuildLogs", _params, nil)
885
if err != nil {
886
return
887
}
888
889
return
890
}
891
892
// IsPrebuildDone calls isPrebuildDone on the server
893
func (gp *APIoverJSONRPC) IsPrebuildDone(ctx context.Context, pwsid string) (res bool, err error) {
894
if gp == nil {
895
err = errNotConnected
896
return
897
}
898
var _params []interface{}
899
900
_params = append(_params, pwsid)
901
902
var result bool
903
err = gp.C.Call(ctx, "isPrebuildDone", _params, &result)
904
if err != nil {
905
return
906
}
907
res = result
908
909
return
910
}
911
912
// SetWorkspaceTimeout calls setWorkspaceTimeout on the server
913
func (gp *APIoverJSONRPC) SetWorkspaceTimeout(ctx context.Context, workspaceID string, duration time.Duration) (res *SetWorkspaceTimeoutResult, err error) {
914
if gp == nil {
915
err = errNotConnected
916
return
917
}
918
var _params []interface{}
919
920
_params = append(_params, workspaceID)
921
_params = append(_params, fmt.Sprintf("%dm", int(duration.Minutes())))
922
923
var result SetWorkspaceTimeoutResult
924
err = gp.C.Call(ctx, "setWorkspaceTimeout", _params, &result)
925
if err != nil {
926
return
927
}
928
res = &result
929
930
return
931
}
932
933
// GetWorkspaceTimeout calls getWorkspaceTimeout on the server
934
func (gp *APIoverJSONRPC) GetWorkspaceTimeout(ctx context.Context, workspaceID string) (res *GetWorkspaceTimeoutResult, err error) {
935
if gp == nil {
936
err = errNotConnected
937
return
938
}
939
var _params []interface{}
940
941
_params = append(_params, workspaceID)
942
943
var result GetWorkspaceTimeoutResult
944
err = gp.C.Call(ctx, "getWorkspaceTimeout", _params, &result)
945
if err != nil {
946
return
947
}
948
res = &result
949
950
return
951
}
952
953
// SendHeartBeat calls sendHeartBeat on the server
954
func (gp *APIoverJSONRPC) SendHeartBeat(ctx context.Context, options *SendHeartBeatOptions) (err error) {
955
if gp == nil {
956
err = errNotConnected
957
return
958
}
959
var _params []interface{}
960
961
_params = append(_params, options)
962
963
err = gp.C.Call(ctx, "sendHeartBeat", _params, nil)
964
if err != nil {
965
return
966
}
967
968
return
969
}
970
971
// UpdateWorkspaceUserPin calls updateWorkspaceUserPin on the server
972
func (gp *APIoverJSONRPC) UpdateWorkspaceUserPin(ctx context.Context, id string, action *PinAction) (err error) {
973
if gp == nil {
974
err = errNotConnected
975
return
976
}
977
var _params []interface{}
978
979
_params = append(_params, id)
980
_params = append(_params, action)
981
982
err = gp.C.Call(ctx, "updateWorkspaceUserPin", _params, nil)
983
if err != nil {
984
return
985
}
986
987
return
988
}
989
990
// GetOpenPorts calls getOpenPorts on the server
991
func (gp *APIoverJSONRPC) GetOpenPorts(ctx context.Context, workspaceID string) (res []*WorkspaceInstancePort, err error) {
992
if gp == nil {
993
err = errNotConnected
994
return
995
}
996
var _params []interface{}
997
998
_params = append(_params, workspaceID)
999
1000
var result []*WorkspaceInstancePort
1001
err = gp.C.Call(ctx, "getOpenPorts", _params, &result)
1002
if err != nil {
1003
return
1004
}
1005
res = result
1006
1007
return
1008
}
1009
1010
// OpenPort calls openPort on the server
1011
func (gp *APIoverJSONRPC) OpenPort(ctx context.Context, workspaceID string, port *WorkspaceInstancePort) (res *WorkspaceInstancePort, err error) {
1012
if gp == nil {
1013
err = errNotConnected
1014
return
1015
}
1016
var _params []interface{}
1017
1018
_params = append(_params, workspaceID)
1019
_params = append(_params, port)
1020
1021
var result WorkspaceInstancePort
1022
err = gp.C.Call(ctx, "openPort", _params, &result)
1023
if err != nil {
1024
return
1025
}
1026
res = &result
1027
1028
return
1029
}
1030
1031
// ClosePort calls closePort on the server
1032
func (gp *APIoverJSONRPC) ClosePort(ctx context.Context, workspaceID string, port float32) (err error) {
1033
if gp == nil {
1034
err = errNotConnected
1035
return
1036
}
1037
var _params []interface{}
1038
1039
_params = append(_params, workspaceID)
1040
_params = append(_params, port)
1041
1042
err = gp.C.Call(ctx, "closePort", _params, nil)
1043
if err != nil {
1044
return
1045
}
1046
1047
return
1048
}
1049
1050
// UpdateGitStatus calls UpdateGitStatus on the server
1051
func (gp *APIoverJSONRPC) UpdateGitStatus(ctx context.Context, workspaceID string, status *WorkspaceInstanceRepoStatus) (err error) {
1052
if gp == nil {
1053
err = errNotConnected
1054
return
1055
}
1056
var _params []interface{}
1057
_params = append(_params, workspaceID)
1058
_params = append(_params, status)
1059
1060
err = gp.C.Call(ctx, "updateGitStatus", _params, nil)
1061
if err != nil {
1062
return
1063
}
1064
1065
return
1066
}
1067
1068
// GetWorkspaceEnvVars calls GetWorkspaceEnvVars on the server
1069
func (gp *APIoverJSONRPC) GetWorkspaceEnvVars(ctx context.Context, workspaceID string) (res []*EnvVar, err error) {
1070
if gp == nil {
1071
err = errNotConnected
1072
return
1073
}
1074
var _params []interface{}
1075
1076
_params = append(_params, workspaceID)
1077
1078
var result []*EnvVar
1079
err = gp.C.Call(ctx, "getWorkspaceEnvVars", _params, &result)
1080
if err != nil {
1081
return
1082
}
1083
res = result
1084
1085
return
1086
}
1087
1088
// SetEnvVar calls setEnvVar on the server
1089
func (gp *APIoverJSONRPC) SetEnvVar(ctx context.Context, variable *UserEnvVarValue) (err error) {
1090
if gp == nil {
1091
err = errNotConnected
1092
return
1093
}
1094
var _params []interface{}
1095
1096
_params = append(_params, variable)
1097
1098
err = gp.C.Call(ctx, "setEnvVar", _params, nil)
1099
if err != nil {
1100
return
1101
}
1102
1103
return
1104
}
1105
1106
// DeleteEnvVar calls deleteEnvVar on the server
1107
func (gp *APIoverJSONRPC) DeleteEnvVar(ctx context.Context, variable *UserEnvVarValue) (err error) {
1108
if gp == nil {
1109
err = errNotConnected
1110
return
1111
}
1112
var _params []interface{}
1113
1114
_params = append(_params, variable)
1115
1116
err = gp.C.Call(ctx, "deleteEnvVar", _params, nil)
1117
if err != nil {
1118
return
1119
}
1120
1121
return
1122
}
1123
1124
// HasSSHPublicKey calls hasSSHPublicKey on the server
1125
func (gp *APIoverJSONRPC) HasSSHPublicKey(ctx context.Context) (res bool, err error) {
1126
if gp == nil {
1127
err = errNotConnected
1128
return
1129
}
1130
var _params []interface{}
1131
err = gp.C.Call(ctx, "hasSSHPublicKey", _params, &res)
1132
return
1133
}
1134
1135
// GetSSHPublicKeys calls getSSHPublicKeys on the server
1136
func (gp *APIoverJSONRPC) GetSSHPublicKeys(ctx context.Context) (res []*UserSSHPublicKeyValue, err error) {
1137
if gp == nil {
1138
err = errNotConnected
1139
return
1140
}
1141
var _params []interface{}
1142
err = gp.C.Call(ctx, "getSSHPublicKeys", _params, &res)
1143
return
1144
}
1145
1146
// AddSSHPublicKey calls addSSHPublicKey on the server
1147
func (gp *APIoverJSONRPC) AddSSHPublicKey(ctx context.Context, value *SSHPublicKeyValue) (res *UserSSHPublicKeyValue, err error) {
1148
if gp == nil {
1149
err = errNotConnected
1150
return
1151
}
1152
_params := []interface{}{value}
1153
err = gp.C.Call(ctx, "addSSHPublicKey", _params, &res)
1154
return
1155
}
1156
1157
// DeleteSSHPublicKey calls deleteSSHPublicKey on the server
1158
func (gp *APIoverJSONRPC) DeleteSSHPublicKey(ctx context.Context, id string) (err error) {
1159
if gp == nil {
1160
err = errNotConnected
1161
return
1162
}
1163
_params := []interface{}{id}
1164
err = gp.C.Call(ctx, "deleteSSHPublicKey", _params, nil)
1165
return
1166
}
1167
1168
// GetGitpodTokens calls getGitpodTokens on the server
1169
func (gp *APIoverJSONRPC) GetGitpodTokens(ctx context.Context) (res []*APIToken, err error) {
1170
if gp == nil {
1171
err = errNotConnected
1172
return
1173
}
1174
var _params []interface{}
1175
1176
var result []*APIToken
1177
err = gp.C.Call(ctx, "getGitpodTokens", _params, &result)
1178
if err != nil {
1179
return
1180
}
1181
res = result
1182
1183
return
1184
}
1185
1186
// GenerateNewGitpodToken calls generateNewGitpodToken on the server
1187
func (gp *APIoverJSONRPC) GenerateNewGitpodToken(ctx context.Context, options *GenerateNewGitpodTokenOptions) (res string, err error) {
1188
if gp == nil {
1189
err = errNotConnected
1190
return
1191
}
1192
var _params []interface{}
1193
1194
_params = append(_params, options)
1195
1196
var result string
1197
err = gp.C.Call(ctx, "generateNewGitpodToken", _params, &result)
1198
if err != nil {
1199
return
1200
}
1201
res = result
1202
1203
return
1204
}
1205
1206
// DeleteGitpodToken calls deleteGitpodToken on the server
1207
func (gp *APIoverJSONRPC) DeleteGitpodToken(ctx context.Context, tokenHash string) (err error) {
1208
if gp == nil {
1209
err = errNotConnected
1210
return
1211
}
1212
var _params []interface{}
1213
1214
_params = append(_params, tokenHash)
1215
1216
err = gp.C.Call(ctx, "deleteGitpodToken", _params, nil)
1217
if err != nil {
1218
return
1219
}
1220
1221
return
1222
}
1223
1224
// RegisterGithubApp calls registerGithubApp on the server
1225
func (gp *APIoverJSONRPC) RegisterGithubApp(ctx context.Context, installationID string) (err error) {
1226
if gp == nil {
1227
err = errNotConnected
1228
return
1229
}
1230
var _params []interface{}
1231
1232
_params = append(_params, installationID)
1233
1234
err = gp.C.Call(ctx, "registerGithubApp", _params, nil)
1235
if err != nil {
1236
return
1237
}
1238
1239
return
1240
}
1241
1242
// TakeSnapshot calls takeSnapshot on the server
1243
func (gp *APIoverJSONRPC) TakeSnapshot(ctx context.Context, options *TakeSnapshotOptions) (res string, err error) {
1244
if gp == nil {
1245
err = errNotConnected
1246
return
1247
}
1248
var _params []interface{}
1249
1250
_params = append(_params, options)
1251
1252
var result string
1253
err = gp.C.Call(ctx, "takeSnapshot", _params, &result)
1254
if err != nil {
1255
return
1256
}
1257
res = result
1258
1259
return
1260
}
1261
1262
// WaitForSnapshot calls waitForSnapshot on the server
1263
func (gp *APIoverJSONRPC) WaitForSnapshot(ctx context.Context, snapshotId string) (err error) {
1264
if gp == nil {
1265
err = errNotConnected
1266
return
1267
}
1268
var _params []interface{}
1269
1270
_params = append(_params, snapshotId)
1271
1272
var result string
1273
err = gp.C.Call(ctx, "waitForSnapshot", _params, &result)
1274
return
1275
}
1276
1277
// GetSnapshots calls getSnapshots on the server
1278
func (gp *APIoverJSONRPC) GetSnapshots(ctx context.Context, workspaceID string) (res []*string, err error) {
1279
if gp == nil {
1280
err = errNotConnected
1281
return
1282
}
1283
var _params []interface{}
1284
1285
_params = append(_params, workspaceID)
1286
1287
var result []*string
1288
err = gp.C.Call(ctx, "getSnapshots", _params, &result)
1289
if err != nil {
1290
return
1291
}
1292
res = result
1293
1294
return
1295
}
1296
1297
// GuessGitTokenScopes calls GuessGitTokenScopes on the server
1298
func (gp *APIoverJSONRPC) GuessGitTokenScopes(ctx context.Context, params *GuessGitTokenScopesParams) (res *GuessedGitTokenScopes, err error) {
1299
if gp == nil {
1300
err = errNotConnected
1301
return
1302
}
1303
var _params []interface{}
1304
1305
_params = append(_params, params)
1306
1307
var result GuessedGitTokenScopes
1308
err = gp.C.Call(ctx, "guessGitTokenScopes", _params, &result)
1309
if err != nil {
1310
return
1311
}
1312
res = &result
1313
1314
return
1315
}
1316
1317
// TrackEvent calls trackEvent on the server
1318
func (gp *APIoverJSONRPC) TrackEvent(ctx context.Context, params *RemoteTrackMessage) (err error) {
1319
if gp == nil {
1320
err = errNotConnected
1321
return
1322
}
1323
var _params []interface{}
1324
1325
_params = append(_params, params)
1326
err = gp.C.Call(ctx, "trackEvent", _params, nil)
1327
return
1328
}
1329
1330
func (gp *APIoverJSONRPC) GetSupportedWorkspaceClasses(ctx context.Context) (res []*SupportedWorkspaceClass, err error) {
1331
if gp == nil {
1332
err = errNotConnected
1333
return
1334
}
1335
_params := []interface{}{}
1336
err = gp.C.Call(ctx, "getSupportedWorkspaceClasses", _params, &res)
1337
return
1338
}
1339
1340
func (gp *APIoverJSONRPC) GetTeam(ctx context.Context, teamID string) (res *Team, err error) {
1341
if gp == nil {
1342
err = errNotConnected
1343
return
1344
}
1345
_params := []interface{}{teamID}
1346
err = gp.C.Call(ctx, string(FunctionGetTeam), _params, &res)
1347
return
1348
}
1349
1350
func (gp *APIoverJSONRPC) GetTeams(ctx context.Context) (res []*Team, err error) {
1351
if gp == nil {
1352
err = errNotConnected
1353
return
1354
}
1355
_params := []interface{}{}
1356
err = gp.C.Call(ctx, string(FunctionGetTeams), _params, &res)
1357
return
1358
}
1359
1360
func (gp *APIoverJSONRPC) CreateTeam(ctx context.Context, teamName string) (res *Team, err error) {
1361
if gp == nil {
1362
err = errNotConnected
1363
return
1364
}
1365
_params := []interface{}{teamName}
1366
err = gp.C.Call(ctx, string(FunctionCreateTeam), _params, &res)
1367
return
1368
}
1369
1370
func (gp *APIoverJSONRPC) GetTeamMembers(ctx context.Context, teamID string) (res []*TeamMemberInfo, err error) {
1371
if gp == nil {
1372
err = errNotConnected
1373
return
1374
}
1375
_params := []interface{}{teamID}
1376
err = gp.C.Call(ctx, string(FunctionGetTeamMembers), _params, &res)
1377
return
1378
}
1379
1380
func (gp *APIoverJSONRPC) JoinTeam(ctx context.Context, inviteID string) (res *Team, err error) {
1381
if gp == nil {
1382
err = errNotConnected
1383
return
1384
}
1385
_params := []interface{}{inviteID}
1386
err = gp.C.Call(ctx, string(FunctionJoinTeam), _params, &res)
1387
return
1388
}
1389
1390
func (gp *APIoverJSONRPC) GetGenericInvite(ctx context.Context, teamID string) (res *TeamMembershipInvite, err error) {
1391
if gp == nil {
1392
err = errNotConnected
1393
return
1394
}
1395
_params := []interface{}{teamID}
1396
err = gp.C.Call(ctx, string(FunctionGetGenericInvite), _params, &res)
1397
return
1398
}
1399
1400
func (gp *APIoverJSONRPC) ResetGenericInvite(ctx context.Context, teamID string) (res *TeamMembershipInvite, err error) {
1401
if gp == nil {
1402
err = errNotConnected
1403
return
1404
}
1405
_params := []interface{}{teamID}
1406
err = gp.C.Call(ctx, string(FunctionResetGenericInvite), _params, &res)
1407
return
1408
}
1409
1410
func (gp *APIoverJSONRPC) SetTeamMemberRole(ctx context.Context, teamID, userID string, role TeamMemberRole) (err error) {
1411
if gp == nil {
1412
err = errNotConnected
1413
return
1414
}
1415
_params := []interface{}{teamID, userID, role}
1416
err = gp.C.Call(ctx, string(FunctionSetTeamMemberRole), _params, nil)
1417
return
1418
}
1419
1420
func (gp *APIoverJSONRPC) RemoveTeamMember(ctx context.Context, teamID, userID string) (err error) {
1421
if gp == nil {
1422
err = errNotConnected
1423
return
1424
}
1425
_params := []interface{}{teamID, userID}
1426
err = gp.C.Call(ctx, string(FunctionRemoveTeamMember), _params, nil)
1427
return
1428
}
1429
1430
func (gp *APIoverJSONRPC) DeleteTeam(ctx context.Context, teamID string) (err error) {
1431
if gp == nil {
1432
err = errNotConnected
1433
return
1434
}
1435
_params := []interface{}{teamID}
1436
err = gp.C.Call(ctx, string(FunctionDeleteTeam), _params, nil)
1437
return
1438
}
1439
1440
func (gp *APIoverJSONRPC) GetOrgSettings(ctx context.Context, orgID string) (res *OrganizationSettings, err error) {
1441
if gp == nil {
1442
err = errNotConnected
1443
return
1444
}
1445
_params := []interface{}{orgID}
1446
err = gp.C.Call(ctx, string(FunctionGetOrgSettings), _params, &res)
1447
return
1448
}
1449
1450
func (gp *APIoverJSONRPC) GetDefaultWorkspaceImage(ctx context.Context, params *GetDefaultWorkspaceImageParams) (res *GetDefaultWorkspaceImageResult, err error) {
1451
if gp == nil {
1452
err = errNotConnected
1453
return
1454
}
1455
var _params []interface{}
1456
1457
_params = append(_params, params)
1458
1459
err = gp.C.Call(ctx, string(FunctionGetDefaultWorkspaceImage), _params, &res)
1460
return
1461
}
1462
1463
func (gp *APIoverJSONRPC) CreateProject(ctx context.Context, options *CreateProjectOptions) (res *Project, err error) {
1464
if gp == nil {
1465
err = errNotConnected
1466
return
1467
}
1468
_params := []interface{}{options}
1469
err = gp.C.Call(ctx, string(FunctionCreateProject), _params, &res)
1470
return
1471
}
1472
1473
func (gp *APIoverJSONRPC) DeleteProject(ctx context.Context, projectID string) (err error) {
1474
if gp == nil {
1475
err = errNotConnected
1476
return
1477
}
1478
_params := []interface{}{projectID}
1479
err = gp.C.Call(ctx, string(FunctionDeleteProject), _params, nil)
1480
return
1481
}
1482
1483
func (gp *APIoverJSONRPC) GetTeamProjects(ctx context.Context, teamID string) (res []*Project, err error) {
1484
if gp == nil {
1485
err = errNotConnected
1486
return
1487
}
1488
_params := []interface{}{teamID}
1489
err = gp.C.Call(ctx, string(FunctionGetTeamProjects), _params, &res)
1490
return
1491
}
1492
1493
func (gp *APIoverJSONRPC) GetIDToken(ctx context.Context) (err error) {
1494
if gp == nil {
1495
err = errNotConnected
1496
return
1497
}
1498
_params := []interface{}{}
1499
err = gp.C.Call(ctx, string(FunctionGetIDToken), _params, nil)
1500
return
1501
}
1502
1503
// PermissionName is the name of a permission
1504
type PermissionName string
1505
1506
const (
1507
// PermissionNameRegistryAccess is the "registry-access" permission
1508
PermissionNameRegistryAccess PermissionName = "registry-access"
1509
// PermissionNameAdminUsers is the "admin-users" permission
1510
PermissionNameAdminUsers PermissionName = "admin-users"
1511
// PermissionNameAdminWorkspaces is the "admin-workspaces" permission
1512
PermissionNameAdminWorkspaces PermissionName = "admin-workspaces"
1513
)
1514
1515
// AdmissionLevel is the admission level to a workspace
1516
type AdmissionLevel string
1517
1518
const (
1519
// AdmissionLevelOwner is the "owner" admission level
1520
AdmissionLevelOwner AdmissionLevel = "owner"
1521
// AdmissionLevelEveryone is the "everyone" admission level
1522
AdmissionLevelEveryone AdmissionLevel = "everyone"
1523
)
1524
1525
// PinAction is the pin action
1526
type PinAction string
1527
1528
const (
1529
// PinActionPin is the "pin" action
1530
PinActionPin PinAction = "pin"
1531
// PinActionUnpin is the "unpin" action
1532
PinActionUnpin PinAction = "unpin"
1533
// PinActionToggle is the "toggle" action
1534
PinActionToggle PinAction = "toggle"
1535
)
1536
1537
// UserInfo is the UserInfo message type
1538
type UserInfo struct {
1539
Name string `json:"name,omitempty"`
1540
}
1541
1542
// GetWorkspacesOptions is the GetWorkspacesOptions message type
1543
type GetWorkspacesOptions struct {
1544
Limit float64 `json:"limit,omitempty"`
1545
SearchString string `json:"searchString,omitempty"`
1546
PinnedOnly bool `json:"pinnedOnly,omitempty"`
1547
OrganizationId string `json:"organizationId,omitempty"`
1548
}
1549
1550
// StartWorkspaceResult is the StartWorkspaceResult message type
1551
type StartWorkspaceResult struct {
1552
InstanceID string `json:"instanceID,omitempty"`
1553
WorkspaceURL string `json:"workspaceURL,omitempty"`
1554
}
1555
1556
// APIToken is the APIToken message type
1557
type APIToken struct {
1558
1559
// Created timestamp
1560
Created string `json:"created,omitempty"`
1561
Deleted bool `json:"deleted,omitempty"`
1562
1563
// Human readable name of the token
1564
Name string `json:"name,omitempty"`
1565
1566
// Scopes (e.g. limition to read-only)
1567
Scopes []string `json:"scopes,omitempty"`
1568
1569
// Hash value (SHA256) of the token (primary key).
1570
TokenHash string `json:"tokenHash,omitempty"`
1571
1572
// // Token kindfloat64 is the float64 message type
1573
Type float64 `json:"type,omitempty"`
1574
1575
// The user the token belongs to.
1576
User *User `json:"user,omitempty"`
1577
}
1578
1579
// OAuth2Config is the OAuth2Config message type
1580
type OAuth2Config struct {
1581
AuthorizationParams map[string]string `json:"authorizationParams,omitempty"`
1582
AuthorizationURL string `json:"authorizationUrl,omitempty"`
1583
CallBackURL string `json:"callBackUrl,omitempty"`
1584
ClientID string `json:"clientId,omitempty"`
1585
ClientSecret string `json:"clientSecret,omitempty"`
1586
ConfigURL string `json:"configURL,omitempty"`
1587
Scope string `json:"scope,omitempty"`
1588
ScopeSeparator string `json:"scopeSeparator,omitempty"`
1589
SettingsURL string `json:"settingsUrl,omitempty"`
1590
TokenURL string `json:"tokenUrl,omitempty"`
1591
}
1592
1593
// AuthProviderEntry is the AuthProviderEntry message type
1594
type AuthProviderEntry struct {
1595
Host string `json:"host,omitempty"`
1596
ID string `json:"id,omitempty"`
1597
Oauth *OAuth2Config `json:"oauth,omitempty"`
1598
OwnerID string `json:"ownerId,omitempty"`
1599
1600
// Status string `json:"status,omitempty"` string is the string message type
1601
Type string `json:"type,omitempty"`
1602
}
1603
1604
// Commit is the Commit message type
1605
type Commit struct {
1606
Ref string `json:"ref,omitempty"`
1607
RefType string `json:"refType,omitempty"`
1608
Repository *Repository `json:"repository,omitempty"`
1609
Revision string `json:"revision,omitempty"`
1610
}
1611
1612
// Fork is the Fork message type
1613
type Fork struct {
1614
Parent *Repository `json:"parent,omitempty"`
1615
}
1616
1617
// Repository is the Repository message type
1618
type Repository struct {
1619
AvatarURL string `json:"avatarUrl,omitempty"`
1620
CloneURL string `json:"cloneUrl,omitempty"`
1621
DefaultBranch string `json:"defaultBranch,omitempty"`
1622
Description string `json:"description,omitempty"`
1623
Fork *Fork `json:"fork,omitempty"`
1624
Host string `json:"host,omitempty"`
1625
Name string `json:"name,omitempty"`
1626
Owner string `json:"owner,omitempty"`
1627
1628
// Optional for backwards compatibility
1629
Private bool `json:"private,omitempty"`
1630
WebURL string `json:"webUrl,omitempty"`
1631
}
1632
1633
// WorkspaceCreationResult is the WorkspaceCreationResult message type
1634
type WorkspaceCreationResult struct {
1635
CreatedWorkspaceID string `json:"createdWorkspaceId,omitempty"`
1636
ExistingWorkspaces []*WorkspaceInfo `json:"existingWorkspaces,omitempty"`
1637
WorkspaceURL string `json:"workspaceURL,omitempty"`
1638
}
1639
1640
// Workspace is the Workspace message type
1641
type Workspace struct {
1642
1643
// The resolved/built fixed named of the base image. This field is only set if the workspace
1644
// already has its base image built.
1645
BaseImageNameResolved string `json:"baseImageNameResolved,omitempty"`
1646
BasedOnPrebuildID string `json:"basedOnPrebuildId,omitempty"`
1647
BasedOnSnapshotID string `json:"basedOnSnapshotId,omitempty"`
1648
Config *WorkspaceConfig `json:"config,omitempty"`
1649
1650
// Marks the time when the workspace content has been deleted.
1651
ContentDeletedTime string `json:"contentDeletedTime,omitempty"`
1652
Context *WorkspaceContext `json:"context,omitempty"`
1653
ContextURL string `json:"contextURL,omitempty"`
1654
CreationTime string `json:"creationTime,omitempty"`
1655
Deleted bool `json:"deleted,omitempty"`
1656
Description string `json:"description,omitempty"`
1657
ID string `json:"id,omitempty"`
1658
1659
// The resolved, fix name of the workspace image. We only use this
1660
// to access the logs during an image build.
1661
ImageNameResolved string `json:"imageNameResolved,omitempty"`
1662
1663
// The source where to get the workspace base image from. This source is resolved
1664
// during workspace creation. Once a base image has been built the information in here
1665
// is superseded by baseImageNameResolved.
1666
ImageSource interface{} `json:"imageSource,omitempty"`
1667
OrganizationId string `json:"organizationId,omitempty"`
1668
OwnerID string `json:"ownerId,omitempty"`
1669
Pinned bool `json:"pinned,omitempty"`
1670
Shareable bool `json:"shareable,omitempty"`
1671
1672
// Mark as deleted (user-facing). The actual deletion of the workspace content is executed
1673
// with a (configurable) delay
1674
SoftDeleted string `json:"softDeleted,omitempty"`
1675
1676
// Marks the time when the workspace was marked as softDeleted. The actual deletion of the
1677
// workspace content happens after a configurable period
1678
1679
// SoftDeletedTime string `json:"softDeletedTime,omitempty"` string is the string message type
1680
Type string `json:"type,omitempty"`
1681
}
1682
1683
// WorkspaceConfig is the WorkspaceConfig message type
1684
type WorkspaceConfig struct {
1685
CheckoutLocation string `json:"checkoutLocation,omitempty"`
1686
1687
// Set of automatically inferred feature flags. That's not something the user can set, but
1688
// that is set by gitpod at workspace creation time.
1689
FeatureFlags []string `json:"_featureFlags,omitempty"`
1690
GitConfig map[string]string `json:"gitConfig,omitempty"`
1691
Github *GithubAppConfig `json:"github,omitempty"`
1692
Ide string `json:"ide,omitempty"`
1693
Image interface{} `json:"image,omitempty"`
1694
1695
// Where the config object originates from.
1696
//
1697
// repo - from the repository
1698
// derived - computed based on analyzing the repository
1699
// default - our static catch-all default config
1700
Origin string `json:"_origin,omitempty"`
1701
Ports []*PortConfig `json:"ports,omitempty"`
1702
Privileged bool `json:"privileged,omitempty"`
1703
Tasks []*TaskConfig `json:"tasks,omitempty"`
1704
Vscode *VSCodeConfig `json:"vscode,omitempty"`
1705
WorkspaceLocation string `json:"workspaceLocation,omitempty"`
1706
}
1707
1708
// WorkspaceContext is the WorkspaceContext message type
1709
type WorkspaceContext struct {
1710
ForceCreateNewWorkspace bool `json:"forceCreateNewWorkspace,omitempty"`
1711
NormalizedContextURL string `json:"normalizedContextURL,omitempty"`
1712
Title string `json:"title,omitempty"`
1713
1714
// Commit context
1715
Repository *Repository `json:"repository,omitempty"`
1716
Revision string `json:"revision,omitempty"`
1717
}
1718
1719
// WorkspaceImageSourceDocker is the WorkspaceImageSourceDocker message type
1720
type WorkspaceImageSourceDocker struct {
1721
DockerFileHash string `json:"dockerFileHash,omitempty"`
1722
DockerFilePath string `json:"dockerFilePath,omitempty"`
1723
DockerFileSource *Commit `json:"dockerFileSource,omitempty"`
1724
}
1725
1726
// WorkspaceImageSourceReference is the WorkspaceImageSourceReference message type
1727
type WorkspaceImageSourceReference struct {
1728
1729
// The resolved, fix base image reference
1730
BaseImageResolved string `json:"baseImageResolved,omitempty"`
1731
}
1732
1733
// WorkspaceInfo is the WorkspaceInfo message type
1734
type WorkspaceInfo struct {
1735
LatestInstance *WorkspaceInstance `json:"latestInstance,omitempty"`
1736
Workspace *Workspace `json:"workspace,omitempty"`
1737
}
1738
1739
// WorkspaceInstance is the WorkspaceInstance message type
1740
type WorkspaceInstance struct {
1741
Configuration *WorkspaceInstanceConfiguration `json:"configuration,omitempty"`
1742
CreationTime string `json:"creationTime,omitempty"`
1743
Deleted bool `json:"deleted,omitempty"`
1744
DeployedTime string `json:"deployedTime,omitempty"`
1745
ID string `json:"id,omitempty"`
1746
IdeURL string `json:"ideUrl,omitempty"`
1747
Region string `json:"region,omitempty"`
1748
StartedTime string `json:"startedTime,omitempty"`
1749
Status *WorkspaceInstanceStatus `json:"status,omitempty"`
1750
GitStatus *WorkspaceInstanceRepoStatus `json:"gitStatus,omitempty"`
1751
StoppedTime string `json:"stoppedTime,omitempty"`
1752
WorkspaceID string `json:"workspaceId,omitempty"`
1753
WorkspaceImage string `json:"workspaceImage,omitempty"`
1754
}
1755
1756
// WorkspaceInstanceConditions is the WorkspaceInstanceConditions message type
1757
type WorkspaceInstanceConditions struct {
1758
Deployed bool `json:"deployed,omitempty"`
1759
Failed string `json:"failed,omitempty"`
1760
FirstUserActivity string `json:"firstUserActivity,omitempty"`
1761
NeededImageBuild bool `json:"neededImageBuild,omitempty"`
1762
PullingImages bool `json:"pullingImages,omitempty"`
1763
Timeout string `json:"timeout,omitempty"`
1764
}
1765
1766
// WorkspaceInstanceConfiguration is the WorkspaceInstanceConfiguration message type
1767
type WorkspaceInstanceConfiguration struct {
1768
FeatureFlags []string `json:"featureFlags,omitempty"`
1769
TheiaVersion string `json:"theiaVersion,omitempty"`
1770
IDEConfig *WorkspaceInstanceIDEConfig `json:"ideConfig,omitempty"`
1771
}
1772
1773
// WorkspaceInstanceIDEConfig is the ide config information of a workspace instance
1774
type WorkspaceInstanceIDEConfig struct {
1775
UseLatest bool `json:"useLatest,omitempty"`
1776
IDE string `json:"ide,omitempty"`
1777
PreferToolbox bool `json:"preferToolbox,omitempty"`
1778
}
1779
1780
// WorkspaceInstanceRepoStatus is the WorkspaceInstanceRepoStatus message type
1781
type WorkspaceInstanceRepoStatus struct {
1782
Branch string `json:"branch,omitempty"`
1783
LatestCommit string `json:"latestCommit,omitempty"`
1784
TotalUncommitedFiles float64 `json:"totalUncommitedFiles,omitempty"`
1785
TotalUnpushedCommits float64 `json:"totalUnpushedCommits,omitempty"`
1786
TotalUntrackedFiles float64 `json:"totalUntrackedFiles,omitempty"`
1787
UncommitedFiles []string `json:"uncommitedFiles,omitempty"`
1788
UnpushedCommits []string `json:"unpushedCommits,omitempty"`
1789
UntrackedFiles []string `json:"untrackedFiles,omitempty"`
1790
}
1791
1792
// WorkspaceInstanceStatus is the WorkspaceInstanceStatus message type
1793
type WorkspaceInstanceStatus struct {
1794
Conditions *WorkspaceInstanceConditions `json:"conditions,omitempty"`
1795
ExposedPorts []*WorkspaceInstancePort `json:"exposedPorts,omitempty"`
1796
Message string `json:"message,omitempty"`
1797
NodeName string `json:"nodeName,omitempty"`
1798
OwnerToken string `json:"ownerToken,omitempty"`
1799
Phase string `json:"phase,omitempty"`
1800
Timeout string `json:"timeout,omitempty"`
1801
Version int `json:"version,omitempty"`
1802
}
1803
1804
// StartWorkspaceOptions is the StartWorkspaceOptions message type
1805
type StartWorkspaceOptions struct {
1806
ForceDefaultImage bool `json:"forceDefaultImage,omitempty"`
1807
WorkspaceClass string `json:"workspaceClass,omitempty"`
1808
IdeSettings *IDESettings `json:"ideSettings,omitempty"`
1809
Region string `json:"region,omitempty"`
1810
}
1811
1812
// GetWorkspaceTimeoutResult is the GetWorkspaceTimeoutResult message type
1813
type GetWorkspaceTimeoutResult struct {
1814
CanChange bool `json:"canChange,omitempty"`
1815
Duration string `json:"duration,omitempty"`
1816
HumanReadableDuration string `json:"humanReadableDuration,omitempty"`
1817
}
1818
1819
// WorkspaceInstancePort is the WorkspaceInstancePort message type
1820
type WorkspaceInstancePort struct {
1821
Port float64 `json:"port,omitempty"`
1822
URL string `json:"url,omitempty"`
1823
Visibility string `json:"visibility,omitempty"`
1824
Protocol string `json:"protocol,omitempty"`
1825
}
1826
1827
const (
1828
PortVisibilityPublic = "public"
1829
PortVisibilityPrivate = "private"
1830
)
1831
1832
const (
1833
PortProtocolHTTP = "http"
1834
PortProtocolHTTPS = "https"
1835
)
1836
1837
// GithubAppConfig is the GithubAppConfig message type
1838
type GithubAppConfig struct {
1839
Prebuilds *GithubAppPrebuildConfig `json:"prebuilds,omitempty"`
1840
}
1841
1842
// GithubAppPrebuildConfig is the GithubAppPrebuildConfig message type
1843
type GithubAppPrebuildConfig struct {
1844
AddBadge bool `json:"addBadge,omitempty"`
1845
AddCheck interface{} `json:"addCheck,omitempty"`
1846
AddComment bool `json:"addComment,omitempty"`
1847
AddLabel interface{} `json:"addLabel,omitempty"`
1848
Branches bool `json:"branches,omitempty"`
1849
Master bool `json:"master,omitempty"`
1850
PullRequests bool `json:"pullRequests,omitempty"`
1851
PullRequestsFromForks bool `json:"pullRequestsFromForks,omitempty"`
1852
}
1853
1854
// ImageConfigFile is the ImageConfigFile message type
1855
type ImageConfigFile struct {
1856
Context string `json:"context,omitempty"`
1857
File string `json:"file,omitempty"`
1858
}
1859
1860
// PortConfig is the PortConfig message type
1861
type PortConfig struct {
1862
OnOpen string `json:"onOpen,omitempty"`
1863
Port float64 `json:"port,omitempty"`
1864
Visibility string `json:"visibility,omitempty"`
1865
Description string `json:"description,omitempty"`
1866
Name string `json:"name,omitempty"`
1867
Protocol string `json:"protocol,omitempty"`
1868
}
1869
1870
// TaskConfig is the TaskConfig message type
1871
type TaskConfig struct {
1872
Before string `json:"before,omitempty"`
1873
Command string `json:"command,omitempty"`
1874
Env map[string]interface{} `json:"env,omitempty"`
1875
Init string `json:"init,omitempty"`
1876
Name string `json:"name,omitempty"`
1877
OpenIn string `json:"openIn,omitempty"`
1878
OpenMode string `json:"openMode,omitempty"`
1879
Prebuild string `json:"prebuild,omitempty"`
1880
}
1881
1882
// VSCodeConfig is the VSCodeConfig message type
1883
type VSCodeConfig struct {
1884
Extensions []string `json:"extensions,omitempty"`
1885
}
1886
1887
// Configuration is the Configuration message type
1888
type Configuration struct {
1889
IsDedicatedInstallation bool `json:"isDedicatedInstallation,omitempty"`
1890
}
1891
1892
// EnvVar is the EnvVar message type
1893
type EnvVar struct {
1894
ID string `json:"id,omitempty"`
1895
Name string `json:"name,omitempty"`
1896
Value string `json:"value,omitempty"`
1897
}
1898
1899
// UserEnvVarValue is the UserEnvVarValue message type
1900
type UserEnvVarValue struct {
1901
ID string `json:"id,omitempty"`
1902
Name string `json:"name,omitempty"`
1903
RepositoryPattern string `json:"repositoryPattern,omitempty"`
1904
Value string `json:"value,omitempty"`
1905
}
1906
1907
type SSHPublicKeyValue struct {
1908
Name string `json:"name,omitempty"`
1909
Key string `json:"key,omitempty"`
1910
}
1911
1912
type UserSSHPublicKeyValue struct {
1913
ID string `json:"id,omitempty"`
1914
Name string `json:"name,omitempty"`
1915
Key string `json:"key,omitempty"`
1916
Fingerprint string `json:"fingerprint,omitempty"`
1917
CreationTime string `json:"creationTime,omitempty"`
1918
LastUsedTime string `json:"lastUsedTime,omitempty"`
1919
}
1920
1921
// GenerateNewGitpodTokenOptions is the GenerateNewGitpodTokenOptions message type
1922
type GenerateNewGitpodTokenOptions struct {
1923
Name string `json:"name,omitempty"`
1924
1925
// Scopes []string `json:"scopes,omitempty"` float64 is the float64 message type
1926
Type float64 `json:"type,omitempty"`
1927
}
1928
1929
// TakeSnapshotOptions is the TakeSnapshotOptions message type
1930
type TakeSnapshotOptions struct {
1931
WorkspaceID string `json:"workspaceId,omitempty"`
1932
DontWait bool `json:"dontWait,omitempty"`
1933
}
1934
1935
// AdminBlockUserRequest is the AdminBlockUserRequest message type
1936
type AdminBlockUserRequest struct {
1937
UserID string `json:"id,omitempty"`
1938
IsBlocked bool `json:"blocked,omitempty"`
1939
}
1940
1941
// PickAuthProviderEntryHostOwnerIDType is the PickAuthProviderEntryHostOwnerIDType message type
1942
type PickAuthProviderEntryHostOwnerIDType struct {
1943
Host string `json:"host,omitempty"`
1944
1945
// OwnerId string `json:"ownerId,omitempty"` string is the string message type
1946
Type string `json:"type,omitempty"`
1947
}
1948
1949
// PickAuthProviderEntryOwnerID is the PickAuthProviderEntryOwnerID message type
1950
type PickAuthProviderEntryOwnerID struct {
1951
ID string `json:"id,omitempty"`
1952
OwnerID string `json:"ownerId,omitempty"`
1953
}
1954
1955
// PickOAuth2ConfigClientIDClientSecret is the PickOAuth2ConfigClientIDClientSecret message type
1956
type PickOAuth2ConfigClientIDClientSecret struct {
1957
ClientID string `json:"clientId,omitempty"`
1958
ClientSecret string `json:"clientSecret,omitempty"`
1959
}
1960
1961
// UpdateOwnAuthProviderParams is the UpdateOwnAuthProviderParams message type
1962
type UpdateOwnAuthProviderParams struct {
1963
Entry interface{} `json:"entry,omitempty"`
1964
}
1965
1966
// CreateWorkspaceOptions is the CreateWorkspaceOptions message type
1967
type CreateWorkspaceOptions struct {
1968
StartWorkspaceOptions
1969
ContextURL string `json:"contextUrl,omitempty"`
1970
ProjectId string `json:"projectId,omitempty"`
1971
OrganizationId string `json:"organizationId,omitempty"`
1972
IgnoreRunningWorkspaceOnSameCommit bool `json:"ignoreRunningWorkspaceOnSameCommit,omitempty"`
1973
ForceDefaultConfig bool `json:"forceDefaultConfig,omitempty"`
1974
IgnoreRunningPrebuild bool `json:"ignoreRunningPrebuild,omitempty"`
1975
AllowUsingPreviousPrebuilds bool `json:"allowUsingPreviousPrebuilds,omitempty"`
1976
}
1977
1978
// DeleteOwnAuthProviderParams is the DeleteOwnAuthProviderParams message type
1979
type DeleteOwnAuthProviderParams struct {
1980
ID string `json:"id,omitempty"`
1981
}
1982
1983
// GuessGitTokenScopesParams is the GuessGitTokenScopesParams message type
1984
type GuessGitTokenScopesParams struct {
1985
Host string `json:"host"`
1986
RepoURL string `json:"repoUrl"`
1987
GitCommand string `json:"gitCommand"`
1988
CurrentToken *GitToken `json:"currentToken"`
1989
}
1990
1991
type GitToken struct {
1992
Token string `json:"token"`
1993
User string `json:"user"`
1994
Scopes []string `json:"scopes"`
1995
}
1996
1997
// GuessedGitTokenScopes is the GuessedGitTokenScopes message type
1998
type GuessedGitTokenScopes struct {
1999
Scopes []string `json:"scopes,omitempty"`
2000
Message string `json:"message,omitempty"`
2001
}
2002
2003
// SupportedWorkspaceClass is the GetSupportedWorkspaceClasses message type
2004
type SupportedWorkspaceClass struct {
2005
ID string `json:"id,omitempty"`
2006
Category string `json:"category,omitempty"`
2007
DisplayName string `json:"displayName,omitempty"`
2008
Description string `json:"description,omitempty"`
2009
Powerups int `json:"powerups,omitempty"`
2010
IsDefault bool `json:"isDefault,omitempty"`
2011
}
2012
2013
type RemoteTrackMessage struct {
2014
Event string `json:"event,omitempty"`
2015
Properties interface{} `json:"properties,omitempty"`
2016
}
2017
2018
// WorkspaceInstanceUser is the WorkspaceInstanceUser message type
2019
type WorkspaceInstanceUser struct {
2020
AvatarURL string `json:"avatarUrl,omitempty"`
2021
InstanceID string `json:"instanceId,omitempty"`
2022
LastSeen string `json:"lastSeen,omitempty"`
2023
Name string `json:"name,omitempty"`
2024
UserID string `json:"userId,omitempty"`
2025
}
2026
2027
// SendHeartBeatOptions is the SendHeartBeatOptions message type
2028
type SendHeartBeatOptions struct {
2029
InstanceID string `json:"instanceId,omitempty"`
2030
RoundTripTime float64 `json:"roundTripTime,omitempty"`
2031
WasClosed bool `json:"wasClosed,omitempty"`
2032
}
2033
2034
// AdditionalUserData is the AdditionalUserData message type
2035
type AdditionalUserData struct {
2036
EmailNotificationSettings *EmailNotificationSettings `json:"emailNotificationSettings,omitempty"`
2037
Platforms []*UserPlatform `json:"platforms,omitempty"`
2038
IdeSettings *IDESettings `json:"ideSettings,omitempty"`
2039
}
2040
2041
// IDESettings is the IDESettings message type
2042
type IDESettings struct {
2043
DefaultIde string `json:"defaultIde,omitempty"`
2044
UseDesktopIde bool `json:"useDesktopIde,omitempty"`
2045
DefaultDesktopIde string `json:"defaultDesktopIde,omitempty"`
2046
UseLatestVersion bool `json:"useLatestVersion"`
2047
PreferToolbox bool `json:"preferToolbox"`
2048
}
2049
2050
// EmailNotificationSettings is the EmailNotificationSettings message type
2051
type EmailNotificationSettings struct {
2052
DisallowTransactionalEmails bool `json:"disallowTransactionalEmails,omitempty"`
2053
}
2054
2055
// Identity is the Identity message type
2056
type Identity struct {
2057
AuthID string `json:"authId,omitempty"`
2058
AuthName string `json:"authName,omitempty"`
2059
AuthProviderID string `json:"authProviderId,omitempty"`
2060
2061
// This is a flag that triggers the HARD DELETION of this entity
2062
Deleted bool `json:"deleted,omitempty"`
2063
PrimaryEmail string `json:"primaryEmail,omitempty"`
2064
Readonly bool `json:"readonly,omitempty"`
2065
Tokens []*Token `json:"tokens,omitempty"`
2066
LastSigninTime string `json:"lastSigninTime,omitempty"`
2067
}
2068
2069
// User is the User message type
2070
type User struct {
2071
AdditionalData *AdditionalUserData `json:"additionalData,omitempty"`
2072
AllowsMarketingCommunication bool `json:"allowsMarketingCommunication,omitempty"`
2073
AvatarURL string `json:"avatarUrl,omitempty"`
2074
2075
// Whether the user has been blocked to use our service, because of TOS violation for example.
2076
// Optional for backwards compatibility.
2077
Blocked bool `json:"blocked,omitempty"`
2078
2079
// The timestamp when the user entry was created
2080
CreationDate string `json:"creationDate,omitempty"`
2081
2082
// A map of random settings that alter the behaviour of Gitpod on a per-user basis
2083
FeatureFlags *UserFeatureSettings `json:"featureFlags,omitempty"`
2084
2085
// Optional for backwards compatibility
2086
FullName string `json:"fullName,omitempty"`
2087
2088
// The user id
2089
ID string `json:"id,omitempty"`
2090
Identities []*Identity `json:"identities,omitempty"`
2091
2092
// Whether the user is logical deleted. This flag is respected by all queries in UserDB
2093
MarkedDeleted bool `json:"markedDeleted,omitempty"`
2094
Name string `json:"name,omitempty"`
2095
2096
// The ID of the Organization this user is owned by. If empty, the user is owned by the installation
2097
OrganizationId string `json:"organizationId,omitempty"`
2098
2099
// whether this user can run workspaces in privileged mode
2100
Privileged bool `json:"privileged,omitempty"`
2101
2102
// The permissions and/or roles the user has
2103
RolesOrPermissions []string `json:"rolesOrPermissions,omitempty"`
2104
}
2105
2106
// Token is the Token message type
2107
type Token struct {
2108
ExpiryDate string `json:"expiryDate,omitempty"`
2109
IDToken string `json:"idToken,omitempty"`
2110
RefreshToken string `json:"refreshToken,omitempty"`
2111
Scopes []string `json:"scopes,omitempty"`
2112
UpdateDate string `json:"updateDate,omitempty"`
2113
Username string `json:"username,omitempty"`
2114
Value string `json:"value,omitempty"`
2115
}
2116
2117
// UserFeatureSettings is the UserFeatureSettings message type
2118
type UserFeatureSettings struct {
2119
2120
// Permanent feature flags are added to each and every workspace instance
2121
// this user starts.
2122
PermanentWSFeatureFlags []string `json:"permanentWSFeatureFlags,omitempty"`
2123
}
2124
2125
// UserPlatform is the UserPlatform message type
2126
type UserPlatform struct {
2127
Browser string `json:"browser,omitempty"`
2128
2129
// Since when does the user have the browser extension installe don this device.
2130
BrowserExtensionInstalledSince string `json:"browserExtensionInstalledSince,omitempty"`
2131
2132
// Since when does the user not have the browser extension installed anymore (but previously had).
2133
BrowserExtensionUninstalledSince string `json:"browserExtensionUninstalledSince,omitempty"`
2134
FirstUsed string `json:"firstUsed,omitempty"`
2135
LastUsed string `json:"lastUsed,omitempty"`
2136
Os string `json:"os,omitempty"`
2137
UID string `json:"uid,omitempty"`
2138
UserAgent string `json:"userAgent,omitempty"`
2139
}
2140
2141
// Requirements is the Requirements message type
2142
type Requirements struct {
2143
Default []string `json:"default,omitempty"`
2144
PrivateRepo []string `json:"privateRepo,omitempty"`
2145
PublicRepo []string `json:"publicRepo,omitempty"`
2146
}
2147
2148
// AuthProviderInfo is the AuthProviderInfo message type
2149
type AuthProviderInfo struct {
2150
AuthProviderID string `json:"authProviderId,omitempty"`
2151
AuthProviderType string `json:"authProviderType,omitempty"`
2152
Description string `json:"description,omitempty"`
2153
DisallowLogin bool `json:"disallowLogin,omitempty"`
2154
HiddenOnDashboard bool `json:"hiddenOnDashboard,omitempty"`
2155
Host string `json:"host,omitempty"`
2156
Icon string `json:"icon,omitempty"`
2157
IsReadonly bool `json:"isReadonly,omitempty"`
2158
LoginContextMatcher string `json:"loginContextMatcher,omitempty"`
2159
OwnerID string `json:"ownerId,omitempty"`
2160
Requirements *Requirements `json:"requirements,omitempty"`
2161
Scopes []string `json:"scopes,omitempty"`
2162
SettingsURL string `json:"settingsUrl,omitempty"`
2163
Verified bool `json:"verified,omitempty"`
2164
}
2165
2166
// GetTokenSearchOptions is the GetTokenSearchOptions message type
2167
type GetTokenSearchOptions struct {
2168
Host string `json:"host,omitempty"`
2169
}
2170
2171
// SetWorkspaceTimeoutResult is the SetWorkspaceTimeoutResult message type
2172
type SetWorkspaceTimeoutResult struct {
2173
ResetTimeoutOnWorkspaces []string `json:"resetTimeoutOnWorkspaces,omitempty"`
2174
HumanReadableDuration string `json:"humanReadableDuration,omitempty"`
2175
}
2176
2177
// UserMessage is the UserMessage message type
2178
type UserMessage struct {
2179
Content string `json:"content,omitempty"`
2180
2181
// date from where on this message should be shown
2182
From string `json:"from,omitempty"`
2183
ID string `json:"id,omitempty"`
2184
Title string `json:"title,omitempty"`
2185
URL string `json:"url,omitempty"`
2186
}
2187
2188
type Team struct {
2189
ID string `json:"id,omitempty"`
2190
Name string `json:"name,omitempty"`
2191
Slug string `json:"slug,omitempty"`
2192
CreationTime string `json:"creationTime,omitempty"`
2193
}
2194
2195
type TeamMemberRole string
2196
2197
const (
2198
TeamMember_Owner TeamMemberRole = "owner"
2199
TeamMember_Member TeamMemberRole = "member"
2200
)
2201
2202
type TeamMemberInfo struct {
2203
UserId string `json:"userId,omitempty"`
2204
FullName string `json:"fullName,omitempty"`
2205
PrimaryEmail string `json:"primaryEmail,omitempty"`
2206
AvatarUrl string `json:"avatarUrl,omitempty"`
2207
Role TeamMemberRole `json:"role,omitempty"`
2208
MemberSince string `json:"memberSince,omitempty"`
2209
OwnedByOrganization bool `json:"ownedByOrganization,omitempty"`
2210
}
2211
2212
type TeamMembershipInvite struct {
2213
ID string `json:"id,omitempty"`
2214
TeamID string `json:"teamId,omitempty"`
2215
Role TeamMemberRole `json:"role,omitempty"`
2216
CreationTime string `json:"creationTime,omitempty"`
2217
InvalidationTime string `json:"invalidationTime,omitempty"`
2218
InvitedEmail string `json:"invitedEmail,omitempty"`
2219
}
2220
2221
type OrganizationSettings struct {
2222
WorkspaceSharingDisabled bool `json:"workspaceSharingDisabled,omitempty"`
2223
DefaultWorkspaceImage string `json:"defaultWorkspaceImage,omitempty"`
2224
}
2225
2226
type Project struct {
2227
ID string `json:"id,omitempty"`
2228
UserID string `json:"userId,omitempty"`
2229
TeamID string `json:"teamId,omitempty"`
2230
Name string `json:"name,omitempty"`
2231
Slug string `json:"slug,omitempty"`
2232
CloneURL string `json:"cloneUrl,omitempty"`
2233
AppInstallationID string `json:"appInstallationId,omitempty"`
2234
Settings *ProjectSettings `json:"settings,omitempty"`
2235
CreationTime string `json:"creationTime,omitempty"`
2236
}
2237
2238
type ProjectSettings struct {
2239
UsePersistentVolumeClaim bool `json:"usePersistentVolumeClaim,omitempty"`
2240
WorkspaceClasses *WorkspaceClassesSettings `json:"workspaceClasses,omitempty"`
2241
PrebuildSettings *PrebuildSettings `json:"prebuilds,omitempty"`
2242
RestrictedWorkspaceClasses *[]string `json:"restrictedWorkspaceClasses,omitempty"`
2243
}
2244
type PrebuildSettings struct {
2245
Enable *bool `json:"enable,omitempty"`
2246
PrebuildInterval *int32 `json:"prebuildInterval,omitempty"`
2247
BranchStrategy *string `json:"branchStrategy,omitempty"`
2248
BranchMatchingPattern *string `json:"branchMatchingPattern,omitempty"`
2249
WorkspaceClass *string `json:"workspaceClass,omitempty"`
2250
}
2251
2252
type WorkspaceClassesSettings struct {
2253
Regular string `json:"regular,omitempty"`
2254
Prebuild string `json:"prebuild,omitempty"`
2255
}
2256
2257
type CreateProjectOptions struct {
2258
UserID string `json:"userId,omitempty"`
2259
TeamID string `json:"teamId,omitempty"`
2260
Name string `json:"name,omitempty"`
2261
Slug string `json:"slug,omitempty"`
2262
CloneURL string `json:"cloneUrl,omitempty"`
2263
AppInstallationID string `json:"appInstallationId,omitempty"`
2264
}
2265
2266
type IDEType string
2267
2268
const (
2269
IDETypeBrowser IDEType = "browser"
2270
IDETypeDesktop IDEType = "desktop"
2271
)
2272
2273
type IDEConfig struct {
2274
SupervisorImage string `json:"supervisorImage"`
2275
IdeOptions IDEOptions `json:"ideOptions"`
2276
}
2277
2278
type IDEOptions struct {
2279
// Options is a list of available IDEs.
2280
Options map[string]IDEOption `json:"options"`
2281
// DefaultIde when the user has not specified one.
2282
DefaultIde string `json:"defaultIde"`
2283
// DefaultDesktopIde when the user has not specified one.
2284
DefaultDesktopIde string `json:"defaultDesktopIde"`
2285
// Clients specific IDE options.
2286
Clients map[string]IDEClient `json:"clients"`
2287
}
2288
2289
type IDEOption struct {
2290
// OrderKey to ensure a stable order one can set an `orderKey`.
2291
OrderKey string `json:"orderKey,omitempty"`
2292
// Title with human readable text of the IDE (plain text only).
2293
Title string `json:"title"`
2294
// Type of the IDE, currently 'browser' or 'desktop'.
2295
Type IDEType `json:"type"`
2296
// Logo URL for the IDE. See also components/ide-proxy/static/image/ide-log/ folder
2297
Logo string `json:"logo"`
2298
// Tooltip plain text only
2299
Tooltip string `json:"tooltip,omitempty"`
2300
// Label is next to the IDE option like “Browser” (plain text only).
2301
Label string `json:"label,omitempty"`
2302
// Notes to the IDE option that are rendered in the preferences when a user chooses this IDE.
2303
Notes []string `json:"notes,omitempty"`
2304
// Hidden this IDE option is not visible in the IDE preferences.
2305
Hidden bool `json:"hidden,omitempty"`
2306
// Experimental this IDE option is to only be shown to some users
2307
Experimental bool `json:"experimental,omitempty"`
2308
// Image ref to the IDE image.
2309
Image string `json:"image"`
2310
// LatestImage ref to the IDE image, this image ref always resolve to digest.
2311
LatestImage string `json:"latestImage,omitempty"`
2312
// ResolveImageDigest when this is `true`, the tag of this image is resolved to the latest image digest regularly.
2313
// This is useful if this image points to a tag like `nightly` that will be updated regularly. When `resolveImageDigest` is `true`, we make sure that we resolve the tag regularly to the most recent image version.
2314
ResolveImageDigest bool `json:"resolveImageDigest,omitempty"`
2315
// PluginImage ref for the IDE image, this image ref always resolve to digest.
2316
// DEPRECATED use ImageLayers instead
2317
PluginImage string `json:"pluginImage,omitempty"`
2318
// PluginLatestImage ref for the latest IDE image, this image ref always resolve to digest.
2319
// DEPRECATED use LatestImageLayers instead
2320
PluginLatestImage string `json:"pluginLatestImage,omitempty"`
2321
// ImageVersion the semantic version of the IDE image.
2322
ImageVersion string `json:"imageVersion,omitempty"`
2323
// LatestImageVersion the semantic version of the latest IDE image.
2324
LatestImageVersion string `json:"latestImageVersion,omitempty"`
2325
// ImageLayers for additional ide layers and dependencies
2326
ImageLayers []string `json:"imageLayers,omitempty"`
2327
// LatestImageLayers for latest additional ide layers and dependencies
2328
LatestImageLayers []string `json:"latestImageLayers,omitempty"`
2329
}
2330
2331
type IDEClient struct {
2332
// DefaultDesktopIDE when the user has not specified one.
2333
DefaultDesktopIDE string `json:"defaultDesktopIDE,omitempty"`
2334
// DesktopIDEs supported by the client.
2335
DesktopIDEs []string `json:"desktopIDEs,omitempty"`
2336
// InstallationSteps to install the client on user machine.
2337
InstallationSteps []string `json:"installationSteps,omitempty"`
2338
}
2339
2340
type GetDefaultWorkspaceImageParams struct {
2341
WorkspaceID string `json:"workspaceId,omitempty"`
2342
}
2343
2344
type WorkspaceImageSource string
2345
2346
const (
2347
WorkspaceImageSourceInstallation WorkspaceImageSource = "installation"
2348
WorkspaceImageSourceOrganization WorkspaceImageSource = "organization"
2349
)
2350
2351
type GetDefaultWorkspaceImageResult struct {
2352
Image string `json:"image,omitempty"`
2353
Source WorkspaceImageSource `json:"source,omitempty"`
2354
}
2355
2356