feat(cli): add hidden netcheck command (#8136)

This commit is contained in:
Colin Adler
2023-06-21 14:33:19 -05:00
committed by GitHub
parent 7703bb77a7
commit bc739bdfce
8 changed files with 189 additions and 0 deletions

28
coderd/apidoc/docs.go generated
View File

@ -4006,6 +4006,34 @@ const docTemplate = `{
}
}
},
"/workspaceagents/connection": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Agents"
],
"summary": "Get connection info for workspace agent generic",
"operationId": "get-connection-info-for-workspace-agent-generic",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.WorkspaceAgentConnectionInfo"
}
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/workspaceagents/google-instance-identity": {
"post": {
"security": [

View File

@ -3528,6 +3528,30 @@
}
}
},
"/workspaceagents/connection": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Agents"],
"summary": "Get connection info for workspace agent generic",
"operationId": "get-connection-info-for-workspace-agent-generic",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.WorkspaceAgentConnectionInfo"
}
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/workspaceagents/google-instance-identity": {
"post": {
"security": [

View File

@ -672,6 +672,7 @@ func New(options *Options) *API {
r.Post("/azure-instance-identity", api.postWorkspaceAuthAzureInstanceIdentity)
r.Post("/aws-instance-identity", api.postWorkspaceAuthAWSInstanceIdentity)
r.Post("/google-instance-identity", api.postWorkspaceAuthGoogleInstanceIdentity)
r.Get("/connection", api.workspaceAgentConnectionGeneric)
r.Route("/me", func(r chi.Router) {
r.Use(httpmw.ExtractWorkspaceAgent(options.Database))
r.Get("/manifest", api.workspaceAgentManifest)

View File

@ -805,6 +805,25 @@ func (api *API) workspaceAgentConnection(rw http.ResponseWriter, r *http.Request
})
}
// workspaceAgentConnectionGeneric is the same as workspaceAgentConnection but
// without the workspaceagent path parameter.
//
// @Summary Get connection info for workspace agent generic
// @ID get-connection-info-for-workspace-agent-generic
// @Security CoderSessionToken
// @Produce json
// @Tags Agents
// @Success 200 {object} codersdk.WorkspaceAgentConnectionInfo
// @Router /workspaceagents/connection [get]
// @x-apidocgen {"skip": true}
func (api *API) workspaceAgentConnectionGeneric(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
httpapi.Write(ctx, rw, http.StatusOK, codersdk.WorkspaceAgentConnectionInfo{
DERPMap: api.DERPMap,
})
}
// @Summary Coordinate workspace agent via Tailnet
// @Description It accepts a WebSocket connection to an agent that listens to
// @Description incoming connections and publishes node updates.