mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: correct SCIM Swagger try it out URLs (#24779)
This commit is contained in:
+10
-10
@@ -44,7 +44,7 @@ import (
|
||||
// @Param user path string true "Username, user ID, or 'me' for the authenticated user"
|
||||
// @Param request body codersdk.CreateTaskRequest true "Create task request"
|
||||
// @Success 201 {object} codersdk.Task
|
||||
// @Router /tasks/{user} [post]
|
||||
// @Router /api/v2/tasks/{user} [post]
|
||||
func (api *API) tasksCreate(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -401,7 +401,7 @@ func deriveTaskCurrentState(
|
||||
// @Tags Tasks
|
||||
// @Param q query string false "Search query for filtering tasks. Supports: owner:<username/uuid/me>, organization:<org-name/uuid>, status:<status>"
|
||||
// @Success 200 {object} codersdk.TasksListResponse
|
||||
// @Router /tasks [get]
|
||||
// @Router /api/v2/tasks [get]
|
||||
func (api *API) tasksList(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -511,7 +511,7 @@ func (api *API) convertTasks(ctx context.Context, requesterID uuid.UUID, dbTasks
|
||||
// @Param user path string true "Username, user ID, or 'me' for the authenticated user"
|
||||
// @Param task path string true "Task ID, or task name"
|
||||
// @Success 200 {object} codersdk.Task
|
||||
// @Router /tasks/{user}/{task} [get]
|
||||
// @Router /api/v2/tasks/{user}/{task} [get]
|
||||
func (api *API) taskGet(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -585,7 +585,7 @@ func (api *API) taskGet(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "Username, user ID, or 'me' for the authenticated user"
|
||||
// @Param task path string true "Task ID, or task name"
|
||||
// @Success 202
|
||||
// @Router /tasks/{user}/{task} [delete]
|
||||
// @Router /api/v2/tasks/{user}/{task} [delete]
|
||||
func (api *API) taskDelete(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -659,7 +659,7 @@ func (api *API) taskDelete(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param task path string true "Task ID, or task name"
|
||||
// @Param request body codersdk.UpdateTaskInputRequest true "Update task input request"
|
||||
// @Success 204
|
||||
// @Router /tasks/{user}/{task}/input [patch]
|
||||
// @Router /api/v2/tasks/{user}/{task}/input [patch]
|
||||
func (api *API) taskUpdateInput(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -739,7 +739,7 @@ func (api *API) taskUpdateInput(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param task path string true "Task ID, or task name"
|
||||
// @Param request body codersdk.TaskSendRequest true "Task input request"
|
||||
// @Success 204
|
||||
// @Router /tasks/{user}/{task}/send [post]
|
||||
// @Router /api/v2/tasks/{user}/{task}/send [post]
|
||||
func (api *API) taskSend(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
task := httpmw.TaskParam(r)
|
||||
@@ -831,7 +831,7 @@ func convertAgentAPIMessagesToLogEntries(messages []agentapisdk.Message) ([]code
|
||||
// @Param user path string true "Username, user ID, or 'me' for the authenticated user"
|
||||
// @Param task path string true "Task ID, or task name"
|
||||
// @Success 200 {object} codersdk.TaskLogsResponse
|
||||
// @Router /tasks/{user}/{task}/logs [get]
|
||||
// @Router /api/v2/tasks/{user}/{task}/logs [get]
|
||||
func (api *API) taskLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
task := httpmw.TaskParam(r)
|
||||
@@ -1117,7 +1117,7 @@ type TaskLogSnapshotEnvelope struct {
|
||||
// @Param format query string true "Snapshot format" enums(agentapi)
|
||||
// @Param request body object true "Raw snapshot payload (structure depends on format parameter)"
|
||||
// @Success 204
|
||||
// @Router /workspaceagents/me/tasks/{task}/log-snapshot [post]
|
||||
// @Router /api/v2/workspaceagents/me/tasks/{task}/log-snapshot [post]
|
||||
func (api *API) postWorkspaceAgentTaskLogSnapshot(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1266,7 +1266,7 @@ func (api *API) postWorkspaceAgentTaskLogSnapshot(rw http.ResponseWriter, r *htt
|
||||
// @Param user path string true "Username, user ID, or 'me' for the authenticated user"
|
||||
// @Param task path string true "Task ID" format(uuid)
|
||||
// @Success 202 {object} codersdk.PauseTaskResponse
|
||||
// @Router /tasks/{user}/{task}/pause [post]
|
||||
// @Router /api/v2/tasks/{user}/{task}/pause [post]
|
||||
func (api *API) pauseTask(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1343,7 +1343,7 @@ func (api *API) pauseTask(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "Username, user ID, or 'me' for the authenticated user"
|
||||
// @Param task path string true "Task ID" format(uuid)
|
||||
// @Success 202 {object} codersdk.ResumeTaskResponse
|
||||
// @Router /tasks/{user}/{task}/resume [post]
|
||||
// @Router /api/v2/tasks/{user}/{task}/resume [post]
|
||||
func (api *API) resumeTask(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
Generated
+10479
-10479
File diff suppressed because it is too large
Load Diff
Generated
+9314
-9314
File diff suppressed because it is too large
Load Diff
+8
-8
@@ -36,7 +36,7 @@ import (
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param request body codersdk.CreateTokenRequest true "Create token request"
|
||||
// @Success 201 {object} codersdk.GenerateAPIKeyResponse
|
||||
// @Router /users/{user}/keys/tokens [post]
|
||||
// @Router /api/v2/users/{user}/keys/tokens [post]
|
||||
func (api *API) postToken(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -190,7 +190,7 @@ func (api *API) postToken(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 201 {object} codersdk.GenerateAPIKeyResponse
|
||||
// @Router /users/{user}/keys [post]
|
||||
// @Router /api/v2/users/{user}/keys [post]
|
||||
func (api *API) postAPIKey(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -244,7 +244,7 @@ func (api *API) postAPIKey(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param keyid path string true "Key ID" format(string)
|
||||
// @Success 200 {object} codersdk.APIKey
|
||||
// @Router /users/{user}/keys/{keyid} [get]
|
||||
// @Router /api/v2/users/{user}/keys/{keyid} [get]
|
||||
func (api *API) apiKeyByID(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -273,7 +273,7 @@ func (api *API) apiKeyByID(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param keyname path string true "Key Name" format(string)
|
||||
// @Success 200 {object} codersdk.APIKey
|
||||
// @Router /users/{user}/keys/tokens/{keyname} [get]
|
||||
// @Router /api/v2/users/{user}/keys/tokens/{keyname} [get]
|
||||
func (api *API) apiKeyByName(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -308,7 +308,7 @@ func (api *API) apiKeyByName(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {array} codersdk.APIKey
|
||||
// @Param include_expired query bool false "Include expired tokens in the list"
|
||||
// @Router /users/{user}/keys/tokens [get]
|
||||
// @Router /api/v2/users/{user}/keys/tokens [get]
|
||||
func (api *API) tokens(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -391,7 +391,7 @@ func (api *API) tokens(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param keyid path string true "Key ID" format(string)
|
||||
// @Success 204
|
||||
// @Router /users/{user}/keys/{keyid} [delete]
|
||||
// @Router /api/v2/users/{user}/keys/{keyid} [delete]
|
||||
func (api *API) deleteAPIKey(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -436,7 +436,7 @@ func (api *API) deleteAPIKey(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Success 204
|
||||
// @Failure 404 {object} codersdk.Response
|
||||
// @Failure 500 {object} codersdk.Response
|
||||
// @Router /users/{user}/keys/{keyid}/expire [put]
|
||||
// @Router /api/v2/users/{user}/keys/{keyid}/expire [put]
|
||||
func (api *API) expireAPIKey(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -497,7 +497,7 @@ func (api *API) expireAPIKey(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags General
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.TokenConfig
|
||||
// @Router /users/{user}/keys/tokens/tokenconfig [get]
|
||||
// @Router /api/v2/users/{user}/keys/tokens/tokenconfig [get]
|
||||
func (api *API) tokenConfig(rw http.ResponseWriter, r *http.Request) {
|
||||
user := httpmw.UserParam(r)
|
||||
maxLifetime, err := api.getMaxTokenLifetime(r.Context(), user.ID)
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
||||
// @Produce json
|
||||
// @Tags General
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router / [get]
|
||||
// @Router /api/v2/ [get]
|
||||
func apiRoot(w http.ResponseWriter, r *http.Request) {
|
||||
httpapi.Write(r.Context(), w, http.StatusOK, codersdk.Response{
|
||||
//nolint:gocritic
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ const auditLogCountCap = 2000
|
||||
// @Param limit query int true "Page limit"
|
||||
// @Param offset query int false "Page offset"
|
||||
// @Success 200 {object} codersdk.AuditLogResponse
|
||||
// @Router /audit [get]
|
||||
// @Router /api/v2/audit [get]
|
||||
func (api *API) auditLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -115,7 +115,7 @@ func (api *API) auditLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Audit
|
||||
// @Param request body codersdk.CreateTestAuditLogRequest true "Audit log request"
|
||||
// @Success 204
|
||||
// @Router /audit/testgenerate [post]
|
||||
// @Router /api/v2/audit/testgenerate [post]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) generateFakeAuditLog(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
+1
-1
@@ -165,7 +165,7 @@ func (h *HTTPAuthorizer) AuthorizeSQLFilterContext(ctx context.Context, action p
|
||||
// @Tags Authorization
|
||||
// @Param request body codersdk.AuthorizationRequest true "Authorization request"
|
||||
// @Success 200 {object} codersdk.AuthorizationResponse
|
||||
// @Router /authcheck [post]
|
||||
// @Router /api/v2/authcheck [post]
|
||||
func (api *API) checkAuthorization(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
auth := httpmw.UserAuthorization(r.Context())
|
||||
|
||||
+10
-11
@@ -5,6 +5,7 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"database/sql"
|
||||
_ "embed"
|
||||
"errors"
|
||||
"expvar"
|
||||
"flag"
|
||||
@@ -115,6 +116,9 @@ import (
|
||||
// See https://github.com/swaggo/http-swagger/issues/78
|
||||
var globalHTTPSwaggerHandler http.HandlerFunc
|
||||
|
||||
//go:embed swagger_request_interceptor.js
|
||||
var swaggerRequestInterceptor string
|
||||
|
||||
func init() {
|
||||
globalHTTPSwaggerHandler = httpSwagger.Handler(
|
||||
httpSwagger.URL("/swagger/doc.json"),
|
||||
@@ -130,16 +134,11 @@ func init() {
|
||||
// So remove authenticating via a cookie, and rely on the authorization
|
||||
// header passed in.
|
||||
httpSwagger.UIConfig(map[string]string{
|
||||
// Pulled from https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/
|
||||
// 'withCredentials' should disable fetch sending browser credentials, but
|
||||
// for whatever reason it does not.
|
||||
// So this `requestInterceptor` ensures browser credentials are
|
||||
// omitted from all requests.
|
||||
"requestInterceptor": `(a => {
|
||||
a.credentials = "omit";
|
||||
return a;
|
||||
})`,
|
||||
"withCredentials": "false",
|
||||
// The interceptor source lives in swagger_request_interceptor.js so
|
||||
// it can be edited as real JavaScript.
|
||||
// See https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/.
|
||||
"requestInterceptor": swaggerRequestInterceptor,
|
||||
"withCredentials": "false",
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -310,7 +309,7 @@ type Options struct {
|
||||
// @license.name AGPL-3.0
|
||||
// @license.url https://github.com/coder/coder/blob/main/LICENSE
|
||||
|
||||
// @BasePath /api/v2
|
||||
// @BasePath /
|
||||
|
||||
// @securitydefinitions.apiKey Authorization
|
||||
// @in header
|
||||
|
||||
+21
-2
@@ -2,6 +2,7 @@ package coderd_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -280,7 +281,9 @@ func TestSwagger(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer resp.Body.Close()
|
||||
|
||||
require.Contains(t, string(body), "Swagger UI")
|
||||
bodyString := string(body)
|
||||
require.Contains(t, bodyString, "Swagger UI")
|
||||
require.Contains(t, bodyString, "requestInterceptor")
|
||||
})
|
||||
t.Run("doc.json exposed", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -299,7 +302,23 @@ func TestSwagger(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer resp.Body.Close()
|
||||
|
||||
require.Contains(t, string(body), `"swagger": "2.0"`)
|
||||
bodyString := string(body)
|
||||
require.NotContains(t, bodyString, `"/api/v2/scim/v2`)
|
||||
|
||||
var doc struct {
|
||||
Swagger string `json:"swagger"`
|
||||
BasePath string `json:"basePath"`
|
||||
Paths map[string]map[string]json.RawMessage `json:"paths"`
|
||||
}
|
||||
require.NoError(t, json.Unmarshal(body, &doc))
|
||||
require.Equal(t, "2.0", doc.Swagger)
|
||||
require.Equal(t, "/", doc.BasePath)
|
||||
require.Contains(t, doc.Paths, "/api/v2/users")
|
||||
require.Contains(t, doc.Paths, "/api/v2/oauth2-provider/apps")
|
||||
require.Contains(t, doc.Paths, "/api/experimental/watch-all-workspacebuilds")
|
||||
require.Contains(t, doc.Paths, "/.well-known/oauth-authorization-server")
|
||||
require.Contains(t, doc.Paths, "/oauth2/tokens")
|
||||
require.Contains(t, doc.Paths, "/scim/v2/Users")
|
||||
})
|
||||
t.Run("endpoint disabled by default", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestEndpointsDocumented(t *testing.T) {
|
||||
require.NotEmpty(t, swaggerComments, "swagger comments must be present")
|
||||
|
||||
_, _, api := coderdtest.NewWithAPI(t, nil)
|
||||
coderdtest.VerifySwaggerDefinitions(t, api.APIHandler, swaggerComments)
|
||||
coderdtest.VerifySwaggerDefinitions(t, api.APIHandler, swaggerComments, coderdtest.WithSwaggerRoutePrefix("/api/v2"))
|
||||
}
|
||||
|
||||
func TestSDKFieldsFormatted(t *testing.T) {
|
||||
|
||||
@@ -147,11 +147,33 @@ func parseSwaggerComment(commentGroup *ast.CommentGroup) SwaggerComment {
|
||||
return c
|
||||
}
|
||||
|
||||
func isExperimentalEndpoint(route string) bool {
|
||||
return strings.HasPrefix(route, "/workspaceagents/me/experimental/")
|
||||
// SwaggerOption configures VerifySwaggerDefinitions.
|
||||
type SwaggerOption func(*swaggerOptions)
|
||||
|
||||
type swaggerOptions struct {
|
||||
routePrefix string
|
||||
}
|
||||
|
||||
func VerifySwaggerDefinitions(t *testing.T, router chi.Router, swaggerComments []SwaggerComment) {
|
||||
// WithSwaggerRoutePrefix prepends the given prefix to every route walked from
|
||||
// the chi router. Use this when calling VerifySwaggerDefinitions with a
|
||||
// subrouter (for example api.APIHandler at /api/v2) so that routes line up
|
||||
// with the absolute paths used in @Router annotations.
|
||||
func WithSwaggerRoutePrefix(prefix string) SwaggerOption {
|
||||
return func(o *swaggerOptions) {
|
||||
o.routePrefix = prefix
|
||||
}
|
||||
}
|
||||
|
||||
func isExperimentalEndpoint(route string) bool {
|
||||
return strings.HasPrefix(route, "/api/v2/workspaceagents/me/experimental/")
|
||||
}
|
||||
|
||||
func VerifySwaggerDefinitions(t *testing.T, router chi.Router, swaggerComments []SwaggerComment, opts ...SwaggerOption) {
|
||||
cfg := swaggerOptions{}
|
||||
for _, opt := range opts {
|
||||
opt(&cfg)
|
||||
}
|
||||
|
||||
assertUniqueRoutes(t, swaggerComments)
|
||||
assertSingleAnnotations(t, swaggerComments)
|
||||
|
||||
@@ -161,6 +183,18 @@ func VerifySwaggerDefinitions(t *testing.T, router chi.Router, swaggerComments [
|
||||
route = route[:len(route)-1]
|
||||
}
|
||||
|
||||
// chi.Walk yields routes relative to the router that
|
||||
// VerifySwaggerDefinitions was called with. Prepend the configured
|
||||
// mount prefix so routes match the absolute paths used in @Router
|
||||
// annotations.
|
||||
if cfg.routePrefix != "" {
|
||||
if route == "/" {
|
||||
route = cfg.routePrefix + "/"
|
||||
} else {
|
||||
route = cfg.routePrefix + route
|
||||
}
|
||||
}
|
||||
|
||||
t.Run(method+" "+route, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -313,14 +347,14 @@ func assertSecurityDefined(t *testing.T, comment SwaggerComment) {
|
||||
"CoderProvisionerKey",
|
||||
}
|
||||
|
||||
if comment.router == "/updatecheck" ||
|
||||
comment.router == "/buildinfo" ||
|
||||
comment.router == "/" ||
|
||||
comment.router == "/auth/scopes" ||
|
||||
comment.router == "/users/login" ||
|
||||
comment.router == "/users/otp/request" ||
|
||||
comment.router == "/users/otp/change-password" ||
|
||||
comment.router == "/init-script/{os}/{arch}" {
|
||||
if comment.router == "/api/v2/updatecheck" ||
|
||||
comment.router == "/api/v2/buildinfo" ||
|
||||
comment.router == "/api/v2/" ||
|
||||
comment.router == "/api/v2/auth/scopes" ||
|
||||
comment.router == "/api/v2/users/login" ||
|
||||
comment.router == "/api/v2/users/otp/request" ||
|
||||
comment.router == "/api/v2/users/otp/change-password" ||
|
||||
comment.router == "/api/v2/init-script/{os}/{arch}" {
|
||||
return // endpoints do not require authorization
|
||||
}
|
||||
assert.Containsf(t, authorizedSecurityTags, comment.security, "@Security must be either of these options: %v", authorizedSecurityTags)
|
||||
@@ -365,14 +399,14 @@ func assertProduce(t *testing.T, comment SwaggerComment) {
|
||||
assert.True(t, comment.produce != "", "Route must have @Produce annotation as it responds with a model structure")
|
||||
assert.Contains(t, allowedProduceTypes, comment.produce, "@Produce value is limited to specific types: %s", strings.Join(allowedProduceTypes, ","))
|
||||
} else {
|
||||
if (comment.router == "/workspaceagents/me/app-health" && comment.method == "post") ||
|
||||
(comment.router == "/workspaceagents/me/startup" && comment.method == "post") ||
|
||||
(comment.router == "/workspaceagents/me/startup/logs" && comment.method == "patch") ||
|
||||
(comment.router == "/licenses/{id}" && comment.method == "delete") ||
|
||||
(comment.router == "/debug/coordinator" && comment.method == "get") ||
|
||||
(comment.router == "/debug/tailnet" && comment.method == "get") ||
|
||||
(comment.router == "/workspaces/{workspace}/acl" && comment.method == "patch") ||
|
||||
(comment.router == "/init-script/{os}/{arch}" && comment.method == "get") {
|
||||
if (comment.router == "/api/v2/workspaceagents/me/app-health" && comment.method == "post") ||
|
||||
(comment.router == "/api/v2/workspaceagents/me/startup" && comment.method == "post") ||
|
||||
(comment.router == "/api/v2/workspaceagents/me/startup/logs" && comment.method == "patch") ||
|
||||
(comment.router == "/api/v2/licenses/{id}" && comment.method == "delete") ||
|
||||
(comment.router == "/api/v2/debug/coordinator" && comment.method == "get") ||
|
||||
(comment.router == "/api/v2/debug/tailnet" && comment.method == "get") ||
|
||||
(comment.router == "/api/v2/workspaces/{workspace}/acl" && comment.method == "patch") ||
|
||||
(comment.router == "/api/v2/init-script/{os}/{arch}" && comment.method == "get") {
|
||||
return // Exception: HTTP 200 is returned without response entity
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ type cspViolation struct {
|
||||
// @Tags General
|
||||
// @Param request body cspViolation true "Violation report"
|
||||
// @Success 200
|
||||
// @Router /csp/reports [post]
|
||||
// @Router /api/v2/csp/reports [post]
|
||||
func (api *API) logReportCSPViolations(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var v cspViolation
|
||||
|
||||
+15
-15
@@ -38,7 +38,7 @@ import (
|
||||
// @Produce text/html
|
||||
// @Tags Debug
|
||||
// @Success 200
|
||||
// @Router /debug/coordinator [get]
|
||||
// @Router /api/v2/debug/coordinator [get]
|
||||
func (api *API) debugCoordinator(rw http.ResponseWriter, r *http.Request) {
|
||||
(*api.TailnetCoordinator.Load()).ServeHTTPDebug(rw, r)
|
||||
}
|
||||
@@ -49,7 +49,7 @@ func (api *API) debugCoordinator(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Produce text/html
|
||||
// @Tags Debug
|
||||
// @Success 200
|
||||
// @Router /debug/tailnet [get]
|
||||
// @Router /api/v2/debug/tailnet [get]
|
||||
func (api *API) debugTailnet(rw http.ResponseWriter, r *http.Request) {
|
||||
api.agentProvider.ServeHTTPDebug(rw, r)
|
||||
}
|
||||
@@ -60,7 +60,7 @@ func (api *API) debugTailnet(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Produce json
|
||||
// @Tags Debug
|
||||
// @Success 200 {object} healthsdk.HealthcheckReport
|
||||
// @Router /debug/health [get]
|
||||
// @Router /api/v2/debug/health [get]
|
||||
// @Param force query boolean false "Force a healthcheck to run"
|
||||
func (api *API) debugDeploymentHealth(rw http.ResponseWriter, r *http.Request) {
|
||||
apiKey := httpmw.APITokenFromRequest(r)
|
||||
@@ -168,7 +168,7 @@ func formatHealthcheck(ctx context.Context, rw http.ResponseWriter, r *http.Requ
|
||||
// @Produce json
|
||||
// @Tags Debug
|
||||
// @Success 200 {object} healthsdk.HealthSettings
|
||||
// @Router /debug/health/settings [get]
|
||||
// @Router /api/v2/debug/health/settings [get]
|
||||
func (api *API) deploymentHealthSettings(rw http.ResponseWriter, r *http.Request) {
|
||||
settingsJSON, err := api.Database.GetHealthSettings(r.Context())
|
||||
if err != nil {
|
||||
@@ -204,7 +204,7 @@ func (api *API) deploymentHealthSettings(rw http.ResponseWriter, r *http.Request
|
||||
// @Tags Debug
|
||||
// @Param request body healthsdk.UpdateHealthSettings true "Update health settings"
|
||||
// @Success 200 {object} healthsdk.UpdateHealthSettings
|
||||
// @Router /debug/health/settings [put]
|
||||
// @Router /api/v2/debug/health/settings [put]
|
||||
func (api *API) putDeploymentHealthSettings(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -297,7 +297,7 @@ func validateHealthSettings(settings healthsdk.HealthSettings) error {
|
||||
// @Produce json
|
||||
// @Tags Debug
|
||||
// @Success 201 {object} codersdk.Response
|
||||
// @Router /debug/ws [get]
|
||||
// @Router /api/v2/debug/ws [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func _debugws(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
|
||||
@@ -307,7 +307,7 @@ func _debugws(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
// @Produce json
|
||||
// @Success 200 {array} derp.BytesSentRecv
|
||||
// @Tags Debug
|
||||
// @Router /debug/derp/traffic [get]
|
||||
// @Router /api/v2/debug/derp/traffic [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func _debugDERPTraffic(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
|
||||
@@ -317,7 +317,7 @@ func _debugDERPTraffic(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
// @Produce json
|
||||
// @Tags Debug
|
||||
// @Success 200 {object} map[string]any
|
||||
// @Router /debug/expvar [get]
|
||||
// @Router /api/v2/debug/expvar [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func _debugExpVar(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
|
||||
@@ -415,7 +415,7 @@ const (
|
||||
// @Security CoderSessionToken
|
||||
// @Tags Debug
|
||||
// @Success 200
|
||||
// @Router /debug/profile [post]
|
||||
// @Router /api/v2/debug/profile [post]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) debugCollectProfile(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
@@ -634,7 +634,7 @@ func (api *API) debugCollectProfile(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Security CoderSessionToken
|
||||
// @Success 200
|
||||
// @Tags Debug
|
||||
// @Router /debug/pprof [get]
|
||||
// @Router /api/v2/debug/pprof [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func _debugPprofIndex(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
|
||||
@@ -643,7 +643,7 @@ func _debugPprofIndex(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
// @Security CoderSessionToken
|
||||
// @Success 200
|
||||
// @Tags Debug
|
||||
// @Router /debug/pprof/cmdline [get]
|
||||
// @Router /api/v2/debug/pprof/cmdline [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func _debugPprofCmdline(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
|
||||
@@ -652,7 +652,7 @@ func _debugPprofCmdline(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
// @Security CoderSessionToken
|
||||
// @Success 200
|
||||
// @Tags Debug
|
||||
// @Router /debug/pprof/profile [get]
|
||||
// @Router /api/v2/debug/pprof/profile [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func _debugPprofProfile(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
|
||||
@@ -661,7 +661,7 @@ func _debugPprofProfile(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
// @Security CoderSessionToken
|
||||
// @Success 200
|
||||
// @Tags Debug
|
||||
// @Router /debug/pprof/symbol [get]
|
||||
// @Router /api/v2/debug/pprof/symbol [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func _debugPprofSymbol(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
|
||||
@@ -670,7 +670,7 @@ func _debugPprofSymbol(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
// @Security CoderSessionToken
|
||||
// @Success 200
|
||||
// @Tags Debug
|
||||
// @Router /debug/pprof/trace [get]
|
||||
// @Router /api/v2/debug/pprof/trace [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func _debugPprofTrace(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
|
||||
@@ -679,6 +679,6 @@ func _debugPprofTrace(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
// @Security CoderSessionToken
|
||||
// @Success 200
|
||||
// @Tags Debug
|
||||
// @Router /debug/metrics [get]
|
||||
// @Router /api/v2/debug/metrics [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func _debugMetrics(http.ResponseWriter, *http.Request) {} //nolint:unused
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
// @Produce json
|
||||
// @Tags General
|
||||
// @Success 200 {object} codersdk.DeploymentConfig
|
||||
// @Router /deployment/config [get]
|
||||
// @Router /api/v2/deployment/config [get]
|
||||
func (api *API) deploymentValues(rw http.ResponseWriter, r *http.Request) {
|
||||
if !api.Authorize(r, policy.ActionRead, rbac.ResourceDeploymentConfig) {
|
||||
httpapi.Forbidden(rw)
|
||||
@@ -43,7 +43,7 @@ func (api *API) deploymentValues(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Produce json
|
||||
// @Tags General
|
||||
// @Success 200 {object} codersdk.DeploymentStats
|
||||
// @Router /deployment/stats [get]
|
||||
// @Router /api/v2/deployment/stats [get]
|
||||
func (api *API) deploymentStats(rw http.ResponseWriter, r *http.Request) {
|
||||
if !api.Authorize(r, policy.ActionRead, rbac.ResourceDeploymentStats) {
|
||||
httpapi.Forbidden(rw)
|
||||
@@ -66,7 +66,7 @@ func (api *API) deploymentStats(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Produce json
|
||||
// @Tags General
|
||||
// @Success 200 {object} codersdk.BuildInfoResponse
|
||||
// @Router /buildinfo [get]
|
||||
// @Router /api/v2/buildinfo [get]
|
||||
func buildInfoHandler(resp codersdk.BuildInfoResponse) http.HandlerFunc {
|
||||
// This is in a handler so that we can generate API docs info.
|
||||
return func(rw http.ResponseWriter, r *http.Request) {
|
||||
@@ -80,7 +80,7 @@ func buildInfoHandler(resp codersdk.BuildInfoResponse) http.HandlerFunc {
|
||||
// @Produce json
|
||||
// @Tags General
|
||||
// @Success 200 {object} codersdk.SSHConfigResponse
|
||||
// @Router /deployment/ssh [get]
|
||||
// @Router /api/v2/deployment/ssh [get]
|
||||
func (api *API) sshConfig(rw http.ResponseWriter, r *http.Request) {
|
||||
httpapi.Write(r.Context(), rw, http.StatusOK, api.SSHConfig)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200
|
||||
// @Router /templateversions/{templateversion}/parameters [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/parameters [get]
|
||||
func templateVersionParametersDeprecated(rw http.ResponseWriter, r *http.Request) {
|
||||
httpapi.Write(r.Context(), rw, http.StatusOK, []struct{}{})
|
||||
}
|
||||
@@ -25,7 +25,7 @@ func templateVersionParametersDeprecated(rw http.ResponseWriter, r *http.Request
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200
|
||||
// @Router /templateversions/{templateversion}/schema [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/schema [get]
|
||||
func templateVersionSchemaDeprecated(rw http.ResponseWriter, r *http.Request) {
|
||||
httpapi.Write(r.Context(), rw, http.StatusOK, []struct{}{})
|
||||
}
|
||||
@@ -41,7 +41,7 @@ func templateVersionSchemaDeprecated(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param follow query bool false "Follow log stream"
|
||||
// @Param no_compression query bool false "Disable compression for WebSocket connection"
|
||||
// @Success 200 {array} codersdk.WorkspaceAgentLog
|
||||
// @Router /workspaceagents/{workspaceagent}/startup-logs [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/startup-logs [get]
|
||||
func (api *API) workspaceAgentLogsDeprecated(rw http.ResponseWriter, r *http.Request) {
|
||||
api.workspaceAgentLogs(rw, r)
|
||||
}
|
||||
@@ -55,7 +55,7 @@ func (api *API) workspaceAgentLogsDeprecated(rw http.ResponseWriter, r *http.Req
|
||||
// @Param id query string true "Provider ID"
|
||||
// @Param listen query bool false "Wait for a new token to be issued"
|
||||
// @Success 200 {object} agentsdk.ExternalAuthResponse
|
||||
// @Router /workspaceagents/me/gitauth [get]
|
||||
// @Router /api/v2/workspaceagents/me/gitauth [get]
|
||||
func (api *API) workspaceAgentsGitAuth(rw http.ResponseWriter, r *http.Request) {
|
||||
api.workspaceAgentsExternalAuth(rw, r)
|
||||
}
|
||||
@@ -67,7 +67,7 @@ func (api *API) workspaceAgentsGitAuth(rw http.ResponseWriter, r *http.Request)
|
||||
// @Tags Builds
|
||||
// @Param workspacebuild path string true "Workspace build ID"
|
||||
// @Success 200 {array} codersdk.WorkspaceResource
|
||||
// @Router /workspacebuilds/{workspacebuild}/resources [get]
|
||||
// @Router /api/v2/workspacebuilds/{workspacebuild}/resources [get]
|
||||
// @Deprecated this endpoint is unused and will be removed in future.
|
||||
func (api *API) workspaceBuildResourcesDeprecated(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
+3
-3
@@ -4486,7 +4486,7 @@ func (api *API) putChatWorkspaceTTL(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Chats
|
||||
// @Produce json
|
||||
// @Success 200 {object} codersdk.ChatRetentionDaysResponse
|
||||
// @Router /experimental/chats/config/retention-days [get]
|
||||
// @Router /api/experimental/chats/config/retention-days [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
//
|
||||
//nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.
|
||||
@@ -4516,7 +4516,7 @@ const retentionDaysMaximum = 3650 // ~10 years
|
||||
// @Accept json
|
||||
// @Param request body codersdk.UpdateChatRetentionDaysRequest true "Request body"
|
||||
// @Success 204
|
||||
// @Router /experimental/chats/config/retention-days [put]
|
||||
// @Router /api/experimental/chats/config/retention-days [put]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) putChatRetentionDays(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
@@ -6941,7 +6941,7 @@ func (api *API) hasEffectiveCentralProviderAPIKey(
|
||||
// @Param start_date query string true "Start date (RFC3339)"
|
||||
// @Param end_date query string true "End date (RFC3339)"
|
||||
// @Success 200 {object} codersdk.PRInsightsResponse
|
||||
// @Router /chats/insights/pull-requests [get]
|
||||
// @Router /api/experimental/chats/insights/pull-requests [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) prInsights(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
// @Produce json
|
||||
// @Tags General
|
||||
// @Success 200 {array} codersdk.Experiment
|
||||
// @Router /experiments [get]
|
||||
// @Router /api/v2/experiments [get]
|
||||
func (api *API) handleExperimentsGet(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
httpapi.Write(ctx, rw, http.StatusOK, api.Experiments)
|
||||
@@ -25,7 +25,7 @@ func (api *API) handleExperimentsGet(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Produce json
|
||||
// @Tags General
|
||||
// @Success 200 {array} codersdk.Experiment
|
||||
// @Router /experiments/available [get]
|
||||
// @Router /api/v2/experiments/available [get]
|
||||
func handleExperimentsAvailable(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
httpapi.Write(ctx, rw, http.StatusOK, codersdk.AvailableExperiments{
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
// @Produce json
|
||||
// @Param externalauth path string true "Git Provider ID" format(string)
|
||||
// @Success 200 {object} codersdk.ExternalAuth
|
||||
// @Router /external-auth/{externalauth} [get]
|
||||
// @Router /api/v2/external-auth/{externalauth} [get]
|
||||
func (api *API) externalAuthByID(w http.ResponseWriter, r *http.Request) {
|
||||
config := httpmw.ExternalAuthParam(r)
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -89,7 +89,7 @@ func (api *API) externalAuthByID(w http.ResponseWriter, r *http.Request) {
|
||||
// @Produce json
|
||||
// @Param externalauth path string true "Git Provider ID" format(string)
|
||||
// @Success 200 {object} codersdk.DeleteExternalAuthByIDResponse
|
||||
// @Router /external-auth/{externalauth} [delete]
|
||||
// @Router /api/v2/external-auth/{externalauth} [delete]
|
||||
func (api *API) deleteExternalAuthByID(w http.ResponseWriter, r *http.Request) {
|
||||
config := httpmw.ExternalAuthParam(r)
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -142,7 +142,7 @@ func (api *API) deleteExternalAuthByID(w http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Git
|
||||
// @Param externalauth path string true "External Provider ID" format(string)
|
||||
// @Success 204
|
||||
// @Router /external-auth/{externalauth}/device [post]
|
||||
// @Router /api/v2/external-auth/{externalauth}/device [post]
|
||||
func (api *API) postExternalAuthDeviceByID(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -232,7 +232,7 @@ func (api *API) postExternalAuthDeviceByID(rw http.ResponseWriter, r *http.Reque
|
||||
// @Tags Git
|
||||
// @Param externalauth path string true "Git Provider ID" format(string)
|
||||
// @Success 200 {object} codersdk.ExternalAuthDevice
|
||||
// @Router /external-auth/{externalauth}/device [get]
|
||||
// @Router /api/v2/external-auth/{externalauth}/device [get]
|
||||
func (*API) externalAuthDeviceByID(rw http.ResponseWriter, r *http.Request) {
|
||||
config := httpmw.ExternalAuthParam(r)
|
||||
ctx := r.Context()
|
||||
@@ -345,7 +345,7 @@ func (api *API) externalAuthCallback(externalAuthConfig *externalauth.Config) ht
|
||||
// @Produce json
|
||||
// @Tags Git
|
||||
// @Success 200 {object} codersdk.ExternalAuthLink
|
||||
// @Router /external-auth [get]
|
||||
// @Router /api/v2/external-auth [get]
|
||||
func (api *API) listUserExternalAuths(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
key := httpmw.APIKey(r)
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ const (
|
||||
// @Param file formData file true "File to be uploaded. If using tar format, file must conform to ustar (pax may cause problems)."
|
||||
// @Success 200 {object} codersdk.UploadResponse "Returns existing file if duplicate"
|
||||
// @Success 201 {object} codersdk.UploadResponse "Returns newly created file"
|
||||
// @Router /files [post]
|
||||
// @Router /api/v2/files [post]
|
||||
func (api *API) postFile(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -149,7 +149,7 @@ func (api *API) postFile(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Files
|
||||
// @Param fileID path string true "File ID" format(uuid)
|
||||
// @Success 200
|
||||
// @Router /files/{fileID} [get]
|
||||
// @Router /api/v2/files/{fileID} [get]
|
||||
func (api *API) fileByID(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@ import (
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.GitSSHKey
|
||||
// @Router /users/{user}/gitsshkey [put]
|
||||
// @Router /api/v2/users/{user}/gitsshkey [put]
|
||||
func (api *API) regenerateGitSSHKey(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -84,7 +84,7 @@ func (api *API) regenerateGitSSHKey(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.GitSSHKey
|
||||
// @Router /users/{user}/gitsshkey [get]
|
||||
// @Router /api/v2/users/{user}/gitsshkey [get]
|
||||
func (api *API) gitSSHKey(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
user := httpmw.UserParam(r)
|
||||
@@ -113,7 +113,7 @@ func (api *API) gitSSHKey(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Produce json
|
||||
// @Tags Agents
|
||||
// @Success 200 {object} agentsdk.GitSSHKey
|
||||
// @Router /workspaceagents/me/gitsshkey [get]
|
||||
// @Router /api/v2/workspaceagents/me/gitsshkey [get]
|
||||
func (api *API) agentGitSSHKey(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
agent := httpmw.WorkspaceAgent(r)
|
||||
|
||||
@@ -115,7 +115,7 @@ func convertInboxNotificationResponse(ctx context.Context, logger slog.Logger, n
|
||||
// @Param read_status query string false "Filter notifications by read status. Possible values: read, unread, all"
|
||||
// @Param format query string false "Define the output format for notifications title and body." enums(plaintext,markdown)
|
||||
// @Success 200 {object} codersdk.GetInboxNotificationResponse
|
||||
// @Router /notifications/inbox/watch [get]
|
||||
// @Router /api/v2/notifications/inbox/watch [get]
|
||||
func (api *API) watchInboxNotifications(rw http.ResponseWriter, r *http.Request) {
|
||||
p := httpapi.NewQueryParamParser()
|
||||
vals := r.URL.Query()
|
||||
@@ -286,7 +286,7 @@ func (api *API) watchInboxNotifications(rw http.ResponseWriter, r *http.Request)
|
||||
// @Param read_status query string false "Filter notifications by read status. Possible values: read, unread, all"
|
||||
// @Param starting_before query string false "ID of the last notification from the current page. Notifications returned will be older than the associated one" format(uuid)
|
||||
// @Success 200 {object} codersdk.ListInboxNotificationsResponse
|
||||
// @Router /notifications/inbox [get]
|
||||
// @Router /api/v2/notifications/inbox [get]
|
||||
func (api *API) listInboxNotifications(rw http.ResponseWriter, r *http.Request) {
|
||||
p := httpapi.NewQueryParamParser()
|
||||
vals := r.URL.Query()
|
||||
@@ -372,7 +372,7 @@ func (api *API) listInboxNotifications(rw http.ResponseWriter, r *http.Request)
|
||||
// @Tags Notifications
|
||||
// @Param id path string true "id of the notification"
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /notifications/inbox/{id}/read-status [put]
|
||||
// @Router /api/v2/notifications/inbox/{id}/read-status [put]
|
||||
func (api *API) updateInboxNotificationReadStatus(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -440,7 +440,7 @@ func (api *API) updateInboxNotificationReadStatus(rw http.ResponseWriter, r *htt
|
||||
// @Security CoderSessionToken
|
||||
// @Tags Notifications
|
||||
// @Success 204
|
||||
// @Router /notifications/inbox/mark-all-as-read [put]
|
||||
// @Router /api/v2/notifications/inbox/mark-all-as-read [put]
|
||||
func (api *API) markAllInboxNotificationsAsRead(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
// @Param os path string true "Operating system"
|
||||
// @Param arch path string true "Architecture"
|
||||
// @Success 200 "Success"
|
||||
// @Router /init-script/{os}/{arch} [get]
|
||||
// @Router /api/v2/init-script/{os}/{arch} [get]
|
||||
func (api *API) initScript(rw http.ResponseWriter, r *http.Request) {
|
||||
os := strings.ToLower(chi.URLParam(r, "os"))
|
||||
arch := strings.ToLower(chi.URLParam(r, "arch"))
|
||||
|
||||
+5
-5
@@ -33,7 +33,7 @@ const insightsTimeLayout = time.RFC3339
|
||||
// @Tags Insights
|
||||
// @Param tz_offset query int true "Time-zone offset (e.g. -2)"
|
||||
// @Success 200 {object} codersdk.DAUsResponse
|
||||
// @Router /insights/daus [get]
|
||||
// @Router /api/v2/insights/daus [get]
|
||||
func (api *API) deploymentDAUs(rw http.ResponseWriter, r *http.Request) {
|
||||
if !api.Authorize(r, policy.ActionRead, rbac.ResourceDeploymentConfig) {
|
||||
httpapi.Forbidden(rw)
|
||||
@@ -106,7 +106,7 @@ func (api *API) returnDAUsInternal(rw http.ResponseWriter, r *http.Request, temp
|
||||
// @Param end_time query string true "End time" format(date-time)
|
||||
// @Param template_ids query []string false "Template IDs" collectionFormat(csv)
|
||||
// @Success 200 {object} codersdk.UserActivityInsightsResponse
|
||||
// @Router /insights/user-activity [get]
|
||||
// @Router /api/v2/insights/user-activity [get]
|
||||
func (api *API) insightsUserActivity(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -209,7 +209,7 @@ func (api *API) insightsUserActivity(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param end_time query string true "End time" format(date-time)
|
||||
// @Param template_ids query []string false "Template IDs" collectionFormat(csv)
|
||||
// @Success 200 {object} codersdk.UserLatencyInsightsResponse
|
||||
// @Router /insights/user-latency [get]
|
||||
// @Router /api/v2/insights/user-latency [get]
|
||||
func (api *API) insightsUserLatency(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -301,7 +301,7 @@ func (api *API) insightsUserLatency(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param timezone query string false "IANA timezone name (e.g. America/St_Johns)"
|
||||
// @Param tz_offset query int false "Deprecated: Time-zone offset (e.g. -2). Use timezone instead."
|
||||
// @Success 200 {object} codersdk.GetUserStatusCountsResponse
|
||||
// @Router /insights/user-status-counts [get]
|
||||
// @Router /api/v2/insights/user-status-counts [get]
|
||||
func (api *API) insightsUserStatusCounts(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -396,7 +396,7 @@ func (api *API) insightsUserStatusCounts(rw http.ResponseWriter, r *http.Request
|
||||
// @Param interval query string true "Interval" enums(week,day)
|
||||
// @Param template_ids query []string false "Template IDs" collectionFormat(csv)
|
||||
// @Success 200 {object} codersdk.TemplateInsightsResponse
|
||||
// @Router /insights/templates [get]
|
||||
// @Router /api/v2/insights/templates [get]
|
||||
func (api *API) insightsTemplates(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
||||
+6
-6
@@ -30,7 +30,7 @@ import (
|
||||
// @Param organization path string true "Organization ID"
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.OrganizationMember
|
||||
// @Router /organizations/{organization}/members/{user} [post]
|
||||
// @Router /api/v2/organizations/{organization}/members/{user} [post]
|
||||
func (api *API) postOrganizationMember(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -97,7 +97,7 @@ func (api *API) postOrganizationMember(rw http.ResponseWriter, r *http.Request)
|
||||
// @Param organization path string true "Organization ID"
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 204
|
||||
// @Router /organizations/{organization}/members/{user} [delete]
|
||||
// @Router /api/v2/organizations/{organization}/members/{user} [delete]
|
||||
func (api *API) deleteOrganizationMember(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -154,7 +154,7 @@ func (api *API) deleteOrganizationMember(rw http.ResponseWriter, r *http.Request
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.OrganizationMemberWithUserData
|
||||
// @Produce json
|
||||
// @Router /organizations/{organization}/members/{user} [get]
|
||||
// @Router /api/v2/organizations/{organization}/members/{user} [get]
|
||||
func (api *API) organizationMember(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -212,7 +212,7 @@ func (api *API) organizationMember(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Members
|
||||
// @Param organization path string true "Organization ID"
|
||||
// @Success 200 {object} []codersdk.OrganizationMemberWithUserData
|
||||
// @Router /organizations/{organization}/members [get]
|
||||
// @Router /api/v2/organizations/{organization}/members [get]
|
||||
func (api *API) listMembers(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -272,7 +272,7 @@ func (api *API) listMembers(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param limit query int false "Page limit, if 0 returns all members"
|
||||
// @Param offset query int false "Page offset"
|
||||
// @Success 200 {object} []codersdk.PaginatedMembersResponse
|
||||
// @Router /organizations/{organization}/paginated-members [get]
|
||||
// @Router /api/v2/organizations/{organization}/paginated-members [get]
|
||||
func (api *API) paginatedMembers(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -403,7 +403,7 @@ func getAISeatSetByUserIDs(ctx context.Context, db database.Store, userIDs []uui
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param request body codersdk.UpdateRoles true "Update roles request"
|
||||
// @Success 200 {object} codersdk.OrganizationMember
|
||||
// @Router /organizations/{organization}/members/{user}/roles [put]
|
||||
// @Router /api/v2/organizations/{organization}/members/{user}/roles [put]
|
||||
func (api *API) putMemberRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
// @Produce json
|
||||
// @Tags Notifications
|
||||
// @Success 200 {object} codersdk.NotificationsSettings
|
||||
// @Router /notifications/settings [get]
|
||||
// @Router /api/v2/notifications/settings [get]
|
||||
func (api *API) notificationsSettings(rw http.ResponseWriter, r *http.Request) {
|
||||
settingsJSON, err := api.Database.GetNotificationsSettings(r.Context())
|
||||
if err != nil {
|
||||
@@ -61,7 +61,7 @@ func (api *API) notificationsSettings(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param request body codersdk.NotificationsSettings true "Notifications settings request"
|
||||
// @Success 200 {object} codersdk.NotificationsSettings
|
||||
// @Success 304
|
||||
// @Router /notifications/settings [put]
|
||||
// @Router /api/v2/notifications/settings [put]
|
||||
func (api *API) putNotificationsSettings(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -149,7 +149,7 @@ func (api *API) notificationTemplatesByKind(rw http.ResponseWriter, r *http.Requ
|
||||
// @Tags Notifications
|
||||
// @Success 200 {array} codersdk.NotificationTemplate
|
||||
// @Failure 500 {object} codersdk.Response "Failed to retrieve 'system' notifications template"
|
||||
// @Router /notifications/templates/system [get]
|
||||
// @Router /api/v2/notifications/templates/system [get]
|
||||
func (api *API) systemNotificationTemplates(rw http.ResponseWriter, r *http.Request) {
|
||||
api.notificationTemplatesByKind(rw, r, database.NotificationTemplateKindSystem)
|
||||
}
|
||||
@@ -161,7 +161,7 @@ func (api *API) systemNotificationTemplates(rw http.ResponseWriter, r *http.Requ
|
||||
// @Tags Notifications
|
||||
// @Success 200 {array} codersdk.NotificationTemplate
|
||||
// @Failure 500 {object} codersdk.Response "Failed to retrieve 'custom' notifications template"
|
||||
// @Router /notifications/templates/custom [get]
|
||||
// @Router /api/v2/notifications/templates/custom [get]
|
||||
func (api *API) customNotificationTemplates(rw http.ResponseWriter, r *http.Request) {
|
||||
api.notificationTemplatesByKind(rw, r, database.NotificationTemplateKindCustom)
|
||||
}
|
||||
@@ -172,7 +172,7 @@ func (api *API) customNotificationTemplates(rw http.ResponseWriter, r *http.Requ
|
||||
// @Produce json
|
||||
// @Tags Notifications
|
||||
// @Success 200 {array} codersdk.NotificationMethodsResponse
|
||||
// @Router /notifications/dispatch-methods [get]
|
||||
// @Router /api/v2/notifications/dispatch-methods [get]
|
||||
func (api *API) notificationDispatchMethods(rw http.ResponseWriter, r *http.Request) {
|
||||
var methods []string
|
||||
for _, nm := range database.AllNotificationMethodValues() {
|
||||
@@ -195,7 +195,7 @@ func (api *API) notificationDispatchMethods(rw http.ResponseWriter, r *http.Requ
|
||||
// @Security CoderSessionToken
|
||||
// @Tags Notifications
|
||||
// @Success 200
|
||||
// @Router /notifications/test [post]
|
||||
// @Router /api/v2/notifications/test [post]
|
||||
func (api *API) postTestNotification(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -244,7 +244,7 @@ func (api *API) postTestNotification(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Notifications
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {array} codersdk.NotificationPreference
|
||||
// @Router /users/{user}/notifications/preferences [get]
|
||||
// @Router /api/v2/users/{user}/notifications/preferences [get]
|
||||
func (api *API) userNotificationPreferences(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -276,7 +276,7 @@ func (api *API) userNotificationPreferences(rw http.ResponseWriter, r *http.Requ
|
||||
// @Param request body codersdk.UpdateUserNotificationPreferences true "Preferences"
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {array} codersdk.NotificationPreference
|
||||
// @Router /users/{user}/notifications/preferences [put]
|
||||
// @Router /api/v2/users/{user}/notifications/preferences [put]
|
||||
func (api *API) putUserNotificationPreferences(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -353,7 +353,7 @@ func (api *API) putUserNotificationPreferences(rw http.ResponseWriter, r *http.R
|
||||
// @Failure 400 {object} codersdk.Response "Invalid request body"
|
||||
// @Failure 403 {object} codersdk.Response "System users cannot send custom notifications"
|
||||
// @Failure 500 {object} codersdk.Response "Failed to send custom notification"
|
||||
// @Router /notifications/custom [post]
|
||||
// @Router /api/v2/notifications/custom [post]
|
||||
func (api *API) postCustomNotification(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
+8
-8
@@ -13,7 +13,7 @@ import (
|
||||
// @Tags Enterprise
|
||||
// @Param user_id query string false "Filter by applications authorized for a user"
|
||||
// @Success 200 {array} codersdk.OAuth2ProviderApp
|
||||
// @Router /oauth2-provider/apps [get]
|
||||
// @Router /api/v2/oauth2-provider/apps [get]
|
||||
func (api *API) oAuth2ProviderApps() http.HandlerFunc {
|
||||
return oauth2provider.ListApps(api.Database, api.AccessURL)
|
||||
}
|
||||
@@ -25,7 +25,7 @@ func (api *API) oAuth2ProviderApps() http.HandlerFunc {
|
||||
// @Tags Enterprise
|
||||
// @Param app path string true "App ID"
|
||||
// @Success 200 {object} codersdk.OAuth2ProviderApp
|
||||
// @Router /oauth2-provider/apps/{app} [get]
|
||||
// @Router /api/v2/oauth2-provider/apps/{app} [get]
|
||||
func (api *API) oAuth2ProviderApp() http.HandlerFunc {
|
||||
return oauth2provider.GetApp(api.AccessURL)
|
||||
}
|
||||
@@ -38,7 +38,7 @@ func (api *API) oAuth2ProviderApp() http.HandlerFunc {
|
||||
// @Tags Enterprise
|
||||
// @Param request body codersdk.PostOAuth2ProviderAppRequest true "The OAuth2 application to create."
|
||||
// @Success 200 {object} codersdk.OAuth2ProviderApp
|
||||
// @Router /oauth2-provider/apps [post]
|
||||
// @Router /api/v2/oauth2-provider/apps [post]
|
||||
func (api *API) postOAuth2ProviderApp() http.HandlerFunc {
|
||||
return oauth2provider.CreateApp(api.Database, api.AccessURL, api.Auditor.Load(), api.Logger)
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func (api *API) postOAuth2ProviderApp() http.HandlerFunc {
|
||||
// @Param app path string true "App ID"
|
||||
// @Param request body codersdk.PutOAuth2ProviderAppRequest true "Update an OAuth2 application."
|
||||
// @Success 200 {object} codersdk.OAuth2ProviderApp
|
||||
// @Router /oauth2-provider/apps/{app} [put]
|
||||
// @Router /api/v2/oauth2-provider/apps/{app} [put]
|
||||
func (api *API) putOAuth2ProviderApp() http.HandlerFunc {
|
||||
return oauth2provider.UpdateApp(api.Database, api.AccessURL, api.Auditor.Load(), api.Logger)
|
||||
}
|
||||
@@ -63,7 +63,7 @@ func (api *API) putOAuth2ProviderApp() http.HandlerFunc {
|
||||
// @Tags Enterprise
|
||||
// @Param app path string true "App ID"
|
||||
// @Success 204
|
||||
// @Router /oauth2-provider/apps/{app} [delete]
|
||||
// @Router /api/v2/oauth2-provider/apps/{app} [delete]
|
||||
func (api *API) deleteOAuth2ProviderApp() http.HandlerFunc {
|
||||
return oauth2provider.DeleteApp(api.Database, api.Auditor.Load(), api.Logger)
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func (api *API) deleteOAuth2ProviderApp() http.HandlerFunc {
|
||||
// @Tags Enterprise
|
||||
// @Param app path string true "App ID"
|
||||
// @Success 200 {array} codersdk.OAuth2ProviderAppSecret
|
||||
// @Router /oauth2-provider/apps/{app}/secrets [get]
|
||||
// @Router /api/v2/oauth2-provider/apps/{app}/secrets [get]
|
||||
func (api *API) oAuth2ProviderAppSecrets() http.HandlerFunc {
|
||||
return oauth2provider.GetAppSecrets(api.Database)
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func (api *API) oAuth2ProviderAppSecrets() http.HandlerFunc {
|
||||
// @Tags Enterprise
|
||||
// @Param app path string true "App ID"
|
||||
// @Success 200 {array} codersdk.OAuth2ProviderAppSecretFull
|
||||
// @Router /oauth2-provider/apps/{app}/secrets [post]
|
||||
// @Router /api/v2/oauth2-provider/apps/{app}/secrets [post]
|
||||
func (api *API) postOAuth2ProviderAppSecret() http.HandlerFunc {
|
||||
return oauth2provider.CreateAppSecret(api.Database, api.Auditor.Load(), api.Logger)
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func (api *API) postOAuth2ProviderAppSecret() http.HandlerFunc {
|
||||
// @Param app path string true "App ID"
|
||||
// @Param secretID path string true "Secret ID"
|
||||
// @Success 204
|
||||
// @Router /oauth2-provider/apps/{app}/secrets/{secretID} [delete]
|
||||
// @Router /api/v2/oauth2-provider/apps/{app}/secrets/{secretID} [delete]
|
||||
func (api *API) deleteOAuth2ProviderAppSecret() http.HandlerFunc {
|
||||
return oauth2provider.DeleteAppSecret(api.Database, api.Auditor.Load(), api.Logger)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
// @Produce json
|
||||
// @Tags Organizations
|
||||
// @Success 200 {object} []codersdk.Organization
|
||||
// @Router /organizations [get]
|
||||
// @Router /api/v2/organizations [get]
|
||||
func (api *API) organizations(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
organizations, err := api.Database.GetOrganizations(ctx, database.GetOrganizationsParams{})
|
||||
@@ -43,7 +43,7 @@ func (api *API) organizations(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Organizations
|
||||
// @Param organization path string true "Organization ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.Organization
|
||||
// @Router /organizations/{organization} [get]
|
||||
// @Router /api/v2/organizations/{organization} [get]
|
||||
func (*API) organization(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
organization := httpmw.OrganizationParam(r)
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
// @Produce json
|
||||
// @Param request body codersdk.DynamicParametersRequest true "Initial parameter values"
|
||||
// @Success 200 {object} codersdk.DynamicParametersResponse
|
||||
// @Router /templateversions/{templateversion}/dynamic-parameters/evaluate [post]
|
||||
// @Router /api/v2/templateversions/{templateversion}/dynamic-parameters/evaluate [post]
|
||||
func (api *API) templateVersionDynamicParametersEvaluate(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var req codersdk.DynamicParametersRequest
|
||||
@@ -44,7 +44,7 @@ func (api *API) templateVersionDynamicParametersEvaluate(rw http.ResponseWriter,
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 101
|
||||
// @Router /templateversions/{templateversion}/dynamic-parameters [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/dynamic-parameters [get]
|
||||
func (api *API) templateVersionDynamicParametersWebsocket(rw http.ResponseWriter, r *http.Request) {
|
||||
apikey := httpmw.APIKey(r)
|
||||
userID := apikey.UserID
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import (
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {array} codersdk.Preset
|
||||
// @Router /templateversions/{templateversion}/presets [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/presets [get]
|
||||
func (api *API) templateVersionPresets(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
templateVersion := httpmw.TemplateVersionParam(r)
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
// @Param status query codersdk.ProvisionerJobStatus false "Filter results by status" enums(pending,running,succeeded,canceling,canceled,failed)
|
||||
// @Param tags query object false "Provisioner tags to filter by (JSON of the form {'tag1':'value1','tag2':'value2'})"
|
||||
// @Success 200 {array} codersdk.ProvisionerDaemon
|
||||
// @Router /organizations/{organization}/provisionerdaemons [get]
|
||||
// @Router /api/v2/organizations/{organization}/provisionerdaemons [get]
|
||||
func (api *API) provisionerDaemons(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
@@ -38,7 +38,7 @@ import (
|
||||
// @Param organization path string true "Organization ID" format(uuid)
|
||||
// @Param job path string true "Job ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.ProvisionerJob
|
||||
// @Router /organizations/{organization}/provisionerjobs/{job} [get]
|
||||
// @Router /api/v2/organizations/{organization}/provisionerjobs/{job} [get]
|
||||
func (api *API) provisionerJob(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -78,7 +78,7 @@ func (api *API) provisionerJob(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param tags query object false "Provisioner tags to filter by (JSON of the form {'tag1':'value1','tag2':'value2'})"
|
||||
// @Param initiator query string false "Filter results by initiator" format(uuid)
|
||||
// @Success 200 {array} codersdk.ProvisionerJob
|
||||
// @Router /organizations/{organization}/provisionerjobs [get]
|
||||
// @Router /api/v2/organizations/{organization}/provisionerjobs [get]
|
||||
func (api *API) provisionerJobs(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import (
|
||||
// @Produce json
|
||||
// @Tags Members
|
||||
// @Success 200 {array} codersdk.AssignableRoles
|
||||
// @Router /users/roles [get]
|
||||
// @Router /api/v2/users/roles [get]
|
||||
func (api *API) AssignableSiteRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
actorRoles := httpmw.UserAuthorization(r.Context())
|
||||
@@ -58,7 +58,7 @@ func (api *API) AssignableSiteRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Members
|
||||
// @Param organization path string true "Organization ID" format(uuid)
|
||||
// @Success 200 {array} codersdk.AssignableRoles
|
||||
// @Router /organizations/{organization}/members/roles [get]
|
||||
// @Router /api/v2/organizations/{organization}/members/roles [get]
|
||||
func (api *API) assignableOrgRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
organization := httpmw.OrganizationParam(r)
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
// @Tags Authorization
|
||||
// @Produce json
|
||||
// @Success 200 {object} codersdk.ExternalAPIKeyScopes
|
||||
// @Router /auth/scopes [get]
|
||||
// @Router /api/v2/auth/scopes [get]
|
||||
func (*API) listExternalScopes(rw http.ResponseWriter, r *http.Request) {
|
||||
scopes := rbac.ExternalScopeNames()
|
||||
external := make([]codersdk.APIKeyScope, 0, len(scopes))
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Swagger UI requestInterceptor.
|
||||
//
|
||||
// Returned to Swagger UI as the value of the `requestInterceptor` config
|
||||
// option. Swagger UI evaluates this string as a JavaScript expression that
|
||||
// must produce a function which receives a request object and returns the
|
||||
// (possibly mutated) request.
|
||||
//
|
||||
// `withCredentials: false` should disable fetch sending browser credentials,
|
||||
// but for whatever reason it does not. So this interceptor explicitly omits
|
||||
// browser credentials from every request to avoid the cookie auth and the
|
||||
// header auth competing.
|
||||
(request => {
|
||||
request.credentials = "omit";
|
||||
return request;
|
||||
})
|
||||
+10
-10
@@ -44,7 +44,7 @@ import (
|
||||
// @Tags Templates
|
||||
// @Param template path string true "Template ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.Template
|
||||
// @Router /templates/{template} [get]
|
||||
// @Router /api/v2/templates/{template} [get]
|
||||
func (api *API) template(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
template := httpmw.TemplateParam(r)
|
||||
@@ -59,7 +59,7 @@ func (api *API) template(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Templates
|
||||
// @Param template path string true "Template ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /templates/{template} [delete]
|
||||
// @Router /api/v2/templates/{template} [delete]
|
||||
func (api *API) deleteTemplate(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
apiKey = httpmw.APIKey(r)
|
||||
@@ -177,7 +177,7 @@ func (api *API) notifyTemplateDeleted(ctx context.Context, template database.Tem
|
||||
// @Param request body codersdk.CreateTemplateRequest true "Request body"
|
||||
// @Param organization path string true "Organization ID"
|
||||
// @Success 200 {object} codersdk.Template
|
||||
// @Router /organizations/{organization}/templates [post]
|
||||
// @Router /api/v2/organizations/{organization}/templates [post]
|
||||
func (api *API) postTemplateByOrganization(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -528,7 +528,7 @@ func (api *API) postTemplateByOrganization(rw http.ResponseWriter, r *http.Reque
|
||||
// @Tags Templates
|
||||
// @Param organization path string true "Organization ID" format(uuid)
|
||||
// @Success 200 {array} codersdk.Template
|
||||
// @Router /organizations/{organization}/templates [get]
|
||||
// @Router /api/v2/organizations/{organization}/templates [get]
|
||||
func (api *API) templatesByOrganization() http.HandlerFunc {
|
||||
// TODO: Should deprecate this endpoint and make it akin to /workspaces with
|
||||
// a filter. There isn't a need to make the organization filter argument
|
||||
@@ -549,7 +549,7 @@ func (api *API) templatesByOrganization() http.HandlerFunc {
|
||||
// @Produce json
|
||||
// @Tags Templates
|
||||
// @Success 200 {array} codersdk.Template
|
||||
// @Router /templates [get]
|
||||
// @Router /api/v2/templates [get]
|
||||
func (api *API) fetchTemplates(mutate func(r *http.Request, arg *database.GetTemplatesWithFilterParams)) http.HandlerFunc {
|
||||
return func(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
@@ -613,7 +613,7 @@ func (api *API) fetchTemplates(mutate func(r *http.Request, arg *database.GetTem
|
||||
// @Param organization path string true "Organization ID" format(uuid)
|
||||
// @Param templatename path string true "Template name"
|
||||
// @Success 200 {object} codersdk.Template
|
||||
// @Router /organizations/{organization}/templates/{templatename} [get]
|
||||
// @Router /api/v2/organizations/{organization}/templates/{templatename} [get]
|
||||
func (api *API) templateByOrganizationAndName(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
organization := httpmw.OrganizationParam(r)
|
||||
@@ -647,7 +647,7 @@ func (api *API) templateByOrganizationAndName(rw http.ResponseWriter, r *http.Re
|
||||
// @Param template path string true "Template ID" format(uuid)
|
||||
// @Param request body codersdk.UpdateTemplateMeta true "Patch template settings request"
|
||||
// @Success 200 {object} codersdk.Template
|
||||
// @Router /templates/{template} [patch]
|
||||
// @Router /api/v2/templates/{template} [patch]
|
||||
func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -998,7 +998,7 @@ func (api *API) notifyUsersOfTemplateDeprecation(ctx context.Context, template d
|
||||
// @Tags Templates
|
||||
// @Param template path string true "Template ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.DAUsResponse
|
||||
// @Router /templates/{template}/daus [get]
|
||||
// @Router /api/v2/templates/{template}/daus [get]
|
||||
func (api *API) templateDAUs(rw http.ResponseWriter, r *http.Request) {
|
||||
template := httpmw.TemplateParam(r)
|
||||
|
||||
@@ -1012,7 +1012,7 @@ func (api *API) templateDAUs(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Templates
|
||||
// @Param organization path string true "Organization ID" format(uuid)
|
||||
// @Success 200 {array} codersdk.TemplateExample
|
||||
// @Router /organizations/{organization}/templates/examples [get]
|
||||
// @Router /api/v2/organizations/{organization}/templates/examples [get]
|
||||
// @Deprecated Use /templates/examples instead
|
||||
func (api *API) templateExamplesByOrganization(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
@@ -1043,7 +1043,7 @@ func (api *API) templateExamplesByOrganization(rw http.ResponseWriter, r *http.R
|
||||
// @Produce json
|
||||
// @Tags Templates
|
||||
// @Success 200 {array} codersdk.TemplateExample
|
||||
// @Router /templates/examples [get]
|
||||
// @Router /api/v2/templates/examples [get]
|
||||
func (api *API) templateExamples(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
||||
+23
-23
@@ -52,7 +52,7 @@ import (
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.TemplateVersion
|
||||
// @Router /templateversions/{templateversion} [get]
|
||||
// @Router /api/v2/templateversions/{templateversion} [get]
|
||||
func (api *API) templateVersion(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
templateVersion := httpmw.TemplateVersionParam(r)
|
||||
@@ -114,7 +114,7 @@ func (api *API) templateVersion(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Param request body codersdk.PatchTemplateVersionRequest true "Patch template version request"
|
||||
// @Success 200 {object} codersdk.TemplateVersion
|
||||
// @Router /templateversions/{templateversion} [patch]
|
||||
// @Router /api/v2/templateversions/{templateversion} [patch]
|
||||
func (api *API) patchTemplateVersion(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
templateVersion := httpmw.TemplateVersionParam(r)
|
||||
@@ -227,7 +227,7 @@ func (api *API) patchTemplateVersion(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /templateversions/{templateversion}/cancel [patch]
|
||||
// @Router /api/v2/templateversions/{templateversion}/cancel [patch]
|
||||
func (api *API) patchCancelTemplateVersion(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
templateVersion := httpmw.TemplateVersionParam(r)
|
||||
@@ -283,7 +283,7 @@ func (api *API) patchCancelTemplateVersion(rw http.ResponseWriter, r *http.Reque
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {array} codersdk.TemplateVersionParameter
|
||||
// @Router /templateversions/{templateversion}/rich-parameters [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/rich-parameters [get]
|
||||
func (api *API) templateVersionRichParameters(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
templateVersion := httpmw.TemplateVersionParam(r)
|
||||
@@ -329,7 +329,7 @@ func (api *API) templateVersionRichParameters(rw http.ResponseWriter, r *http.Re
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {array} codersdk.TemplateVersionExternalAuth
|
||||
// @Router /templateversions/{templateversion}/external-auth [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/external-auth [get]
|
||||
func (api *API) templateVersionExternalAuth(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var (
|
||||
@@ -423,7 +423,7 @@ func (api *API) templateVersionExternalAuth(rw http.ResponseWriter, r *http.Requ
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {array} codersdk.TemplateVersionVariable
|
||||
// @Router /templateversions/{templateversion}/variables [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/variables [get]
|
||||
func (api *API) templateVersionVariables(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
templateVersion := httpmw.TemplateVersionParam(r)
|
||||
@@ -463,7 +463,7 @@ func (api *API) templateVersionVariables(rw http.ResponseWriter, r *http.Request
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Param request body codersdk.CreateTemplateVersionDryRunRequest true "Dry-run request"
|
||||
// @Success 201 {object} codersdk.ProvisionerJob
|
||||
// @Router /templateversions/{templateversion}/dry-run [post]
|
||||
// @Router /api/v2/templateversions/{templateversion}/dry-run [post]
|
||||
func (api *API) postTemplateVersionDryRun(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var (
|
||||
@@ -580,7 +580,7 @@ func (api *API) postTemplateVersionDryRun(rw http.ResponseWriter, r *http.Reques
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Param jobID path string true "Job ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.ProvisionerJob
|
||||
// @Router /templateversions/{templateversion}/dry-run/{jobID} [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/dry-run/{jobID} [get]
|
||||
func (api *API) templateVersionDryRun(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
job, ok := api.fetchTemplateVersionDryRunJob(rw, r)
|
||||
@@ -599,7 +599,7 @@ func (api *API) templateVersionDryRun(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Param jobID path string true "Job ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.MatchedProvisioners
|
||||
// @Router /templateversions/{templateversion}/dry-run/{jobID}/matched-provisioners [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/dry-run/{jobID}/matched-provisioners [get]
|
||||
func (api *API) templateVersionDryRunMatchedProvisioners(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
job, ok := api.fetchTemplateVersionDryRunJob(rw, r)
|
||||
@@ -636,7 +636,7 @@ func (api *API) templateVersionDryRunMatchedProvisioners(rw http.ResponseWriter,
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Param jobID path string true "Job ID" format(uuid)
|
||||
// @Success 200 {array} codersdk.WorkspaceResource
|
||||
// @Router /templateversions/{templateversion}/dry-run/{jobID}/resources [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/dry-run/{jobID}/resources [get]
|
||||
func (api *API) templateVersionDryRunResources(rw http.ResponseWriter, r *http.Request) {
|
||||
job, ok := api.fetchTemplateVersionDryRunJob(rw, r)
|
||||
if !ok {
|
||||
@@ -658,7 +658,7 @@ func (api *API) templateVersionDryRunResources(rw http.ResponseWriter, r *http.R
|
||||
// @Param follow query bool false "Follow log stream"
|
||||
// @Param format query string false "Log output format. Accepted: 'json' (default), 'text' (plain text with RFC3339 timestamps and ANSI colors). Not supported with follow=true." Enums(json,text)
|
||||
// @Success 200 {array} codersdk.ProvisionerJobLog
|
||||
// @Router /templateversions/{templateversion}/dry-run/{jobID}/logs [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/dry-run/{jobID}/logs [get]
|
||||
func (api *API) templateVersionDryRunLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
job, ok := api.fetchTemplateVersionDryRunJob(rw, r)
|
||||
if !ok {
|
||||
@@ -676,7 +676,7 @@ func (api *API) templateVersionDryRunLogs(rw http.ResponseWriter, r *http.Reques
|
||||
// @Param jobID path string true "Job ID" format(uuid)
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /templateversions/{templateversion}/dry-run/{jobID}/cancel [patch]
|
||||
// @Router /api/v2/templateversions/{templateversion}/dry-run/{jobID}/cancel [patch]
|
||||
func (api *API) patchTemplateVersionDryRunCancel(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
templateVersion := httpmw.TemplateVersionParam(r)
|
||||
@@ -804,7 +804,7 @@ func (api *API) fetchTemplateVersionDryRunJob(rw http.ResponseWriter, r *http.Re
|
||||
// @Param limit query int false "Page limit"
|
||||
// @Param offset query int false "Page offset"
|
||||
// @Success 200 {array} codersdk.TemplateVersion
|
||||
// @Router /templates/{template}/versions [get]
|
||||
// @Router /api/v2/templates/{template}/versions [get]
|
||||
func (api *API) templateVersionsByTemplate(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
template := httpmw.TemplateParam(r)
|
||||
@@ -925,7 +925,7 @@ func (api *API) templateVersionsByTemplate(rw http.ResponseWriter, r *http.Reque
|
||||
// @Param template path string true "Template ID" format(uuid)
|
||||
// @Param templateversionname path string true "Template version name"
|
||||
// @Success 200 {array} codersdk.TemplateVersion
|
||||
// @Router /templates/{template}/versions/{templateversionname} [get]
|
||||
// @Router /api/v2/templates/{template}/versions/{templateversionname} [get]
|
||||
func (api *API) templateVersionByName(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
template := httpmw.TemplateParam(r)
|
||||
@@ -990,7 +990,7 @@ func (api *API) templateVersionByName(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param templatename path string true "Template name"
|
||||
// @Param templateversionname path string true "Template version name"
|
||||
// @Success 200 {object} codersdk.TemplateVersion
|
||||
// @Router /organizations/{organization}/templates/{templatename}/versions/{templateversionname} [get]
|
||||
// @Router /api/v2/organizations/{organization}/templates/{templatename}/versions/{templateversionname} [get]
|
||||
func (api *API) templateVersionByOrganizationTemplateAndName(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
organization := httpmw.OrganizationParam(r)
|
||||
@@ -1075,7 +1075,7 @@ func (api *API) templateVersionByOrganizationTemplateAndName(rw http.ResponseWri
|
||||
// @Param templateversionname path string true "Template version name"
|
||||
// @Success 200 {object} codersdk.TemplateVersion
|
||||
// @Success 204
|
||||
// @Router /organizations/{organization}/templates/{templatename}/versions/{templateversionname}/previous [get]
|
||||
// @Router /api/v2/organizations/{organization}/templates/{templatename}/versions/{templateversionname}/previous [get]
|
||||
func (api *API) previousTemplateVersionByOrganizationTemplateAndName(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
organization := httpmw.OrganizationParam(r)
|
||||
@@ -1178,7 +1178,7 @@ func (api *API) previousTemplateVersionByOrganizationTemplateAndName(rw http.Res
|
||||
// @Param template path string true "Template ID" format(uuid)
|
||||
// @Param request body codersdk.ArchiveTemplateVersionsRequest true "Archive request"
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /templates/{template}/versions/archive [post]
|
||||
// @Router /api/v2/templates/{template}/versions/archive [post]
|
||||
func (api *API) postArchiveTemplateVersions(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1243,7 +1243,7 @@ func (api *API) postArchiveTemplateVersions(rw http.ResponseWriter, r *http.Requ
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /templateversions/{templateversion}/archive [post]
|
||||
// @Router /api/v2/templateversions/{templateversion}/archive [post]
|
||||
func (api *API) postArchiveTemplateVersion() func(rw http.ResponseWriter, r *http.Request) {
|
||||
return api.setArchiveTemplateVersion(true)
|
||||
}
|
||||
@@ -1255,7 +1255,7 @@ func (api *API) postArchiveTemplateVersion() func(rw http.ResponseWriter, r *htt
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /templateversions/{templateversion}/unarchive [post]
|
||||
// @Router /api/v2/templateversions/{templateversion}/unarchive [post]
|
||||
func (api *API) postUnarchiveTemplateVersion() func(rw http.ResponseWriter, r *http.Request) {
|
||||
return api.setArchiveTemplateVersion(false)
|
||||
}
|
||||
@@ -1345,7 +1345,7 @@ func (api *API) setArchiveTemplateVersion(archive bool) func(rw http.ResponseWri
|
||||
// @Param request body codersdk.UpdateActiveTemplateVersion true "Modified template version"
|
||||
// @Param template path string true "Template ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /templates/{template}/versions [patch]
|
||||
// @Router /api/v2/templates/{template}/versions [patch]
|
||||
func (api *API) patchActiveTemplateVersion(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1448,7 +1448,7 @@ func (api *API) patchActiveTemplateVersion(rw http.ResponseWriter, r *http.Reque
|
||||
// @Param organization path string true "Organization ID" format(uuid)
|
||||
// @Param request body codersdk.CreateTemplateVersionRequest true "Create template version request"
|
||||
// @Success 201 {object} codersdk.TemplateVersion
|
||||
// @Router /organizations/{organization}/templateversions [post]
|
||||
// @Router /api/v2/organizations/{organization}/templateversions [post]
|
||||
func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1905,7 +1905,7 @@ func (api *API) classicTemplateVersionTags(ctx context.Context, rw http.Response
|
||||
// @Tags Templates
|
||||
// @Param templateversion path string true "Template version ID" format(uuid)
|
||||
// @Success 200 {array} codersdk.WorkspaceResource
|
||||
// @Router /templateversions/{templateversion}/resources [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/resources [get]
|
||||
func (api *API) templateVersionResources(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1939,7 +1939,7 @@ func (api *API) templateVersionResources(rw http.ResponseWriter, r *http.Request
|
||||
// @Param follow query bool false "Follow log stream"
|
||||
// @Param format query string false "Log output format. Accepted: 'json' (default), 'text' (plain text with RFC3339 timestamps and ANSI colors). Not supported with follow=true." Enums(json,text)
|
||||
// @Success 200 {array} codersdk.ProvisionerJobLog
|
||||
// @Router /templateversions/{templateversion}/logs [get]
|
||||
// @Router /api/v2/templateversions/{templateversion}/logs [get]
|
||||
func (api *API) templateVersionLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
// @Produce json
|
||||
// @Tags General
|
||||
// @Success 200 {object} codersdk.UpdateCheckResponse
|
||||
// @Router /updatecheck [get]
|
||||
// @Router /api/v2/updatecheck [get]
|
||||
func (api *API) updateCheck(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
||||
+10
-10
@@ -86,7 +86,7 @@ func (o *OAuthConvertStateClaims) Validate(e jwt.Expected) error {
|
||||
// @Param request body codersdk.ConvertLoginRequest true "Convert request"
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 201 {object} codersdk.OAuthConversionResponse
|
||||
// @Router /users/{user}/convert-login [post]
|
||||
// @Router /api/v2/users/{user}/convert-login [post]
|
||||
func (api *API) postConvertLoginType(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
user = httpmw.UserParam(r)
|
||||
@@ -225,7 +225,7 @@ func (api *API) postConvertLoginType(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Authorization
|
||||
// @Param request body codersdk.RequestOneTimePasscodeRequest true "One-time passcode request"
|
||||
// @Success 204
|
||||
// @Router /users/otp/request [post]
|
||||
// @Router /api/v2/users/otp/request [post]
|
||||
func (api *API) postRequestOneTimePasscode(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -331,7 +331,7 @@ func (api *API) notifyUserRequestedOneTimePasscode(ctx context.Context, user dat
|
||||
// @Tags Authorization
|
||||
// @Param request body codersdk.ChangePasswordWithOneTimePasscodeRequest true "Change password request"
|
||||
// @Success 204
|
||||
// @Router /users/otp/change-password [post]
|
||||
// @Router /api/v2/users/otp/change-password [post]
|
||||
func (api *API) postChangePasswordWithOneTimePasscode(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
err error
|
||||
@@ -465,7 +465,7 @@ func (api *API) postChangePasswordWithOneTimePasscode(rw http.ResponseWriter, r
|
||||
// @Tags Authorization
|
||||
// @Param request body codersdk.ValidateUserPasswordRequest true "Validate user password request"
|
||||
// @Success 200 {object} codersdk.ValidateUserPasswordResponse
|
||||
// @Router /users/validate-password [post]
|
||||
// @Router /api/v2/users/validate-password [post]
|
||||
func (*API) validateUserPassword(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -499,7 +499,7 @@ func (*API) validateUserPassword(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Authorization
|
||||
// @Param request body codersdk.LoginWithPasswordRequest true "Login request"
|
||||
// @Success 201 {object} codersdk.LoginWithPasswordResponse
|
||||
// @Router /users/login [post]
|
||||
// @Router /api/v2/users/login [post]
|
||||
func (api *API) postLogin(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -684,7 +684,7 @@ func ActivateDormantUser(logger slog.Logger, auditor *atomic.Pointer[audit.Audit
|
||||
// @Produce json
|
||||
// @Tags Users
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /users/logout [post]
|
||||
// @Router /api/v2/users/logout [post]
|
||||
func (api *API) postLogout(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -796,7 +796,7 @@ func (c *GithubOAuth2Config) AuthCodeURL(state string, opts ...oauth2.AuthCodeOp
|
||||
// @Produce json
|
||||
// @Tags Users
|
||||
// @Success 200 {object} codersdk.AuthMethods
|
||||
// @Router /users/authmethods [get]
|
||||
// @Router /api/v2/users/authmethods [get]
|
||||
func (api *API) userAuthMethods(rw http.ResponseWriter, r *http.Request) {
|
||||
var signInText string
|
||||
var iconURL string
|
||||
@@ -831,7 +831,7 @@ func (api *API) userAuthMethods(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Produce json
|
||||
// @Tags Users
|
||||
// @Success 200 {object} codersdk.ExternalAuthDevice
|
||||
// @Router /users/oauth2/github/device [get]
|
||||
// @Router /api/v2/users/oauth2/github/device [get]
|
||||
func (api *API) userOAuth2GithubDevice(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -877,7 +877,7 @@ func (api *API) userOAuth2GithubDevice(rw http.ResponseWriter, r *http.Request)
|
||||
// @Security CoderSessionToken
|
||||
// @Tags Users
|
||||
// @Success 307
|
||||
// @Router /users/oauth2/github/callback [get]
|
||||
// @Router /api/v2/users/oauth2/github/callback [get]
|
||||
func (api *API) userOAuth2Github(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
// userOAuth2Github is a system function.
|
||||
@@ -1192,7 +1192,7 @@ func (o *OIDCConfig) PKCESupported() []promoauth.Oauth2PKCEChallengeMethod {
|
||||
// @Security CoderSessionToken
|
||||
// @Tags Users
|
||||
// @Success 307
|
||||
// @Router /users/oidc/callback [get]
|
||||
// @Router /api/v2/users/oidc/callback [get]
|
||||
func (api *API) userOIDC(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
// userOIDC is a system function.
|
||||
|
||||
+22
-22
@@ -42,7 +42,7 @@ import (
|
||||
// @Tags Agents
|
||||
// @Success 200 "Success"
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Router /debug/{user}/debug-link [get]
|
||||
// @Router /api/v2/debug/{user}/debug-link [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) userDebugOIDC(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
@@ -80,7 +80,7 @@ func (api *API) userDebugOIDC(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Produce json
|
||||
// @Tags Users
|
||||
// @Success 200 {object} codersdk.OIDCClaimsResponse
|
||||
// @Router /users/oidc-claims [get]
|
||||
// @Router /api/v2/users/oidc-claims [get]
|
||||
func (api *API) userOIDCClaims(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -138,7 +138,7 @@ func (api *API) userOIDCClaims(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Produce json
|
||||
// @Tags Users
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /users/first [get]
|
||||
// @Router /api/v2/users/first [get]
|
||||
func (api *API) firstUser(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
// nolint:gocritic // Getting user count is a system function.
|
||||
@@ -173,7 +173,7 @@ func (api *API) firstUser(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Users
|
||||
// @Param request body codersdk.CreateFirstUserRequest true "First user request"
|
||||
// @Success 201 {object} codersdk.CreateFirstUserResponse
|
||||
// @Router /users/first [post]
|
||||
// @Router /api/v2/users/first [post]
|
||||
func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) {
|
||||
// The first user can also be created via oidc, so if making changes to the flow,
|
||||
// ensure that the oidc flow is also updated.
|
||||
@@ -312,7 +312,7 @@ func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param limit query int false "Page limit"
|
||||
// @Param offset query int false "Page offset"
|
||||
// @Success 200 {object} codersdk.GetUsersResponse
|
||||
// @Router /users [get]
|
||||
// @Router /api/v2/users [get]
|
||||
func (api *API) users(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
users, userCount, ok := api.GetUsers(rw, r)
|
||||
@@ -432,7 +432,7 @@ func (api *API) GetUsers(rw http.ResponseWriter, r *http.Request) ([]database.Us
|
||||
// @Tags Users
|
||||
// @Param request body codersdk.CreateUserRequestWithOrgs true "Create user request"
|
||||
// @Success 201 {object} codersdk.User
|
||||
// @Router /users [post]
|
||||
// @Router /api/v2/users [post]
|
||||
func (api *API) postUser(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
auditor := *api.Auditor.Load()
|
||||
@@ -650,7 +650,7 @@ func (api *API) postUser(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200
|
||||
// @Router /users/{user} [delete]
|
||||
// @Router /api/v2/users/{user} [delete]
|
||||
func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
auditor := *api.Auditor.Load()
|
||||
@@ -756,7 +756,7 @@ func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, username, or me"
|
||||
// @Success 200 {object} codersdk.User
|
||||
// @Router /users/{user} [get]
|
||||
// @Router /api/v2/users/{user} [get]
|
||||
func (api *API) userByName(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
user := httpmw.UserParam(r)
|
||||
@@ -784,7 +784,7 @@ func (api *API) userByName(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "User ID, username, or me"
|
||||
// @Param template_id query string true "Template ID"
|
||||
// @Success 200 {array} codersdk.UserParameter
|
||||
// @Router /users/{user}/autofill-parameters [get]
|
||||
// @Router /api/v2/users/{user}/autofill-parameters [get]
|
||||
func (api *API) userAutofillParameters(rw http.ResponseWriter, r *http.Request) {
|
||||
user := httpmw.UserParam(r)
|
||||
|
||||
@@ -835,7 +835,7 @@ func (api *API) userAutofillParameters(rw http.ResponseWriter, r *http.Request)
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.UserLoginType
|
||||
// @Router /users/{user}/login-type [get]
|
||||
// @Router /api/v2/users/{user}/login-type [get]
|
||||
func (*API) userLoginType(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -865,7 +865,7 @@ func (*API) userLoginType(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param request body codersdk.UpdateUserProfileRequest true "Updated profile"
|
||||
// @Success 200 {object} codersdk.User
|
||||
// @Router /users/{user}/profile [put]
|
||||
// @Router /api/v2/users/{user}/profile [put]
|
||||
func (api *API) putUserProfile(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -956,7 +956,7 @@ func (api *API) putUserProfile(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.User
|
||||
// @Router /users/{user}/status/suspend [put]
|
||||
// @Router /api/v2/users/{user}/status/suspend [put]
|
||||
func (api *API) putSuspendUserAccount() func(rw http.ResponseWriter, r *http.Request) {
|
||||
return api.putUserStatus(database.UserStatusSuspended)
|
||||
}
|
||||
@@ -968,7 +968,7 @@ func (api *API) putSuspendUserAccount() func(rw http.ResponseWriter, r *http.Req
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.User
|
||||
// @Router /users/{user}/status/activate [put]
|
||||
// @Router /api/v2/users/{user}/status/activate [put]
|
||||
func (api *API) putActivateUserAccount() func(rw http.ResponseWriter, r *http.Request) {
|
||||
return api.putUserStatus(database.UserStatusActive)
|
||||
}
|
||||
@@ -1117,7 +1117,7 @@ func (api *API) notifyUserStatusChanged(ctx context.Context, actingUserName stri
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.UserAppearanceSettings
|
||||
// @Router /users/{user}/appearance [get]
|
||||
// @Router /api/v2/users/{user}/appearance [get]
|
||||
func (api *API) userAppearanceSettings(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1165,7 +1165,7 @@ func (api *API) userAppearanceSettings(rw http.ResponseWriter, r *http.Request)
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param request body codersdk.UpdateUserAppearanceSettingsRequest true "New appearance settings"
|
||||
// @Success 200 {object} codersdk.UserAppearanceSettings
|
||||
// @Router /users/{user}/appearance [put]
|
||||
// @Router /api/v2/users/{user}/appearance [put]
|
||||
func (api *API) putUserAppearanceSettings(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1221,7 +1221,7 @@ func (api *API) putUserAppearanceSettings(rw http.ResponseWriter, r *http.Reques
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.UserPreferenceSettings
|
||||
// @Router /users/{user}/preferences [get]
|
||||
// @Router /api/v2/users/{user}/preferences [get]
|
||||
func (api *API) userPreferenceSettings(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1263,7 +1263,7 @@ func (api *API) userPreferenceSettings(rw http.ResponseWriter, r *http.Request)
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param request body codersdk.UpdateUserPreferenceSettingsRequest true "New preference settings"
|
||||
// @Success 200 {object} codersdk.UserPreferenceSettings
|
||||
// @Router /users/{user}/preferences [put]
|
||||
// @Router /api/v2/users/{user}/preferences [put]
|
||||
func (api *API) putUserPreferenceSettings(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1363,7 +1363,7 @@ func isValidFontName(font codersdk.TerminalFontName) bool {
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param request body codersdk.UpdateUserPasswordRequest true "Update password request"
|
||||
// @Success 204
|
||||
// @Router /users/{user}/password [put]
|
||||
// @Router /api/v2/users/{user}/password [put]
|
||||
func (api *API) putUserPassword(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1498,7 +1498,7 @@ func (api *API) putUserPassword(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {object} codersdk.User
|
||||
// @Router /users/{user}/roles [get]
|
||||
// @Router /api/v2/users/{user}/roles [get]
|
||||
func (api *API) userRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
user := httpmw.UserParam(r)
|
||||
@@ -1544,7 +1544,7 @@ func (api *API) userRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param request body codersdk.UpdateRoles true "Update roles request"
|
||||
// @Success 200 {object} codersdk.User
|
||||
// @Router /users/{user}/roles [put]
|
||||
// @Router /api/v2/users/{user}/roles [put]
|
||||
func (api *API) putUserRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1621,7 +1621,7 @@ func (api *API) putUserRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Users
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 200 {array} codersdk.Organization
|
||||
// @Router /users/{user}/organizations [get]
|
||||
// @Router /api/v2/users/{user}/organizations [get]
|
||||
func (api *API) organizationsByUser(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
user := httpmw.UserParam(r)
|
||||
@@ -1663,7 +1663,7 @@ func (api *API) organizationsByUser(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Param organizationname path string true "Organization name"
|
||||
// @Success 200 {object} codersdk.Organization
|
||||
// @Router /users/{user}/organizations/{organizationname} [get]
|
||||
// @Router /api/v2/users/{user}/organizations/{organizationname} [get]
|
||||
func (api *API) organizationByUserAndName(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
organizationName := chi.URLParam(r, "organizationname")
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
// @Param user path string true "User ID, username, or me"
|
||||
// @Param request body codersdk.CreateUserSecretRequest true "Create secret request"
|
||||
// @Success 201 {object} codersdk.UserSecret
|
||||
// @Router /users/{user}/secrets [post]
|
||||
// @Router /api/v2/users/{user}/secrets [post]
|
||||
func (api *API) postUserSecret(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -116,7 +116,7 @@ func (api *API) postUserSecret(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Secrets
|
||||
// @Param user path string true "User ID, username, or me"
|
||||
// @Success 200 {array} codersdk.UserSecret
|
||||
// @Router /users/{user}/secrets [get]
|
||||
// @Router /api/v2/users/{user}/secrets [get]
|
||||
func (api *API) getUserSecrets(rw http.ResponseWriter, r *http.Request) { //nolint:revive // Method name matches route.
|
||||
ctx := r.Context()
|
||||
user := httpmw.UserParam(r)
|
||||
@@ -141,7 +141,7 @@ func (api *API) getUserSecrets(rw http.ResponseWriter, r *http.Request) { //noli
|
||||
// @Param user path string true "User ID, username, or me"
|
||||
// @Param name path string true "Secret name"
|
||||
// @Success 200 {object} codersdk.UserSecret
|
||||
// @Router /users/{user}/secrets/{name} [get]
|
||||
// @Router /api/v2/users/{user}/secrets/{name} [get]
|
||||
func (api *API) getUserSecret(rw http.ResponseWriter, r *http.Request) { //nolint:revive // Method name matches route.
|
||||
ctx := r.Context()
|
||||
user := httpmw.UserParam(r)
|
||||
@@ -176,7 +176,7 @@ func (api *API) getUserSecret(rw http.ResponseWriter, r *http.Request) { //nolin
|
||||
// @Param name path string true "Secret name"
|
||||
// @Param request body codersdk.UpdateUserSecretRequest true "Update secret request"
|
||||
// @Success 200 {object} codersdk.UserSecret
|
||||
// @Router /users/{user}/secrets/{name} [patch]
|
||||
// @Router /api/v2/users/{user}/secrets/{name} [patch]
|
||||
func (api *API) patchUserSecret(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -313,7 +313,7 @@ func (api *API) patchUserSecret(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param user path string true "User ID, username, or me"
|
||||
// @Param name path string true "Secret name"
|
||||
// @Success 204
|
||||
// @Router /users/{user}/secrets/{name} [delete]
|
||||
// @Router /api/v2/users/{user}/secrets/{name} [delete]
|
||||
func (api *API) deleteUserSecret(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
+3
-3
@@ -28,7 +28,7 @@ import (
|
||||
// @Tags Notifications
|
||||
// @Param request body codersdk.WebpushSubscription true "Webpush subscription"
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Router /users/{user}/webpush/subscription [post]
|
||||
// @Router /api/v2/users/{user}/webpush/subscription [post]
|
||||
// @Success 204
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) postUserWebpushSubscription(rw http.ResponseWriter, r *http.Request) {
|
||||
@@ -117,7 +117,7 @@ func validateWebpushEndpoint(rawEndpoint string) error {
|
||||
// @Tags Notifications
|
||||
// @Param request body codersdk.DeleteWebpushSubscription true "Webpush subscription"
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Router /users/{user}/webpush/subscription [delete]
|
||||
// @Router /api/v2/users/{user}/webpush/subscription [delete]
|
||||
// @Success 204
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) deleteUserWebpushSubscription(rw http.ResponseWriter, r *http.Request) {
|
||||
@@ -176,7 +176,7 @@ func (api *API) deleteUserWebpushSubscription(rw http.ResponseWriter, r *http.Re
|
||||
// @Tags Notifications
|
||||
// @Param user path string true "User ID, name, or me"
|
||||
// @Success 204
|
||||
// @Router /users/{user}/webpush/test [post]
|
||||
// @Router /api/v2/users/{user}/webpush/test [post]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) postUserPushNotificationTest(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.UpsertWorkspaceAgentPortShareRequest true "Upsert port sharing level request"
|
||||
// @Success 200 {object} codersdk.WorkspaceAgentPortShare
|
||||
// @Router /workspaces/{workspace}/port-share [post]
|
||||
// @Router /api/v2/workspaces/{workspace}/port-share [post]
|
||||
func (api *API) postWorkspaceAgentPortShare(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspace := httpmw.WorkspaceParam(r)
|
||||
@@ -119,7 +119,7 @@ func (api *API) postWorkspaceAgentPortShare(rw http.ResponseWriter, r *http.Requ
|
||||
// @Tags PortSharing
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.WorkspaceAgentPortShares
|
||||
// @Router /workspaces/{workspace}/port-share [get]
|
||||
// @Router /api/v2/workspaces/{workspace}/port-share [get]
|
||||
func (api *API) workspaceAgentPortShares(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspace := httpmw.WorkspaceParam(r)
|
||||
@@ -143,7 +143,7 @@ func (api *API) workspaceAgentPortShares(rw http.ResponseWriter, r *http.Request
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.DeleteWorkspaceAgentPortShareRequest true "Delete port sharing level request"
|
||||
// @Success 200
|
||||
// @Router /workspaces/{workspace}/port-share [delete]
|
||||
// @Router /api/v2/workspaces/{workspace}/port-share [delete]
|
||||
func (api *API) deleteWorkspaceAgentPortShare(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspace := httpmw.WorkspaceParam(r)
|
||||
|
||||
+19
-19
@@ -61,7 +61,7 @@ import (
|
||||
// @Tags Agents
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.WorkspaceAgent
|
||||
// @Router /workspaceagents/{workspaceagent} [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent} [get]
|
||||
func (api *API) workspaceAgent(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -138,7 +138,7 @@ const AgentAPIVersionREST = "1.0"
|
||||
// @Tags Agents
|
||||
// @Param request body agentsdk.PatchLogs true "logs"
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /workspaceagents/me/logs [patch]
|
||||
// @Router /api/v2/workspaceagents/me/logs [patch]
|
||||
func (api *API) patchWorkspaceAgentLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspaceAgent := httpmw.WorkspaceAgent(r)
|
||||
@@ -295,7 +295,7 @@ func (api *API) patchWorkspaceAgentLogs(rw http.ResponseWriter, r *http.Request)
|
||||
// @Tags Agents
|
||||
// @Param request body agentsdk.PatchAppStatus true "app status"
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /workspaceagents/me/app-status [patch]
|
||||
// @Router /api/v2/workspaceagents/me/app-status [patch]
|
||||
// @Deprecated Use UpdateAppStatus on the Agent API instead.
|
||||
func (api *API) patchWorkspaceAgentAppStatus(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
@@ -378,7 +378,7 @@ func (api *API) patchWorkspaceAgentAppStatus(rw http.ResponseWriter, r *http.Req
|
||||
// @Param no_compression query bool false "Disable compression for WebSocket connection"
|
||||
// @Param format query string false "Log output format. Accepted: 'json' (default), 'text' (plain text with RFC3339 timestamps and ANSI colors). Not supported with follow=true." Enums(json,text)
|
||||
// @Success 200 {array} codersdk.WorkspaceAgentLog
|
||||
// @Router /workspaceagents/{workspaceagent}/logs [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/logs [get]
|
||||
func (api *API) workspaceAgentLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
// This mostly copies how provisioner job logs are streamed!
|
||||
var (
|
||||
@@ -686,7 +686,7 @@ func (api *API) workspaceAgentLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Agents
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.WorkspaceAgentListeningPortsResponse
|
||||
// @Router /workspaceagents/{workspaceagent}/listening-ports [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/listening-ports [get]
|
||||
func (api *API) workspaceAgentListeningPorts(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
waws := httpmw.WorkspaceAgentAndWorkspaceParam(r)
|
||||
@@ -796,7 +796,7 @@ func (api *API) workspaceAgentListeningPorts(rw http.ResponseWriter, r *http.Req
|
||||
// @Tags Agents
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.WorkspaceAgentListContainersResponse
|
||||
// @Router /workspaceagents/{workspaceagent}/containers/watch [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/containers/watch [get]
|
||||
func (api *API) watchWorkspaceAgentContainers(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -904,7 +904,7 @@ func (api *API) watchWorkspaceAgentContainers(rw http.ResponseWriter, r *http.Re
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Param label query string true "Labels" format(key=value)
|
||||
// @Success 200 {object} codersdk.WorkspaceAgentListContainersResponse
|
||||
// @Router /workspaceagents/{workspaceagent}/containers [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/containers [get]
|
||||
func (api *API) workspaceAgentListContainers(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
waws := httpmw.WorkspaceAgentAndWorkspaceParam(r)
|
||||
@@ -1001,7 +1001,7 @@ func (api *API) workspaceAgentListContainers(rw http.ResponseWriter, r *http.Req
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Param devcontainer path string true "Devcontainer ID"
|
||||
// @Success 204
|
||||
// @Router /workspaceagents/{workspaceagent}/containers/devcontainers/{devcontainer} [delete]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/containers/devcontainers/{devcontainer} [delete]
|
||||
func (api *API) workspaceAgentDeleteDevcontainer(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
waws := httpmw.WorkspaceAgentAndWorkspaceParam(r)
|
||||
@@ -1091,7 +1091,7 @@ func (api *API) workspaceAgentDeleteDevcontainer(rw http.ResponseWriter, r *http
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Param devcontainer path string true "Devcontainer ID"
|
||||
// @Success 202 {object} codersdk.Response
|
||||
// @Router /workspaceagents/{workspaceagent}/containers/devcontainers/{devcontainer}/recreate [post]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/containers/devcontainers/{devcontainer}/recreate [post]
|
||||
func (api *API) workspaceAgentRecreateDevcontainer(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
waws := httpmw.WorkspaceAgentAndWorkspaceParam(r)
|
||||
@@ -1176,7 +1176,7 @@ func (api *API) workspaceAgentRecreateDevcontainer(rw http.ResponseWriter, r *ht
|
||||
// @Tags Agents
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Success 200 {object} workspacesdk.AgentConnectionInfo
|
||||
// @Router /workspaceagents/{workspaceagent}/connection [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/connection [get]
|
||||
func (api *API) workspaceAgentConnection(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -1197,7 +1197,7 @@ func (api *API) workspaceAgentConnection(rw http.ResponseWriter, r *http.Request
|
||||
// @Produce json
|
||||
// @Tags Agents
|
||||
// @Success 200 {object} workspacesdk.AgentConnectionInfo
|
||||
// @Router /workspaceagents/connection [get]
|
||||
// @Router /api/v2/workspaceagents/connection [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) workspaceAgentConnectionGeneric(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
@@ -1215,7 +1215,7 @@ func (api *API) workspaceAgentConnectionGeneric(rw http.ResponseWriter, r *http.
|
||||
// @Security CoderSessionToken
|
||||
// @Tags Agents
|
||||
// @Success 101
|
||||
// @Router /derp-map [get]
|
||||
// @Router /api/v2/derp-map [get]
|
||||
func (api *API) derpMapUpdates(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -1297,7 +1297,7 @@ func (api *API) derpMapUpdates(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Agents
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Success 101
|
||||
// @Router /workspaceagents/{workspaceagent}/coordinate [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/coordinate [get]
|
||||
func (api *API) workspaceAgentClientCoordinate(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -1421,7 +1421,7 @@ func (api *API) handleResumeToken(ctx context.Context, rw http.ResponseWriter, r
|
||||
// @Tags Agents
|
||||
// @Param request body agentsdk.PostLogSourceRequest true "Log source request"
|
||||
// @Success 200 {object} codersdk.WorkspaceAgentLogSource
|
||||
// @Router /workspaceagents/me/log-source [post]
|
||||
// @Router /api/v2/workspaceagents/me/log-source [post]
|
||||
func (api *API) workspaceAgentPostLogSource(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var req agentsdk.PostLogSourceRequest
|
||||
@@ -1471,7 +1471,7 @@ func (api *API) workspaceAgentPostLogSource(rw http.ResponseWriter, r *http.Requ
|
||||
// @Param wait query bool false "Opt in to durable reinit checks"
|
||||
// @Success 200 {object} agentsdk.ReinitializationEvent
|
||||
// @Failure 409 {object} codersdk.Response
|
||||
// @Router /workspaceagents/me/reinit [get]
|
||||
// @Router /api/v2/workspaceagents/me/reinit [get]
|
||||
func (api *API) workspaceAgentReinit(rw http.ResponseWriter, r *http.Request) {
|
||||
// Allow us to interrupt watch via cancel.
|
||||
ctx, cancel := context.WithCancel(r.Context())
|
||||
@@ -1648,7 +1648,7 @@ func convertScripts(dbScripts []database.GetWorkspaceAgentScriptsByAgentIDsRow)
|
||||
// @Tags Agents
|
||||
// @Success 200 "Success"
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Router /workspaceagents/{workspaceagent}/watch-metadata [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/watch-metadata [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
// @Deprecated Use /workspaceagents/{workspaceagent}/watch-metadata-ws instead
|
||||
func (api *API) watchWorkspaceAgentMetadataSSE(rw http.ResponseWriter, r *http.Request) {
|
||||
@@ -1662,7 +1662,7 @@ func (api *API) watchWorkspaceAgentMetadataSSE(rw http.ResponseWriter, r *http.R
|
||||
// @Tags Agents
|
||||
// @Success 200 {object} codersdk.ServerSentEvent
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Router /workspaceagents/{workspaceagent}/watch-metadata-ws [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/watch-metadata-ws [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) watchWorkspaceAgentMetadataWS(rw http.ResponseWriter, r *http.Request) {
|
||||
api.watchWorkspaceAgentMetadata(rw, r, httpapi.OneWayWebSocketEventSender(api.Logger))
|
||||
@@ -1922,7 +1922,7 @@ func convertWorkspaceAgentMetadata(db []database.WorkspaceAgentMetadatum) []code
|
||||
// @Param id query string true "Provider ID"
|
||||
// @Param listen query bool false "Wait for a new token to be issued"
|
||||
// @Success 200 {object} agentsdk.ExternalAuthResponse
|
||||
// @Router /workspaceagents/me/external-auth [get]
|
||||
// @Router /api/v2/workspaceagents/me/external-auth [get]
|
||||
func (api *API) workspaceAgentsExternalAuth(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
query := r.URL.Query()
|
||||
@@ -2203,7 +2203,7 @@ func (api *API) workspaceAgentsExternalAuthListen(ctx context.Context, rw http.R
|
||||
// @Security CoderSessionToken
|
||||
// @Tags Agents
|
||||
// @Success 101
|
||||
// @Router /tailnet [get]
|
||||
// @Router /api/v2/tailnet [get]
|
||||
func (api *API) tailnetRPCConn(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import (
|
||||
// @Security CoderSessionToken
|
||||
// @Tags Agents
|
||||
// @Success 101
|
||||
// @Router /workspaceagents/me/rpc [get]
|
||||
// @Router /api/v2/workspaceagents/me/rpc [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) workspaceAgentRPC(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
// @Produce json
|
||||
// @Tags Applications
|
||||
// @Success 200 {object} codersdk.AppHostResponse
|
||||
// @Router /applications/host [get]
|
||||
// @Router /api/v2/applications/host [get]
|
||||
// @Deprecated use api/v2/regions and see the primary proxy.
|
||||
func (api *API) appHost(rw http.ResponseWriter, r *http.Request) {
|
||||
httpapi.Write(r.Context(), rw, http.StatusOK, codersdk.AppHostResponse{
|
||||
@@ -50,7 +50,7 @@ func (api *API) appHost(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Applications
|
||||
// @Param redirect_uri query string false "Redirect destination"
|
||||
// @Success 307
|
||||
// @Router /applications/auth-redirect [get]
|
||||
// @Router /api/v2/applications/auth-redirect [get]
|
||||
func (api *API) workspaceApplicationAuth(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
apiKey := httpmw.APIKey(r)
|
||||
|
||||
@@ -701,7 +701,7 @@ func (s *Server) proxyWorkspaceApp(rw http.ResponseWriter, r *http.Request, appT
|
||||
// @Tags Agents
|
||||
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
|
||||
// @Success 101
|
||||
// @Router /workspaceagents/{workspaceagent}/pty [get]
|
||||
// @Router /api/v2/workspaceagents/{workspaceagent}/pty [get]
|
||||
func (s *Server) workspaceAgentPTY(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx, cancel := context.WithCancel(r.Context())
|
||||
defer cancel()
|
||||
|
||||
+10
-10
@@ -44,7 +44,7 @@ import (
|
||||
// @Tags Builds
|
||||
// @Param workspacebuild path string true "Workspace build ID"
|
||||
// @Success 200 {object} codersdk.WorkspaceBuild
|
||||
// @Router /workspacebuilds/{workspacebuild} [get]
|
||||
// @Router /api/v2/workspacebuilds/{workspacebuild} [get]
|
||||
func (api *API) workspaceBuild(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspaceBuild := httpmw.WorkspaceBuildParam(r)
|
||||
@@ -113,7 +113,7 @@ func (api *API) workspaceBuild(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param offset query int false "Page offset"
|
||||
// @Param since query string false "Since timestamp" format(date-time)
|
||||
// @Success 200 {array} codersdk.WorkspaceBuild
|
||||
// @Router /workspaces/{workspace}/builds [get]
|
||||
// @Router /api/v2/workspaces/{workspace}/builds [get]
|
||||
func (api *API) workspaceBuilds(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspace := httpmw.WorkspaceParam(r)
|
||||
@@ -230,7 +230,7 @@ func (api *API) workspaceBuilds(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param workspacename path string true "Workspace name"
|
||||
// @Param buildnumber path string true "Build number" format(number)
|
||||
// @Success 200 {object} codersdk.WorkspaceBuild
|
||||
// @Router /users/{user}/workspace/{workspacename}/builds/{buildnumber} [get]
|
||||
// @Router /api/v2/users/{user}/workspace/{workspacename}/builds/{buildnumber} [get]
|
||||
func (api *API) workspaceBuildByBuildNumber(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
mems := httpmw.OrganizationMembersParam(r)
|
||||
@@ -324,7 +324,7 @@ func (api *API) workspaceBuildByBuildNumber(rw http.ResponseWriter, r *http.Requ
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.CreateWorkspaceBuildRequest true "Create workspace build request"
|
||||
// @Success 200 {object} codersdk.WorkspaceBuild
|
||||
// @Router /workspaces/{workspace}/builds [post]
|
||||
// @Router /api/v2/workspaces/{workspace}/builds [post]
|
||||
func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -662,7 +662,7 @@ func (api *API) notifyWorkspaceUpdated(
|
||||
// @Param workspacebuild path string true "Workspace build ID"
|
||||
// @Param expect_status query string false "Expected status of the job. If expect_status is supplied, the request will be rejected with 412 Precondition Failed if the job doesn't match the state when performing the cancellation." Enums(running, pending)
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /workspacebuilds/{workspacebuild}/cancel [patch]
|
||||
// @Router /api/v2/workspacebuilds/{workspacebuild}/cancel [patch]
|
||||
func (api *API) patchCancelWorkspaceBuild(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -817,7 +817,7 @@ func verifyUserCanCancelWorkspaceBuilds(ctx context.Context, store database.Stor
|
||||
// @Tags Builds
|
||||
// @Param workspacebuild path string true "Workspace build ID"
|
||||
// @Success 200 {array} codersdk.WorkspaceBuildParameter
|
||||
// @Router /workspacebuilds/{workspacebuild}/parameters [get]
|
||||
// @Router /api/v2/workspacebuilds/{workspacebuild}/parameters [get]
|
||||
func (api *API) workspaceBuildParameters(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspaceBuild := httpmw.WorkspaceBuildParam(r)
|
||||
@@ -845,7 +845,7 @@ func (api *API) workspaceBuildParameters(rw http.ResponseWriter, r *http.Request
|
||||
// @Param follow query bool false "Follow log stream"
|
||||
// @Param format query string false "Log output format. Accepted: 'json' (default), 'text' (plain text with RFC3339 timestamps and ANSI colors). Not supported with follow=true." Enums(json,text)
|
||||
// @Success 200 {array} codersdk.ProvisionerJobLog
|
||||
// @Router /workspacebuilds/{workspacebuild}/logs [get]
|
||||
// @Router /api/v2/workspacebuilds/{workspacebuild}/logs [get]
|
||||
func (api *API) workspaceBuildLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspaceBuild := httpmw.WorkspaceBuildParam(r)
|
||||
@@ -868,7 +868,7 @@ func (api *API) workspaceBuildLogs(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Builds
|
||||
// @Param workspacebuild path string true "Workspace build ID"
|
||||
// @Success 200 {object} codersdk.WorkspaceBuild
|
||||
// @Router /workspacebuilds/{workspacebuild}/state [get]
|
||||
// @Router /api/v2/workspacebuilds/{workspacebuild}/state [get]
|
||||
func (api *API) workspaceBuildState(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspaceBuild := httpmw.WorkspaceBuildParam(r)
|
||||
@@ -900,7 +900,7 @@ func (api *API) workspaceBuildState(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param workspacebuild path string true "Workspace build ID" format(uuid)
|
||||
// @Param request body codersdk.UpdateWorkspaceBuildStateRequest true "Request body"
|
||||
// @Success 204
|
||||
// @Router /workspacebuilds/{workspacebuild}/state [put]
|
||||
// @Router /api/v2/workspacebuilds/{workspacebuild}/state [put]
|
||||
func (api *API) workspaceBuildUpdateState(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspaceBuild := httpmw.WorkspaceBuildParam(r)
|
||||
@@ -956,7 +956,7 @@ func (api *API) workspaceBuildUpdateState(rw http.ResponseWriter, r *http.Reques
|
||||
// @Tags Builds
|
||||
// @Param workspacebuild path string true "Workspace build ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.WorkspaceBuildTimings
|
||||
// @Router /workspacebuilds/{workspacebuild}/timings [get]
|
||||
// @Router /api/v2/workspacebuilds/{workspacebuild}/timings [get]
|
||||
func (api *API) workspaceBuildTimings(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
|
||||
@@ -74,7 +74,7 @@ func (api *API) PrimaryWorkspaceProxy(ctx context.Context) (database.WorkspacePr
|
||||
// @Produce json
|
||||
// @Tags WorkspaceProxies
|
||||
// @Success 200 {object} codersdk.RegionsResponse[codersdk.Region]
|
||||
// @Router /regions [get]
|
||||
// @Router /api/v2/regions [get]
|
||||
func (api *API) regions(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
//nolint:gocritic // this route intentionally requests resources that users
|
||||
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
// @Tags Agents
|
||||
// @Param request body agentsdk.AzureInstanceIdentityToken true "Instance identity token. The optional agent_name field disambiguates when multiple agents share the same instance ID."
|
||||
// @Success 200 {object} agentsdk.AuthenticateResponse
|
||||
// @Router /workspaceagents/azure-instance-identity [post]
|
||||
// @Router /api/v2/workspaceagents/azure-instance-identity [post]
|
||||
func (api *API) postWorkspaceAuthAzureInstanceIdentity(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var req agentsdk.AzureInstanceIdentityToken
|
||||
@@ -63,7 +63,7 @@ func (api *API) postWorkspaceAuthAzureInstanceIdentity(rw http.ResponseWriter, r
|
||||
// @Tags Agents
|
||||
// @Param request body agentsdk.AWSInstanceIdentityToken true "Instance identity token. The optional agent_name field disambiguates when multiple agents share the same instance ID."
|
||||
// @Success 200 {object} agentsdk.AuthenticateResponse
|
||||
// @Router /workspaceagents/aws-instance-identity [post]
|
||||
// @Router /api/v2/workspaceagents/aws-instance-identity [post]
|
||||
func (api *API) postWorkspaceAuthAWSInstanceIdentity(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var req agentsdk.AWSInstanceIdentityToken
|
||||
@@ -93,7 +93,7 @@ func (api *API) postWorkspaceAuthAWSInstanceIdentity(rw http.ResponseWriter, r *
|
||||
// @Tags Agents
|
||||
// @Param request body agentsdk.GoogleInstanceIdentityToken true "Instance identity token. The optional agent_name field disambiguates when multiple agents share the same instance ID."
|
||||
// @Success 200 {object} agentsdk.AuthenticateResponse
|
||||
// @Router /workspaceagents/google-instance-identity [post]
|
||||
// @Router /api/v2/workspaceagents/google-instance-identity [post]
|
||||
func (api *API) postWorkspaceAuthGoogleInstanceIdentity(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var req agentsdk.GoogleInstanceIdentityToken
|
||||
|
||||
+23
-23
@@ -65,7 +65,7 @@ var (
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param include_deleted query bool false "Return data instead of HTTP 404 if the workspace is deleted"
|
||||
// @Success 200 {object} codersdk.Workspace
|
||||
// @Router /workspaces/{workspace} [get]
|
||||
// @Router /api/v2/workspaces/{workspace} [get]
|
||||
func (api *API) workspace(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspace := httpmw.WorkspaceParam(r)
|
||||
@@ -146,7 +146,7 @@ func (api *API) workspace(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param limit query int false "Page limit"
|
||||
// @Param offset query int false "Page offset"
|
||||
// @Success 200 {object} codersdk.WorkspacesResponse
|
||||
// @Router /workspaces [get]
|
||||
// @Router /api/v2/workspaces [get]
|
||||
func (api *API) workspaces(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
apiKey := httpmw.APIKey(r)
|
||||
@@ -269,7 +269,7 @@ func (api *API) workspaces(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param workspacename path string true "Workspace name"
|
||||
// @Param include_deleted query bool false "Return data instead of HTTP 404 if the workspace is deleted"
|
||||
// @Success 200 {object} codersdk.Workspace
|
||||
// @Router /users/{user}/workspace/{workspacename} [get]
|
||||
// @Router /api/v2/users/{user}/workspace/{workspacename} [get]
|
||||
func (api *API) workspaceByOwnerAndName(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
@@ -371,7 +371,7 @@ func (api *API) workspaceByOwnerAndName(rw http.ResponseWriter, r *http.Request)
|
||||
// @Param user path string true "Username, UUID, or me"
|
||||
// @Param request body codersdk.CreateWorkspaceRequest true "Create workspace request"
|
||||
// @Success 200 {object} codersdk.Workspace
|
||||
// @Router /organizations/{organization}/members/{user}/workspaces [post]
|
||||
// @Router /api/v2/organizations/{organization}/members/{user}/workspaces [post]
|
||||
func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -432,7 +432,7 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req
|
||||
// @Param user path string true "Username, UUID, or me"
|
||||
// @Param request body codersdk.CreateWorkspaceRequest true "Create workspace request"
|
||||
// @Success 200 {object} codersdk.Workspace
|
||||
// @Router /users/{user}/workspaces [post]
|
||||
// @Router /api/v2/users/{user}/workspaces [post]
|
||||
func (api *API) postUserWorkspaces(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1048,7 +1048,7 @@ func (api *API) notifyWorkspaceCreated(
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.UpdateWorkspaceRequest true "Metadata update request"
|
||||
// @Success 204
|
||||
// @Router /workspaces/{workspace} [patch]
|
||||
// @Router /api/v2/workspaces/{workspace} [patch]
|
||||
func (api *API) patchWorkspace(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1143,7 +1143,7 @@ func (api *API) patchWorkspace(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.UpdateWorkspaceAutostartRequest true "Schedule update request"
|
||||
// @Success 204
|
||||
// @Router /workspaces/{workspace}/autostart [put]
|
||||
// @Router /api/v2/workspaces/{workspace}/autostart [put]
|
||||
func (api *API) putWorkspaceAutostart(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1246,7 +1246,7 @@ func (api *API) putWorkspaceAutostart(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.UpdateWorkspaceTTLRequest true "Workspace TTL update request"
|
||||
// @Success 204
|
||||
// @Router /workspaces/{workspace}/ttl [put]
|
||||
// @Router /api/v2/workspaces/{workspace}/ttl [put]
|
||||
func (api *API) putWorkspaceTTL(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1375,7 +1375,7 @@ func (api *API) putWorkspaceTTL(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.UpdateWorkspaceDormancy true "Make a workspace dormant or active"
|
||||
// @Success 200 {object} codersdk.Workspace
|
||||
// @Router /workspaces/{workspace}/dormant [put]
|
||||
// @Router /api/v2/workspaces/{workspace}/dormant [put]
|
||||
func (api *API) putWorkspaceDormant(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1547,7 +1547,7 @@ func (api *API) putWorkspaceDormant(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.PutExtendWorkspaceRequest true "Extend deadline update request"
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /workspaces/{workspace}/extend [put]
|
||||
// @Router /api/v2/workspaces/{workspace}/extend [put]
|
||||
func (api *API) putExtendWorkspace(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
workspace := httpmw.WorkspaceParam(r)
|
||||
@@ -1655,7 +1655,7 @@ func (api *API) putExtendWorkspace(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.PostWorkspaceUsageRequest false "Post workspace usage request"
|
||||
// @Success 204
|
||||
// @Router /workspaces/{workspace}/usage [post]
|
||||
// @Router /api/v2/workspaces/{workspace}/usage [post]
|
||||
func (api *API) postWorkspaceUsage(rw http.ResponseWriter, r *http.Request) {
|
||||
workspace := httpmw.WorkspaceParam(r)
|
||||
if !api.Authorize(r, policy.ActionUpdate, workspace) {
|
||||
@@ -1769,7 +1769,7 @@ func (api *API) postWorkspaceUsage(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Workspaces
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Success 204
|
||||
// @Router /workspaces/{workspace}/favorite [put]
|
||||
// @Router /api/v2/workspaces/{workspace}/favorite [put]
|
||||
func (api *API) putFavoriteWorkspace(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1816,7 +1816,7 @@ func (api *API) putFavoriteWorkspace(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Workspaces
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Success 204
|
||||
// @Router /workspaces/{workspace}/favorite [delete]
|
||||
// @Router /api/v2/workspaces/{workspace}/favorite [delete]
|
||||
func (api *API) deleteFavoriteWorkspace(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1865,7 +1865,7 @@ func (api *API) deleteFavoriteWorkspace(rw http.ResponseWriter, r *http.Request)
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.UpdateWorkspaceAutomaticUpdatesRequest true "Automatic updates request"
|
||||
// @Success 204
|
||||
// @Router /workspaces/{workspace}/autoupdates [put]
|
||||
// @Router /api/v2/workspaces/{workspace}/autoupdates [put]
|
||||
func (api *API) putWorkspaceAutoupdates(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -1925,7 +1925,7 @@ func (api *API) putWorkspaceAutoupdates(rw http.ResponseWriter, r *http.Request)
|
||||
// @Tags Workspaces
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.ResolveAutostartResponse
|
||||
// @Router /workspaces/{workspace}/resolve-autostart [get]
|
||||
// @Router /api/v2/workspaces/{workspace}/resolve-autostart [get]
|
||||
func (api *API) resolveAutostart(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -2019,7 +2019,7 @@ func (api *API) resolveAutostart(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Workspaces
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.Response
|
||||
// @Router /workspaces/{workspace}/watch [get]
|
||||
// @Router /api/v2/workspaces/{workspace}/watch [get]
|
||||
// @Deprecated Use /workspaces/{workspace}/watch-ws instead
|
||||
func (api *API) watchWorkspaceSSE(rw http.ResponseWriter, r *http.Request) {
|
||||
api.watchWorkspace(rw, r, httpapi.ServerSentEventSender)
|
||||
@@ -2032,7 +2032,7 @@ func (api *API) watchWorkspaceSSE(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Workspaces
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.ServerSentEvent
|
||||
// @Router /workspaces/{workspace}/watch-ws [get]
|
||||
// @Router /api/v2/workspaces/{workspace}/watch-ws [get]
|
||||
func (api *API) watchWorkspaceWS(rw http.ResponseWriter, r *http.Request) {
|
||||
api.watchWorkspace(rw, r, httpapi.OneWayWebSocketEventSender(api.Logger))
|
||||
}
|
||||
@@ -2184,7 +2184,7 @@ func (api *API) watchWorkspace(
|
||||
// @Produce json
|
||||
// @Tags Workspaces
|
||||
// @Success 101
|
||||
// @Router /experimental/watch-all-workspacebuilds [get]
|
||||
// @Router /api/experimental/watch-all-workspacebuilds [get]
|
||||
// @x-apidocgen {"skip": true}
|
||||
func (api *API) watchAllWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
@@ -2257,7 +2257,7 @@ func (api *API) watchAllWorkspaceBuilds(rw http.ResponseWriter, r *http.Request)
|
||||
// @Tags Workspaces
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.WorkspaceBuildTimings
|
||||
// @Router /workspaces/{workspace}/timings [get]
|
||||
// @Router /api/v2/workspaces/{workspace}/timings [get]
|
||||
func (api *API) workspaceTimings(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -2292,7 +2292,7 @@ func (api *API) workspaceTimings(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags Workspaces
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Success 200 {object} codersdk.WorkspaceACL
|
||||
// @Router /workspaces/{workspace}/acl [get]
|
||||
// @Router /api/v2/workspaces/{workspace}/acl [get]
|
||||
func (api *API) workspaceACL(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -2403,7 +2403,7 @@ func (api *API) workspaceACL(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Param request body codersdk.UpdateWorkspaceACL true "Update workspace ACL request"
|
||||
// @Success 204
|
||||
// @Router /workspaces/{workspace}/acl [patch]
|
||||
// @Router /api/v2/workspaces/{workspace}/acl [patch]
|
||||
func (api *API) patchWorkspaceACL(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -2514,7 +2514,7 @@ type workspaceData struct {
|
||||
// @Tags Workspaces
|
||||
// @Param workspace path string true "Workspace ID" format(uuid)
|
||||
// @Success 204
|
||||
// @Router /workspaces/{workspace}/acl [delete]
|
||||
// @Router /api/v2/workspaces/{workspace}/acl [delete]
|
||||
func (api *API) deleteWorkspaceACL(rw http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
@@ -3024,7 +3024,7 @@ func convertToWorkspaceRole(actions []policy.Action) codersdk.WorkspaceRole {
|
||||
// @Param limit query int false "Limit results"
|
||||
// @Param offset query int false "Offset for pagination"
|
||||
// @Success 200 {array} codersdk.MinimalUser
|
||||
// @Router /organizations/{organization}/members/{user}/workspaces/available-users [get]
|
||||
// @Router /api/v2/organizations/{organization}/members/{user}/workspaces/available-users [get]
|
||||
func (api *API) workspaceAvailableUsers(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
organization := httpmw.OrganizationParam(r)
|
||||
|
||||
Reference in New Issue
Block a user