Skip to content

Commit f1b5f44

Browse files
committed
add autostop method to store
1 parent 4c064d1 commit f1b5f44

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pkg/store/workspace.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,23 @@ func (s AuthHTTPStore) StopWorkspace(workspaceID string) (*entity.Workspace, err
368368
return &result, nil
369369
}
370370

371+
func (s AuthHTTPStore) AutoStopWorkspace(workspaceID string) (*entity.Workspace, error) {
372+
var result entity.Workspace
373+
res, err := s.authHTTPClient.restyClient.R().
374+
SetHeader("Content-Type", "application/json").
375+
SetQueryParam("autoStop", "true").
376+
SetPathParam(workspaceIDParamName, workspaceID).
377+
SetResult(&result).
378+
Put(workspaceStopPath)
379+
if err != nil {
380+
return nil, breverrors.WrapAndTrace(err)
381+
}
382+
if res.IsError() {
383+
return nil, NewHTTPResponseError(res)
384+
}
385+
return &result, nil
386+
}
387+
371388
var (
372389
workspaceStartPathPattern = fmt.Sprintf("%s/start", workspacePathPattern)
373390
workspaceStartPath = fmt.Sprintf(workspaceStartPathPattern, fmt.Sprintf("{%s}", workspaceIDParamName))

0 commit comments

Comments
 (0)