Skip to content

webapi cleanup#24363

Merged
ibeckermayer merged 12 commits intomasterfrom
isaiah/webapi-cleanup
Apr 28, 2023
Merged

webapi cleanup#24363
ibeckermayer merged 12 commits intomasterfrom
isaiah/webapi-cleanup

Conversation

@ibeckermayer
Copy link
Copy Markdown
Contributor

  • Ensures that every Session has Kind defined
  • Previously on the frontend, we were using a single variable
terminalSessionPath: '/v1/webapi/sites/:clusterId/sessions/:sid?',

to hit all of /webapi/sites/:site/sessions, /webapi/sites/:site/sessions/:sid/events, and /webapi/sites/:site/sessions/:sid/stream on the backend. The latter two were being hit in the EventProvider where we append "/events" or "/stream" to this.url. Now this has been split into

activeAndPendingSessionsPath: '/v1/webapi/sites/:clusterId/sessions',
sshPlaybackPrefix: '/v1/webapi/sites/:clusterId/sessions/:sid', // prefix because this is eventually concatenated with "/stream" or "/events"

which better indicates the different purposes of the paths.

  • renames siteSessionsGet to clusterActiveAndPendingSessionsGet
  • deletes siteSessionGenerate and siteSessionGet, which were not being used.

TODO: change base branch once #24238 is merged

Comment thread lib/web/apiserver.go
// Response body:
//
// {"session": {"id": "sid", "terminal_params": {"w": 100, "h": 100}, "parties": [], "login": "bob"}}
func (h *Handler) siteSessionGet(w http.ResponseWriter, r *http.Request, p httprouter.Params, sctx *SessionContext, site reversetunnel.RemoteSite) (interface{}, error) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing uses this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT no. But I can use more pairs of eyes as a sanity check.

Copy link
Copy Markdown
Contributor

@avatus avatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems to be working fine. I Tested everything session related manually and no hiccups

Base automatically changed from michaelmyers/is_moderated_sesion_flag to master April 12, 2023 21:42
@ibeckermayer ibeckermayer enabled auto-merge April 14, 2023 18:23
Comment thread lib/web/apiserver.go
@ibeckermayer ibeckermayer force-pushed the isaiah/webapi-cleanup branch from a6c5e7e to 6d1343a Compare April 28, 2023 20:33
@ibeckermayer ibeckermayer added this pull request to the merge queue Apr 28, 2023
Merged via the queue into master with commit 1267c72 Apr 28, 2023
@ibeckermayer ibeckermayer deleted the isaiah/webapi-cleanup branch April 28, 2023 21:04
ibeckermayer pushed a commit that referenced this pull request Apr 28, 2023
* Add isModeratedSession flag to web ssh session

* Fix lint

* Change to snakecase

* Change to moderated

* Ensures every Session has a valid Kind field.

Also cleans up the client code to distinguish between
terminalSessionPath and activeAndPendingSessionsPath.

* Entirely removes siteSessionGet which was not being used

* removes siteSessionGenerate which was not being used

* removes test testing webapi/sites/<cluster-name>/sessions post call, which is no longer used by the frontend

* removing unused struct

---------

Co-authored-by: Michael Myers <michael.myers@goteleport.com>
ibeckermayer pushed a commit that referenced this pull request Apr 28, 2023
* Add isModeratedSession flag to web ssh session

* Fix lint

* Change to snakecase

* Change to moderated

* Ensures every Session has a valid Kind field.

Also cleans up the client code to distinguish between
terminalSessionPath and activeAndPendingSessionsPath.

* Entirely removes siteSessionGet which was not being used

* removes siteSessionGenerate which was not being used

* removes test testing webapi/sites/<cluster-name>/sessions post call, which is no longer used by the frontend

* removing unused struct

---------

Co-authored-by: Michael Myers <michael.myers@goteleport.com>
ibeckermayer pushed a commit that referenced this pull request Apr 29, 2023
* Add isModeratedSession flag to web ssh session

* Fix lint

* Change to snakecase

* Change to moderated

* Ensures every Session has a valid Kind field.

Also cleans up the client code to distinguish between
terminalSessionPath and activeAndPendingSessionsPath.

* Entirely removes siteSessionGet which was not being used

* removes siteSessionGenerate which was not being used

* removes test testing webapi/sites/<cluster-name>/sessions post call, which is no longer used by the frontend

* removing unused struct

---------

Co-authored-by: Michael Myers <michael.myers@goteleport.com>
stevenGravy pushed a commit that referenced this pull request May 1, 2023
* Add isModeratedSession flag to web ssh session

* Fix lint

* Change to snakecase

* Change to moderated

* Ensures every Session has a valid Kind field.

Also cleans up the client code to distinguish between
terminalSessionPath and activeAndPendingSessionsPath.

* Entirely removes siteSessionGet which was not being used

* removes siteSessionGenerate which was not being used

* removes test testing webapi/sites/<cluster-name>/sessions post call, which is no longer used by the frontend

* removing unused struct

---------

Co-authored-by: Michael Myers <michael.myers@goteleport.com>
@r0mant r0mant mentioned this pull request Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants