From 621fa13093605de406f35d41c8fbb92096114477 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Fri, 23 Feb 2024 10:04:43 +0000 Subject: [PATCH 1/3] refactor(coderd): move healthcheck report structs to codersdk --- cli/netcheck.go | 2 +- cli/netcheck_test.go | 5 +- coderd/apidoc/docs.go | 977 +-- coderd/apidoc/swagger.json | 955 +-- coderd/coderd.go | 10 +- coderd/coderdtest/coderdtest.go | 3 +- coderd/debug.go | 7 +- coderd/debug_test.go | 34 +- coderd/healthcheck/accessurl.go | 17 +- coderd/healthcheck/database.go | 17 +- coderd/healthcheck/derphealth/derp.go | 98 +- coderd/healthcheck/healthcheck.go | 63 +- coderd/healthcheck/healthcheck_test.go | 156 +- coderd/healthcheck/provisioner.go | 20 +- coderd/healthcheck/provisioner_test.go | 26 +- coderd/healthcheck/websocket.go | 15 +- coderd/healthcheck/workspaceproxy.go | 11 +- codersdk/health.go | 146 + docs/api/debug.md | 8 +- docs/api/schemas.md | 8266 ++++++++++++------------ scripts/apitypings/main.go | 4 +- site/src/api/typesGenerated.ts | 268 +- 22 files changed, 5560 insertions(+), 5548 deletions(-) diff --git a/cli/netcheck.go b/cli/netcheck.go index 5ca7a3d99975b..1130a1e0373fd 100644 --- a/cli/netcheck.go +++ b/cli/netcheck.go @@ -38,7 +38,7 @@ func (r *RootCmd) netcheck() *clibase.Cmd { DERPMap: connInfo.DERPMap, }) - raw, err := json.MarshalIndent(report, "", " ") + raw, err := json.MarshalIndent(report.DERPHealthReport, "", " ") if err != nil { return err } diff --git a/cli/netcheck_test.go b/cli/netcheck_test.go index 79abf775562e2..bf9608d826a26 100644 --- a/cli/netcheck_test.go +++ b/cli/netcheck_test.go @@ -5,11 +5,12 @@ import ( "encoding/json" "testing" + "github.com/coder/coder/v2/codersdk" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/coder/coder/v2/cli/clitest" - "github.com/coder/coder/v2/coderd/healthcheck/derphealth" "github.com/coder/coder/v2/pty/ptytest" ) @@ -27,7 +28,7 @@ func TestNetcheck(t *testing.T) { b := out.Bytes() t.Log(string(b)) - var report derphealth.Report + var report codersdk.DERPHealthReport require.NoError(t, json.Unmarshal(b, &report)) assert.True(t, report.Healthy) diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index b73384696394c..bf44240fd0a76 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -485,7 +485,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/healthcheck.Report" + "$ref": "#/definitions/codersdk.HealthcheckReport" } } } @@ -8394,6 +8394,51 @@ const docTemplate = `{ "APIKeyScopeApplicationConnect" ] }, + "codersdk.AccessURLReport": { + "type": "object", + "properties": { + "access_url": { + "type": "string" + }, + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", + "type": "boolean" + }, + "healthz_response": { + "type": "string" + }, + "reachable": { + "type": "boolean" + }, + "severity": { + "enum": [ + "ok", + "warning", + "error" + ], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "status_code": { + "type": "integer" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.AddLicenseRequest": { "type": "object", "required": [ @@ -9305,6 +9350,126 @@ const docTemplate = `{ } } }, + "codersdk.DERPHealthReport": { + "type": "object", + "properties": { + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", + "type": "boolean" + }, + "netcheck": { + "$ref": "#/definitions/netcheck.Report" + }, + "netcheck_err": { + "type": "string" + }, + "netcheck_logs": { + "type": "array", + "items": { + "type": "string" + } + }, + "regions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/codersdk.DERPRegionReport" + } + }, + "severity": { + "enum": [ + "ok", + "warning", + "error" + ], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, + "codersdk.DERPNodeReport": { + "type": "object", + "properties": { + "can_exchange_messages": { + "type": "boolean" + }, + "client_errs": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "client_logs": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", + "type": "boolean" + }, + "node": { + "$ref": "#/definitions/tailcfg.DERPNode" + }, + "node_info": { + "$ref": "#/definitions/derp.ServerInfoMessage" + }, + "round_trip_ping": { + "type": "string" + }, + "round_trip_ping_ms": { + "type": "integer" + }, + "severity": { + "enum": [ + "ok", + "warning", + "error" + ], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "stun": { + "$ref": "#/definitions/codersdk.STUNReport" + }, + "uses_websocket": { + "type": "boolean" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.DERPRegion": { "type": "object", "properties": { @@ -9316,6 +9481,45 @@ const docTemplate = `{ } } }, + "codersdk.DERPRegionReport": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", + "type": "boolean" + }, + "node_reports": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.DERPNodeReport" + } + }, + "region": { + "$ref": "#/definitions/tailcfg.DERPRegion" + }, + "severity": { + "enum": [ + "ok", + "warning", + "error" + ], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.DERPServerConfig": { "type": "object", "properties": { @@ -9356,6 +9560,51 @@ const docTemplate = `{ } } }, + "codersdk.DatabaseReport": { + "type": "object", + "properties": { + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", + "type": "boolean" + }, + "latency": { + "type": "string" + }, + "latency_ms": { + "type": "integer" + }, + "reachable": { + "type": "boolean" + }, + "severity": { + "enum": [ + "ok", + "warning", + "error" + ], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "threshold_ms": { + "type": "integer" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.DeleteWorkspaceAgentPortShareRequest": { "type": "object", "properties": { @@ -10033,22 +10282,78 @@ const docTemplate = `{ } } }, - "codersdk.InsightsReportInterval": { - "type": "string", - "enum": [ - "day", - "week" - ], - "x-enum-varnames": [ - "InsightsReportIntervalDay", - "InsightsReportIntervalWeek" - ] - }, - "codersdk.IssueReconnectingPTYSignedTokenRequest": { + "codersdk.HealthcheckReport": { "type": "object", - "required": [ - "agentID", - "url" + "properties": { + "access_url": { + "$ref": "#/definitions/codersdk.AccessURLReport" + }, + "coder_version": { + "description": "The Coder version of the server that the report was generated on.", + "type": "string" + }, + "database": { + "$ref": "#/definitions/codersdk.DatabaseReport" + }, + "derp": { + "$ref": "#/definitions/codersdk.DERPHealthReport" + }, + "failing_sections": { + "description": "FailingSections is a list of sections that have failed their healthcheck.", + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.HealthSection" + } + }, + "healthy": { + "description": "Healthy is true if the report returns no errors.\nDeprecated: use ` + "`" + `Severity` + "`" + ` instead", + "type": "boolean" + }, + "provisioner_daemons": { + "$ref": "#/definitions/codersdk.ProvisionerDaemonsReport" + }, + "severity": { + "description": "Severity indicates the status of Coder health.", + "enum": [ + "ok", + "warning", + "error" + ], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "time": { + "description": "Time is the time the report was generated at.", + "type": "string", + "format": "date-time" + }, + "websocket": { + "$ref": "#/definitions/codersdk.WebsocketReport" + }, + "workspace_proxy": { + "$ref": "#/definitions/codersdk.WorkspaceProxyReport" + } + } + }, + "codersdk.InsightsReportInterval": { + "type": "string", + "enum": [ + "day", + "week" + ], + "x-enum-varnames": [ + "InsightsReportIntervalDay", + "InsightsReportIntervalWeek" + ] + }, + "codersdk.IssueReconnectingPTYSignedTokenRequest": { + "type": "object", + "required": [ + "agentID", + "url" ], "properties": { "agentID": { @@ -10719,6 +11024,46 @@ const docTemplate = `{ } } }, + "codersdk.ProvisionerDaemonsReport": { + "type": "object", + "properties": { + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.ProvisionerDaemonsReportItem" + } + }, + "severity": { + "$ref": "#/definitions/health.Severity" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, + "codersdk.ProvisionerDaemonsReportItem": { + "type": "object", + "properties": { + "provisioner_daemon": { + "$ref": "#/definitions/codersdk.ProvisionerDaemon" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.ProvisionerJob": { "type": "object", "properties": { @@ -11238,6 +11583,20 @@ const docTemplate = `{ } } }, + "codersdk.STUNReport": { + "type": "object", + "properties": { + "canSTUN": { + "type": "boolean" + }, + "enabled": { + "type": "boolean" + }, + "error": { + "type": "string" + } + } + }, "codersdk.ServiceBannerConfig": { "type": "object", "properties": { @@ -12558,6 +12917,45 @@ const docTemplate = `{ } } }, + "codersdk.WebsocketReport": { + "type": "object", + "properties": { + "body": { + "type": "string" + }, + "code": { + "type": "integer" + }, + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", + "type": "boolean" + }, + "severity": { + "enum": [ + "ok", + "warning", + "error" + ], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "codersdk.Workspace": { "type": "object", "properties": { @@ -13384,6 +13782,32 @@ const docTemplate = `{ } } }, + "codersdk.WorkspaceProxyReport": { + "type": "object", + "properties": { + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "type": "boolean" + }, + "severity": { + "$ref": "#/definitions/health.Severity" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + }, + "workspace_proxies": { + "$ref": "#/definitions/codersdk.RegionsResponse-codersdk_WorkspaceProxy" + } + } + }, "codersdk.WorkspaceProxyStatus": { "type": "object", "properties": { @@ -13571,231 +13995,58 @@ const docTemplate = `{ } } }, - "derphealth.NodeReport": { + "health.Code": { + "type": "string", + "enum": [ + "EUNKNOWN", + "EWP01", + "EWP02", + "EWP03", + "EWP04", + "EDB01", + "EDB02", + "EWS01", + "EWS02", + "EWS03", + "EACS01", + "EACS02", + "EACS03", + "EACS04", + "EDERP01", + "EDERP02", + "EPD01", + "EPD02", + "EPD03" + ], + "x-enum-varnames": [ + "CodeUnknown", + "CodeProxyUpdate", + "CodeProxyFetch", + "CodeProxyVersionMismatch", + "CodeProxyUnhealthy", + "CodeDatabasePingFailed", + "CodeDatabasePingSlow", + "CodeWebsocketDial", + "CodeWebsocketEcho", + "CodeWebsocketMsg", + "CodeAccessURLNotSet", + "CodeAccessURLInvalid", + "CodeAccessURLFetch", + "CodeAccessURLNotOK", + "CodeDERPNodeUsesWebsocket", + "CodeDERPOneNodeUnhealthy", + "CodeProvisionerDaemonsNoProvisionerDaemons", + "CodeProvisionerDaemonVersionMismatch", + "CodeProvisionerDaemonAPIMajorVersionDeprecated" + ] + }, + "health.Message": { "type": "object", "properties": { - "can_exchange_messages": { - "type": "boolean" - }, - "client_errs": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "client_logs": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string" - } - } + "code": { + "$ref": "#/definitions/health.Code" }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", - "type": "boolean" - }, - "node": { - "$ref": "#/definitions/tailcfg.DERPNode" - }, - "node_info": { - "$ref": "#/definitions/derp.ServerInfoMessage" - }, - "round_trip_ping": { - "type": "string" - }, - "round_trip_ping_ms": { - "type": "integer" - }, - "severity": { - "enum": [ - "ok", - "warning", - "error" - ], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "stun": { - "$ref": "#/definitions/derphealth.StunReport" - }, - "uses_websocket": { - "type": "boolean" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "derphealth.RegionReport": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", - "type": "boolean" - }, - "node_reports": { - "type": "array", - "items": { - "$ref": "#/definitions/derphealth.NodeReport" - } - }, - "region": { - "$ref": "#/definitions/tailcfg.DERPRegion" - }, - "severity": { - "enum": [ - "ok", - "warning", - "error" - ], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "derphealth.Report": { - "type": "object", - "properties": { - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", - "type": "boolean" - }, - "netcheck": { - "$ref": "#/definitions/netcheck.Report" - }, - "netcheck_err": { - "type": "string" - }, - "netcheck_logs": { - "type": "array", - "items": { - "type": "string" - } - }, - "regions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/derphealth.RegionReport" - } - }, - "severity": { - "enum": [ - "ok", - "warning", - "error" - ], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "derphealth.StunReport": { - "type": "object", - "properties": { - "canSTUN": { - "type": "boolean" - }, - "enabled": { - "type": "boolean" - }, - "error": { - "type": "string" - } - } - }, - "health.Code": { - "type": "string", - "enum": [ - "EUNKNOWN", - "EWP01", - "EWP02", - "EWP03", - "EWP04", - "EDB01", - "EDB02", - "EWS01", - "EWS02", - "EWS03", - "EACS01", - "EACS02", - "EACS03", - "EACS04", - "EDERP01", - "EDERP02", - "EPD01", - "EPD02", - "EPD03" - ], - "x-enum-varnames": [ - "CodeUnknown", - "CodeProxyUpdate", - "CodeProxyFetch", - "CodeProxyVersionMismatch", - "CodeProxyUnhealthy", - "CodeDatabasePingFailed", - "CodeDatabasePingSlow", - "CodeWebsocketDial", - "CodeWebsocketEcho", - "CodeWebsocketMsg", - "CodeAccessURLNotSet", - "CodeAccessURLInvalid", - "CodeAccessURLFetch", - "CodeAccessURLNotOK", - "CodeDERPNodeUsesWebsocket", - "CodeDERPOneNodeUnhealthy", - "CodeProvisionerDaemonsNoProvisionerDaemons", - "CodeProvisionerDaemonVersionMismatch", - "CodeProvisionerDaemonAPIMajorVersionDeprecated" - ] - }, - "health.Message": { - "type": "object", - "properties": { - "code": { - "$ref": "#/definitions/health.Code" - }, - "message": { + "message": { "type": "string" } } @@ -13813,256 +14064,6 @@ const docTemplate = `{ "SeverityError" ] }, - "healthcheck.AccessURLReport": { - "type": "object", - "properties": { - "access_url": { - "type": "string" - }, - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", - "type": "boolean" - }, - "healthz_response": { - "type": "string" - }, - "reachable": { - "type": "boolean" - }, - "severity": { - "enum": [ - "ok", - "warning", - "error" - ], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "status_code": { - "type": "integer" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "healthcheck.DatabaseReport": { - "type": "object", - "properties": { - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", - "type": "boolean" - }, - "latency": { - "type": "string" - }, - "latency_ms": { - "type": "integer" - }, - "reachable": { - "type": "boolean" - }, - "severity": { - "enum": [ - "ok", - "warning", - "error" - ], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "threshold_ms": { - "type": "integer" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "healthcheck.ProvisionerDaemonsReport": { - "type": "object", - "properties": { - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/healthcheck.ProvisionerDaemonsReportItem" - } - }, - "severity": { - "$ref": "#/definitions/health.Severity" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "healthcheck.ProvisionerDaemonsReportItem": { - "type": "object", - "properties": { - "provisioner_daemon": { - "$ref": "#/definitions/codersdk.ProvisionerDaemon" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "healthcheck.Report": { - "type": "object", - "properties": { - "access_url": { - "$ref": "#/definitions/healthcheck.AccessURLReport" - }, - "coder_version": { - "description": "The Coder version of the server that the report was generated on.", - "type": "string" - }, - "database": { - "$ref": "#/definitions/healthcheck.DatabaseReport" - }, - "derp": { - "$ref": "#/definitions/derphealth.Report" - }, - "failing_sections": { - "description": "FailingSections is a list of sections that have failed their healthcheck.", - "type": "array", - "items": { - "$ref": "#/definitions/codersdk.HealthSection" - } - }, - "healthy": { - "description": "Healthy is true if the report returns no errors.\nDeprecated: use ` + "`" + `Severity` + "`" + ` instead", - "type": "boolean" - }, - "provisioner_daemons": { - "$ref": "#/definitions/healthcheck.ProvisionerDaemonsReport" - }, - "severity": { - "description": "Severity indicates the status of Coder health.", - "enum": [ - "ok", - "warning", - "error" - ], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "time": { - "description": "Time is the time the report was generated at.", - "type": "string" - }, - "websocket": { - "$ref": "#/definitions/healthcheck.WebsocketReport" - }, - "workspace_proxy": { - "$ref": "#/definitions/healthcheck.WorkspaceProxyReport" - } - } - }, - "healthcheck.WebsocketReport": { - "type": "object", - "properties": { - "body": { - "type": "string" - }, - "code": { - "type": "integer" - }, - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use ` + "`" + `Severity` + "`" + ` instead.", - "type": "boolean" - }, - "severity": { - "enum": [ - "ok", - "warning", - "error" - ], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "healthcheck.WorkspaceProxyReport": { - "type": "object", - "properties": { - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "type": "boolean" - }, - "severity": { - "$ref": "#/definitions/health.Severity" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - }, - "workspace_proxies": { - "$ref": "#/definitions/codersdk.RegionsResponse-codersdk_WorkspaceProxy" - } - } - }, "key.NodePublic": { "type": "object" }, diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index a3f00910e7ff2..edae5dee2f498 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -413,7 +413,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/healthcheck.Report" + "$ref": "#/definitions/codersdk.HealthcheckReport" } } } @@ -7465,6 +7465,47 @@ "enum": ["all", "application_connect"], "x-enum-varnames": ["APIKeyScopeAll", "APIKeyScopeApplicationConnect"] }, + "codersdk.AccessURLReport": { + "type": "object", + "properties": { + "access_url": { + "type": "string" + }, + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", + "type": "boolean" + }, + "healthz_response": { + "type": "string" + }, + "reachable": { + "type": "boolean" + }, + "severity": { + "enum": ["ok", "warning", "error"], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "status_code": { + "type": "integer" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.AddLicenseRequest": { "type": "object", "required": ["license"], @@ -8306,6 +8347,118 @@ } } }, + "codersdk.DERPHealthReport": { + "type": "object", + "properties": { + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", + "type": "boolean" + }, + "netcheck": { + "$ref": "#/definitions/netcheck.Report" + }, + "netcheck_err": { + "type": "string" + }, + "netcheck_logs": { + "type": "array", + "items": { + "type": "string" + } + }, + "regions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/codersdk.DERPRegionReport" + } + }, + "severity": { + "enum": ["ok", "warning", "error"], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, + "codersdk.DERPNodeReport": { + "type": "object", + "properties": { + "can_exchange_messages": { + "type": "boolean" + }, + "client_errs": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "client_logs": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", + "type": "boolean" + }, + "node": { + "$ref": "#/definitions/tailcfg.DERPNode" + }, + "node_info": { + "$ref": "#/definitions/derp.ServerInfoMessage" + }, + "round_trip_ping": { + "type": "string" + }, + "round_trip_ping_ms": { + "type": "integer" + }, + "severity": { + "enum": ["ok", "warning", "error"], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "stun": { + "$ref": "#/definitions/codersdk.STUNReport" + }, + "uses_websocket": { + "type": "boolean" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.DERPRegion": { "type": "object", "properties": { @@ -8317,6 +8470,41 @@ } } }, + "codersdk.DERPRegionReport": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", + "type": "boolean" + }, + "node_reports": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.DERPNodeReport" + } + }, + "region": { + "$ref": "#/definitions/tailcfg.DERPRegion" + }, + "severity": { + "enum": ["ok", "warning", "error"], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.DERPServerConfig": { "type": "object", "properties": { @@ -8357,6 +8545,47 @@ } } }, + "codersdk.DatabaseReport": { + "type": "object", + "properties": { + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", + "type": "boolean" + }, + "latency": { + "type": "string" + }, + "latency_ms": { + "type": "integer" + }, + "reachable": { + "type": "boolean" + }, + "severity": { + "enum": ["ok", "warning", "error"], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "threshold_ms": { + "type": "integer" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.DeleteWorkspaceAgentPortShareRequest": { "type": "object", "properties": { @@ -9020,42 +9249,94 @@ } } }, - "codersdk.InsightsReportInterval": { - "type": "string", - "enum": ["day", "week"], - "x-enum-varnames": [ - "InsightsReportIntervalDay", - "InsightsReportIntervalWeek" - ] - }, - "codersdk.IssueReconnectingPTYSignedTokenRequest": { + "codersdk.HealthcheckReport": { "type": "object", - "required": ["agentID", "url"], "properties": { - "agentID": { - "type": "string", - "format": "uuid" + "access_url": { + "$ref": "#/definitions/codersdk.AccessURLReport" }, - "url": { - "description": "URL is the URL of the reconnecting-pty endpoint you are connecting to.", - "type": "string" - } - } - }, - "codersdk.IssueReconnectingPTYSignedTokenResponse": { - "type": "object", - "properties": { - "signed_token": { + "coder_version": { + "description": "The Coder version of the server that the report was generated on.", "type": "string" - } - } - }, - "codersdk.JFrogXrayScan": { - "type": "object", - "properties": { - "agent_id": { - "type": "string", - "format": "uuid" + }, + "database": { + "$ref": "#/definitions/codersdk.DatabaseReport" + }, + "derp": { + "$ref": "#/definitions/codersdk.DERPHealthReport" + }, + "failing_sections": { + "description": "FailingSections is a list of sections that have failed their healthcheck.", + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.HealthSection" + } + }, + "healthy": { + "description": "Healthy is true if the report returns no errors.\nDeprecated: use `Severity` instead", + "type": "boolean" + }, + "provisioner_daemons": { + "$ref": "#/definitions/codersdk.ProvisionerDaemonsReport" + }, + "severity": { + "description": "Severity indicates the status of Coder health.", + "enum": ["ok", "warning", "error"], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "time": { + "description": "Time is the time the report was generated at.", + "type": "string", + "format": "date-time" + }, + "websocket": { + "$ref": "#/definitions/codersdk.WebsocketReport" + }, + "workspace_proxy": { + "$ref": "#/definitions/codersdk.WorkspaceProxyReport" + } + } + }, + "codersdk.InsightsReportInterval": { + "type": "string", + "enum": ["day", "week"], + "x-enum-varnames": [ + "InsightsReportIntervalDay", + "InsightsReportIntervalWeek" + ] + }, + "codersdk.IssueReconnectingPTYSignedTokenRequest": { + "type": "object", + "required": ["agentID", "url"], + "properties": { + "agentID": { + "type": "string", + "format": "uuid" + }, + "url": { + "description": "URL is the URL of the reconnecting-pty endpoint you are connecting to.", + "type": "string" + } + } + }, + "codersdk.IssueReconnectingPTYSignedTokenResponse": { + "type": "object", + "properties": { + "signed_token": { + "type": "string" + } + } + }, + "codersdk.JFrogXrayScan": { + "type": "object", + "properties": { + "agent_id": { + "type": "string", + "format": "uuid" }, "critical": { "type": "integer" @@ -9651,6 +9932,46 @@ } } }, + "codersdk.ProvisionerDaemonsReport": { + "type": "object", + "properties": { + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.ProvisionerDaemonsReportItem" + } + }, + "severity": { + "$ref": "#/definitions/health.Severity" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, + "codersdk.ProvisionerDaemonsReportItem": { + "type": "object", + "properties": { + "provisioner_daemon": { + "$ref": "#/definitions/codersdk.ProvisionerDaemon" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + } + } + }, "codersdk.ProvisionerJob": { "type": "object", "properties": { @@ -10136,6 +10457,20 @@ } } }, + "codersdk.STUNReport": { + "type": "object", + "properties": { + "canSTUN": { + "type": "boolean" + }, + "enabled": { + "type": "boolean" + }, + "error": { + "type": "string" + } + } + }, "codersdk.ServiceBannerConfig": { "type": "object", "properties": { @@ -11387,6 +11722,41 @@ } } }, + "codersdk.WebsocketReport": { + "type": "object", + "properties": { + "body": { + "type": "string" + }, + "code": { + "type": "integer" + }, + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", + "type": "boolean" + }, + "severity": { + "enum": ["ok", "warning", "error"], + "allOf": [ + { + "$ref": "#/definitions/health.Severity" + } + ] + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "codersdk.Workspace": { "type": "object", "properties": { @@ -12177,6 +12547,32 @@ } } }, + "codersdk.WorkspaceProxyReport": { + "type": "object", + "properties": { + "dismissed": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "healthy": { + "type": "boolean" + }, + "severity": { + "$ref": "#/definitions/health.Severity" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/health.Message" + } + }, + "workspace_proxies": { + "$ref": "#/definitions/codersdk.RegionsResponse-codersdk_WorkspaceProxy" + } + } + }, "codersdk.WorkspaceProxyStatus": { "type": "object", "properties": { @@ -12356,219 +12752,58 @@ } } }, - "derphealth.NodeReport": { + "health.Code": { + "type": "string", + "enum": [ + "EUNKNOWN", + "EWP01", + "EWP02", + "EWP03", + "EWP04", + "EDB01", + "EDB02", + "EWS01", + "EWS02", + "EWS03", + "EACS01", + "EACS02", + "EACS03", + "EACS04", + "EDERP01", + "EDERP02", + "EPD01", + "EPD02", + "EPD03" + ], + "x-enum-varnames": [ + "CodeUnknown", + "CodeProxyUpdate", + "CodeProxyFetch", + "CodeProxyVersionMismatch", + "CodeProxyUnhealthy", + "CodeDatabasePingFailed", + "CodeDatabasePingSlow", + "CodeWebsocketDial", + "CodeWebsocketEcho", + "CodeWebsocketMsg", + "CodeAccessURLNotSet", + "CodeAccessURLInvalid", + "CodeAccessURLFetch", + "CodeAccessURLNotOK", + "CodeDERPNodeUsesWebsocket", + "CodeDERPOneNodeUnhealthy", + "CodeProvisionerDaemonsNoProvisionerDaemons", + "CodeProvisionerDaemonVersionMismatch", + "CodeProvisionerDaemonAPIMajorVersionDeprecated" + ] + }, + "health.Message": { "type": "object", "properties": { - "can_exchange_messages": { - "type": "boolean" - }, - "client_errs": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "client_logs": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string" - } - } + "code": { + "$ref": "#/definitions/health.Code" }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", - "type": "boolean" - }, - "node": { - "$ref": "#/definitions/tailcfg.DERPNode" - }, - "node_info": { - "$ref": "#/definitions/derp.ServerInfoMessage" - }, - "round_trip_ping": { - "type": "string" - }, - "round_trip_ping_ms": { - "type": "integer" - }, - "severity": { - "enum": ["ok", "warning", "error"], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "stun": { - "$ref": "#/definitions/derphealth.StunReport" - }, - "uses_websocket": { - "type": "boolean" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "derphealth.RegionReport": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", - "type": "boolean" - }, - "node_reports": { - "type": "array", - "items": { - "$ref": "#/definitions/derphealth.NodeReport" - } - }, - "region": { - "$ref": "#/definitions/tailcfg.DERPRegion" - }, - "severity": { - "enum": ["ok", "warning", "error"], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "derphealth.Report": { - "type": "object", - "properties": { - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", - "type": "boolean" - }, - "netcheck": { - "$ref": "#/definitions/netcheck.Report" - }, - "netcheck_err": { - "type": "string" - }, - "netcheck_logs": { - "type": "array", - "items": { - "type": "string" - } - }, - "regions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/derphealth.RegionReport" - } - }, - "severity": { - "enum": ["ok", "warning", "error"], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "derphealth.StunReport": { - "type": "object", - "properties": { - "canSTUN": { - "type": "boolean" - }, - "enabled": { - "type": "boolean" - }, - "error": { - "type": "string" - } - } - }, - "health.Code": { - "type": "string", - "enum": [ - "EUNKNOWN", - "EWP01", - "EWP02", - "EWP03", - "EWP04", - "EDB01", - "EDB02", - "EWS01", - "EWS02", - "EWS03", - "EACS01", - "EACS02", - "EACS03", - "EACS04", - "EDERP01", - "EDERP02", - "EPD01", - "EPD02", - "EPD03" - ], - "x-enum-varnames": [ - "CodeUnknown", - "CodeProxyUpdate", - "CodeProxyFetch", - "CodeProxyVersionMismatch", - "CodeProxyUnhealthy", - "CodeDatabasePingFailed", - "CodeDatabasePingSlow", - "CodeWebsocketDial", - "CodeWebsocketEcho", - "CodeWebsocketMsg", - "CodeAccessURLNotSet", - "CodeAccessURLInvalid", - "CodeAccessURLFetch", - "CodeAccessURLNotOK", - "CodeDERPNodeUsesWebsocket", - "CodeDERPOneNodeUnhealthy", - "CodeProvisionerDaemonsNoProvisionerDaemons", - "CodeProvisionerDaemonVersionMismatch", - "CodeProvisionerDaemonAPIMajorVersionDeprecated" - ] - }, - "health.Message": { - "type": "object", - "properties": { - "code": { - "$ref": "#/definitions/health.Code" - }, - "message": { + "message": { "type": "string" } } @@ -12578,240 +12813,6 @@ "enum": ["ok", "warning", "error"], "x-enum-varnames": ["SeverityOK", "SeverityWarning", "SeverityError"] }, - "healthcheck.AccessURLReport": { - "type": "object", - "properties": { - "access_url": { - "type": "string" - }, - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", - "type": "boolean" - }, - "healthz_response": { - "type": "string" - }, - "reachable": { - "type": "boolean" - }, - "severity": { - "enum": ["ok", "warning", "error"], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "status_code": { - "type": "integer" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "healthcheck.DatabaseReport": { - "type": "object", - "properties": { - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", - "type": "boolean" - }, - "latency": { - "type": "string" - }, - "latency_ms": { - "type": "integer" - }, - "reachable": { - "type": "boolean" - }, - "severity": { - "enum": ["ok", "warning", "error"], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "threshold_ms": { - "type": "integer" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "healthcheck.ProvisionerDaemonsReport": { - "type": "object", - "properties": { - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/healthcheck.ProvisionerDaemonsReportItem" - } - }, - "severity": { - "$ref": "#/definitions/health.Severity" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "healthcheck.ProvisionerDaemonsReportItem": { - "type": "object", - "properties": { - "provisioner_daemon": { - "$ref": "#/definitions/codersdk.ProvisionerDaemon" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - } - } - }, - "healthcheck.Report": { - "type": "object", - "properties": { - "access_url": { - "$ref": "#/definitions/healthcheck.AccessURLReport" - }, - "coder_version": { - "description": "The Coder version of the server that the report was generated on.", - "type": "string" - }, - "database": { - "$ref": "#/definitions/healthcheck.DatabaseReport" - }, - "derp": { - "$ref": "#/definitions/derphealth.Report" - }, - "failing_sections": { - "description": "FailingSections is a list of sections that have failed their healthcheck.", - "type": "array", - "items": { - "$ref": "#/definitions/codersdk.HealthSection" - } - }, - "healthy": { - "description": "Healthy is true if the report returns no errors.\nDeprecated: use `Severity` instead", - "type": "boolean" - }, - "provisioner_daemons": { - "$ref": "#/definitions/healthcheck.ProvisionerDaemonsReport" - }, - "severity": { - "description": "Severity indicates the status of Coder health.", - "enum": ["ok", "warning", "error"], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "time": { - "description": "Time is the time the report was generated at.", - "type": "string" - }, - "websocket": { - "$ref": "#/definitions/healthcheck.WebsocketReport" - }, - "workspace_proxy": { - "$ref": "#/definitions/healthcheck.WorkspaceProxyReport" - } - } - }, - "healthcheck.WebsocketReport": { - "type": "object", - "properties": { - "body": { - "type": "string" - }, - "code": { - "type": "integer" - }, - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "description": "Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.", - "type": "boolean" - }, - "severity": { - "enum": ["ok", "warning", "error"], - "allOf": [ - { - "$ref": "#/definitions/health.Severity" - } - ] - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "healthcheck.WorkspaceProxyReport": { - "type": "object", - "properties": { - "dismissed": { - "type": "boolean" - }, - "error": { - "type": "string" - }, - "healthy": { - "type": "boolean" - }, - "severity": { - "$ref": "#/definitions/health.Severity" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/health.Message" - } - }, - "workspace_proxies": { - "$ref": "#/definitions/codersdk.RegionsResponse-codersdk_WorkspaceProxy" - } - } - }, "key.NodePublic": { "type": "object" }, diff --git a/coderd/coderd.go b/coderd/coderd.go index a4bf3b52a371b..119953dfaae15 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -143,7 +143,7 @@ type Options struct { // workspace applications. It consists of both a signing and encryption key. AppSecurityKey workspaceapps.SecurityKey - HealthcheckFunc func(ctx context.Context, apiKey string) *healthcheck.Report + HealthcheckFunc func(ctx context.Context, apiKey string) *codersdk.HealthcheckReport HealthcheckTimeout time.Duration HealthcheckRefresh time.Duration WorkspaceProxiesFetchUpdater *atomic.Pointer[healthcheck.WorkspaceProxiesFetchUpdater] @@ -397,7 +397,7 @@ func New(options *Options) *API { UserQuietHoursScheduleStore: options.UserQuietHoursScheduleStore, AccessControlStore: options.AccessControlStore, Experiments: experiments, - healthCheckGroup: &singleflight.Group[string, *healthcheck.Report]{}, + healthCheckGroup: &singleflight.Group[string, *codersdk.HealthcheckReport]{}, Acquirer: provisionerdserver.NewAcquirer( ctx, options.Logger.Named("acquirer"), @@ -433,7 +433,7 @@ func New(options *Options) *API { } if options.HealthcheckFunc == nil { - options.HealthcheckFunc = func(ctx context.Context, apiKey string) *healthcheck.Report { + options.HealthcheckFunc = func(ctx context.Context, apiKey string) *codersdk.HealthcheckReport { // NOTE: dismissed healthchecks are marked in formatHealthcheck. // Not here, as this result gets cached. return healthcheck.Run(ctx, &healthcheck.ReportOptions{ @@ -1170,8 +1170,8 @@ type API struct { // This is used to gate features that are not yet ready for production. Experiments codersdk.Experiments - healthCheckGroup *singleflight.Group[string, *healthcheck.Report] - healthCheckCache atomic.Pointer[healthcheck.Report] + healthCheckGroup *singleflight.Group[string, *codersdk.HealthcheckReport] + healthCheckCache atomic.Pointer[codersdk.HealthcheckReport] statsBatcher *batchstats.Batcher diff --git a/coderd/coderdtest/coderdtest.go b/coderd/coderdtest/coderdtest.go index e75c32f9b09a7..f1a53815bbd3d 100644 --- a/coderd/coderdtest/coderdtest.go +++ b/coderd/coderdtest/coderdtest.go @@ -61,7 +61,6 @@ import ( "github.com/coder/coder/v2/coderd/database/pubsub" "github.com/coder/coder/v2/coderd/externalauth" "github.com/coder/coder/v2/coderd/gitsshkey" - "github.com/coder/coder/v2/coderd/healthcheck" "github.com/coder/coder/v2/coderd/httpmw" "github.com/coder/coder/v2/coderd/rbac" "github.com/coder/coder/v2/coderd/schedule" @@ -111,7 +110,7 @@ type Options struct { TemplateScheduleStore schedule.TemplateScheduleStore Coordinator tailnet.Coordinator - HealthcheckFunc func(ctx context.Context, apiKey string) *healthcheck.Report + HealthcheckFunc func(ctx context.Context, apiKey string) *codersdk.HealthcheckReport HealthcheckTimeout time.Duration HealthcheckRefresh time.Duration diff --git a/coderd/debug.go b/coderd/debug.go index 40e3b10b82e5a..da40167c9cac5 100644 --- a/coderd/debug.go +++ b/coderd/debug.go @@ -17,7 +17,6 @@ import ( "github.com/coder/coder/v2/coderd/audit" "github.com/coder/coder/v2/coderd/database" - "github.com/coder/coder/v2/coderd/healthcheck" "github.com/coder/coder/v2/coderd/httpapi" "github.com/coder/coder/v2/coderd/httpmw" "github.com/coder/coder/v2/coderd/rbac" @@ -51,7 +50,7 @@ func (api *API) debugTailnet(rw http.ResponseWriter, r *http.Request) { // @Security CoderSessionToken // @Produce json // @Tags Debug -// @Success 200 {object} healthcheck.Report +// @Success 200 {object} codersdk.HealthcheckReport // @Router /debug/health [get] // @Param force query boolean false "Force a healthcheck to run" func (api *API) debugDeploymentHealth(rw http.ResponseWriter, r *http.Request) { @@ -77,7 +76,7 @@ func (api *API) debugDeploymentHealth(rw http.ResponseWriter, r *http.Request) { } } - resChan := api.healthCheckGroup.DoChan("", func() (*healthcheck.Report, error) { + resChan := api.healthCheckGroup.DoChan("", func() (*codersdk.HealthcheckReport, error) { // Create a new context not tied to the request. ctx, cancel := context.WithTimeout(context.Background(), api.Options.HealthcheckTimeout) defer cancel() @@ -107,7 +106,7 @@ func (api *API) debugDeploymentHealth(rw http.ResponseWriter, r *http.Request) { } } -func formatHealthcheck(ctx context.Context, rw http.ResponseWriter, r *http.Request, hc healthcheck.Report, dismissed ...codersdk.HealthSection) { +func formatHealthcheck(ctx context.Context, rw http.ResponseWriter, r *http.Request, hc codersdk.HealthcheckReport, dismissed ...codersdk.HealthSection) { // Mark any sections previously marked as dismissed. for _, d := range dismissed { switch d { diff --git a/coderd/debug_test.go b/coderd/debug_test.go index faa8efe747eec..b3ba003755738 100644 --- a/coderd/debug_test.go +++ b/coderd/debug_test.go @@ -15,8 +15,6 @@ import ( "cdr.dev/slog/sloggers/slogtest" "github.com/coder/coder/v2/coderd/coderdtest" - "github.com/coder/coder/v2/coderd/healthcheck" - "github.com/coder/coder/v2/coderd/healthcheck/derphealth" "github.com/coder/coder/v2/codersdk" "github.com/coder/coder/v2/testutil" ) @@ -31,10 +29,10 @@ func TestDebugHealth(t *testing.T) { ctx, cancel = context.WithTimeout(context.Background(), testutil.WaitShort) sessionToken string client = coderdtest.New(t, &coderdtest.Options{ - HealthcheckFunc: func(_ context.Context, apiKey string) *healthcheck.Report { + HealthcheckFunc: func(_ context.Context, apiKey string) *codersdk.HealthcheckReport { calls.Add(1) assert.Equal(t, sessionToken, apiKey) - return &healthcheck.Report{ + return &codersdk.HealthcheckReport{ Time: time.Now(), } }, @@ -64,10 +62,10 @@ func TestDebugHealth(t *testing.T) { ctx, cancel = context.WithTimeout(context.Background(), testutil.WaitShort) sessionToken string client = coderdtest.New(t, &coderdtest.Options{ - HealthcheckFunc: func(_ context.Context, apiKey string) *healthcheck.Report { + HealthcheckFunc: func(_ context.Context, apiKey string) *codersdk.HealthcheckReport { calls.Add(1) assert.Equal(t, sessionToken, apiKey) - return &healthcheck.Report{ + return &codersdk.HealthcheckReport{ Time: time.Now(), } }, @@ -99,15 +97,15 @@ func TestDebugHealth(t *testing.T) { client = coderdtest.New(t, &coderdtest.Options{ Logger: &logger, HealthcheckTimeout: time.Microsecond, - HealthcheckFunc: func(context.Context, string) *healthcheck.Report { + HealthcheckFunc: func(context.Context, string) *codersdk.HealthcheckReport { t := time.NewTimer(time.Second) defer t.Stop() select { case <-ctx.Done(): - return &healthcheck.Report{} + return &codersdk.HealthcheckReport{} case <-t.C: - return &healthcheck.Report{} + return &codersdk.HealthcheckReport{} } }, }) @@ -131,9 +129,9 @@ func TestDebugHealth(t *testing.T) { ctx, cancel = context.WithTimeout(context.Background(), testutil.WaitShort) client = coderdtest.New(t, &coderdtest.Options{ HealthcheckRefresh: time.Microsecond, - HealthcheckFunc: func(context.Context, string) *healthcheck.Report { + HealthcheckFunc: func(context.Context, string) *codersdk.HealthcheckReport { calls <- struct{}{} - return &healthcheck.Report{} + return &codersdk.HealthcheckReport{} }, }) _ = coderdtest.CreateFirstUser(t, client) @@ -176,9 +174,9 @@ func TestDebugHealth(t *testing.T) { client = coderdtest.New(t, &coderdtest.Options{ HealthcheckRefresh: time.Hour, HealthcheckTimeout: time.Hour, - HealthcheckFunc: func(context.Context, string) *healthcheck.Report { + HealthcheckFunc: func(context.Context, string) *codersdk.HealthcheckReport { calls++ - return &healthcheck.Report{ + return &codersdk.HealthcheckReport{ Time: time.Now(), } }, @@ -210,12 +208,12 @@ func TestDebugHealth(t *testing.T) { ctx, cancel = context.WithTimeout(context.Background(), testutil.WaitShort) sessionToken string client = coderdtest.New(t, &coderdtest.Options{ - HealthcheckFunc: func(_ context.Context, apiKey string) *healthcheck.Report { + HealthcheckFunc: func(_ context.Context, apiKey string) *codersdk.HealthcheckReport { assert.Equal(t, sessionToken, apiKey) - return &healthcheck.Report{ + return &codersdk.HealthcheckReport{ Time: time.Now(), Healthy: true, - DERP: derphealth.Report{Healthy: true}, + DERP: codersdk.DERPHealthReport{Healthy: true}, } }, }) @@ -289,7 +287,7 @@ func TestHealthSettings(t *testing.T) { bs, err := io.ReadAll(res.Body) require.NoError(t, err) defer res.Body.Close() - var hc healthcheck.Report + var hc codersdk.HealthcheckReport require.NoError(t, json.Unmarshal(bs, &hc)) require.True(t, hc.DERP.Dismissed) require.True(t, hc.Websocket.Dismissed) @@ -331,7 +329,7 @@ func TestHealthSettings(t *testing.T) { bs, err := io.ReadAll(res.Body) require.NoError(t, err) defer res.Body.Close() - var hc healthcheck.Report + var hc codersdk.HealthcheckReport require.NoError(t, json.Unmarshal(bs, &hc)) require.True(t, hc.DERP.Dismissed) require.False(t, hc.Websocket.Dismissed) diff --git a/coderd/healthcheck/accessurl.go b/coderd/healthcheck/accessurl.go index 2c1d27f1641a3..2e8d7e23301c2 100644 --- a/coderd/healthcheck/accessurl.go +++ b/coderd/healthcheck/accessurl.go @@ -7,23 +7,12 @@ import ( "net/url" "time" + "github.com/coder/coder/v2/codersdk" + "github.com/coder/coder/v2/coderd/healthcheck/health" ) -// @typescript-generate AccessURLReport -type AccessURLReport struct { - // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. - Healthy bool `json:"healthy"` - Severity health.Severity `json:"severity" enums:"ok,warning,error"` - Warnings []health.Message `json:"warnings"` - Dismissed bool `json:"dismissed"` - - AccessURL string `json:"access_url"` - Reachable bool `json:"reachable"` - StatusCode int `json:"status_code"` - HealthzResponse string `json:"healthz_response"` - Error *string `json:"error"` -} +type AccessURLReport codersdk.AccessURLReport type AccessURLReportOptions struct { AccessURL *url.URL diff --git a/coderd/healthcheck/database.go b/coderd/healthcheck/database.go index ac36ec0d534f1..6ae2b60e566a3 100644 --- a/coderd/healthcheck/database.go +++ b/coderd/healthcheck/database.go @@ -4,6 +4,8 @@ import ( "context" "time" + "github.com/coder/coder/v2/codersdk" + "golang.org/x/exp/slices" "github.com/coder/coder/v2/coderd/database" @@ -14,20 +16,7 @@ const ( DatabaseDefaultThreshold = 15 * time.Millisecond ) -// @typescript-generate DatabaseReport -type DatabaseReport struct { - // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. - Healthy bool `json:"healthy"` - Severity health.Severity `json:"severity" enums:"ok,warning,error"` - Warnings []health.Message `json:"warnings"` - Dismissed bool `json:"dismissed"` - - Reachable bool `json:"reachable"` - Latency string `json:"latency"` - LatencyMS int64 `json:"latency_ms"` - ThresholdMS int64 `json:"threshold_ms"` - Error *string `json:"error"` -} +type DatabaseReport codersdk.DatabaseReport type DatabaseReportOptions struct { DB database.Store diff --git a/coderd/healthcheck/derphealth/derp.go b/coderd/healthcheck/derphealth/derp.go index de8899fcf1423..41cf9571cd3b5 100644 --- a/coderd/healthcheck/derphealth/derp.go +++ b/coderd/healthcheck/derphealth/derp.go @@ -11,6 +11,8 @@ import ( "sync/atomic" "time" + "github.com/coder/coder/v2/codersdk" + "golang.org/x/exp/slices" "golang.org/x/xerrors" "tailscale.com/derp" @@ -33,72 +35,25 @@ const ( missingNodeReport = "Missing node health report, probably a developer error." ) -// @typescript-generate Report -type Report struct { - // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. - Healthy bool `json:"healthy"` - Severity health.Severity `json:"severity" enums:"ok,warning,error"` - Warnings []health.Message `json:"warnings"` - Dismissed bool `json:"dismissed"` - - Regions map[int]*RegionReport `json:"regions"` +type ReportOptions struct { + Dismissed bool - Netcheck *netcheck.Report `json:"netcheck"` - NetcheckErr *string `json:"netcheck_err"` - NetcheckLogs []string `json:"netcheck_logs"` + DERPMap *tailcfg.DERPMap +} - Error *string `json:"error"` +type Report struct { + codersdk.DERPHealthReport } -// @typescript-generate RegionReport type RegionReport struct { + codersdk.DERPRegionReport mu sync.Mutex - - // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. - Healthy bool `json:"healthy"` - Severity health.Severity `json:"severity" enums:"ok,warning,error"` - Warnings []health.Message `json:"warnings"` - - Region *tailcfg.DERPRegion `json:"region"` - NodeReports []*NodeReport `json:"node_reports"` - Error *string `json:"error"` } -// @typescript-generate NodeReport type NodeReport struct { + codersdk.DERPNodeReport mu sync.Mutex clientCounter int - - // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. - Healthy bool `json:"healthy"` - Severity health.Severity `json:"severity" enums:"ok,warning,error"` - Warnings []health.Message `json:"warnings"` - - Node *tailcfg.DERPNode `json:"node"` - - ServerInfo derp.ServerInfoMessage `json:"node_info"` - CanExchangeMessages bool `json:"can_exchange_messages"` - RoundTripPing string `json:"round_trip_ping"` - RoundTripPingMs int `json:"round_trip_ping_ms"` - UsesWebsocket bool `json:"uses_websocket"` - ClientLogs [][]string `json:"client_logs"` - ClientErrs [][]string `json:"client_errs"` - Error *string `json:"error"` - - STUN StunReport `json:"stun"` -} - -// @typescript-generate StunReport -type StunReport struct { - Enabled bool - CanSTUN bool - Error *string -} - -type ReportOptions struct { - Dismissed bool - - DERPMap *tailcfg.DERPMap } func (r *Report) Run(ctx context.Context, opts *ReportOptions) { @@ -107,7 +62,7 @@ func (r *Report) Run(ctx context.Context, opts *ReportOptions) { r.Warnings = []health.Message{} r.Dismissed = opts.Dismissed - r.Regions = map[int]*RegionReport{} + r.Regions = map[int]*codersdk.DERPRegionReport{} wg := &sync.WaitGroup{} mu := sync.Mutex{} @@ -116,22 +71,16 @@ func (r *Report) Run(ctx context.Context, opts *ReportOptions) { for _, region := range opts.DERPMap.Regions { var ( region = region - regionReport = RegionReport{ - Region: region, - } + regionReport RegionReport ) + regionReport.Region = region go func() { defer wg.Done() - defer func() { - if err := recover(); err != nil { - regionReport.Error = ptr.Ref(fmt.Sprint(err)) - } - }() regionReport.Run(ctx) mu.Lock() - r.Regions[region.RegionID] = ®ionReport + r.Regions[region.RegionID] = ®ionReport.DERPRegionReport if !regionReport.Healthy { r.Healthy = false } @@ -167,7 +116,7 @@ func (r *Report) Run(ctx context.Context, opts *ReportOptions) { func (r *RegionReport) Run(ctx context.Context) { r.Healthy = true r.Severity = health.SeverityOK - r.NodeReports = []*NodeReport{} + r.NodeReports = []*codersdk.DERPNodeReport{} r.Warnings = []health.Message{} wg := &sync.WaitGroup{} @@ -177,11 +126,10 @@ func (r *RegionReport) Run(ctx context.Context) { for _, node := range r.Region.Nodes { var ( node = node - nodeReport = NodeReport{ - Node: node, - Healthy: true, - } + nodeReport NodeReport ) + nodeReport.Node = node + nodeReport.Healthy = true go func() { defer wg.Done() @@ -195,7 +143,7 @@ func (r *RegionReport) Run(ctx context.Context) { nodeReport.Run(ctx) r.mu.Lock() - r.NodeReports = append(r.NodeReports, &nodeReport) + r.NodeReports = append(r.NodeReports, &nodeReport.DERPNodeReport) if nodeReport.Severity != health.SeverityOK { unhealthyNodes++ } @@ -347,8 +295,8 @@ func (r *NodeReport) doExchangeMessage(ctx context.Context) { } defer send.Close() - key := send.SelfPublicKey() - peerKey.Store(&key) + pk := send.SelfPublicKey() + peerKey.Store(&pk) ticker := time.NewTicker(time.Second) defer ticker.Stop() @@ -543,8 +491,8 @@ func convertError(err error) *string { return nil } -func sortNodeReports(reports []*NodeReport) { - slices.SortFunc(reports, func(a, b *NodeReport) int { +func sortNodeReports(reports []*codersdk.DERPNodeReport) { + slices.SortFunc(reports, func(a, b *codersdk.DERPNodeReport) int { return slice.Ascending(a.Node.Name, b.Node.Name) }) } diff --git a/coderd/healthcheck/healthcheck.go b/coderd/healthcheck/healthcheck.go index 1d1890ba23cbb..3f523ae24e726 100644 --- a/coderd/healthcheck/healthcheck.go +++ b/coderd/healthcheck/healthcheck.go @@ -13,35 +13,12 @@ import ( ) type Checker interface { - DERP(ctx context.Context, opts *derphealth.ReportOptions) derphealth.Report - AccessURL(ctx context.Context, opts *AccessURLReportOptions) AccessURLReport - Websocket(ctx context.Context, opts *WebsocketReportOptions) WebsocketReport - Database(ctx context.Context, opts *DatabaseReportOptions) DatabaseReport - WorkspaceProxy(ctx context.Context, opts *WorkspaceProxyReportOptions) WorkspaceProxyReport - ProvisionerDaemons(ctx context.Context, opts *ProvisionerDaemonsReportDeps) ProvisionerDaemonsReport -} - -// @typescript-generate Report -type Report struct { - // Time is the time the report was generated at. - Time time.Time `json:"time"` - // Healthy is true if the report returns no errors. - // Deprecated: use `Severity` instead - Healthy bool `json:"healthy"` - // Severity indicates the status of Coder health. - Severity health.Severity `json:"severity" enums:"ok,warning,error"` - // FailingSections is a list of sections that have failed their healthcheck. - FailingSections []codersdk.HealthSection `json:"failing_sections"` - - DERP derphealth.Report `json:"derp"` - AccessURL AccessURLReport `json:"access_url"` - Websocket WebsocketReport `json:"websocket"` - Database DatabaseReport `json:"database"` - WorkspaceProxy WorkspaceProxyReport `json:"workspace_proxy"` - ProvisionerDaemons ProvisionerDaemonsReport `json:"provisioner_daemons"` - - // The Coder version of the server that the report was generated on. - CoderVersion string `json:"coder_version"` + DERP(ctx context.Context, opts *derphealth.ReportOptions) codersdk.DERPHealthReport + AccessURL(ctx context.Context, opts *AccessURLReportOptions) codersdk.AccessURLReport + Websocket(ctx context.Context, opts *WebsocketReportOptions) codersdk.WebsocketReport + Database(ctx context.Context, opts *DatabaseReportOptions) codersdk.DatabaseReport + WorkspaceProxy(ctx context.Context, opts *WorkspaceProxyReportOptions) codersdk.WorkspaceProxyReport + ProvisionerDaemons(ctx context.Context, opts *ProvisionerDaemonsReportDeps) codersdk.ProvisionerDaemonsReport } type ReportOptions struct { @@ -57,46 +34,46 @@ type ReportOptions struct { type defaultChecker struct{} -func (defaultChecker) DERP(ctx context.Context, opts *derphealth.ReportOptions) derphealth.Report { +func (defaultChecker) DERP(ctx context.Context, opts *derphealth.ReportOptions) codersdk.DERPHealthReport { var report derphealth.Report report.Run(ctx, opts) - return report + return report.DERPHealthReport } -func (defaultChecker) AccessURL(ctx context.Context, opts *AccessURLReportOptions) AccessURLReport { +func (defaultChecker) AccessURL(ctx context.Context, opts *AccessURLReportOptions) codersdk.AccessURLReport { var report AccessURLReport report.Run(ctx, opts) - return report + return codersdk.AccessURLReport(report) } -func (defaultChecker) Websocket(ctx context.Context, opts *WebsocketReportOptions) WebsocketReport { +func (defaultChecker) Websocket(ctx context.Context, opts *WebsocketReportOptions) codersdk.WebsocketReport { var report WebsocketReport report.Run(ctx, opts) - return report + return codersdk.WebsocketReport(report) } -func (defaultChecker) Database(ctx context.Context, opts *DatabaseReportOptions) DatabaseReport { +func (defaultChecker) Database(ctx context.Context, opts *DatabaseReportOptions) codersdk.DatabaseReport { var report DatabaseReport report.Run(ctx, opts) - return report + return codersdk.DatabaseReport(report) } -func (defaultChecker) WorkspaceProxy(ctx context.Context, opts *WorkspaceProxyReportOptions) WorkspaceProxyReport { +func (defaultChecker) WorkspaceProxy(ctx context.Context, opts *WorkspaceProxyReportOptions) codersdk.WorkspaceProxyReport { var report WorkspaceProxyReport report.Run(ctx, opts) - return report + return codersdk.WorkspaceProxyReport(report) } -func (defaultChecker) ProvisionerDaemons(ctx context.Context, opts *ProvisionerDaemonsReportDeps) ProvisionerDaemonsReport { +func (defaultChecker) ProvisionerDaemons(ctx context.Context, opts *ProvisionerDaemonsReportDeps) codersdk.ProvisionerDaemonsReport { var report ProvisionerDaemonsReport report.Run(ctx, opts) - return report + return codersdk.ProvisionerDaemonsReport(report) } -func Run(ctx context.Context, opts *ReportOptions) *Report { +func Run(ctx context.Context, opts *ReportOptions) *codersdk.HealthcheckReport { var ( wg sync.WaitGroup - report Report + report codersdk.HealthcheckReport ) if opts.Checker == nil { diff --git a/coderd/healthcheck/healthcheck_test.go b/coderd/healthcheck/healthcheck_test.go index 1dc155623a2df..01cd08fb7afa4 100644 --- a/coderd/healthcheck/healthcheck_test.go +++ b/coderd/healthcheck/healthcheck_test.go @@ -13,35 +13,35 @@ import ( ) type testChecker struct { - DERPReport derphealth.Report - AccessURLReport healthcheck.AccessURLReport - WebsocketReport healthcheck.WebsocketReport - DatabaseReport healthcheck.DatabaseReport - WorkspaceProxyReport healthcheck.WorkspaceProxyReport - ProvisionerDaemonsReport healthcheck.ProvisionerDaemonsReport + DERPReport codersdk.DERPHealthReport + AccessURLReport codersdk.AccessURLReport + WebsocketReport codersdk.WebsocketReport + DatabaseReport codersdk.DatabaseReport + WorkspaceProxyReport codersdk.WorkspaceProxyReport + ProvisionerDaemonsReport codersdk.ProvisionerDaemonsReport } -func (c *testChecker) DERP(context.Context, *derphealth.ReportOptions) derphealth.Report { +func (c *testChecker) DERP(context.Context, *derphealth.ReportOptions) codersdk.DERPHealthReport { return c.DERPReport } -func (c *testChecker) AccessURL(context.Context, *healthcheck.AccessURLReportOptions) healthcheck.AccessURLReport { +func (c *testChecker) AccessURL(context.Context, *healthcheck.AccessURLReportOptions) codersdk.AccessURLReport { return c.AccessURLReport } -func (c *testChecker) Websocket(context.Context, *healthcheck.WebsocketReportOptions) healthcheck.WebsocketReport { +func (c *testChecker) Websocket(context.Context, *healthcheck.WebsocketReportOptions) codersdk.WebsocketReport { return c.WebsocketReport } -func (c *testChecker) Database(context.Context, *healthcheck.DatabaseReportOptions) healthcheck.DatabaseReport { +func (c *testChecker) Database(context.Context, *healthcheck.DatabaseReportOptions) codersdk.DatabaseReport { return c.DatabaseReport } -func (c *testChecker) WorkspaceProxy(context.Context, *healthcheck.WorkspaceProxyReportOptions) healthcheck.WorkspaceProxyReport { +func (c *testChecker) WorkspaceProxy(context.Context, *healthcheck.WorkspaceProxyReportOptions) codersdk.WorkspaceProxyReport { return c.WorkspaceProxyReport } -func (c *testChecker) ProvisionerDaemons(context.Context, *healthcheck.ProvisionerDaemonsReportDeps) healthcheck.ProvisionerDaemonsReport { +func (c *testChecker) ProvisionerDaemons(context.Context, *healthcheck.ProvisionerDaemonsReportDeps) codersdk.ProvisionerDaemonsReport { return c.ProvisionerDaemonsReport } @@ -57,27 +57,27 @@ func TestHealthcheck(t *testing.T) { }{{ name: "OK", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: true, Severity: health.SeverityOK, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: true, Severity: health.SeverityOK, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: true, Severity: health.SeverityOK, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: true, Severity: health.SeverityOK, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: true, Severity: health.SeverityOK, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityOK, }, }, @@ -87,27 +87,27 @@ func TestHealthcheck(t *testing.T) { }, { name: "DERPFail", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: false, Severity: health.SeverityError, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: true, Severity: health.SeverityOK, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: true, Severity: health.SeverityOK, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: true, Severity: health.SeverityOK, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: true, Severity: health.SeverityOK, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityOK, }, }, @@ -117,28 +117,28 @@ func TestHealthcheck(t *testing.T) { }, { name: "DERPWarning", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: true, Warnings: []health.Message{{Message: "foobar", Code: "EFOOBAR"}}, Severity: health.SeverityWarning, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: true, Severity: health.SeverityOK, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: true, Severity: health.SeverityOK, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: true, Severity: health.SeverityOK, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: true, Severity: health.SeverityOK, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityOK, }, }, @@ -148,27 +148,27 @@ func TestHealthcheck(t *testing.T) { }, { name: "AccessURLFail", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: true, Severity: health.SeverityOK, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: false, Severity: health.SeverityWarning, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: true, Severity: health.SeverityOK, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: true, Severity: health.SeverityOK, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: true, Severity: health.SeverityOK, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityOK, }, }, @@ -178,27 +178,27 @@ func TestHealthcheck(t *testing.T) { }, { name: "WebsocketFail", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: true, Severity: health.SeverityOK, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: true, Severity: health.SeverityOK, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: false, Severity: health.SeverityError, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: true, Severity: health.SeverityOK, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: true, Severity: health.SeverityOK, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityOK, }, }, @@ -208,27 +208,27 @@ func TestHealthcheck(t *testing.T) { }, { name: "DatabaseFail", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: true, Severity: health.SeverityOK, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: true, Severity: health.SeverityOK, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: true, Severity: health.SeverityOK, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: false, Severity: health.SeverityError, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: true, Severity: health.SeverityOK, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityOK, }, }, @@ -238,27 +238,27 @@ func TestHealthcheck(t *testing.T) { }, { name: "ProxyFail", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: true, Severity: health.SeverityOK, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: true, Severity: health.SeverityOK, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: true, Severity: health.SeverityOK, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: true, Severity: health.SeverityOK, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: false, Severity: health.SeverityError, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityOK, }, }, @@ -268,28 +268,28 @@ func TestHealthcheck(t *testing.T) { }, { name: "ProxyWarn", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: true, Severity: health.SeverityOK, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: true, Severity: health.SeverityOK, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: true, Severity: health.SeverityOK, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: true, Severity: health.SeverityOK, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: true, Warnings: []health.Message{{Message: "foobar", Code: "EFOOBAR"}}, Severity: health.SeverityWarning, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityOK, }, }, @@ -299,27 +299,27 @@ func TestHealthcheck(t *testing.T) { }, { name: "ProvisionerDaemonsFail", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: true, Severity: health.SeverityOK, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: true, Severity: health.SeverityOK, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: true, Severity: health.SeverityOK, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: true, Severity: health.SeverityOK, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: true, Severity: health.SeverityOK, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityError, }, }, @@ -329,27 +329,27 @@ func TestHealthcheck(t *testing.T) { }, { name: "ProvisionerDaemonsWarn", checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: true, Severity: health.SeverityOK, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: true, Severity: health.SeverityOK, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: true, Severity: health.SeverityOK, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: true, Severity: health.SeverityOK, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: true, Severity: health.SeverityOK, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityWarning, Warnings: []health.Message{{Message: "foobar", Code: "EFOOBAR"}}, }, @@ -361,27 +361,27 @@ func TestHealthcheck(t *testing.T) { name: "AllFail", healthy: false, checker: &testChecker{ - DERPReport: derphealth.Report{ + DERPReport: codersdk.DERPHealthReport{ Healthy: false, Severity: health.SeverityError, }, - AccessURLReport: healthcheck.AccessURLReport{ + AccessURLReport: codersdk.AccessURLReport{ Healthy: false, Severity: health.SeverityError, }, - WebsocketReport: healthcheck.WebsocketReport{ + WebsocketReport: codersdk.WebsocketReport{ Healthy: false, Severity: health.SeverityError, }, - DatabaseReport: healthcheck.DatabaseReport{ + DatabaseReport: codersdk.DatabaseReport{ Healthy: false, Severity: health.SeverityError, }, - WorkspaceProxyReport: healthcheck.WorkspaceProxyReport{ + WorkspaceProxyReport: codersdk.WorkspaceProxyReport{ Healthy: false, Severity: health.SeverityError, }, - ProvisionerDaemonsReport: healthcheck.ProvisionerDaemonsReport{ + ProvisionerDaemonsReport: codersdk.ProvisionerDaemonsReport{ Severity: health.SeverityError, }, }, diff --git a/coderd/healthcheck/provisioner.go b/coderd/healthcheck/provisioner.go index 36ef4d3b3a8ec..f30f067fb5c9b 100644 --- a/coderd/healthcheck/provisioner.go +++ b/coderd/healthcheck/provisioner.go @@ -20,21 +20,7 @@ import ( "github.com/coder/coder/v2/provisionerd/proto" ) -// @typescript-generate ProvisionerDaemonsReport -type ProvisionerDaemonsReport struct { - Severity health.Severity `json:"severity"` - Warnings []health.Message `json:"warnings"` - Dismissed bool `json:"dismissed"` - Error *string `json:"error"` - - Items []ProvisionerDaemonsReportItem `json:"items"` -} - -// @typescript-generate ProvisionerDaemonsReportItem -type ProvisionerDaemonsReportItem struct { - codersdk.ProvisionerDaemon `json:"provisioner_daemon"` - Warnings []health.Message `json:"warnings"` -} +type ProvisionerDaemonsReport codersdk.ProvisionerDaemonsReport type ProvisionerDaemonsReportDeps struct { // Required @@ -54,7 +40,7 @@ type ProvisionerDaemonsStore interface { } func (r *ProvisionerDaemonsReport) Run(ctx context.Context, opts *ProvisionerDaemonsReportDeps) { - r.Items = make([]ProvisionerDaemonsReportItem, 0) + r.Items = make([]codersdk.ProvisionerDaemonsReportItem, 0) r.Severity = health.SeverityOK r.Warnings = make([]health.Message, 0) r.Dismissed = opts.Dismissed @@ -109,7 +95,7 @@ func (r *ProvisionerDaemonsReport) Run(ctx context.Context, opts *ProvisionerDae continue } - it := ProvisionerDaemonsReportItem{ + it := codersdk.ProvisionerDaemonsReportItem{ ProvisionerDaemon: db2sdk.ProvisionerDaemon(daemon), Warnings: make([]health.Message, 0), } diff --git a/coderd/healthcheck/provisioner_test.go b/coderd/healthcheck/provisioner_test.go index d627e2f573e3d..7942f5a7ddc50 100644 --- a/coderd/healthcheck/provisioner_test.go +++ b/coderd/healthcheck/provisioner_test.go @@ -34,21 +34,21 @@ func TestProvisionerDaemonReport(t *testing.T) { expectedSeverity health.Severity expectedWarningCode health.Code expectedError string - expectedItems []healthcheck.ProvisionerDaemonsReportItem + expectedItems []codersdk.ProvisionerDaemonsReportItem }{ { name: "current version empty", currentVersion: "", expectedSeverity: health.SeverityError, expectedError: "Developer error: CurrentVersion is empty", - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{}, + expectedItems: []codersdk.ProvisionerDaemonsReportItem{}, }, { name: "no daemons", currentVersion: "v1.2.3", currentAPIMajorVersion: proto.CurrentMajor, expectedSeverity: health.SeverityError, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{}, + expectedItems: []codersdk.ProvisionerDaemonsReportItem{}, expectedWarningCode: health.CodeProvisionerDaemonsNoProvisionerDaemons, }, { @@ -58,7 +58,7 @@ func TestProvisionerDaemonReport(t *testing.T) { provisionerDaemonsErr: assert.AnError, expectedSeverity: health.SeverityError, expectedError: assert.AnError.Error(), - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{}, + expectedItems: []codersdk.ProvisionerDaemonsReportItem{}, }, { name: "one daemon up to date", @@ -66,7 +66,7 @@ func TestProvisionerDaemonReport(t *testing.T) { currentAPIMajorVersion: proto.CurrentMajor, expectedSeverity: health.SeverityOK, provisionerDaemons: []database.ProvisionerDaemon{fakeProvisionerDaemon(t, "pd-ok", "v1.2.3", "1.0", now)}, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{ + expectedItems: []codersdk.ProvisionerDaemonsReportItem{ { ProvisionerDaemon: codersdk.ProvisionerDaemon{ ID: uuid.Nil, @@ -89,7 +89,7 @@ func TestProvisionerDaemonReport(t *testing.T) { expectedSeverity: health.SeverityWarning, expectedWarningCode: health.CodeProvisionerDaemonVersionMismatch, provisionerDaemons: []database.ProvisionerDaemon{fakeProvisionerDaemon(t, "pd-old", "v1.1.2", "1.0", now)}, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{ + expectedItems: []codersdk.ProvisionerDaemonsReportItem{ { ProvisionerDaemon: codersdk.ProvisionerDaemon{ ID: uuid.Nil, @@ -117,7 +117,7 @@ func TestProvisionerDaemonReport(t *testing.T) { expectedSeverity: health.SeverityError, expectedWarningCode: health.CodeUnknown, provisionerDaemons: []database.ProvisionerDaemon{fakeProvisionerDaemon(t, "pd-invalid-version", "invalid", "1.0", now)}, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{ + expectedItems: []codersdk.ProvisionerDaemonsReportItem{ { ProvisionerDaemon: codersdk.ProvisionerDaemon{ ID: uuid.Nil, @@ -145,7 +145,7 @@ func TestProvisionerDaemonReport(t *testing.T) { expectedSeverity: health.SeverityError, expectedWarningCode: health.CodeUnknown, provisionerDaemons: []database.ProvisionerDaemon{fakeProvisionerDaemon(t, "pd-invalid-api", "v1.2.3", "invalid", now)}, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{ + expectedItems: []codersdk.ProvisionerDaemonsReportItem{ { ProvisionerDaemon: codersdk.ProvisionerDaemon{ ID: uuid.Nil, @@ -173,7 +173,7 @@ func TestProvisionerDaemonReport(t *testing.T) { expectedSeverity: health.SeverityWarning, expectedWarningCode: health.CodeProvisionerDaemonAPIMajorVersionDeprecated, provisionerDaemons: []database.ProvisionerDaemon{fakeProvisionerDaemon(t, "pd-old-api", "v2.3.4", "1.0", now)}, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{ + expectedItems: []codersdk.ProvisionerDaemonsReportItem{ { ProvisionerDaemon: codersdk.ProvisionerDaemon{ ID: uuid.Nil, @@ -201,7 +201,7 @@ func TestProvisionerDaemonReport(t *testing.T) { expectedSeverity: health.SeverityWarning, expectedWarningCode: health.CodeProvisionerDaemonVersionMismatch, provisionerDaemons: []database.ProvisionerDaemon{fakeProvisionerDaemon(t, "pd-ok", "v1.2.3", "1.0", now), fakeProvisionerDaemon(t, "pd-old", "v1.1.2", "1.0", now)}, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{ + expectedItems: []codersdk.ProvisionerDaemonsReportItem{ { ProvisionerDaemon: codersdk.ProvisionerDaemon{ ID: uuid.Nil, @@ -242,7 +242,7 @@ func TestProvisionerDaemonReport(t *testing.T) { expectedSeverity: health.SeverityWarning, expectedWarningCode: health.CodeProvisionerDaemonVersionMismatch, provisionerDaemons: []database.ProvisionerDaemon{fakeProvisionerDaemon(t, "pd-ok", "v1.2.3", "1.0", now), fakeProvisionerDaemon(t, "pd-new", "v2.3.4", "1.0", now)}, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{ + expectedItems: []codersdk.ProvisionerDaemonsReportItem{ { ProvisionerDaemon: codersdk.ProvisionerDaemon{ ID: uuid.Nil, @@ -282,7 +282,7 @@ func TestProvisionerDaemonReport(t *testing.T) { currentAPIMajorVersion: proto.CurrentMajor, expectedSeverity: health.SeverityOK, provisionerDaemons: []database.ProvisionerDaemon{fakeProvisionerDaemonStale(t, "pd-stale", "v1.2.3", "0.9", now.Add(-5*time.Minute), now), fakeProvisionerDaemon(t, "pd-ok", "v2.3.4", "1.0", now)}, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{ + expectedItems: []codersdk.ProvisionerDaemonsReportItem{ { ProvisionerDaemon: codersdk.ProvisionerDaemon{ ID: uuid.Nil, @@ -305,7 +305,7 @@ func TestProvisionerDaemonReport(t *testing.T) { expectedSeverity: health.SeverityError, expectedWarningCode: health.CodeProvisionerDaemonsNoProvisionerDaemons, provisionerDaemons: []database.ProvisionerDaemon{fakeProvisionerDaemonStale(t, "pd-ok", "v1.2.3", "0.9", now.Add(-5*time.Minute), now)}, - expectedItems: []healthcheck.ProvisionerDaemonsReportItem{}, + expectedItems: []codersdk.ProvisionerDaemonsReportItem{}, }, } { tt := tt diff --git a/coderd/healthcheck/websocket.go b/coderd/healthcheck/websocket.go index 215465fe5c655..eefa509df0f83 100644 --- a/coderd/healthcheck/websocket.go +++ b/coderd/healthcheck/websocket.go @@ -9,24 +9,15 @@ import ( "strconv" "time" + "github.com/coder/coder/v2/codersdk" + "golang.org/x/xerrors" "nhooyr.io/websocket" "github.com/coder/coder/v2/coderd/healthcheck/health" ) -// @typescript-generate WebsocketReport -type WebsocketReport struct { - // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. - Healthy bool `json:"healthy"` - Severity health.Severity `json:"severity" enums:"ok,warning,error"` - Warnings []string `json:"warnings"` - Dismissed bool `json:"dismissed"` - - Body string `json:"body"` - Code int `json:"code"` - Error *string `json:"error"` -} +type WebsocketReport codersdk.WebsocketReport type WebsocketReportOptions struct { APIKey string diff --git a/coderd/healthcheck/workspaceproxy.go b/coderd/healthcheck/workspaceproxy.go index 509ac3318b67f..c5ff1c7082a37 100644 --- a/coderd/healthcheck/workspaceproxy.go +++ b/coderd/healthcheck/workspaceproxy.go @@ -14,16 +14,7 @@ import ( "golang.org/x/xerrors" ) -// @typescript-generate WorkspaceProxyReport -type WorkspaceProxyReport struct { - Healthy bool `json:"healthy"` - Severity health.Severity `json:"severity"` - Warnings []health.Message `json:"warnings"` - Dismissed bool `json:"dismissed"` - Error *string `json:"error"` - - WorkspaceProxies codersdk.RegionsResponse[codersdk.WorkspaceProxy] `json:"workspace_proxies"` -} +type WorkspaceProxyReport codersdk.WorkspaceProxyReport type WorkspaceProxyReportOptions struct { // CurrentVersion is the current server version. diff --git a/codersdk/health.go b/codersdk/health.go index a54b65762efea..266d05c2e20c9 100644 --- a/codersdk/health.go +++ b/codersdk/health.go @@ -4,6 +4,13 @@ import ( "context" "encoding/json" "net/http" + "time" + + "tailscale.com/derp" + "tailscale.com/net/netcheck" + "tailscale.com/tailcfg" + + "github.com/coder/coder/v2/coderd/healthcheck/health" "golang.org/x/xerrors" ) @@ -65,3 +72,142 @@ func (c *Client) PutHealthSettings(ctx context.Context, settings HealthSettings) } return nil } + +type HealthcheckReport struct { + // Time is the time the report was generated at. + Time time.Time `json:"time" format:"date-time"` + // Healthy is true if the report returns no errors. + // Deprecated: use `Severity` instead + Healthy bool `json:"healthy"` + // Severity indicates the status of Coder health. + Severity health.Severity `json:"severity" enums:"ok,warning,error"` + // FailingSections is a list of sections that have failed their healthcheck. + FailingSections []HealthSection `json:"failing_sections"` + + DERP DERPHealthReport `json:"derp"` + AccessURL AccessURLReport `json:"access_url"` + Websocket WebsocketReport `json:"websocket"` + Database DatabaseReport `json:"database"` + WorkspaceProxy WorkspaceProxyReport `json:"workspace_proxy"` + ProvisionerDaemons ProvisionerDaemonsReport `json:"provisioner_daemons"` + + // The Coder version of the server that the report was generated on. + CoderVersion string `json:"coder_version"` +} + +type AccessURLReport struct { + // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. + Healthy bool `json:"healthy"` + Severity health.Severity `json:"severity" enums:"ok,warning,error"` + Warnings []health.Message `json:"warnings"` + Dismissed bool `json:"dismissed"` + + AccessURL string `json:"access_url"` + Reachable bool `json:"reachable"` + StatusCode int `json:"status_code"` + HealthzResponse string `json:"healthz_response"` + Error *string `json:"error"` +} + +type DERPHealthReport struct { + // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. + Healthy bool `json:"healthy"` + Severity health.Severity `json:"severity" enums:"ok,warning,error"` + Warnings []health.Message `json:"warnings"` + Dismissed bool `json:"dismissed"` + + Regions map[int]*DERPRegionReport `json:"regions"` + + Netcheck *netcheck.Report `json:"netcheck"` + NetcheckErr *string `json:"netcheck_err"` + NetcheckLogs []string `json:"netcheck_logs"` + + Error *string `json:"error"` +} + +type DERPRegionReport struct { + // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. + Healthy bool `json:"healthy"` + Severity health.Severity `json:"severity" enums:"ok,warning,error"` + Warnings []health.Message `json:"warnings"` + + Region *tailcfg.DERPRegion `json:"region"` + NodeReports []*DERPNodeReport `json:"node_reports"` + Error *string `json:"error"` +} + +type DERPNodeReport struct { + // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. + Healthy bool `json:"healthy"` + Severity health.Severity `json:"severity" enums:"ok,warning,error"` + Warnings []health.Message `json:"warnings"` + + Node *tailcfg.DERPNode `json:"node"` + + ServerInfo derp.ServerInfoMessage `json:"node_info"` + CanExchangeMessages bool `json:"can_exchange_messages"` + RoundTripPing string `json:"round_trip_ping"` + RoundTripPingMs int `json:"round_trip_ping_ms"` + UsesWebsocket bool `json:"uses_websocket"` + ClientLogs [][]string `json:"client_logs"` + ClientErrs [][]string `json:"client_errs"` + Error *string `json:"error"` + + STUN STUNReport `json:"stun"` +} + +type STUNReport struct { + Enabled bool + CanSTUN bool + Error *string +} + +type DatabaseReport struct { + // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. + Healthy bool `json:"healthy"` + Severity health.Severity `json:"severity" enums:"ok,warning,error"` + Warnings []health.Message `json:"warnings"` + Dismissed bool `json:"dismissed"` + + Reachable bool `json:"reachable"` + Latency string `json:"latency"` + LatencyMS int64 `json:"latency_ms"` + ThresholdMS int64 `json:"threshold_ms"` + Error *string `json:"error"` +} + +type ProvisionerDaemonsReport struct { + Severity health.Severity `json:"severity"` + Warnings []health.Message `json:"warnings"` + Dismissed bool `json:"dismissed"` + Error *string `json:"error"` + + Items []ProvisionerDaemonsReportItem `json:"items"` +} + +type ProvisionerDaemonsReportItem struct { + ProvisionerDaemon `json:"provisioner_daemon"` + Warnings []health.Message `json:"warnings"` +} + +type WebsocketReport struct { + // Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. + Healthy bool `json:"healthy"` + Severity health.Severity `json:"severity" enums:"ok,warning,error"` + Warnings []string `json:"warnings"` + Dismissed bool `json:"dismissed"` + + Body string `json:"body"` + Code int `json:"code"` + Error *string `json:"error"` +} + +type WorkspaceProxyReport struct { + Healthy bool `json:"healthy"` + Severity health.Severity `json:"severity"` + Warnings []health.Message `json:"warnings"` + Dismissed bool `json:"dismissed"` + Error *string `json:"error"` + + WorkspaceProxies RegionsResponse[WorkspaceProxy] `json:"workspace_proxies"` +} diff --git a/docs/api/debug.md b/docs/api/debug.md index 7b84457ad292d..6f9bee2f553d9 100644 --- a/docs/api/debug.md +++ b/docs/api/debug.md @@ -317,7 +317,7 @@ curl -X GET http://coder-server:8080/api/v2/debug/health \ ] }, "severity": "ok", - "time": "string", + "time": "2019-08-24T14:15:22Z", "websocket": { "body": "string", "code": 0, @@ -371,9 +371,9 @@ curl -X GET http://coder-server:8080/api/v2/debug/health \ ### Responses -| Status | Meaning | Description | Schema | -| ------ | ------------------------------------------------------- | ----------- | -------------------------------------------------- | -| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [healthcheck.Report](schemas.md#healthcheckreport) | +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------ | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.HealthcheckReport](schemas.md#codersdkhealthcheckreport) | To perform this operation, you must be authenticated. [Learn more](authentication.md). diff --git a/docs/api/schemas.md b/docs/api/schemas.md index c4ab8128fabb0..b383a707c6f81 100644 --- a/docs/api/schemas.md +++ b/docs/api/schemas.md @@ -955,6 +955,49 @@ _None_ | `all` | | `application_connect` | +## codersdk.AccessURLReport + +```json +{ + "access_url": "string", + "dismissed": true, + "error": "string", + "healthy": true, + "healthz_response": "string", + "reachable": true, + "severity": "ok", + "status_code": 0, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------ | ----------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------- | +| `access_url` | string | false | | | +| `dismissed` | boolean | false | | | +| `error` | string | false | | | +| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | +| `healthz_response` | string | false | | | +| `reachable` | boolean | false | | | +| `severity` | [health.Severity](#healthseverity) | false | | | +| `status_code` | integer | false | | | +| `warnings` | array of [health.Message](#healthmessage) | false | | | + +#### Enumerated Values + +| Property | Value | +| ---------- | --------- | +| `severity` | `ok` | +| `severity` | `warning` | +| `severity` | `error` | + ## codersdk.AddLicenseRequest ```json @@ -2011,29 +2054,433 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in | `path` | string | false | | | | `url` | string | false | | | -## codersdk.DERPRegion +## codersdk.DERPHealthReport ```json { - "latency_ms": 0, - "preferred": true + "dismissed": true, + "error": "string", + "healthy": true, + "netcheck": { + "captivePortal": "string", + "globalV4": "string", + "globalV6": "string", + "hairPinning": "string", + "icmpv4": true, + "ipv4": true, + "ipv4CanSend": true, + "ipv6": true, + "ipv6CanSend": true, + "mappingVariesByDestIP": "string", + "oshasIPv6": true, + "pcp": "string", + "pmp": "string", + "preferredDERP": 0, + "regionLatency": { + "property1": 0, + "property2": 0 + }, + "regionV4Latency": { + "property1": 0, + "property2": 0 + }, + "regionV6Latency": { + "property1": 0, + "property2": 0 + }, + "udp": true, + "upnP": "string" + }, + "netcheck_err": "string", + "netcheck_logs": ["string"], + "regions": { + "property1": { + "error": "string", + "healthy": true, + "node_reports": [ + { + "can_exchange_messages": true, + "client_errs": [["string"]], + "client_logs": [["string"]], + "error": "string", + "healthy": true, + "node": { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + }, + "node_info": { + "tokenBucketBytesBurst": 0, + "tokenBucketBytesPerSecond": 0 + }, + "round_trip_ping": "string", + "round_trip_ping_ms": 0, + "severity": "ok", + "stun": { + "canSTUN": true, + "enabled": true, + "error": "string" + }, + "uses_websocket": true, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + } + ], + "region": { + "avoid": true, + "embeddedRelay": true, + "nodes": [ + { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + } + ], + "regionCode": "string", + "regionID": 0, + "regionName": "string" + }, + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + }, + "property2": { + "error": "string", + "healthy": true, + "node_reports": [ + { + "can_exchange_messages": true, + "client_errs": [["string"]], + "client_logs": [["string"]], + "error": "string", + "healthy": true, + "node": { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + }, + "node_info": { + "tokenBucketBytesBurst": 0, + "tokenBucketBytesPerSecond": 0 + }, + "round_trip_ping": "string", + "round_trip_ping_ms": 0, + "severity": "ok", + "stun": { + "canSTUN": true, + "enabled": true, + "error": "string" + }, + "uses_websocket": true, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + } + ], + "region": { + "avoid": true, + "embeddedRelay": true, + "nodes": [ + { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + } + ], + "regionCode": "string", + "regionID": 0, + "regionName": "string" + }, + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + } + }, + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------ | ------- | -------- | ------------ | ----------- | -| `latency_ms` | number | false | | | -| `preferred` | boolean | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------------------------------------------------------ | -------- | ------------ | ------------------------------------------------------------------------------------------- | +| `dismissed` | boolean | false | | | +| `error` | string | false | | | +| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | +| `netcheck` | [netcheck.Report](#netcheckreport) | false | | | +| `netcheck_err` | string | false | | | +| `netcheck_logs` | array of string | false | | | +| `regions` | object | false | | | +| » `[any property]` | [codersdk.DERPRegionReport](#codersdkderpregionreport) | false | | | +| `severity` | [health.Severity](#healthseverity) | false | | | +| `warnings` | array of [health.Message](#healthmessage) | false | | | -## codersdk.DERPServerConfig +#### Enumerated Values -```json -{ - "enable": true, - "region_code": "string", - "region_id": 0, +| Property | Value | +| ---------- | --------- | +| `severity` | `ok` | +| `severity` | `warning` | +| `severity` | `error` | + +## codersdk.DERPNodeReport + +```json +{ + "can_exchange_messages": true, + "client_errs": [["string"]], + "client_logs": [["string"]], + "error": "string", + "healthy": true, + "node": { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + }, + "node_info": { + "tokenBucketBytesBurst": 0, + "tokenBucketBytesPerSecond": 0 + }, + "round_trip_ping": "string", + "round_trip_ping_ms": 0, + "severity": "ok", + "stun": { + "canSTUN": true, + "enabled": true, + "error": "string" + }, + "uses_websocket": true, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------------------- | ------------------------------------------------ | -------- | ------------ | ------------------------------------------------------------------------------------------- | +| `can_exchange_messages` | boolean | false | | | +| `client_errs` | array of array | false | | | +| `client_logs` | array of array | false | | | +| `error` | string | false | | | +| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | +| `node` | [tailcfg.DERPNode](#tailcfgderpnode) | false | | | +| `node_info` | [derp.ServerInfoMessage](#derpserverinfomessage) | false | | | +| `round_trip_ping` | string | false | | | +| `round_trip_ping_ms` | integer | false | | | +| `severity` | [health.Severity](#healthseverity) | false | | | +| `stun` | [codersdk.STUNReport](#codersdkstunreport) | false | | | +| `uses_websocket` | boolean | false | | | +| `warnings` | array of [health.Message](#healthmessage) | false | | | + +#### Enumerated Values + +| Property | Value | +| ---------- | --------- | +| `severity` | `ok` | +| `severity` | `warning` | +| `severity` | `error` | + +## codersdk.DERPRegion + +```json +{ + "latency_ms": 0, + "preferred": true +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | ------- | -------- | ------------ | ----------- | +| `latency_ms` | number | false | | | +| `preferred` | boolean | false | | | + +## codersdk.DERPRegionReport + +```json +{ + "error": "string", + "healthy": true, + "node_reports": [ + { + "can_exchange_messages": true, + "client_errs": [["string"]], + "client_logs": [["string"]], + "error": "string", + "healthy": true, + "node": { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + }, + "node_info": { + "tokenBucketBytesBurst": 0, + "tokenBucketBytesPerSecond": 0 + }, + "round_trip_ping": "string", + "round_trip_ping_ms": 0, + "severity": "ok", + "stun": { + "canSTUN": true, + "enabled": true, + "error": "string" + }, + "uses_websocket": true, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + } + ], + "region": { + "avoid": true, + "embeddedRelay": true, + "nodes": [ + { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + } + ], + "regionCode": "string", + "regionID": 0, + "regionName": "string" + }, + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------------- | ----------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------- | +| `error` | string | false | | | +| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | +| `node_reports` | array of [codersdk.DERPNodeReport](#codersdkderpnodereport) | false | | | +| `region` | [tailcfg.DERPRegion](#tailcfgderpregion) | false | | | +| `severity` | [health.Severity](#healthseverity) | false | | | +| `warnings` | array of [health.Message](#healthmessage) | false | | | + +#### Enumerated Values + +| Property | Value | +| ---------- | --------- | +| `severity` | `ok` | +| `severity` | `warning` | +| `severity` | `error` | + +## codersdk.DERPServerConfig + +```json +{ + "enable": true, + "region_code": "string", + "region_id": 0, "region_name": "string", "relay_url": { "forceQuery": true, @@ -2081,6 +2528,49 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in | `allow_path_app_sharing` | boolean | false | | | | `allow_path_app_site_owner_access` | boolean | false | | | +## codersdk.DatabaseReport + +```json +{ + "dismissed": true, + "error": "string", + "healthy": true, + "latency": "string", + "latency_ms": 0, + "reachable": true, + "severity": "ok", + "threshold_ms": 0, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------------- | ----------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------- | +| `dismissed` | boolean | false | | | +| `error` | string | false | | | +| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | +| `latency` | string | false | | | +| `latency_ms` | integer | false | | | +| `reachable` | boolean | false | | | +| `severity` | [health.Severity](#healthseverity) | false | | | +| `threshold_ms` | integer | false | | | +| `warnings` | array of [health.Message](#healthmessage) | false | | | + +#### Enumerated Values + +| Property | Value | +| ---------- | --------- | +| `severity` | `ok` | +| `severity` | `warning` | +| `severity` | `error` | + ## codersdk.DeleteWorkspaceAgentPortShareRequest ```json @@ -3300,609 +3790,394 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in | `refresh` | integer | false | | | | `threshold_database` | integer | false | | | -## codersdk.InsightsReportInterval - -```json -"day" -``` - -### Properties - -#### Enumerated Values - -| Value | -| ------ | -| `day` | -| `week` | - -## codersdk.IssueReconnectingPTYSignedTokenRequest +## codersdk.HealthcheckReport ```json { - "agentID": "bc282582-04f9-45ce-b904-3e3bfab66958", - "url": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| --------- | ------ | -------- | ------------ | ---------------------------------------------------------------------- | -| `agentID` | string | true | | | -| `url` | string | true | | URL is the URL of the reconnecting-pty endpoint you are connecting to. | - -## codersdk.IssueReconnectingPTYSignedTokenResponse - -```json -{ - "signed_token": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| -------------- | ------ | -------- | ------------ | ----------- | -| `signed_token` | string | false | | | - -## codersdk.JFrogXrayScan - -```json -{ - "agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978", - "critical": 0, - "high": 0, - "medium": 0, - "results_url": "string", - "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| -------------- | ------- | -------- | ------------ | ----------- | -| `agent_id` | string | false | | | -| `critical` | integer | false | | | -| `high` | integer | false | | | -| `medium` | integer | false | | | -| `results_url` | string | false | | | -| `workspace_id` | string | false | | | - -## codersdk.JobErrorCode - -```json -"REQUIRED_TEMPLATE_VARIABLES" -``` - -### Properties - -#### Enumerated Values - -| Value | -| ----------------------------- | -| `REQUIRED_TEMPLATE_VARIABLES` | - -## codersdk.License - -```json -{ - "claims": {}, - "id": 0, - "uploaded_at": "2019-08-24T14:15:22Z", - "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ------------- | ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `claims` | object | false | | Claims are the JWT claims asserted by the license. Here we use a generic string map to ensure that all data from the server is parsed verbatim, not just the fields this version of Coder understands. | -| `id` | integer | false | | | -| `uploaded_at` | string | false | | | -| `uuid` | string | false | | | - -## codersdk.LinkConfig - -```json -{ - "icon": "bug", - "name": "string", - "target": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| -------- | ------ | -------- | ------------ | ----------- | -| `icon` | string | false | | | -| `name` | string | false | | | -| `target` | string | false | | | - -#### Enumerated Values - -| Property | Value | -| -------- | ------ | -| `icon` | `bug` | -| `icon` | `chat` | -| `icon` | `docs` | - -## codersdk.LogLevel - -```json -"trace" -``` - -### Properties - -#### Enumerated Values - -| Value | -| ------- | -| `trace` | -| `debug` | -| `info` | -| `warn` | -| `error` | - -## codersdk.LogSource - -```json -"provisioner_daemon" -``` - -### Properties - -#### Enumerated Values - -| Value | -| -------------------- | -| `provisioner_daemon` | -| `provisioner` | - -## codersdk.LoggingConfig - -```json -{ - "human": "string", - "json": "string", - "log_filter": ["string"], - "stackdriver": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ------------- | --------------- | -------- | ------------ | ----------- | -| `human` | string | false | | | -| `json` | string | false | | | -| `log_filter` | array of string | false | | | -| `stackdriver` | string | false | | | - -## codersdk.LoginType - -```json -"" -``` - -### Properties - -#### Enumerated Values - -| Value | -| ---------- | -| `` | -| `password` | -| `github` | -| `oidc` | -| `token` | -| `none` | - -## codersdk.LoginWithPasswordRequest - -```json -{ - "email": "user@example.com", - "password": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ---------- | ------ | -------- | ------------ | ----------- | -| `email` | string | true | | | -| `password` | string | true | | | - -## codersdk.LoginWithPasswordResponse - -```json -{ - "session_token": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| --------------- | ------ | -------- | ------------ | ----------- | -| `session_token` | string | true | | | - -## codersdk.MinimalUser - -```json -{ - "avatar_url": "http://example.com", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "username": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ------------ | ------ | -------- | ------------ | ----------- | -| `avatar_url` | string | false | | | -| `id` | string | true | | | -| `username` | string | true | | | - -## codersdk.OAuth2AppEndpoints - -```json -{ - "authorization": "string", - "device_authorization": "string", - "token": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ---------------------- | ------ | -------- | ------------ | --------------------------------- | -| `authorization` | string | false | | | -| `device_authorization` | string | false | | Device authorization is optional. | -| `token` | string | false | | | - -## codersdk.OAuth2Config - -```json -{ - "github": { - "allow_everyone": true, - "allow_signups": true, - "allowed_orgs": ["string"], - "allowed_teams": ["string"], - "client_id": "string", - "client_secret": "string", - "enterprise_base_url": "string" - } -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| -------- | ---------------------------------------------------------- | -------- | ------------ | ----------- | -| `github` | [codersdk.OAuth2GithubConfig](#codersdkoauth2githubconfig) | false | | | - -## codersdk.OAuth2GithubConfig - -```json -{ - "allow_everyone": true, - "allow_signups": true, - "allowed_orgs": ["string"], - "allowed_teams": ["string"], - "client_id": "string", - "client_secret": "string", - "enterprise_base_url": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| --------------------- | --------------- | -------- | ------------ | ----------- | -| `allow_everyone` | boolean | false | | | -| `allow_signups` | boolean | false | | | -| `allowed_orgs` | array of string | false | | | -| `allowed_teams` | array of string | false | | | -| `client_id` | string | false | | | -| `client_secret` | string | false | | | -| `enterprise_base_url` | string | false | | | - -## codersdk.OAuth2ProviderApp - -```json -{ - "callback_url": "string", - "endpoints": { - "authorization": "string", - "device_authorization": "string", - "token": "string" + "access_url": { + "access_url": "string", + "dismissed": true, + "error": "string", + "healthy": true, + "healthz_response": "string", + "reachable": true, + "severity": "ok", + "status_code": 0, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] }, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "name": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| -------------- | ---------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `callback_url` | string | false | | | -| `endpoints` | [codersdk.OAuth2AppEndpoints](#codersdkoauth2appendpoints) | false | | Endpoints are included in the app response for easier discovery. The OAuth2 spec does not have a defined place to find these (for comparison, OIDC has a '/.well-known/openid-configuration' endpoint). | -| `icon` | string | false | | | -| `id` | string | false | | | -| `name` | string | false | | | - -## codersdk.OAuth2ProviderAppSecret - -```json -{ - "client_secret_truncated": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "last_used_at": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ------------------------- | ------ | -------- | ------------ | ----------- | -| `client_secret_truncated` | string | false | | | -| `id` | string | false | | | -| `last_used_at` | string | false | | | - -## codersdk.OAuth2ProviderAppSecretFull - -```json -{ - "client_secret_full": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| -------------------- | ------ | -------- | ------------ | ----------- | -| `client_secret_full` | string | false | | | -| `id` | string | false | | | - -## codersdk.OAuthConversionResponse - -```json -{ - "expires_at": "2019-08-24T14:15:22Z", - "state_string": "string", - "to_type": "", - "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| -------------- | ---------------------------------------- | -------- | ------------ | ----------- | -| `expires_at` | string | false | | | -| `state_string` | string | false | | | -| `to_type` | [codersdk.LoginType](#codersdklogintype) | false | | | -| `user_id` | string | false | | | - -## codersdk.OIDCAuthMethod - -```json -{ - "enabled": true, - "iconUrl": "string", - "signInText": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ------------ | ------- | -------- | ------------ | ----------- | -| `enabled` | boolean | false | | | -| `iconUrl` | string | false | | | -| `signInText` | string | false | | | - -## codersdk.OIDCConfig - -```json -{ - "allow_signups": true, - "auth_url_params": {}, - "client_cert_file": "string", - "client_id": "string", - "client_key_file": "string", - "client_secret": "string", - "email_domain": ["string"], - "email_field": "string", - "group_allow_list": ["string"], - "group_auto_create": true, - "group_mapping": {}, - "group_regex_filter": {}, - "groups_field": "string", - "icon_url": { - "forceQuery": true, - "fragment": "string", - "host": "string", - "omitHost": true, - "opaque": "string", - "path": "string", - "rawFragment": "string", - "rawPath": "string", - "rawQuery": "string", - "scheme": "string", - "user": {} + "coder_version": "string", + "database": { + "dismissed": true, + "error": "string", + "healthy": true, + "latency": "string", + "latency_ms": 0, + "reachable": true, + "severity": "ok", + "threshold_ms": 0, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + }, + "derp": { + "dismissed": true, + "error": "string", + "healthy": true, + "netcheck": { + "captivePortal": "string", + "globalV4": "string", + "globalV6": "string", + "hairPinning": "string", + "icmpv4": true, + "ipv4": true, + "ipv4CanSend": true, + "ipv6": true, + "ipv6CanSend": true, + "mappingVariesByDestIP": "string", + "oshasIPv6": true, + "pcp": "string", + "pmp": "string", + "preferredDERP": 0, + "regionLatency": { + "property1": 0, + "property2": 0 + }, + "regionV4Latency": { + "property1": 0, + "property2": 0 + }, + "regionV6Latency": { + "property1": 0, + "property2": 0 + }, + "udp": true, + "upnP": "string" + }, + "netcheck_err": "string", + "netcheck_logs": ["string"], + "regions": { + "property1": { + "error": "string", + "healthy": true, + "node_reports": [ + { + "can_exchange_messages": true, + "client_errs": [["string"]], + "client_logs": [["string"]], + "error": "string", + "healthy": true, + "node": { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + }, + "node_info": { + "tokenBucketBytesBurst": 0, + "tokenBucketBytesPerSecond": 0 + }, + "round_trip_ping": "string", + "round_trip_ping_ms": 0, + "severity": "ok", + "stun": { + "canSTUN": true, + "enabled": true, + "error": "string" + }, + "uses_websocket": true, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + } + ], + "region": { + "avoid": true, + "embeddedRelay": true, + "nodes": [ + { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + } + ], + "regionCode": "string", + "regionID": 0, + "regionName": "string" + }, + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + }, + "property2": { + "error": "string", + "healthy": true, + "node_reports": [ + { + "can_exchange_messages": true, + "client_errs": [["string"]], + "client_logs": [["string"]], + "error": "string", + "healthy": true, + "node": { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + }, + "node_info": { + "tokenBucketBytesBurst": 0, + "tokenBucketBytesPerSecond": 0 + }, + "round_trip_ping": "string", + "round_trip_ping_ms": 0, + "severity": "ok", + "stun": { + "canSTUN": true, + "enabled": true, + "error": "string" + }, + "uses_websocket": true, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + } + ], + "region": { + "avoid": true, + "embeddedRelay": true, + "nodes": [ + { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + } + ], + "regionCode": "string", + "regionID": 0, + "regionName": "string" + }, + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + } + }, + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] }, - "ignore_email_verified": true, - "ignore_user_info": true, - "issuer_url": "string", - "scopes": ["string"], - "sign_in_text": "string", - "signups_disabled_text": "string", - "user_role_field": "string", - "user_role_mapping": {}, - "user_roles_default": ["string"], - "username_field": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ----------------------- | -------------------------------- | -------- | ------------ | -------------------------------------------------------------------------------- | -| `allow_signups` | boolean | false | | | -| `auth_url_params` | object | false | | | -| `client_cert_file` | string | false | | | -| `client_id` | string | false | | | -| `client_key_file` | string | false | | Client key file & ClientCertFile are used in place of ClientSecret for PKI auth. | -| `client_secret` | string | false | | | -| `email_domain` | array of string | false | | | -| `email_field` | string | false | | | -| `group_allow_list` | array of string | false | | | -| `group_auto_create` | boolean | false | | | -| `group_mapping` | object | false | | | -| `group_regex_filter` | [clibase.Regexp](#clibaseregexp) | false | | | -| `groups_field` | string | false | | | -| `icon_url` | [clibase.URL](#clibaseurl) | false | | | -| `ignore_email_verified` | boolean | false | | | -| `ignore_user_info` | boolean | false | | | -| `issuer_url` | string | false | | | -| `scopes` | array of string | false | | | -| `sign_in_text` | string | false | | | -| `signups_disabled_text` | string | false | | | -| `user_role_field` | string | false | | | -| `user_role_mapping` | object | false | | | -| `user_roles_default` | array of string | false | | | -| `username_field` | string | false | | | - -## codersdk.Organization - -```json -{ - "created_at": "2019-08-24T14:15:22Z", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "is_default": true, - "name": "string", - "updated_at": "2019-08-24T14:15:22Z" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ------------ | ------- | -------- | ------------ | ----------- | -| `created_at` | string | true | | | -| `id` | string | true | | | -| `is_default` | boolean | true | | | -| `name` | string | true | | | -| `updated_at` | string | true | | | - -## codersdk.OrganizationMember - -```json -{ - "created_at": "2019-08-24T14:15:22Z", - "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", - "roles": [ - { - "display_name": "string", - "name": "string" + "failing_sections": ["DERP"], + "healthy": true, + "provisioner_daemons": { + "dismissed": true, + "error": "string", + "items": [ + { + "provisioner_daemon": { + "api_version": "string", + "created_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "name": "string", + "provisioners": ["string"], + "tags": { + "property1": "string", + "property2": "string" + }, + "version": "string" + }, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + } + ], + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] + }, + "severity": "ok", + "time": "2019-08-24T14:15:22Z", + "websocket": { + "body": "string", + "code": 0, + "dismissed": true, + "error": "string", + "healthy": true, + "severity": "ok", + "warnings": ["string"] + }, + "workspace_proxy": { + "dismissed": true, + "error": "string", + "healthy": true, + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ], + "workspace_proxies": { + "regions": [ + { + "created_at": "2019-08-24T14:15:22Z", + "deleted": true, + "derp_enabled": true, + "derp_only": true, + "display_name": "string", + "healthy": true, + "icon_url": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "path_app_url": "string", + "status": { + "checked_at": "2019-08-24T14:15:22Z", + "report": { + "errors": ["string"], + "warnings": ["string"] + }, + "status": "ok" + }, + "updated_at": "2019-08-24T14:15:22Z", + "version": "string", + "wildcard_hostname": "string" + } + ] } - ], - "updated_at": "2019-08-24T14:15:22Z", - "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5" + } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ----------------- | --------------------------------------- | -------- | ------------ | ----------- | -| `created_at` | string | false | | | -| `organization_id` | string | false | | | -| `roles` | array of [codersdk.Role](#codersdkrole) | false | | | -| `updated_at` | string | false | | | -| `user_id` | string | false | | | - -## codersdk.PatchGroupRequest - -```json -{ - "add_users": ["string"], - "avatar_url": "string", - "display_name": "string", - "name": "string", - "quota_allowance": 0, - "remove_users": ["string"] -} -``` +| Name | Type | Required | Restrictions | Description | +| --------------------- | ---------------------------------------------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------- | +| `access_url` | [codersdk.AccessURLReport](#codersdkaccessurlreport) | false | | | +| `coder_version` | string | false | | The Coder version of the server that the report was generated on. | +| `database` | [codersdk.DatabaseReport](#codersdkdatabasereport) | false | | | +| `derp` | [codersdk.DERPHealthReport](#codersdkderphealthreport) | false | | | +| `failing_sections` | array of [codersdk.HealthSection](#codersdkhealthsection) | false | | Failing sections is a list of sections that have failed their healthcheck. | +| `healthy` | boolean | false | | Healthy is true if the report returns no errors. Deprecated: use `Severity` instead | +| `provisioner_daemons` | [codersdk.ProvisionerDaemonsReport](#codersdkprovisionerdaemonsreport) | false | | | +| `severity` | [health.Severity](#healthseverity) | false | | Severity indicates the status of Coder health. | +| `time` | string | false | | Time is the time the report was generated at. | +| `websocket` | [codersdk.WebsocketReport](#codersdkwebsocketreport) | false | | | +| `workspace_proxy` | [codersdk.WorkspaceProxyReport](#codersdkworkspaceproxyreport) | false | | | -### Properties +#### Enumerated Values -| Name | Type | Required | Restrictions | Description | -| ----------------- | --------------- | -------- | ------------ | ----------- | -| `add_users` | array of string | false | | | -| `avatar_url` | string | false | | | -| `display_name` | string | false | | | -| `name` | string | false | | | -| `quota_allowance` | integer | false | | | -| `remove_users` | array of string | false | | | +| Property | Value | +| ---------- | --------- | +| `severity` | `ok` | +| `severity` | `warning` | +| `severity` | `error` | -## codersdk.PatchTemplateVersionRequest +## codersdk.InsightsReportInterval ```json -{ - "message": "string", - "name": "string" -} +"day" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------- | ------ | -------- | ------------ | ----------- | -| `message` | string | false | | | -| `name` | string | false | | | +#### Enumerated Values -## codersdk.PatchWorkspaceProxy +| Value | +| ------ | +| `day` | +| `week` | + +## codersdk.IssueReconnectingPTYSignedTokenRequest ```json { - "display_name": "string", - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "name": "string", - "regenerate_token": true + "agentID": "bc282582-04f9-45ce-b904-3e3bfab66958", + "url": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------- | -------- | ------------ | ----------- | -| `display_name` | string | true | | | -| `icon` | string | true | | | -| `id` | string | true | | | -| `name` | string | true | | | -| `regenerate_token` | boolean | false | | | +| Name | Type | Required | Restrictions | Description | +| --------- | ------ | -------- | ------------ | ---------------------------------------------------------------------- | +| `agentID` | string | true | | | +| `url` | string | true | | URL is the URL of the reconnecting-pty endpoint you are connecting to. | -## codersdk.PostOAuth2ProviderAppRequest +## codersdk.IssueReconnectingPTYSignedTokenResponse ```json { - "callback_url": "string", - "icon": "string", - "name": "string" + "signed_token": "string" } ``` @@ -3910,220 +4185,96 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in | Name | Type | Required | Restrictions | Description | | -------------- | ------ | -------- | ------------ | ----------- | -| `callback_url` | string | true | | | -| `icon` | string | false | | | -| `name` | string | true | | | - -## codersdk.PprofConfig - -```json -{ - "address": { - "host": "string", - "port": "string" - }, - "enable": true -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| --------- | ------------------------------------ | -------- | ------------ | ----------- | -| `address` | [clibase.HostPort](#clibasehostport) | false | | | -| `enable` | boolean | false | | | - -## codersdk.PrometheusConfig - -```json -{ - "address": { - "host": "string", - "port": "string" - }, - "collect_agent_stats": true, - "collect_db_metrics": true, - "enable": true -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| --------------------- | ------------------------------------ | -------- | ------------ | ----------- | -| `address` | [clibase.HostPort](#clibasehostport) | false | | | -| `collect_agent_stats` | boolean | false | | | -| `collect_db_metrics` | boolean | false | | | -| `enable` | boolean | false | | | - -## codersdk.ProvisionerConfig - -```json -{ - "daemon_poll_interval": 0, - "daemon_poll_jitter": 0, - "daemon_psk": "string", - "daemons": 0, - "daemons_echo": true, - "force_cancel_interval": 0 -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ----------------------- | ------- | -------- | ------------ | ----------- | -| `daemon_poll_interval` | integer | false | | | -| `daemon_poll_jitter` | integer | false | | | -| `daemon_psk` | string | false | | | -| `daemons` | integer | false | | | -| `daemons_echo` | boolean | false | | | -| `force_cancel_interval` | integer | false | | | +| `signed_token` | string | false | | | -## codersdk.ProvisionerDaemon +## codersdk.JFrogXrayScan ```json { - "api_version": "string", - "created_at": "2019-08-24T14:15:22Z", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "last_seen_at": "2019-08-24T14:15:22Z", - "name": "string", - "provisioners": ["string"], - "tags": { - "property1": "string", - "property2": "string" - }, - "version": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ------------------ | --------------- | -------- | ------------ | ----------- | -| `api_version` | string | false | | | -| `created_at` | string | false | | | -| `id` | string | false | | | -| `last_seen_at` | string | false | | | -| `name` | string | false | | | -| `provisioners` | array of string | false | | | -| `tags` | object | false | | | -| » `[any property]` | string | false | | | -| `version` | string | false | | | + "agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978", + "critical": 0, + "high": 0, + "medium": 0, + "results_url": "string", + "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9" +} +``` -## codersdk.ProvisionerJob +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------------- | ------- | -------- | ------------ | ----------- | +| `agent_id` | string | false | | | +| `critical` | integer | false | | | +| `high` | integer | false | | | +| `medium` | integer | false | | | +| `results_url` | string | false | | | +| `workspace_id` | string | false | | | + +## codersdk.JobErrorCode ```json -{ - "canceled_at": "2019-08-24T14:15:22Z", - "completed_at": "2019-08-24T14:15:22Z", - "created_at": "2019-08-24T14:15:22Z", - "error": "string", - "error_code": "REQUIRED_TEMPLATE_VARIABLES", - "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "queue_position": 0, - "queue_size": 0, - "started_at": "2019-08-24T14:15:22Z", - "status": "pending", - "tags": { - "property1": "string", - "property2": "string" - }, - "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" -} +"REQUIRED_TEMPLATE_VARIABLES" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | -------------------------------------------------------------- | -------- | ------------ | ----------- | -| `canceled_at` | string | false | | | -| `completed_at` | string | false | | | -| `created_at` | string | false | | | -| `error` | string | false | | | -| `error_code` | [codersdk.JobErrorCode](#codersdkjoberrorcode) | false | | | -| `file_id` | string | false | | | -| `id` | string | false | | | -| `queue_position` | integer | false | | | -| `queue_size` | integer | false | | | -| `started_at` | string | false | | | -| `status` | [codersdk.ProvisionerJobStatus](#codersdkprovisionerjobstatus) | false | | | -| `tags` | object | false | | | -| » `[any property]` | string | false | | | -| `worker_id` | string | false | | | - #### Enumerated Values -| Property | Value | -| ------------ | ----------------------------- | -| `error_code` | `REQUIRED_TEMPLATE_VARIABLES` | -| `status` | `pending` | -| `status` | `running` | -| `status` | `succeeded` | -| `status` | `canceling` | -| `status` | `canceled` | -| `status` | `failed` | +| Value | +| ----------------------------- | +| `REQUIRED_TEMPLATE_VARIABLES` | -## codersdk.ProvisionerJobLog +## codersdk.License ```json { - "created_at": "2019-08-24T14:15:22Z", + "claims": {}, "id": 0, - "log_level": "trace", - "log_source": "provisioner_daemon", - "output": "string", - "stage": "string" + "uploaded_at": "2019-08-24T14:15:22Z", + "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------ | ---------------------------------------- | -------- | ------------ | ----------- | -| `created_at` | string | false | | | -| `id` | integer | false | | | -| `log_level` | [codersdk.LogLevel](#codersdkloglevel) | false | | | -| `log_source` | [codersdk.LogSource](#codersdklogsource) | false | | | -| `output` | string | false | | | -| `stage` | string | false | | | - -#### Enumerated Values - -| Property | Value | -| ----------- | ------- | -| `log_level` | `trace` | -| `log_level` | `debug` | -| `log_level` | `info` | -| `log_level` | `warn` | -| `log_level` | `error` | +| Name | Type | Required | Restrictions | Description | +| ------------- | ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `claims` | object | false | | Claims are the JWT claims asserted by the license. Here we use a generic string map to ensure that all data from the server is parsed verbatim, not just the fields this version of Coder understands. | +| `id` | integer | false | | | +| `uploaded_at` | string | false | | | +| `uuid` | string | false | | | -## codersdk.ProvisionerJobStatus +## codersdk.LinkConfig ```json -"pending" +{ + "icon": "bug", + "name": "string", + "target": "string" +} ``` ### Properties +| Name | Type | Required | Restrictions | Description | +| -------- | ------ | -------- | ------------ | ----------- | +| `icon` | string | false | | | +| `name` | string | false | | | +| `target` | string | false | | | + #### Enumerated Values -| Value | -| ----------- | -| `pending` | -| `running` | -| `succeeded` | -| `canceling` | -| `canceled` | -| `failed` | -| `unknown` | +| Property | Value | +| -------- | ------ | +| `icon` | `bug` | +| `icon` | `chat` | +| `icon` | `docs` | -## codersdk.ProvisionerLogLevel +## codersdk.LogLevel ```json -"debug" +"trace" ``` ### Properties @@ -4132,60 +4283,72 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in | Value | | ------- | +| `trace` | | `debug` | +| `info` | +| `warn` | +| `error` | -## codersdk.ProvisionerStorageMethod +## codersdk.LogSource ```json -"file" +"provisioner_daemon" ``` ### Properties #### Enumerated Values -| Value | -| ------ | -| `file` | +| Value | +| -------------------- | +| `provisioner_daemon` | +| `provisioner` | -## codersdk.ProxyHealthReport +## codersdk.LoggingConfig ```json { - "errors": ["string"], - "warnings": ["string"] + "human": "string", + "json": "string", + "log_filter": ["string"], + "stackdriver": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------- | --------------- | -------- | ------------ | ---------------------------------------------------------------------------------------- | -| `errors` | array of string | false | | Errors are problems that prevent the workspace proxy from being healthy | -| `warnings` | array of string | false | | Warnings do not prevent the workspace proxy from being healthy, but should be addressed. | +| Name | Type | Required | Restrictions | Description | +| ------------- | --------------- | -------- | ------------ | ----------- | +| `human` | string | false | | | +| `json` | string | false | | | +| `log_filter` | array of string | false | | | +| `stackdriver` | string | false | | | -## codersdk.ProxyHealthStatus +## codersdk.LoginType ```json -"ok" +"" ``` ### Properties #### Enumerated Values -| Value | -| -------------- | -| `ok` | -| `unreachable` | -| `unhealthy` | -| `unregistered` | +| Value | +| ---------- | +| `` | +| `password` | +| `github` | +| `oidc` | +| `token` | +| `none` | -## codersdk.PutExtendWorkspaceRequest +## codersdk.LoginWithPasswordRequest ```json { - "deadline": "2019-08-24T14:15:22Z" + "email": "user@example.com", + "password": "string" } ``` @@ -4193,373 +4356,375 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in | Name | Type | Required | Restrictions | Description | | ---------- | ------ | -------- | ------------ | ----------- | -| `deadline` | string | true | | | +| `email` | string | true | | | +| `password` | string | true | | | -## codersdk.PutOAuth2ProviderAppRequest +## codersdk.LoginWithPasswordResponse ```json { - "callback_url": "string", - "icon": "string", - "name": "string" + "session_token": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------ | -------- | ------------ | ----------- | -| `callback_url` | string | true | | | -| `icon` | string | false | | | -| `name` | string | true | | | +| Name | Type | Required | Restrictions | Description | +| --------------- | ------ | -------- | ------------ | ----------- | +| `session_token` | string | true | | | -## codersdk.RBACResource +## codersdk.MinimalUser ```json -"workspace" +{ + "avatar_url": "http://example.com", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "username": "string" +} ``` ### Properties -#### Enumerated Values - -| Value | -| --------------------------------- | -| `workspace` | -| `workspace_proxy` | -| `workspace_execution` | -| `application_connect` | -| `audit_log` | -| `template` | -| `group` | -| `file` | -| `provisioner_daemon` | -| `organization` | -| `assign_role` | -| `assign_org_role` | -| `api_key` | -| `user` | -| `user_data` | -| `user_workspace_build_parameters` | -| `organization_member` | -| `license` | -| `deployment_config` | -| `deployment_stats` | -| `replicas` | -| `debug_info` | -| `system` | -| `template_insights` | +| Name | Type | Required | Restrictions | Description | +| ------------ | ------ | -------- | ------------ | ----------- | +| `avatar_url` | string | false | | | +| `id` | string | true | | | +| `username` | string | true | | | -## codersdk.RateLimitConfig +## codersdk.OAuth2AppEndpoints ```json { - "api": 0, - "disable_all": true + "authorization": "string", + "device_authorization": "string", + "token": "string" } ``` -### Properties - -| Name | Type | Required | Restrictions | Description | -| ------------- | ------- | -------- | ------------ | ----------- | -| `api` | integer | false | | | -| `disable_all` | boolean | false | | | +### Properties -## codersdk.ReducedUser +| Name | Type | Required | Restrictions | Description | +| ---------------------- | ------ | -------- | ------------ | --------------------------------- | +| `authorization` | string | false | | | +| `device_authorization` | string | false | | Device authorization is optional. | +| `token` | string | false | | | + +## codersdk.OAuth2Config ```json { - "avatar_url": "http://example.com", - "created_at": "2019-08-24T14:15:22Z", - "email": "user@example.com", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "last_seen_at": "2019-08-24T14:15:22Z", - "login_type": "", - "name": "string", - "status": "active", - "theme_preference": "string", - "username": "string" + "github": { + "allow_everyone": true, + "allow_signups": true, + "allowed_orgs": ["string"], + "allowed_teams": ["string"], + "client_id": "string", + "client_secret": "string", + "enterprise_base_url": "string" + } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------------------------------------------ | -------- | ------------ | ----------- | -| `avatar_url` | string | false | | | -| `created_at` | string | true | | | -| `email` | string | true | | | -| `id` | string | true | | | -| `last_seen_at` | string | false | | | -| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | | -| `name` | string | false | | | -| `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | -| `theme_preference` | string | false | | | -| `username` | string | true | | | - -#### Enumerated Values - -| Property | Value | -| -------- | ----------- | -| `status` | `active` | -| `status` | `suspended` | +| Name | Type | Required | Restrictions | Description | +| -------- | ---------------------------------------------------------- | -------- | ------------ | ----------- | +| `github` | [codersdk.OAuth2GithubConfig](#codersdkoauth2githubconfig) | false | | | -## codersdk.Region +## codersdk.OAuth2GithubConfig ```json { - "display_name": "string", - "healthy": true, - "icon_url": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "name": "string", - "path_app_url": "string", - "wildcard_hostname": "string" + "allow_everyone": true, + "allow_signups": true, + "allowed_orgs": ["string"], + "allowed_teams": ["string"], + "client_id": "string", + "client_secret": "string", + "enterprise_base_url": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------- | ------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `display_name` | string | false | | | -| `healthy` | boolean | false | | | -| `icon_url` | string | false | | | -| `id` | string | false | | | -| `name` | string | false | | | -| `path_app_url` | string | false | | Path app URL is the URL to the base path for path apps. Optional unless wildcard_hostname is set. E.g. https://us.example.com | -| `wildcard_hostname` | string | false | | Wildcard hostname is the wildcard hostname for subdomain apps. E.g. _.us.example.com E.g. _--suffix.au.example.com Optional. Does not need to be on the same domain as PathAppURL. | +| Name | Type | Required | Restrictions | Description | +| --------------------- | --------------- | -------- | ------------ | ----------- | +| `allow_everyone` | boolean | false | | | +| `allow_signups` | boolean | false | | | +| `allowed_orgs` | array of string | false | | | +| `allowed_teams` | array of string | false | | | +| `client_id` | string | false | | | +| `client_secret` | string | false | | | +| `enterprise_base_url` | string | false | | | -## codersdk.RegionsResponse-codersdk_Region +## codersdk.OAuth2ProviderApp ```json { - "regions": [ - { - "display_name": "string", - "healthy": true, - "icon_url": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "name": "string", - "path_app_url": "string", - "wildcard_hostname": "string" - } - ] + "callback_url": "string", + "endpoints": { + "authorization": "string", + "device_authorization": "string", + "token": "string" + }, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------- | ------------------------------------------- | -------- | ------------ | ----------- | -| `regions` | array of [codersdk.Region](#codersdkregion) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ---------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `callback_url` | string | false | | | +| `endpoints` | [codersdk.OAuth2AppEndpoints](#codersdkoauth2appendpoints) | false | | Endpoints are included in the app response for easier discovery. The OAuth2 spec does not have a defined place to find these (for comparison, OIDC has a '/.well-known/openid-configuration' endpoint). | +| `icon` | string | false | | | +| `id` | string | false | | | +| `name` | string | false | | | -## codersdk.RegionsResponse-codersdk_WorkspaceProxy +## codersdk.OAuth2ProviderAppSecret ```json { - "regions": [ - { - "created_at": "2019-08-24T14:15:22Z", - "deleted": true, - "derp_enabled": true, - "derp_only": true, - "display_name": "string", - "healthy": true, - "icon_url": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "name": "string", - "path_app_url": "string", - "status": { - "checked_at": "2019-08-24T14:15:22Z", - "report": { - "errors": ["string"], - "warnings": ["string"] - }, - "status": "ok" - }, - "updated_at": "2019-08-24T14:15:22Z", - "version": "string", - "wildcard_hostname": "string" - } - ] + "client_secret_truncated": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_used_at": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------- | ----------------------------------------------------------- | -------- | ------------ | ----------- | -| `regions` | array of [codersdk.WorkspaceProxy](#codersdkworkspaceproxy) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------------- | ------ | -------- | ------------ | ----------- | +| `client_secret_truncated` | string | false | | | +| `id` | string | false | | | +| `last_used_at` | string | false | | | -## codersdk.Replica +## codersdk.OAuth2ProviderAppSecretFull ```json { - "created_at": "2019-08-24T14:15:22Z", - "database_latency": 0, - "error": "string", - "hostname": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "region_id": 0, - "relay_address": "string" + "client_secret_full": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------- | -------- | ------------ | ------------------------------------------------------------------ | -| `created_at` | string | false | | Created at is the timestamp when the replica was first seen. | -| `database_latency` | integer | false | | Database latency is the latency in microseconds to the database. | -| `error` | string | false | | Error is the replica error. | -| `hostname` | string | false | | Hostname is the hostname of the replica. | -| `id` | string | false | | ID is the unique identifier for the replica. | -| `region_id` | integer | false | | Region ID is the region of the replica. | -| `relay_address` | string | false | | Relay address is the accessible address to relay DERP connections. | +| Name | Type | Required | Restrictions | Description | +| -------------------- | ------ | -------- | ------------ | ----------- | +| `client_secret_full` | string | false | | | +| `id` | string | false | | | -## codersdk.ResolveAutostartResponse +## codersdk.OAuthConversionResponse ```json { - "parameter_mismatch": true + "expires_at": "2019-08-24T14:15:22Z", + "state_string": "string", + "to_type": "", + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------------- | ------- | -------- | ------------ | ----------- | -| `parameter_mismatch` | boolean | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ---------------------------------------- | -------- | ------------ | ----------- | +| `expires_at` | string | false | | | +| `state_string` | string | false | | | +| `to_type` | [codersdk.LoginType](#codersdklogintype) | false | | | +| `user_id` | string | false | | | -## codersdk.ResourceType +## codersdk.OIDCAuthMethod ```json -"template" +{ + "enabled": true, + "iconUrl": "string", + "signInText": "string" +} ``` ### Properties -#### Enumerated Values - -| Value | -| ------------------ | -| `template` | -| `template_version` | -| `user` | -| `workspace` | -| `workspace_build` | -| `git_ssh_key` | -| `api_key` | -| `group` | -| `license` | -| `convert_login` | -| `health_settings` | -| `workspace_proxy` | -| `organization` | +| Name | Type | Required | Restrictions | Description | +| ------------ | ------- | -------- | ------------ | ----------- | +| `enabled` | boolean | false | | | +| `iconUrl` | string | false | | | +| `signInText` | string | false | | | -## codersdk.Response +## codersdk.OIDCConfig ```json { - "detail": "string", - "message": "string", - "validations": [ - { - "detail": "string", - "field": "string" - } - ] + "allow_signups": true, + "auth_url_params": {}, + "client_cert_file": "string", + "client_id": "string", + "client_key_file": "string", + "client_secret": "string", + "email_domain": ["string"], + "email_field": "string", + "group_allow_list": ["string"], + "group_auto_create": true, + "group_mapping": {}, + "group_regex_filter": {}, + "groups_field": "string", + "icon_url": { + "forceQuery": true, + "fragment": "string", + "host": "string", + "omitHost": true, + "opaque": "string", + "path": "string", + "rawFragment": "string", + "rawPath": "string", + "rawQuery": "string", + "scheme": "string", + "user": {} + }, + "ignore_email_verified": true, + "ignore_user_info": true, + "issuer_url": "string", + "scopes": ["string"], + "sign_in_text": "string", + "signups_disabled_text": "string", + "user_role_field": "string", + "user_role_mapping": {}, + "user_roles_default": ["string"], + "username_field": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------- | ------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `detail` | string | false | | Detail is a debug message that provides further insight into why the action failed. This information can be technical and a regular golang err.Error() text. - "database: too many open connections" - "stat: too many open files" | -| `message` | string | false | | Message is an actionable message that depicts actions the request took. These messages should be fully formed sentences with proper punctuation. Examples: - "A user has been created." - "Failed to create a user." | -| `validations` | array of [codersdk.ValidationError](#codersdkvalidationerror) | false | | Validations are form field-specific friendly error messages. They will be shown on a form field in the UI. These can also be used to add additional context if there is a set of errors in the primary 'Message'. | +| Name | Type | Required | Restrictions | Description | +| ----------------------- | -------------------------------- | -------- | ------------ | -------------------------------------------------------------------------------- | +| `allow_signups` | boolean | false | | | +| `auth_url_params` | object | false | | | +| `client_cert_file` | string | false | | | +| `client_id` | string | false | | | +| `client_key_file` | string | false | | Client key file & ClientCertFile are used in place of ClientSecret for PKI auth. | +| `client_secret` | string | false | | | +| `email_domain` | array of string | false | | | +| `email_field` | string | false | | | +| `group_allow_list` | array of string | false | | | +| `group_auto_create` | boolean | false | | | +| `group_mapping` | object | false | | | +| `group_regex_filter` | [clibase.Regexp](#clibaseregexp) | false | | | +| `groups_field` | string | false | | | +| `icon_url` | [clibase.URL](#clibaseurl) | false | | | +| `ignore_email_verified` | boolean | false | | | +| `ignore_user_info` | boolean | false | | | +| `issuer_url` | string | false | | | +| `scopes` | array of string | false | | | +| `sign_in_text` | string | false | | | +| `signups_disabled_text` | string | false | | | +| `user_role_field` | string | false | | | +| `user_role_mapping` | object | false | | | +| `user_roles_default` | array of string | false | | | +| `username_field` | string | false | | | -## codersdk.Role +## codersdk.Organization ```json { - "display_name": "string", - "name": "string" + "created_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "is_default": true, + "name": "string", + "updated_at": "2019-08-24T14:15:22Z" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------ | -------- | ------------ | ----------- | -| `display_name` | string | false | | | -| `name` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------ | ------- | -------- | ------------ | ----------- | +| `created_at` | string | true | | | +| `id` | string | true | | | +| `is_default` | boolean | true | | | +| `name` | string | true | | | +| `updated_at` | string | true | | | -## codersdk.SSHConfig +## codersdk.OrganizationMember ```json { - "deploymentName": "string", - "sshconfigOptions": ["string"] + "created_at": "2019-08-24T14:15:22Z", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "updated_at": "2019-08-24T14:15:22Z", + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | --------------- | -------- | ------------ | --------------------------------------------------------------------------------------------------- | -| `deploymentName` | string | false | | Deploymentname is the config-ssh Hostname prefix | -| `sshconfigOptions` | array of string | false | | Sshconfigoptions are additional options to add to the ssh config file. This will override defaults. | +| Name | Type | Required | Restrictions | Description | +| ----------------- | --------------------------------------- | -------- | ------------ | ----------- | +| `created_at` | string | false | | | +| `organization_id` | string | false | | | +| `roles` | array of [codersdk.Role](#codersdkrole) | false | | | +| `updated_at` | string | false | | | +| `user_id` | string | false | | | -## codersdk.SSHConfigResponse +## codersdk.PatchGroupRequest ```json { - "hostname_prefix": "string", - "ssh_config_options": { - "property1": "string", - "property2": "string" - } + "add_users": ["string"], + "avatar_url": "string", + "display_name": "string", + "name": "string", + "quota_allowance": 0, + "remove_users": ["string"] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------------- | ------ | -------- | ------------ | ----------- | -| `hostname_prefix` | string | false | | | -| `ssh_config_options` | object | false | | | -| » `[any property]` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ----------------- | --------------- | -------- | ------------ | ----------- | +| `add_users` | array of string | false | | | +| `avatar_url` | string | false | | | +| `display_name` | string | false | | | +| `name` | string | false | | | +| `quota_allowance` | integer | false | | | +| `remove_users` | array of string | false | | | -## codersdk.ServiceBannerConfig +## codersdk.PatchTemplateVersionRequest ```json { - "background_color": "string", - "enabled": true, - "message": "string" + "message": "string", + "name": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------- | -------- | ------------ | ----------- | -| `background_color` | string | false | | | -| `enabled` | boolean | false | | | -| `message` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| --------- | ------ | -------- | ------------ | ----------- | +| `message` | string | false | | | +| `name` | string | false | | | -## codersdk.SessionCountDeploymentStats +## codersdk.PatchWorkspaceProxy ```json { - "jetbrains": 0, - "reconnecting_pty": 0, - "ssh": 0, - "vscode": 0 + "display_name": "string", + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "regenerate_token": true } ``` @@ -4567,48 +4732,50 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in | Name | Type | Required | Restrictions | Description | | ------------------ | ------- | -------- | ------------ | ----------- | -| `jetbrains` | integer | false | | | -| `reconnecting_pty` | integer | false | | | -| `ssh` | integer | false | | | -| `vscode` | integer | false | | | +| `display_name` | string | true | | | +| `icon` | string | true | | | +| `id` | string | true | | | +| `name` | string | true | | | +| `regenerate_token` | boolean | false | | | -## codersdk.SupportConfig +## codersdk.PostOAuth2ProviderAppRequest ```json { - "links": { - "value": [ - { - "icon": "bug", - "name": "string", - "target": "string" - } - ] - } + "callback_url": "string", + "icon": "string", + "name": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------- | ------------------------------------------------------------------------------------ | -------- | ------------ | ----------- | -| `links` | [clibase.Struct-array_codersdk_LinkConfig](#clibasestruct-array_codersdk_linkconfig) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------ | -------- | ------------ | ----------- | +| `callback_url` | string | true | | | +| `icon` | string | false | | | +| `name` | string | true | | | -## codersdk.SwaggerConfig +## codersdk.PprofConfig ```json { + "address": { + "host": "string", + "port": "string" + }, "enable": true } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------- | ------- | -------- | ------------ | ----------- | -| `enable` | boolean | false | | | +| Name | Type | Required | Restrictions | Description | +| --------- | ------------------------------------ | -------- | ------------ | ----------- | +| `address` | [clibase.HostPort](#clibasehostport) | false | | | +| `enable` | boolean | false | | | -## codersdk.TLSConfig +## codersdk.PrometheusConfig ```json { @@ -4616,486 +4783,414 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in "host": "string", "port": "string" }, - "allow_insecure_ciphers": true, - "cert_file": ["string"], - "client_auth": "string", - "client_ca_file": "string", - "client_cert_file": "string", - "client_key_file": "string", - "enable": true, - "key_file": ["string"], - "min_version": "string", - "redirect_http": true, - "supported_ciphers": ["string"] + "collect_agent_stats": true, + "collect_db_metrics": true, + "enable": true } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------------ | ------------------------------------ | -------- | ------------ | ----------- | -| `address` | [clibase.HostPort](#clibasehostport) | false | | | -| `allow_insecure_ciphers` | boolean | false | | | -| `cert_file` | array of string | false | | | -| `client_auth` | string | false | | | -| `client_ca_file` | string | false | | | -| `client_cert_file` | string | false | | | -| `client_key_file` | string | false | | | -| `enable` | boolean | false | | | -| `key_file` | array of string | false | | | -| `min_version` | string | false | | | -| `redirect_http` | boolean | false | | | -| `supported_ciphers` | array of string | false | | | +| Name | Type | Required | Restrictions | Description | +| --------------------- | ------------------------------------ | -------- | ------------ | ----------- | +| `address` | [clibase.HostPort](#clibasehostport) | false | | | +| `collect_agent_stats` | boolean | false | | | +| `collect_db_metrics` | boolean | false | | | +| `enable` | boolean | false | | | -## codersdk.TelemetryConfig +## codersdk.ProvisionerConfig ```json { - "enable": true, - "trace": true, - "url": { - "forceQuery": true, - "fragment": "string", - "host": "string", - "omitHost": true, - "opaque": "string", - "path": "string", - "rawFragment": "string", - "rawPath": "string", - "rawQuery": "string", - "scheme": "string", - "user": {} - } + "daemon_poll_interval": 0, + "daemon_poll_jitter": 0, + "daemon_psk": "string", + "daemons": 0, + "daemons_echo": true, + "force_cancel_interval": 0 +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------------------- | ------- | -------- | ------------ | ----------- | +| `daemon_poll_interval` | integer | false | | | +| `daemon_poll_jitter` | integer | false | | | +| `daemon_psk` | string | false | | | +| `daemons` | integer | false | | | +| `daemons_echo` | boolean | false | | | +| `force_cancel_interval` | integer | false | | | + +## codersdk.ProvisionerDaemon + +```json +{ + "api_version": "string", + "created_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "name": "string", + "provisioners": ["string"], + "tags": { + "property1": "string", + "property2": "string" + }, + "version": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------- | -------------------------- | -------- | ------------ | ----------- | -| `enable` | boolean | false | | | -| `trace` | boolean | false | | | -| `url` | [clibase.URL](#clibaseurl) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | --------------- | -------- | ------------ | ----------- | +| `api_version` | string | false | | | +| `created_at` | string | false | | | +| `id` | string | false | | | +| `last_seen_at` | string | false | | | +| `name` | string | false | | | +| `provisioners` | array of string | false | | | +| `tags` | object | false | | | +| » `[any property]` | string | false | | | +| `version` | string | false | | | -## codersdk.Template +## codersdk.ProvisionerDaemonsReport ```json { - "active_user_count": 0, - "active_version_id": "eae64611-bd53-4a80-bb77-df1e432c0fbc", - "activity_bump_ms": 0, - "allow_user_autostart": true, - "allow_user_autostop": true, - "allow_user_cancel_workspace_jobs": true, - "autostart_requirement": { - "days_of_week": ["monday"] - }, - "autostop_requirement": { - "days_of_week": ["monday"], - "weeks": 0 - }, - "build_time_stats": { - "property1": { - "p50": 123, - "p95": 146 - }, - "property2": { - "p50": 123, - "p95": 146 + "dismissed": true, + "error": "string", + "items": [ + { + "provisioner_daemon": { + "api_version": "string", + "created_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "name": "string", + "provisioners": ["string"], + "tags": { + "property1": "string", + "property2": "string" + }, + "version": "string" + }, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] } - }, - "created_at": "2019-08-24T14:15:22Z", - "created_by_id": "9377d689-01fb-4abf-8450-3368d2c1924f", - "created_by_name": "string", - "default_ttl_ms": 0, - "deprecated": true, - "deprecation_message": "string", - "description": "string", - "display_name": "string", - "failure_ttl_ms": 0, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "max_port_share_level": "owner", - "max_ttl_ms": 0, - "name": "string", - "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", - "provisioner": "terraform", - "require_active_version": true, - "time_til_dormant_autodelete_ms": 0, - "time_til_dormant_ms": 0, - "updated_at": "2019-08-24T14:15:22Z", - "use_max_ttl": true + ], + "severity": "ok", + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------------------------------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `active_user_count` | integer | false | | Active user count is set to -1 when loading. | -| `active_version_id` | string | false | | | -| `activity_bump_ms` | integer | false | | | -| `allow_user_autostart` | boolean | false | | Allow user autostart and AllowUserAutostop are enterprise-only. Their values are only used if your license is entitled to use the advanced template scheduling feature. | -| `allow_user_autostop` | boolean | false | | | -| `allow_user_cancel_workspace_jobs` | boolean | false | | | -| `autostart_requirement` | [codersdk.TemplateAutostartRequirement](#codersdktemplateautostartrequirement) | false | | | -| `autostop_requirement` | [codersdk.TemplateAutostopRequirement](#codersdktemplateautostoprequirement) | false | | Autostop requirement and AutostartRequirement are enterprise features. Its value is only used if your license is entitled to use the advanced template scheduling feature. | -| `build_time_stats` | [codersdk.TemplateBuildTimeStats](#codersdktemplatebuildtimestats) | false | | | -| `created_at` | string | false | | | -| `created_by_id` | string | false | | | -| `created_by_name` | string | false | | | -| `default_ttl_ms` | integer | false | | | -| `deprecated` | boolean | false | | | -| `deprecation_message` | string | false | | | -| `description` | string | false | | | -| `display_name` | string | false | | | -| `failure_ttl_ms` | integer | false | | Failure ttl ms TimeTilDormantMillis, and TimeTilDormantAutoDeleteMillis are enterprise-only. Their values are used if your license is entitled to use the advanced template scheduling feature. | -| `icon` | string | false | | | -| `id` | string | false | | | -| `max_port_share_level` | [codersdk.WorkspaceAgentPortShareLevel](#codersdkworkspaceagentportsharelevel) | false | | | -| `max_ttl_ms` | integer | false | | Max ttl ms remove max_ttl once autostop_requirement is matured | -| `name` | string | false | | | -| `organization_id` | string | false | | | -| `provisioner` | string | false | | | -| `require_active_version` | boolean | false | | Require active version mandates that workspaces are built with the active template version. | -| `time_til_dormant_autodelete_ms` | integer | false | | | -| `time_til_dormant_ms` | integer | false | | | -| `updated_at` | string | false | | | -| `use_max_ttl` | boolean | false | | Use max ttl picks whether to use the deprecated max TTL for the template or the new autostop requirement. | - -#### Enumerated Values - -| Property | Value | -| ------------- | ----------- | -| `provisioner` | `terraform` | +| Name | Type | Required | Restrictions | Description | +| ----------- | --------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `dismissed` | boolean | false | | | +| `error` | string | false | | | +| `items` | array of [codersdk.ProvisionerDaemonsReportItem](#codersdkprovisionerdaemonsreportitem) | false | | | +| `severity` | [health.Severity](#healthseverity) | false | | | +| `warnings` | array of [health.Message](#healthmessage) | false | | | -## codersdk.TemplateAppUsage +## codersdk.ProvisionerDaemonsReportItem ```json { - "display_name": "Visual Studio Code", - "icon": "string", - "seconds": 80500, - "slug": "vscode", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "type": "builtin" + "provisioner_daemon": { + "api_version": "string", + "created_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "name": "string", + "provisioners": ["string"], + "tags": { + "property1": "string", + "property2": "string" + }, + "version": "string" + }, + "warnings": [ + { + "code": "EUNKNOWN", + "message": "string" + } + ] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------------------------------------------------------ | -------- | ------------ | ----------- | -| `display_name` | string | false | | | -| `icon` | string | false | | | -| `seconds` | integer | false | | | -| `slug` | string | false | | | -| `template_ids` | array of string | false | | | -| `type` | [codersdk.TemplateAppsType](#codersdktemplateappstype) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------------- | -------------------------------------------------------- | -------- | ------------ | ----------- | +| `provisioner_daemon` | [codersdk.ProvisionerDaemon](#codersdkprovisionerdaemon) | false | | | +| `warnings` | array of [health.Message](#healthmessage) | false | | | -## codersdk.TemplateAppsType +## codersdk.ProvisionerJob ```json -"builtin" +{ + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "error_code": "REQUIRED_TEMPLATE_VARIABLES", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "queue_position": 0, + "queue_size": 0, + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" +} ``` ### Properties +| Name | Type | Required | Restrictions | Description | +| ------------------ | -------------------------------------------------------------- | -------- | ------------ | ----------- | +| `canceled_at` | string | false | | | +| `completed_at` | string | false | | | +| `created_at` | string | false | | | +| `error` | string | false | | | +| `error_code` | [codersdk.JobErrorCode](#codersdkjoberrorcode) | false | | | +| `file_id` | string | false | | | +| `id` | string | false | | | +| `queue_position` | integer | false | | | +| `queue_size` | integer | false | | | +| `started_at` | string | false | | | +| `status` | [codersdk.ProvisionerJobStatus](#codersdkprovisionerjobstatus) | false | | | +| `tags` | object | false | | | +| » `[any property]` | string | false | | | +| `worker_id` | string | false | | | + #### Enumerated Values -| Value | -| --------- | -| `builtin` | -| `app` | +| Property | Value | +| ------------ | ----------------------------- | +| `error_code` | `REQUIRED_TEMPLATE_VARIABLES` | +| `status` | `pending` | +| `status` | `running` | +| `status` | `succeeded` | +| `status` | `canceling` | +| `status` | `canceled` | +| `status` | `failed` | -## codersdk.TemplateAutostartRequirement +## codersdk.ProvisionerJobLog ```json { - "days_of_week": ["monday"] + "created_at": "2019-08-24T14:15:22Z", + "id": 0, + "log_level": "trace", + "log_source": "provisioner_daemon", + "output": "string", + "stage": "string" } ``` -### Properties +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | ---------------------------------------- | -------- | ------------ | ----------- | +| `created_at` | string | false | | | +| `id` | integer | false | | | +| `log_level` | [codersdk.LogLevel](#codersdkloglevel) | false | | | +| `log_source` | [codersdk.LogSource](#codersdklogsource) | false | | | +| `output` | string | false | | | +| `stage` | string | false | | | + +#### Enumerated Values -| Name | Type | Required | Restrictions | Description | -| -------------- | --------------- | -------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- | -| `days_of_week` | array of string | false | | Days of week is a list of days of the week in which autostart is allowed to happen. If no days are specified, autostart is not allowed. | +| Property | Value | +| ----------- | ------- | +| `log_level` | `trace` | +| `log_level` | `debug` | +| `log_level` | `info` | +| `log_level` | `warn` | +| `log_level` | `error` | -## codersdk.TemplateAutostopRequirement +## codersdk.ProvisionerJobStatus ```json -{ - "days_of_week": ["monday"], - "weeks": 0 -} +"pending" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------------------------------------------------------------------------- | --------------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `days_of_week` | array of string | false | | Days of week is a list of days of the week on which restarts are required. Restarts happen within the user's quiet hours (in their configured timezone). If no days are specified, restarts are not required. Weekdays cannot be specified twice. | -| Restarts will only happen on weekdays in this list on weeks which line up with Weeks. | -| `weeks` | integer | false | | Weeks is the number of weeks between required restarts. Weeks are synced across all workspaces (and Coder deployments) using modulo math on a hardcoded epoch week of January 2nd, 2023 (the first Monday of 2023). Values of 0 or 1 indicate weekly restarts. Values of 2 indicate fortnightly restarts, etc. | +#### Enumerated Values -## codersdk.TemplateBuildTimeStats +| Value | +| ----------- | +| `pending` | +| `running` | +| `succeeded` | +| `canceling` | +| `canceled` | +| `failed` | +| `unknown` | + +## codersdk.ProvisionerLogLevel ```json -{ - "property1": { - "p50": 123, - "p95": 146 - }, - "property2": { - "p50": 123, - "p95": 146 - } -} +"debug" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------------- | ---------------------------------------------------- | -------- | ------------ | ----------- | -| `[any property]` | [codersdk.TransitionStats](#codersdktransitionstats) | false | | | +#### Enumerated Values -## codersdk.TemplateExample +| Value | +| ------- | +| `debug` | + +## codersdk.ProvisionerStorageMethod ```json -{ - "description": "string", - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "markdown": "string", - "name": "string", - "tags": ["string"], - "url": "string" -} +"file" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------- | --------------- | -------- | ------------ | ----------- | -| `description` | string | false | | | -| `icon` | string | false | | | -| `id` | string | false | | | -| `markdown` | string | false | | | -| `name` | string | false | | | -| `tags` | array of string | false | | | -| `url` | string | false | | | +#### Enumerated Values -## codersdk.TemplateInsightsIntervalReport +| Value | +| ------ | +| `file` | + +## codersdk.ProxyHealthReport ```json { - "active_users": 14, - "end_time": "2019-08-24T14:15:22Z", - "interval": "week", - "start_time": "2019-08-24T14:15:22Z", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"] + "errors": ["string"], + "warnings": ["string"] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------------------------------------------------------------------ | -------- | ------------ | ----------- | -| `active_users` | integer | false | | | -| `end_time` | string | false | | | -| `interval` | [codersdk.InsightsReportInterval](#codersdkinsightsreportinterval) | false | | | -| `start_time` | string | false | | | -| `template_ids` | array of string | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------- | --------------- | -------- | ------------ | ---------------------------------------------------------------------------------------- | +| `errors` | array of string | false | | Errors are problems that prevent the workspace proxy from being healthy | +| `warnings` | array of string | false | | Warnings do not prevent the workspace proxy from being healthy, but should be addressed. | -## codersdk.TemplateInsightsReport +## codersdk.ProxyHealthStatus ```json -{ - "active_users": 22, - "apps_usage": [ - { - "display_name": "Visual Studio Code", - "icon": "string", - "seconds": 80500, - "slug": "vscode", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "type": "builtin" - } - ], - "end_time": "2019-08-24T14:15:22Z", - "parameters_usage": [ - { - "description": "string", - "display_name": "string", - "name": "string", - "options": [ - { - "description": "string", - "icon": "string", - "name": "string", - "value": "string" - } - ], - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "type": "string", - "values": [ - { - "count": 0, - "value": "string" - } - ] - } - ], - "start_time": "2019-08-24T14:15:22Z", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"] -} +"ok" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | --------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `active_users` | integer | false | | | -| `apps_usage` | array of [codersdk.TemplateAppUsage](#codersdktemplateappusage) | false | | | -| `end_time` | string | false | | | -| `parameters_usage` | array of [codersdk.TemplateParameterUsage](#codersdktemplateparameterusage) | false | | | -| `start_time` | string | false | | | -| `template_ids` | array of string | false | | | +#### Enumerated Values -## codersdk.TemplateInsightsResponse +| Value | +| -------------- | +| `ok` | +| `unreachable` | +| `unhealthy` | +| `unregistered` | + +## codersdk.PutExtendWorkspaceRequest ```json { - "interval_reports": [ - { - "active_users": 14, - "end_time": "2019-08-24T14:15:22Z", - "interval": "week", - "start_time": "2019-08-24T14:15:22Z", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"] - } - ], - "report": { - "active_users": 22, - "apps_usage": [ - { - "display_name": "Visual Studio Code", - "icon": "string", - "seconds": 80500, - "slug": "vscode", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "type": "builtin" - } - ], - "end_time": "2019-08-24T14:15:22Z", - "parameters_usage": [ - { - "description": "string", - "display_name": "string", - "name": "string", - "options": [ - { - "description": "string", - "icon": "string", - "name": "string", - "value": "string" - } - ], - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "type": "string", - "values": [ - { - "count": 0, - "value": "string" - } - ] - } - ], - "start_time": "2019-08-24T14:15:22Z", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"] - } + "deadline": "2019-08-24T14:15:22Z" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `interval_reports` | array of [codersdk.TemplateInsightsIntervalReport](#codersdktemplateinsightsintervalreport) | false | | | -| `report` | [codersdk.TemplateInsightsReport](#codersdktemplateinsightsreport) | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------- | ------ | -------- | ------------ | ----------- | +| `deadline` | string | true | | | -## codersdk.TemplateParameterUsage +## codersdk.PutOAuth2ProviderAppRequest ```json { - "description": "string", - "display_name": "string", - "name": "string", - "options": [ - { - "description": "string", - "icon": "string", - "name": "string", - "value": "string" - } - ], - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "type": "string", - "values": [ - { - "count": 0, - "value": "string" - } - ] + "callback_url": "string", + "icon": "string", + "name": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `description` | string | false | | | -| `display_name` | string | false | | | -| `name` | string | false | | | -| `options` | array of [codersdk.TemplateVersionParameterOption](#codersdktemplateversionparameteroption) | false | | | -| `template_ids` | array of string | false | | | -| `type` | string | false | | | -| `values` | array of [codersdk.TemplateParameterValue](#codersdktemplateparametervalue) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------ | -------- | ------------ | ----------- | +| `callback_url` | string | true | | | +| `icon` | string | false | | | +| `name` | string | true | | | -## codersdk.TemplateParameterValue +## codersdk.RBACResource ```json -{ - "count": 0, - "value": "string" -} +"workspace" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------- | ------- | -------- | ------------ | ----------- | -| `count` | integer | false | | | -| `value` | string | false | | | +#### Enumerated Values -## codersdk.TemplateRole +| Value | +| --------------------------------- | +| `workspace` | +| `workspace_proxy` | +| `workspace_execution` | +| `application_connect` | +| `audit_log` | +| `template` | +| `group` | +| `file` | +| `provisioner_daemon` | +| `organization` | +| `assign_role` | +| `assign_org_role` | +| `api_key` | +| `user` | +| `user_data` | +| `user_workspace_build_parameters` | +| `organization_member` | +| `license` | +| `deployment_config` | +| `deployment_stats` | +| `replicas` | +| `debug_info` | +| `system` | +| `template_insights` | + +## codersdk.RateLimitConfig ```json -"admin" +{ + "api": 0, + "disable_all": true +} ``` ### Properties -#### Enumerated Values - -| Value | -| ------- | -| `admin` | -| `use` | -| `` | +| Name | Type | Required | Restrictions | Description | +| ------------- | ------- | -------- | ------------ | ----------- | +| `api` | integer | false | | | +| `disable_all` | boolean | false | | | -## codersdk.TemplateUser +## codersdk.ReducedUser ```json { @@ -5106,14 +5201,6 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in "last_seen_at": "2019-08-24T14:15:22Z", "login_type": "", "name": "string", - "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "role": "admin", - "roles": [ - { - "display_name": "string", - "name": "string" - } - ], "status": "active", "theme_preference": "string", "username": "string" @@ -5122,649 +5209,785 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ---------------------------------------------- | -------- | ------------ | ----------- | -| `avatar_url` | string | false | | | -| `created_at` | string | true | | | -| `email` | string | true | | | -| `id` | string | true | | | -| `last_seen_at` | string | false | | | -| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | | -| `name` | string | false | | | -| `organization_ids` | array of string | false | | | -| `role` | [codersdk.TemplateRole](#codersdktemplaterole) | false | | | -| `roles` | array of [codersdk.Role](#codersdkrole) | false | | | -| `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | -| `theme_preference` | string | false | | | -| `username` | string | true | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------------------------------------------ | -------- | ------------ | ----------- | +| `avatar_url` | string | false | | | +| `created_at` | string | true | | | +| `email` | string | true | | | +| `id` | string | true | | | +| `last_seen_at` | string | false | | | +| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | | +| `name` | string | false | | | +| `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | +| `theme_preference` | string | false | | | +| `username` | string | true | | | #### Enumerated Values | Property | Value | | -------- | ----------- | -| `role` | `admin` | -| `role` | `use` | | `status` | `active` | | `status` | `suspended` | -## codersdk.TemplateVersion +## codersdk.Region ```json { - "archived": true, - "created_at": "2019-08-24T14:15:22Z", - "created_by": { - "avatar_url": "http://example.com", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "username": "string" - }, + "display_name": "string", + "healthy": true, + "icon_url": "string", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "job": { - "canceled_at": "2019-08-24T14:15:22Z", - "completed_at": "2019-08-24T14:15:22Z", - "created_at": "2019-08-24T14:15:22Z", - "error": "string", - "error_code": "REQUIRED_TEMPLATE_VARIABLES", - "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "queue_position": 0, - "queue_size": 0, - "started_at": "2019-08-24T14:15:22Z", - "status": "pending", - "tags": { - "property1": "string", - "property2": "string" - }, - "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" - }, - "message": "string", "name": "string", - "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", - "readme": "string", - "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", - "updated_at": "2019-08-24T14:15:22Z", - "warnings": ["UNSUPPORTED_WORKSPACES"] + "path_app_url": "string", + "wildcard_hostname": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ----------------- | --------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `archived` | boolean | false | | | -| `created_at` | string | false | | | -| `created_by` | [codersdk.MinimalUser](#codersdkminimaluser) | false | | | -| `id` | string | false | | | -| `job` | [codersdk.ProvisionerJob](#codersdkprovisionerjob) | false | | | -| `message` | string | false | | | -| `name` | string | false | | | -| `organization_id` | string | false | | | -| `readme` | string | false | | | -| `template_id` | string | false | | | -| `updated_at` | string | false | | | -| `warnings` | array of [codersdk.TemplateVersionWarning](#codersdktemplateversionwarning) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------- | ------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `display_name` | string | false | | | +| `healthy` | boolean | false | | | +| `icon_url` | string | false | | | +| `id` | string | false | | | +| `name` | string | false | | | +| `path_app_url` | string | false | | Path app URL is the URL to the base path for path apps. Optional unless wildcard_hostname is set. E.g. https://us.example.com | +| `wildcard_hostname` | string | false | | Wildcard hostname is the wildcard hostname for subdomain apps. E.g. _.us.example.com E.g. _--suffix.au.example.com Optional. Does not need to be on the same domain as PathAppURL. | -## codersdk.TemplateVersionExternalAuth +## codersdk.RegionsResponse-codersdk_Region ```json { - "authenticate_url": "string", - "authenticated": true, - "display_icon": "string", - "display_name": "string", - "id": "string", - "optional": true, - "type": "string" + "regions": [ + { + "display_name": "string", + "healthy": true, + "icon_url": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "path_app_url": "string", + "wildcard_hostname": "string" + } + ] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------- | -------- | ------------ | ----------- | -| `authenticate_url` | string | false | | | -| `authenticated` | boolean | false | | | -| `display_icon` | string | false | | | -| `display_name` | string | false | | | -| `id` | string | false | | | -| `optional` | boolean | false | | | -| `type` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| --------- | ------------------------------------------- | -------- | ------------ | ----------- | +| `regions` | array of [codersdk.Region](#codersdkregion) | false | | | -## codersdk.TemplateVersionParameter +## codersdk.RegionsResponse-codersdk_WorkspaceProxy ```json { - "default_value": "string", - "description": "string", - "description_plaintext": "string", - "display_name": "string", - "ephemeral": true, - "icon": "string", - "mutable": true, - "name": "string", - "options": [ + "regions": [ { - "description": "string", - "icon": "string", + "created_at": "2019-08-24T14:15:22Z", + "deleted": true, + "derp_enabled": true, + "derp_only": true, + "display_name": "string", + "healthy": true, + "icon_url": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", - "value": "string" + "path_app_url": "string", + "status": { + "checked_at": "2019-08-24T14:15:22Z", + "report": { + "errors": ["string"], + "warnings": ["string"] + }, + "status": "ok" + }, + "updated_at": "2019-08-24T14:15:22Z", + "version": "string", + "wildcard_hostname": "string" } - ], - "required": true, - "type": "string", - "validation_error": "string", - "validation_max": 0, - "validation_min": 0, - "validation_monotonic": "increasing", - "validation_regex": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ----------------------- | ------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `default_value` | string | false | | | -| `description` | string | false | | | -| `description_plaintext` | string | false | | | -| `display_name` | string | false | | | -| `ephemeral` | boolean | false | | | -| `icon` | string | false | | | -| `mutable` | boolean | false | | | -| `name` | string | false | | | -| `options` | array of [codersdk.TemplateVersionParameterOption](#codersdktemplateversionparameteroption) | false | | | -| `required` | boolean | false | | | -| `type` | string | false | | | -| `validation_error` | string | false | | | -| `validation_max` | integer | false | | | -| `validation_min` | integer | false | | | -| `validation_monotonic` | [codersdk.ValidationMonotonicOrder](#codersdkvalidationmonotonicorder) | false | | | -| `validation_regex` | string | false | | | + ] +} +``` -#### Enumerated Values +### Properties -| Property | Value | -| ---------------------- | -------------- | -| `type` | `string` | -| `type` | `number` | -| `type` | `bool` | -| `type` | `list(string)` | -| `validation_monotonic` | `increasing` | -| `validation_monotonic` | `decreasing` | +| Name | Type | Required | Restrictions | Description | +| --------- | ----------------------------------------------------------- | -------- | ------------ | ----------- | +| `regions` | array of [codersdk.WorkspaceProxy](#codersdkworkspaceproxy) | false | | | -## codersdk.TemplateVersionParameterOption +## codersdk.Replica ```json { - "description": "string", - "icon": "string", - "name": "string", - "value": "string" + "created_at": "2019-08-24T14:15:22Z", + "database_latency": 0, + "error": "string", + "hostname": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "region_id": 0, + "relay_address": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------- | ------ | -------- | ------------ | ----------- | -| `description` | string | false | | | -| `icon` | string | false | | | -| `name` | string | false | | | -| `value` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------- | -------- | ------------ | ------------------------------------------------------------------ | +| `created_at` | string | false | | Created at is the timestamp when the replica was first seen. | +| `database_latency` | integer | false | | Database latency is the latency in microseconds to the database. | +| `error` | string | false | | Error is the replica error. | +| `hostname` | string | false | | Hostname is the hostname of the replica. | +| `id` | string | false | | ID is the unique identifier for the replica. | +| `region_id` | integer | false | | Region ID is the region of the replica. | +| `relay_address` | string | false | | Relay address is the accessible address to relay DERP connections. | -## codersdk.TemplateVersionVariable +## codersdk.ResolveAutostartResponse ```json { - "default_value": "string", - "description": "string", - "name": "string", - "required": true, - "sensitive": true, - "type": "string", - "value": "string" + "parameter_mismatch": true } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------------- | ------- | -------- | ------------ | ----------- | -| `default_value` | string | false | | | -| `description` | string | false | | | -| `name` | string | false | | | -| `required` | boolean | false | | | -| `sensitive` | boolean | false | | | -| `type` | string | false | | | -| `value` | string | false | | | - -#### Enumerated Values - -| Property | Value | -| -------- | -------- | -| `type` | `string` | -| `type` | `number` | -| `type` | `bool` | +| Name | Type | Required | Restrictions | Description | +| -------------------- | ------- | -------- | ------------ | ----------- | +| `parameter_mismatch` | boolean | false | | | -## codersdk.TemplateVersionWarning +## codersdk.ResourceType ```json -"UNSUPPORTED_WORKSPACES" +"template" ``` ### Properties #### Enumerated Values -| Value | -| ------------------------ | -| `UNSUPPORTED_WORKSPACES` | - -## codersdk.TokenConfig - -```json -{ - "max_token_lifetime": 0 -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| -------------------- | ------- | -------- | ------------ | ----------- | -| `max_token_lifetime` | integer | false | | | +| Value | +| ------------------ | +| `template` | +| `template_version` | +| `user` | +| `workspace` | +| `workspace_build` | +| `git_ssh_key` | +| `api_key` | +| `group` | +| `license` | +| `convert_login` | +| `health_settings` | +| `workspace_proxy` | +| `organization` | -## codersdk.TraceConfig +## codersdk.Response ```json { - "capture_logs": true, - "data_dog": true, - "enable": true, - "honeycomb_api_key": "string" + "detail": "string", + "message": "string", + "validations": [ + { + "detail": "string", + "field": "string" + } + ] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------- | ------- | -------- | ------------ | ----------- | -| `capture_logs` | boolean | false | | | -| `data_dog` | boolean | false | | | -| `enable` | boolean | false | | | -| `honeycomb_api_key` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------- | ------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `detail` | string | false | | Detail is a debug message that provides further insight into why the action failed. This information can be technical and a regular golang err.Error() text. - "database: too many open connections" - "stat: too many open files" | +| `message` | string | false | | Message is an actionable message that depicts actions the request took. These messages should be fully formed sentences with proper punctuation. Examples: - "A user has been created." - "Failed to create a user." | +| `validations` | array of [codersdk.ValidationError](#codersdkvalidationerror) | false | | Validations are form field-specific friendly error messages. They will be shown on a form field in the UI. These can also be used to add additional context if there is a set of errors in the primary 'Message'. | -## codersdk.TransitionStats +## codersdk.Role ```json { - "p50": 123, - "p95": 146 + "display_name": "string", + "name": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ----- | ------- | -------- | ------------ | ----------- | -| `p50` | integer | false | | | -| `p95` | integer | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------ | -------- | ------------ | ----------- | +| `display_name` | string | false | | | +| `name` | string | false | | | -## codersdk.UpdateActiveTemplateVersion +## codersdk.SSHConfig ```json { - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" + "deploymentName": "string", + "sshconfigOptions": ["string"] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---- | ------ | -------- | ------------ | ----------- | -| `id` | string | true | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | --------------- | -------- | ------------ | --------------------------------------------------------------------------------------------------- | +| `deploymentName` | string | false | | Deploymentname is the config-ssh Hostname prefix | +| `sshconfigOptions` | array of string | false | | Sshconfigoptions are additional options to add to the ssh config file. This will override defaults. | -## codersdk.UpdateAppearanceConfig +## codersdk.SSHConfigResponse ```json { - "application_name": "string", - "logo_url": "string", - "service_banner": { - "background_color": "string", - "enabled": true, - "message": "string" + "hostname_prefix": "string", + "ssh_config_options": { + "property1": "string", + "property2": "string" } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------------------------------------------------------------ | -------- | ------------ | ----------- | -| `application_name` | string | false | | | -| `logo_url` | string | false | | | -| `service_banner` | [codersdk.ServiceBannerConfig](#codersdkservicebannerconfig) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------------- | ------ | -------- | ------------ | ----------- | +| `hostname_prefix` | string | false | | | +| `ssh_config_options` | object | false | | | +| » `[any property]` | string | false | | | -## codersdk.UpdateCheckResponse +## codersdk.STUNReport ```json { - "current": true, - "url": "string", - "version": "string" + "canSTUN": true, + "enabled": true, + "error": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------- | ------- | -------- | ------------ | ----------------------------------------------------------------------- | -| `current` | boolean | false | | Current indicates whether the server version is the same as the latest. | -| `url` | string | false | | URL to download the latest release of Coder. | -| `version` | string | false | | Version is the semantic version for the latest release of Coder. | +| Name | Type | Required | Restrictions | Description | +| --------- | ------- | -------- | ------------ | ----------- | +| `canSTUN` | boolean | false | | | +| `enabled` | boolean | false | | | +| `error` | string | false | | | -## codersdk.UpdateHealthSettings +## codersdk.ServiceBannerConfig ```json { - "dismissed_healthchecks": ["DERP"] + "background_color": "string", + "enabled": true, + "message": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------------ | --------------------------------------------------------- | -------- | ------------ | ----------- | -| `dismissed_healthchecks` | array of [codersdk.HealthSection](#codersdkhealthsection) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------- | -------- | ------------ | ----------- | +| `background_color` | string | false | | | +| `enabled` | boolean | false | | | +| `message` | string | false | | | -## codersdk.UpdateRoles +## codersdk.SessionCountDeploymentStats ```json { - "roles": ["string"] + "jetbrains": 0, + "reconnecting_pty": 0, + "ssh": 0, + "vscode": 0 } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------- | --------------- | -------- | ------------ | ----------- | -| `roles` | array of string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------- | -------- | ------------ | ----------- | +| `jetbrains` | integer | false | | | +| `reconnecting_pty` | integer | false | | | +| `ssh` | integer | false | | | +| `vscode` | integer | false | | | -## codersdk.UpdateTemplateACL +## codersdk.SupportConfig ```json { - "group_perms": { - "8bd26b20-f3e8-48be-a903-46bb920cf671": "use", - ">": "admin" - }, - "user_perms": { - "4df59e74-c027-470b-ab4d-cbba8963a5e9": "use", - "": "admin" + "links": { + "value": [ + { + "icon": "bug", + "name": "string", + "target": "string" + } + ] } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ---------------------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | -| `group_perms` | object | false | | Group perms should be a mapping of group ID to role. | -| » `[any property]` | [codersdk.TemplateRole](#codersdktemplaterole) | false | | | -| `user_perms` | object | false | | User perms should be a mapping of user ID to role. The user ID must be the uuid of the user, not a username or email address. | -| » `[any property]` | [codersdk.TemplateRole](#codersdktemplaterole) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------- | ------------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `links` | [clibase.Struct-array_codersdk_LinkConfig](#clibasestruct-array_codersdk_linkconfig) | false | | | -## codersdk.UpdateUserAppearanceSettingsRequest +## codersdk.SwaggerConfig ```json { - "theme_preference": "string" + "enable": true } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------ | -------- | ------------ | ----------- | -| `theme_preference` | string | true | | | +| Name | Type | Required | Restrictions | Description | +| -------- | ------- | -------- | ------------ | ----------- | +| `enable` | boolean | false | | | -## codersdk.UpdateUserPasswordRequest +## codersdk.TLSConfig ```json { - "old_password": "string", - "password": "string" + "address": { + "host": "string", + "port": "string" + }, + "allow_insecure_ciphers": true, + "cert_file": ["string"], + "client_auth": "string", + "client_ca_file": "string", + "client_cert_file": "string", + "client_key_file": "string", + "enable": true, + "key_file": ["string"], + "min_version": "string", + "redirect_http": true, + "supported_ciphers": ["string"] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------ | -------- | ------------ | ----------- | -| `old_password` | string | false | | | -| `password` | string | true | | | +| Name | Type | Required | Restrictions | Description | +| ------------------------ | ------------------------------------ | -------- | ------------ | ----------- | +| `address` | [clibase.HostPort](#clibasehostport) | false | | | +| `allow_insecure_ciphers` | boolean | false | | | +| `cert_file` | array of string | false | | | +| `client_auth` | string | false | | | +| `client_ca_file` | string | false | | | +| `client_cert_file` | string | false | | | +| `client_key_file` | string | false | | | +| `enable` | boolean | false | | | +| `key_file` | array of string | false | | | +| `min_version` | string | false | | | +| `redirect_http` | boolean | false | | | +| `supported_ciphers` | array of string | false | | | -## codersdk.UpdateUserProfileRequest +## codersdk.TelemetryConfig ```json { - "name": "string", - "username": "string" + "enable": true, + "trace": true, + "url": { + "forceQuery": true, + "fragment": "string", + "host": "string", + "omitHost": true, + "opaque": "string", + "path": "string", + "rawFragment": "string", + "rawPath": "string", + "rawQuery": "string", + "scheme": "string", + "user": {} + } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------- | ------ | -------- | ------------ | ----------- | -| `name` | string | false | | | -| `username` | string | true | | | +| Name | Type | Required | Restrictions | Description | +| -------- | -------------------------- | -------- | ------------ | ----------- | +| `enable` | boolean | false | | | +| `trace` | boolean | false | | | +| `url` | [clibase.URL](#clibaseurl) | false | | | -## codersdk.UpdateUserQuietHoursScheduleRequest +## codersdk.Template ```json { - "schedule": "string" + "active_user_count": 0, + "active_version_id": "eae64611-bd53-4a80-bb77-df1e432c0fbc", + "activity_bump_ms": 0, + "allow_user_autostart": true, + "allow_user_autostop": true, + "allow_user_cancel_workspace_jobs": true, + "autostart_requirement": { + "days_of_week": ["monday"] + }, + "autostop_requirement": { + "days_of_week": ["monday"], + "weeks": 0 + }, + "build_time_stats": { + "property1": { + "p50": 123, + "p95": 146 + }, + "property2": { + "p50": 123, + "p95": 146 + } + }, + "created_at": "2019-08-24T14:15:22Z", + "created_by_id": "9377d689-01fb-4abf-8450-3368d2c1924f", + "created_by_name": "string", + "default_ttl_ms": 0, + "deprecated": true, + "deprecation_message": "string", + "description": "string", + "display_name": "string", + "failure_ttl_ms": 0, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "max_port_share_level": "owner", + "max_ttl_ms": 0, + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "provisioner": "terraform", + "require_active_version": true, + "time_til_dormant_autodelete_ms": 0, + "time_til_dormant_ms": 0, + "updated_at": "2019-08-24T14:15:22Z", + "use_max_ttl": true } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------- | ------ | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `schedule` | string | true | | Schedule is a cron expression that defines when the user's quiet hours window is. Schedule must not be empty. For new users, the schedule is set to 2am in their browser or computer's timezone. The schedule denotes the beginning of a 4 hour window where the workspace is allowed to automatically stop or restart due to maintenance or template max TTL. | +| Name | Type | Required | Restrictions | Description | +| ---------------------------------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `active_user_count` | integer | false | | Active user count is set to -1 when loading. | +| `active_version_id` | string | false | | | +| `activity_bump_ms` | integer | false | | | +| `allow_user_autostart` | boolean | false | | Allow user autostart and AllowUserAutostop are enterprise-only. Their values are only used if your license is entitled to use the advanced template scheduling feature. | +| `allow_user_autostop` | boolean | false | | | +| `allow_user_cancel_workspace_jobs` | boolean | false | | | +| `autostart_requirement` | [codersdk.TemplateAutostartRequirement](#codersdktemplateautostartrequirement) | false | | | +| `autostop_requirement` | [codersdk.TemplateAutostopRequirement](#codersdktemplateautostoprequirement) | false | | Autostop requirement and AutostartRequirement are enterprise features. Its value is only used if your license is entitled to use the advanced template scheduling feature. | +| `build_time_stats` | [codersdk.TemplateBuildTimeStats](#codersdktemplatebuildtimestats) | false | | | +| `created_at` | string | false | | | +| `created_by_id` | string | false | | | +| `created_by_name` | string | false | | | +| `default_ttl_ms` | integer | false | | | +| `deprecated` | boolean | false | | | +| `deprecation_message` | string | false | | | +| `description` | string | false | | | +| `display_name` | string | false | | | +| `failure_ttl_ms` | integer | false | | Failure ttl ms TimeTilDormantMillis, and TimeTilDormantAutoDeleteMillis are enterprise-only. Their values are used if your license is entitled to use the advanced template scheduling feature. | +| `icon` | string | false | | | +| `id` | string | false | | | +| `max_port_share_level` | [codersdk.WorkspaceAgentPortShareLevel](#codersdkworkspaceagentportsharelevel) | false | | | +| `max_ttl_ms` | integer | false | | Max ttl ms remove max_ttl once autostop_requirement is matured | +| `name` | string | false | | | +| `organization_id` | string | false | | | +| `provisioner` | string | false | | | +| `require_active_version` | boolean | false | | Require active version mandates that workspaces are built with the active template version. | +| `time_til_dormant_autodelete_ms` | integer | false | | | +| `time_til_dormant_ms` | integer | false | | | +| `updated_at` | string | false | | | +| `use_max_ttl` | boolean | false | | Use max ttl picks whether to use the deprecated max TTL for the template or the new autostop requirement. | -The schedule must be daily with a single time, and should have a timezone specified via a CRON_TZ prefix (otherwise UTC will be used). -If the schedule is empty, the user will be updated to use the default schedule.| +#### Enumerated Values -## codersdk.UpdateWorkspaceAutomaticUpdatesRequest +| Property | Value | +| ------------- | ----------- | +| `provisioner` | `terraform` | + +## codersdk.TemplateAppUsage ```json { - "automatic_updates": "always" + "display_name": "Visual Studio Code", + "icon": "string", + "seconds": 80500, + "slug": "vscode", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "type": "builtin" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------- | ------------------------------------------------------ | -------- | ------------ | ----------- | -| `automatic_updates` | [codersdk.AutomaticUpdates](#codersdkautomaticupdates) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------------------------------------------------------ | -------- | ------------ | ----------- | +| `display_name` | string | false | | | +| `icon` | string | false | | | +| `seconds` | integer | false | | | +| `slug` | string | false | | | +| `template_ids` | array of string | false | | | +| `type` | [codersdk.TemplateAppsType](#codersdktemplateappstype) | false | | | -## codersdk.UpdateWorkspaceAutostartRequest +## codersdk.TemplateAppsType ```json -{ - "schedule": "string" -} +"builtin" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------- | ------ | -------- | ------------ | ----------- | -| `schedule` | string | false | | | +#### Enumerated Values -## codersdk.UpdateWorkspaceDormancy +| Value | +| --------- | +| `builtin` | +| `app` | + +## codersdk.TemplateAutostartRequirement ```json { - "dormant": true + "days_of_week": ["monday"] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------- | ------- | -------- | ------------ | ----------- | -| `dormant` | boolean | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | --------------- | -------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- | +| `days_of_week` | array of string | false | | Days of week is a list of days of the week in which autostart is allowed to happen. If no days are specified, autostart is not allowed. | -## codersdk.UpdateWorkspaceRequest +## codersdk.TemplateAutostopRequirement ```json { - "name": "string" + "days_of_week": ["monday"], + "weeks": 0 } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------ | ------ | -------- | ------------ | ----------- | -| `name` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------------------------------------------------------------------------- | --------------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `days_of_week` | array of string | false | | Days of week is a list of days of the week on which restarts are required. Restarts happen within the user's quiet hours (in their configured timezone). If no days are specified, restarts are not required. Weekdays cannot be specified twice. | +| Restarts will only happen on weekdays in this list on weeks which line up with Weeks. | +| `weeks` | integer | false | | Weeks is the number of weeks between required restarts. Weeks are synced across all workspaces (and Coder deployments) using modulo math on a hardcoded epoch week of January 2nd, 2023 (the first Monday of 2023). Values of 0 or 1 indicate weekly restarts. Values of 2 indicate fortnightly restarts, etc. | -## codersdk.UpdateWorkspaceTTLRequest +## codersdk.TemplateBuildTimeStats ```json { - "ttl_ms": 0 + "property1": { + "p50": 123, + "p95": 146 + }, + "property2": { + "p50": 123, + "p95": 146 + } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------- | ------- | -------- | ------------ | ----------- | -| `ttl_ms` | integer | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------------- | ---------------------------------------------------- | -------- | ------------ | ----------- | +| `[any property]` | [codersdk.TransitionStats](#codersdktransitionstats) | false | | | -## codersdk.UploadResponse +## codersdk.TemplateExample ```json { - "hash": "19686d84-b10d-4f90-b18e-84fd3fa038fd" + "description": "string", + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "markdown": "string", + "name": "string", + "tags": ["string"], + "url": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------ | ------ | -------- | ------------ | ----------- | -| `hash` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------- | --------------- | -------- | ------------ | ----------- | +| `description` | string | false | | | +| `icon` | string | false | | | +| `id` | string | false | | | +| `markdown` | string | false | | | +| `name` | string | false | | | +| `tags` | array of string | false | | | +| `url` | string | false | | | -## codersdk.UpsertWorkspaceAgentPortShareRequest +## codersdk.TemplateInsightsIntervalReport ```json { - "agent_name": "string", - "port": 0, - "share_level": "owner" + "active_users": 14, + "end_time": "2019-08-24T14:15:22Z", + "interval": "week", + "start_time": "2019-08-24T14:15:22Z", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | -| `agent_name` | string | false | | | -| `port` | integer | false | | | -| `share_level` | [codersdk.WorkspaceAgentPortShareLevel](#codersdkworkspaceagentportsharelevel) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `active_users` | integer | false | | | +| `end_time` | string | false | | | +| `interval` | [codersdk.InsightsReportInterval](#codersdkinsightsreportinterval) | false | | | +| `start_time` | string | false | | | +| `template_ids` | array of string | false | | | -## codersdk.User +## codersdk.TemplateInsightsReport ```json { - "avatar_url": "http://example.com", - "created_at": "2019-08-24T14:15:22Z", - "email": "user@example.com", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "last_seen_at": "2019-08-24T14:15:22Z", - "login_type": "", - "name": "string", - "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "roles": [ + "active_users": 22, + "apps_usage": [ + { + "display_name": "Visual Studio Code", + "icon": "string", + "seconds": 80500, + "slug": "vscode", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "type": "builtin" + } + ], + "end_time": "2019-08-24T14:15:22Z", + "parameters_usage": [ { + "description": "string", "display_name": "string", - "name": "string" + "name": "string", + "options": [ + { + "description": "string", + "icon": "string", + "name": "string", + "value": "string" + } + ], + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "type": "string", + "values": [ + { + "count": 0, + "value": "string" + } + ] } ], - "status": "active", - "theme_preference": "string", - "username": "string" + "start_time": "2019-08-24T14:15:22Z", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------------------------------------------ | -------- | ------------ | ----------- | -| `avatar_url` | string | false | | | -| `created_at` | string | true | | | -| `email` | string | true | | | -| `id` | string | true | | | -| `last_seen_at` | string | false | | | -| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | | -| `name` | string | false | | | -| `organization_ids` | array of string | false | | | -| `roles` | array of [codersdk.Role](#codersdkrole) | false | | | -| `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | -| `theme_preference` | string | false | | | -| `username` | string | true | | | - -#### Enumerated Values - -| Property | Value | -| -------- | ----------- | -| `status` | `active` | -| `status` | `suspended` | +| Name | Type | Required | Restrictions | Description | +| ------------------ | --------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `active_users` | integer | false | | | +| `apps_usage` | array of [codersdk.TemplateAppUsage](#codersdktemplateappusage) | false | | | +| `end_time` | string | false | | | +| `parameters_usage` | array of [codersdk.TemplateParameterUsage](#codersdktemplateparameterusage) | false | | | +| `start_time` | string | false | | | +| `template_ids` | array of string | false | | | -## codersdk.UserActivity +## codersdk.TemplateInsightsResponse ```json { - "avatar_url": "http://example.com", - "seconds": 80500, - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", - "username": "string" + "interval_reports": [ + { + "active_users": 14, + "end_time": "2019-08-24T14:15:22Z", + "interval": "week", + "start_time": "2019-08-24T14:15:22Z", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"] + } + ], + "report": { + "active_users": 22, + "apps_usage": [ + { + "display_name": "Visual Studio Code", + "icon": "string", + "seconds": 80500, + "slug": "vscode", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "type": "builtin" + } + ], + "end_time": "2019-08-24T14:15:22Z", + "parameters_usage": [ + { + "description": "string", + "display_name": "string", + "name": "string", + "options": [ + { + "description": "string", + "icon": "string", + "name": "string", + "value": "string" + } + ], + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "type": "string", + "values": [ + { + "count": 0, + "value": "string" + } + ] + } + ], + "start_time": "2019-08-24T14:15:22Z", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"] + } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | --------------- | -------- | ------------ | ----------- | -| `avatar_url` | string | false | | | -| `seconds` | integer | false | | | -| `template_ids` | array of string | false | | | -| `user_id` | string | false | | | -| `username` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `interval_reports` | array of [codersdk.TemplateInsightsIntervalReport](#codersdktemplateinsightsintervalreport) | false | | | +| `report` | [codersdk.TemplateInsightsReport](#codersdktemplateinsightsreport) | false | | | -## codersdk.UserActivityInsightsReport +## codersdk.TemplateParameterUsage ```json { - "end_time": "2019-08-24T14:15:22Z", - "start_time": "2019-08-24T14:15:22Z", + "description": "string", + "display_name": "string", + "name": "string", + "options": [ + { + "description": "string", + "icon": "string", + "name": "string", + "value": "string" + } + ], "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "users": [ + "type": "string", + "values": [ { - "avatar_url": "http://example.com", - "seconds": 80500, - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", - "username": "string" + "count": 0, + "value": "string" } ] } @@ -5772,752 +5995,718 @@ If the schedule is empty, the user will be updated to use the default schedule.| ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------------------------------------------------------- | -------- | ------------ | ----------- | -| `end_time` | string | false | | | -| `start_time` | string | false | | | -| `template_ids` | array of string | false | | | -| `users` | array of [codersdk.UserActivity](#codersdkuseractivity) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `description` | string | false | | | +| `display_name` | string | false | | | +| `name` | string | false | | | +| `options` | array of [codersdk.TemplateVersionParameterOption](#codersdktemplateversionparameteroption) | false | | | +| `template_ids` | array of string | false | | | +| `type` | string | false | | | +| `values` | array of [codersdk.TemplateParameterValue](#codersdktemplateparametervalue) | false | | | -## codersdk.UserActivityInsightsResponse +## codersdk.TemplateParameterValue ```json { - "report": { - "end_time": "2019-08-24T14:15:22Z", - "start_time": "2019-08-24T14:15:22Z", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "users": [ - { - "avatar_url": "http://example.com", - "seconds": 80500, - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", - "username": "string" - } - ] - } + "count": 0, + "value": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------- | -------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `report` | [codersdk.UserActivityInsightsReport](#codersdkuseractivityinsightsreport) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------- | ------- | -------- | ------------ | ----------- | +| `count` | integer | false | | | +| `value` | string | false | | | -## codersdk.UserLatency +## codersdk.TemplateRole ```json -{ - "avatar_url": "http://example.com", - "latency_ms": { - "p50": 31.312, - "p95": 119.832 - }, - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", - "username": "string" -} +"admin" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | -------------------------------------------------------- | -------- | ------------ | ----------- | -| `avatar_url` | string | false | | | -| `latency_ms` | [codersdk.ConnectionLatency](#codersdkconnectionlatency) | false | | | -| `template_ids` | array of string | false | | | -| `user_id` | string | false | | | -| `username` | string | false | | | +#### Enumerated Values -## codersdk.UserLatencyInsightsReport +| Value | +| ------- | +| `admin` | +| `use` | +| `` | + +## codersdk.TemplateUser ```json { - "end_time": "2019-08-24T14:15:22Z", - "start_time": "2019-08-24T14:15:22Z", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "users": [ + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", + "email": "user@example.com", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "login_type": "", + "name": "string", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "role": "admin", + "roles": [ { - "avatar_url": "http://example.com", - "latency_ms": { - "p50": 31.312, - "p95": 119.832 - }, - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", - "username": "string" + "display_name": "string", + "name": "string" } - ] + ], + "status": "active", + "theme_preference": "string", + "username": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ----------------------------------------------------- | -------- | ------------ | ----------- | -| `end_time` | string | false | | | -| `start_time` | string | false | | | -| `template_ids` | array of string | false | | | -| `users` | array of [codersdk.UserLatency](#codersdkuserlatency) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | ---------------------------------------------- | -------- | ------------ | ----------- | +| `avatar_url` | string | false | | | +| `created_at` | string | true | | | +| `email` | string | true | | | +| `id` | string | true | | | +| `last_seen_at` | string | false | | | +| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | | +| `name` | string | false | | | +| `organization_ids` | array of string | false | | | +| `role` | [codersdk.TemplateRole](#codersdktemplaterole) | false | | | +| `roles` | array of [codersdk.Role](#codersdkrole) | false | | | +| `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | +| `theme_preference` | string | false | | | +| `username` | string | true | | | -## codersdk.UserLatencyInsightsResponse +#### Enumerated Values + +| Property | Value | +| -------- | ----------- | +| `role` | `admin` | +| `role` | `use` | +| `status` | `active` | +| `status` | `suspended` | + +## codersdk.TemplateVersion ```json { - "report": { - "end_time": "2019-08-24T14:15:22Z", - "start_time": "2019-08-24T14:15:22Z", - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "users": [ - { - "avatar_url": "http://example.com", - "latency_ms": { - "p50": 31.312, - "p95": 119.832 - }, - "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", - "username": "string" - } - ] - } + "archived": true, + "created_at": "2019-08-24T14:15:22Z", + "created_by": { + "avatar_url": "http://example.com", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "username": "string" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "error_code": "REQUIRED_TEMPLATE_VARIABLES", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "queue_position": 0, + "queue_size": 0, + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" + }, + "message": "string", + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "readme": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "updated_at": "2019-08-24T14:15:22Z", + "warnings": ["UNSUPPORTED_WORKSPACES"] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------- | ------------------------------------------------------------------------ | -------- | ------------ | ----------- | -| `report` | [codersdk.UserLatencyInsightsReport](#codersdkuserlatencyinsightsreport) | false | | | +| Name | Type | Required | Restrictions | Description | +| ----------------- | --------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `archived` | boolean | false | | | +| `created_at` | string | false | | | +| `created_by` | [codersdk.MinimalUser](#codersdkminimaluser) | false | | | +| `id` | string | false | | | +| `job` | [codersdk.ProvisionerJob](#codersdkprovisionerjob) | false | | | +| `message` | string | false | | | +| `name` | string | false | | | +| `organization_id` | string | false | | | +| `readme` | string | false | | | +| `template_id` | string | false | | | +| `updated_at` | string | false | | | +| `warnings` | array of [codersdk.TemplateVersionWarning](#codersdktemplateversionwarning) | false | | | -## codersdk.UserLoginType +## codersdk.TemplateVersionExternalAuth ```json { - "login_type": "" + "authenticate_url": "string", + "authenticated": true, + "display_icon": "string", + "display_name": "string", + "id": "string", + "optional": true, + "type": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------ | ---------------------------------------- | -------- | ------------ | ----------- | -| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------- | -------- | ------------ | ----------- | +| `authenticate_url` | string | false | | | +| `authenticated` | boolean | false | | | +| `display_icon` | string | false | | | +| `display_name` | string | false | | | +| `id` | string | false | | | +| `optional` | boolean | false | | | +| `type` | string | false | | | -## codersdk.UserParameter +## codersdk.TemplateVersionParameter ```json { + "default_value": "string", + "description": "string", + "description_plaintext": "string", + "display_name": "string", + "ephemeral": true, + "icon": "string", + "mutable": true, "name": "string", - "value": "string" + "options": [ + { + "description": "string", + "icon": "string", + "name": "string", + "value": "string" + } + ], + "required": true, + "type": "string", + "validation_error": "string", + "validation_max": 0, + "validation_min": 0, + "validation_monotonic": "increasing", + "validation_regex": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------- | ------ | -------- | ------------ | ----------- | -| `name` | string | false | | | -| `value` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ----------------------- | ------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `default_value` | string | false | | | +| `description` | string | false | | | +| `description_plaintext` | string | false | | | +| `display_name` | string | false | | | +| `ephemeral` | boolean | false | | | +| `icon` | string | false | | | +| `mutable` | boolean | false | | | +| `name` | string | false | | | +| `options` | array of [codersdk.TemplateVersionParameterOption](#codersdktemplateversionparameteroption) | false | | | +| `required` | boolean | false | | | +| `type` | string | false | | | +| `validation_error` | string | false | | | +| `validation_max` | integer | false | | | +| `validation_min` | integer | false | | | +| `validation_monotonic` | [codersdk.ValidationMonotonicOrder](#codersdkvalidationmonotonicorder) | false | | | +| `validation_regex` | string | false | | | -## codersdk.UserQuietHoursScheduleConfig +#### Enumerated Values + +| Property | Value | +| ---------------------- | -------------- | +| `type` | `string` | +| `type` | `number` | +| `type` | `bool` | +| `type` | `list(string)` | +| `validation_monotonic` | `increasing` | +| `validation_monotonic` | `decreasing` | + +## codersdk.TemplateVersionParameterOption ```json { - "allow_user_custom": true, - "default_schedule": "string" + "description": "string", + "icon": "string", + "name": "string", + "value": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------- | ------- | -------- | ------------ | ----------- | -| `allow_user_custom` | boolean | false | | | -| `default_schedule` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------- | ------ | -------- | ------------ | ----------- | +| `description` | string | false | | | +| `icon` | string | false | | | +| `name` | string | false | | | +| `value` | string | false | | | -## codersdk.UserQuietHoursScheduleResponse +## codersdk.TemplateVersionVariable ```json { - "next": "2019-08-24T14:15:22Z", - "raw_schedule": "string", - "time": "string", - "timezone": "string", - "user_can_set": true, - "user_set": true + "default_value": "string", + "description": "string", + "name": "string", + "required": true, + "sensitive": true, + "type": "string", + "value": "string" } ``` -### Properties +### Properties + +| Name | Type | Required | Restrictions | Description | +| --------------- | ------- | -------- | ------------ | ----------- | +| `default_value` | string | false | | | +| `description` | string | false | | | +| `name` | string | false | | | +| `required` | boolean | false | | | +| `sensitive` | boolean | false | | | +| `type` | string | false | | | +| `value` | string | false | | | + +#### Enumerated Values -| Name | Type | Required | Restrictions | Description | -| -------------- | ------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `next` | string | false | | Next is the next time that the quiet hours window will start. | -| `raw_schedule` | string | false | | | -| `time` | string | false | | Time is the time of day that the quiet hours window starts in the given Timezone each day. | -| `timezone` | string | false | | raw format from the cron expression, UTC if unspecified | -| `user_can_set` | boolean | false | | User can set is true if the user is allowed to set their own quiet hours schedule. If false, the user cannot set a custom schedule and the default schedule will always be used. | -| `user_set` | boolean | false | | User set is true if the user has set their own quiet hours schedule. If false, the user is using the default schedule. | +| Property | Value | +| -------- | -------- | +| `type` | `string` | +| `type` | `number` | +| `type` | `bool` | -## codersdk.UserStatus +## codersdk.TemplateVersionWarning ```json -"active" +"UNSUPPORTED_WORKSPACES" ``` ### Properties #### Enumerated Values -| Value | -| ----------- | -| `active` | -| `dormant` | -| `suspended` | +| Value | +| ------------------------ | +| `UNSUPPORTED_WORKSPACES` | -## codersdk.ValidationError +## codersdk.TokenConfig ```json { - "detail": "string", - "field": "string" + "max_token_lifetime": 0 } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------- | ------ | -------- | ------------ | ----------- | -| `detail` | string | true | | | -| `field` | string | true | | | +| Name | Type | Required | Restrictions | Description | +| -------------------- | ------- | -------- | ------------ | ----------- | +| `max_token_lifetime` | integer | false | | | -## codersdk.ValidationMonotonicOrder +## codersdk.TraceConfig ```json -"increasing" +{ + "capture_logs": true, + "data_dog": true, + "enable": true, + "honeycomb_api_key": "string" +} ``` ### Properties -#### Enumerated Values - -| Value | -| ------------ | -| `increasing` | -| `decreasing` | +| Name | Type | Required | Restrictions | Description | +| ------------------- | ------- | -------- | ------------ | ----------- | +| `capture_logs` | boolean | false | | | +| `data_dog` | boolean | false | | | +| `enable` | boolean | false | | | +| `honeycomb_api_key` | string | false | | | -## codersdk.VariableValue +## codersdk.TransitionStats ```json { - "name": "string", - "value": "string" + "p50": 123, + "p95": 146 } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------- | ------ | -------- | ------------ | ----------- | -| `name` | string | false | | | -| `value` | string | false | | | - -## codersdk.Workspace - -```json -{ - "allow_renames": true, - "automatic_updates": "always", - "autostart_schedule": "string", - "created_at": "2019-08-24T14:15:22Z", - "deleting_at": "2019-08-24T14:15:22Z", - "dormant_at": "2019-08-24T14:15:22Z", - "favorite": true, - "health": { - "failing_agents": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "healthy": false - }, - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "last_used_at": "2019-08-24T14:15:22Z", - "latest_build": { - "build_number": 0, - "created_at": "2019-08-24T14:15:22Z", - "daily_cost": 0, - "deadline": "2019-08-24T14:15:22Z", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", - "initiator_name": "string", - "job": { - "canceled_at": "2019-08-24T14:15:22Z", - "completed_at": "2019-08-24T14:15:22Z", - "created_at": "2019-08-24T14:15:22Z", - "error": "string", - "error_code": "REQUIRED_TEMPLATE_VARIABLES", - "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "queue_position": 0, - "queue_size": 0, - "started_at": "2019-08-24T14:15:22Z", - "status": "pending", - "tags": { - "property1": "string", - "property2": "string" - }, - "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" - }, - "max_deadline": "2019-08-24T14:15:22Z", - "reason": "initiator", - "resources": [ - { - "agents": [ - { - "api_version": "string", - "apps": [ - { - "command": "string", - "display_name": "string", - "external": true, - "health": "disabled", - "healthcheck": { - "interval": 0, - "threshold": 0, - "url": "string" - }, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "sharing_level": "owner", - "slug": "string", - "subdomain": true, - "subdomain_name": "string", - "url": "string" - } - ], - "architecture": "string", - "connection_timeout_seconds": 0, - "created_at": "2019-08-24T14:15:22Z", - "directory": "string", - "disconnected_at": "2019-08-24T14:15:22Z", - "display_apps": ["vscode"], - "environment_variables": { - "property1": "string", - "property2": "string" - }, - "expanded_directory": "string", - "first_connected_at": "2019-08-24T14:15:22Z", - "health": { - "healthy": false, - "reason": "agent has lost connection" - }, - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "instance_id": "string", - "last_connected_at": "2019-08-24T14:15:22Z", - "latency": { - "property1": { - "latency_ms": 0, - "preferred": true - }, - "property2": { - "latency_ms": 0, - "preferred": true - } - }, - "lifecycle_state": "created", - "log_sources": [ - { - "created_at": "2019-08-24T14:15:22Z", - "display_name": "string", - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" - } - ], - "logs_length": 0, - "logs_overflowed": true, - "name": "string", - "operating_system": "string", - "ready_at": "2019-08-24T14:15:22Z", - "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", - "scripts": [ - { - "cron": "string", - "log_path": "string", - "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", - "run_on_start": true, - "run_on_stop": true, - "script": "string", - "start_blocks_login": true, - "timeout": 0 - } - ], - "started_at": "2019-08-24T14:15:22Z", - "startup_script_behavior": "blocking", - "status": "connecting", - "subsystems": ["envbox"], - "troubleshooting_url": "string", - "updated_at": "2019-08-24T14:15:22Z", - "version": "string" - } - ], - "created_at": "2019-08-24T14:15:22Z", - "daily_cost": 0, - "hide": true, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", - "metadata": [ - { - "key": "string", - "sensitive": true, - "value": "string" - } - ], - "name": "string", - "type": "string", - "workspace_transition": "start" - } - ], - "status": "pending", - "template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1", - "template_version_name": "string", - "transition": "start", - "updated_at": "2019-08-24T14:15:22Z", - "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", - "workspace_name": "string", - "workspace_owner_avatar_url": "string", - "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string" - }, - "name": "string", - "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", - "outdated": true, - "owner_avatar_url": "string", - "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05", - "owner_name": "string", - "template_active_version_id": "b0da9c29-67d8-4c87-888c-bafe356f7f3c", - "template_allow_user_cancel_workspace_jobs": true, - "template_display_name": "string", - "template_icon": "string", - "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", - "template_name": "string", - "template_require_active_version": true, - "ttl_ms": 0, - "updated_at": "2019-08-24T14:15:22Z" +| Name | Type | Required | Restrictions | Description | +| ----- | ------- | -------- | ------------ | ----------- | +| `p50` | integer | false | | | +| `p95` | integer | false | | | + +## codersdk.UpdateActiveTemplateVersion + +```json +{ + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------------------------------- | ------------------------------------------------------ | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allow_renames` | boolean | false | | | -| `automatic_updates` | [codersdk.AutomaticUpdates](#codersdkautomaticupdates) | false | | | -| `autostart_schedule` | string | false | | | -| `created_at` | string | false | | | -| `deleting_at` | string | false | | Deleting at indicates the time at which the workspace will be permanently deleted. A workspace is eligible for deletion if it is dormant (a non-nil dormant_at value) and a value has been specified for time_til_dormant_autodelete on its template. | -| `dormant_at` | string | false | | Dormant at being non-nil indicates a workspace that is dormant. A dormant workspace is no longer accessible must be activated. It is subject to deletion if it breaches the duration of the time*til* field on its template. | -| `favorite` | boolean | false | | | -| `health` | [codersdk.WorkspaceHealth](#codersdkworkspacehealth) | false | | Health shows the health of the workspace and information about what is causing an unhealthy status. | -| `id` | string | false | | | -| `last_used_at` | string | false | | | -| `latest_build` | [codersdk.WorkspaceBuild](#codersdkworkspacebuild) | false | | | -| `name` | string | false | | | -| `organization_id` | string | false | | | -| `outdated` | boolean | false | | | -| `owner_avatar_url` | string | false | | | -| `owner_id` | string | false | | | -| `owner_name` | string | false | | | -| `template_active_version_id` | string | false | | | -| `template_allow_user_cancel_workspace_jobs` | boolean | false | | | -| `template_display_name` | string | false | | | -| `template_icon` | string | false | | | -| `template_id` | string | false | | | -| `template_name` | string | false | | | -| `template_require_active_version` | boolean | false | | | -| `ttl_ms` | integer | false | | | -| `updated_at` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ---- | ------ | -------- | ------------ | ----------- | +| `id` | string | true | | | -#### Enumerated Values +## codersdk.UpdateAppearanceConfig -| Property | Value | -| ------------------- | -------- | -| `automatic_updates` | `always` | -| `automatic_updates` | `never` | +```json +{ + "application_name": "string", + "logo_url": "string", + "service_banner": { + "background_color": "string", + "enabled": true, + "message": "string" + } +} +``` -## codersdk.WorkspaceAgent +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------------------------------------------------------------ | -------- | ------------ | ----------- | +| `application_name` | string | false | | | +| `logo_url` | string | false | | | +| `service_banner` | [codersdk.ServiceBannerConfig](#codersdkservicebannerconfig) | false | | | + +## codersdk.UpdateCheckResponse ```json { - "api_version": "string", - "apps": [ - { - "command": "string", - "display_name": "string", - "external": true, - "health": "disabled", - "healthcheck": { - "interval": 0, - "threshold": 0, - "url": "string" - }, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "sharing_level": "owner", - "slug": "string", - "subdomain": true, - "subdomain_name": "string", - "url": "string" - } - ], - "architecture": "string", - "connection_timeout_seconds": 0, - "created_at": "2019-08-24T14:15:22Z", - "directory": "string", - "disconnected_at": "2019-08-24T14:15:22Z", - "display_apps": ["vscode"], - "environment_variables": { - "property1": "string", - "property2": "string" - }, - "expanded_directory": "string", - "first_connected_at": "2019-08-24T14:15:22Z", - "health": { - "healthy": false, - "reason": "agent has lost connection" - }, - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "instance_id": "string", - "last_connected_at": "2019-08-24T14:15:22Z", - "latency": { - "property1": { - "latency_ms": 0, - "preferred": true - }, - "property2": { - "latency_ms": 0, - "preferred": true - } + "current": true, + "url": "string", + "version": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| --------- | ------- | -------- | ------------ | ----------------------------------------------------------------------- | +| `current` | boolean | false | | Current indicates whether the server version is the same as the latest. | +| `url` | string | false | | URL to download the latest release of Coder. | +| `version` | string | false | | Version is the semantic version for the latest release of Coder. | + +## codersdk.UpdateHealthSettings + +```json +{ + "dismissed_healthchecks": ["DERP"] +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------------ | --------------------------------------------------------- | -------- | ------------ | ----------- | +| `dismissed_healthchecks` | array of [codersdk.HealthSection](#codersdkhealthsection) | false | | | + +## codersdk.UpdateRoles + +```json +{ + "roles": ["string"] +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------- | --------------- | -------- | ------------ | ----------- | +| `roles` | array of string | false | | | + +## codersdk.UpdateTemplateACL + +```json +{ + "group_perms": { + "8bd26b20-f3e8-48be-a903-46bb920cf671": "use", + ">": "admin" }, - "lifecycle_state": "created", - "log_sources": [ - { - "created_at": "2019-08-24T14:15:22Z", - "display_name": "string", - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" - } - ], - "logs_length": 0, - "logs_overflowed": true, + "user_perms": { + "4df59e74-c027-470b-ab4d-cbba8963a5e9": "use", + "": "admin" + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------ | ---------------------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | +| `group_perms` | object | false | | Group perms should be a mapping of group ID to role. | +| » `[any property]` | [codersdk.TemplateRole](#codersdktemplaterole) | false | | | +| `user_perms` | object | false | | User perms should be a mapping of user ID to role. The user ID must be the uuid of the user, not a username or email address. | +| » `[any property]` | [codersdk.TemplateRole](#codersdktemplaterole) | false | | | + +## codersdk.UpdateUserAppearanceSettingsRequest + +```json +{ + "theme_preference": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------ | -------- | ------------ | ----------- | +| `theme_preference` | string | true | | | + +## codersdk.UpdateUserPasswordRequest + +```json +{ + "old_password": "string", + "password": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------------- | ------ | -------- | ------------ | ----------- | +| `old_password` | string | false | | | +| `password` | string | true | | | + +## codersdk.UpdateUserProfileRequest + +```json +{ "name": "string", - "operating_system": "string", - "ready_at": "2019-08-24T14:15:22Z", - "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", - "scripts": [ - { - "cron": "string", - "log_path": "string", - "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", - "run_on_start": true, - "run_on_stop": true, - "script": "string", - "start_blocks_login": true, - "timeout": 0 - } - ], - "started_at": "2019-08-24T14:15:22Z", - "startup_script_behavior": "blocking", - "status": "connecting", - "subsystems": ["envbox"], - "troubleshooting_url": "string", - "updated_at": "2019-08-24T14:15:22Z", - "version": "string" + "username": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ---------- | ------ | -------- | ------------ | ----------- | +| `name` | string | false | | | +| `username` | string | true | | | + +## codersdk.UpdateUserQuietHoursScheduleRequest + +```json +{ + "schedule": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------------------------- | -------------------------------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `api_version` | string | false | | | -| `apps` | array of [codersdk.WorkspaceApp](#codersdkworkspaceapp) | false | | | -| `architecture` | string | false | | | -| `connection_timeout_seconds` | integer | false | | | -| `created_at` | string | false | | | -| `directory` | string | false | | | -| `disconnected_at` | string | false | | | -| `display_apps` | array of [codersdk.DisplayApp](#codersdkdisplayapp) | false | | | -| `environment_variables` | object | false | | | -| » `[any property]` | string | false | | | -| `expanded_directory` | string | false | | | -| `first_connected_at` | string | false | | | -| `health` | [codersdk.WorkspaceAgentHealth](#codersdkworkspaceagenthealth) | false | | Health reports the health of the agent. | -| `id` | string | false | | | -| `instance_id` | string | false | | | -| `last_connected_at` | string | false | | | -| `latency` | object | false | | Latency is mapped by region name (e.g. "New York City", "Seattle"). | -| » `[any property]` | [codersdk.DERPRegion](#codersdkderpregion) | false | | | -| `lifecycle_state` | [codersdk.WorkspaceAgentLifecycle](#codersdkworkspaceagentlifecycle) | false | | | -| `log_sources` | array of [codersdk.WorkspaceAgentLogSource](#codersdkworkspaceagentlogsource) | false | | | -| `logs_length` | integer | false | | | -| `logs_overflowed` | boolean | false | | | -| `name` | string | false | | | -| `operating_system` | string | false | | | -| `ready_at` | string | false | | | -| `resource_id` | string | false | | | -| `scripts` | array of [codersdk.WorkspaceAgentScript](#codersdkworkspaceagentscript) | false | | | -| `started_at` | string | false | | | -| `startup_script_behavior` | [codersdk.WorkspaceAgentStartupScriptBehavior](#codersdkworkspaceagentstartupscriptbehavior) | false | | Startup script behavior is a legacy field that is deprecated in favor of the `coder_script` resource. It's only referenced by old clients. Deprecated: Remove in the future! | -| `status` | [codersdk.WorkspaceAgentStatus](#codersdkworkspaceagentstatus) | false | | | -| `subsystems` | array of [codersdk.AgentSubsystem](#codersdkagentsubsystem) | false | | | -| `troubleshooting_url` | string | false | | | -| `updated_at` | string | false | | | -| `version` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------- | ------ | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `schedule` | string | true | | Schedule is a cron expression that defines when the user's quiet hours window is. Schedule must not be empty. For new users, the schedule is set to 2am in their browser or computer's timezone. The schedule denotes the beginning of a 4 hour window where the workspace is allowed to automatically stop or restart due to maintenance or template max TTL. | -## codersdk.WorkspaceAgentConnectionInfo +The schedule must be daily with a single time, and should have a timezone specified via a CRON_TZ prefix (otherwise UTC will be used). +If the schedule is empty, the user will be updated to use the default schedule.| + +## codersdk.UpdateWorkspaceAutomaticUpdatesRequest ```json { - "derp_force_websockets": true, - "derp_map": { - "homeParams": { - "regionScore": { - "property1": 0, - "property2": 0 - } - }, - "omitDefaultRegions": true, - "regions": { - "property1": { - "avoid": true, - "embeddedRelay": true, - "nodes": [ - { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - } - ], - "regionCode": "string", - "regionID": 0, - "regionName": "string" - }, - "property2": { - "avoid": true, - "embeddedRelay": true, - "nodes": [ - { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - } - ], - "regionCode": "string", - "regionID": 0, - "regionName": "string" - } - } - }, - "disable_direct_connections": true + "automatic_updates": "always" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------------------------- | ---------------------------------- | -------- | ------------ | ----------- | -| `derp_force_websockets` | boolean | false | | | -| `derp_map` | [tailcfg.DERPMap](#tailcfgderpmap) | false | | | -| `disable_direct_connections` | boolean | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------- | ------------------------------------------------------ | -------- | ------------ | ----------- | +| `automatic_updates` | [codersdk.AutomaticUpdates](#codersdkautomaticupdates) | false | | | -## codersdk.WorkspaceAgentHealth +## codersdk.UpdateWorkspaceAutostartRequest ```json { - "healthy": false, - "reason": "agent has lost connection" + "schedule": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------- | ------- | -------- | ------------ | --------------------------------------------------------------------------------------------- | -| `healthy` | boolean | false | | Healthy is true if the agent is healthy. | -| `reason` | string | false | | Reason is a human-readable explanation of the agent's health. It is empty if Healthy is true. | +| Name | Type | Required | Restrictions | Description | +| ---------- | ------ | -------- | ------------ | ----------- | +| `schedule` | string | false | | | -## codersdk.WorkspaceAgentLifecycle +## codersdk.UpdateWorkspaceDormancy ```json -"created" +{ + "dormant": true +} ``` ### Properties -#### Enumerated Values +| Name | Type | Required | Restrictions | Description | +| --------- | ------- | -------- | ------------ | ----------- | +| `dormant` | boolean | false | | | -| Value | -| ------------------ | -| `created` | -| `starting` | -| `start_timeout` | -| `start_error` | -| `ready` | -| `shutting_down` | -| `shutdown_timeout` | -| `shutdown_error` | -| `off` | +## codersdk.UpdateWorkspaceRequest + +```json +{ + "name": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------ | ------ | -------- | ------------ | ----------- | +| `name` | string | false | | | + +## codersdk.UpdateWorkspaceTTLRequest + +```json +{ + "ttl_ms": 0 +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------- | ------- | -------- | ------------ | ----------- | +| `ttl_ms` | integer | false | | | + +## codersdk.UploadResponse + +```json +{ + "hash": "19686d84-b10d-4f90-b18e-84fd3fa038fd" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------ | ------ | -------- | ------------ | ----------- | +| `hash` | string | false | | | + +## codersdk.UpsertWorkspaceAgentPortShareRequest + +```json +{ + "agent_name": "string", + "port": 0, + "share_level": "owner" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `agent_name` | string | false | | | +| `port` | integer | false | | | +| `share_level` | [codersdk.WorkspaceAgentPortShareLevel](#codersdkworkspaceagentportsharelevel) | false | | | + +## codersdk.User + +```json +{ + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", + "email": "user@example.com", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "login_type": "", + "name": "string", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "active", + "theme_preference": "string", + "username": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------------------------------------------ | -------- | ------------ | ----------- | +| `avatar_url` | string | false | | | +| `created_at` | string | true | | | +| `email` | string | true | | | +| `id` | string | true | | | +| `last_seen_at` | string | false | | | +| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | | +| `name` | string | false | | | +| `organization_ids` | array of string | false | | | +| `roles` | array of [codersdk.Role](#codersdkrole) | false | | | +| `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | +| `theme_preference` | string | false | | | +| `username` | string | true | | | -## codersdk.WorkspaceAgentListeningPort +#### Enumerated Values + +| Property | Value | +| -------- | ----------- | +| `status` | `active` | +| `status` | `suspended` | + +## codersdk.UserActivity ```json { - "network": "string", - "port": 0, - "process_name": "string" + "avatar_url": "http://example.com", + "seconds": 80500, + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", + "username": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------- | -------- | ------------ | ------------------------ | -| `network` | string | false | | only "tcp" at the moment | -| `port` | integer | false | | | -| `process_name` | string | false | | may be empty | +| Name | Type | Required | Restrictions | Description | +| -------------- | --------------- | -------- | ------------ | ----------- | +| `avatar_url` | string | false | | | +| `seconds` | integer | false | | | +| `template_ids` | array of string | false | | | +| `user_id` | string | false | | | +| `username` | string | false | | | -## codersdk.WorkspaceAgentListeningPortsResponse +## codersdk.UserActivityInsightsReport ```json { - "ports": [ + "end_time": "2019-08-24T14:15:22Z", + "start_time": "2019-08-24T14:15:22Z", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "users": [ { - "network": "string", - "port": 0, - "process_name": "string" + "avatar_url": "http://example.com", + "seconds": 80500, + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", + "username": "string" } ] } @@ -6525,2151 +6714,1962 @@ If the schedule is empty, the user will be updated to use the default schedule.| ### Properties -| Name | Type | Required | Restrictions | Description | -| ------- | ------------------------------------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `ports` | array of [codersdk.WorkspaceAgentListeningPort](#codersdkworkspaceagentlisteningport) | false | | If there are no ports in the list, nothing should be displayed in the UI. There must not be a "no ports available" message or anything similar, as there will always be no ports displayed on platforms where our port detection logic is unsupported. | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------------------------------------------------------- | -------- | ------------ | ----------- | +| `end_time` | string | false | | | +| `start_time` | string | false | | | +| `template_ids` | array of string | false | | | +| `users` | array of [codersdk.UserActivity](#codersdkuseractivity) | false | | | -## codersdk.WorkspaceAgentLog +## codersdk.UserActivityInsightsResponse ```json { - "created_at": "2019-08-24T14:15:22Z", - "id": 0, - "level": "trace", - "output": "string", - "source_id": "ae50a35c-df42-4eff-ba26-f8bc28d2af81" + "report": { + "end_time": "2019-08-24T14:15:22Z", + "start_time": "2019-08-24T14:15:22Z", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "users": [ + { + "avatar_url": "http://example.com", + "seconds": 80500, + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", + "username": "string" + } + ] + } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------ | -------------------------------------- | -------- | ------------ | ----------- | -| `created_at` | string | false | | | -| `id` | integer | false | | | -| `level` | [codersdk.LogLevel](#codersdkloglevel) | false | | | -| `output` | string | false | | | -| `source_id` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| -------- | -------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `report` | [codersdk.UserActivityInsightsReport](#codersdkuseractivityinsightsreport) | false | | | -## codersdk.WorkspaceAgentLogSource +## codersdk.UserLatency ```json { - "created_at": "2019-08-24T14:15:22Z", - "display_name": "string", - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" + "avatar_url": "http://example.com", + "latency_ms": { + "p50": 31.312, + "p95": 119.832 + }, + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", + "username": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------------- | ------ | -------- | ------------ | ----------- | -| `created_at` | string | false | | | -| `display_name` | string | false | | | -| `icon` | string | false | | | -| `id` | string | false | | | -| `workspace_agent_id` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | -------------------------------------------------------- | -------- | ------------ | ----------- | +| `avatar_url` | string | false | | | +| `latency_ms` | [codersdk.ConnectionLatency](#codersdkconnectionlatency) | false | | | +| `template_ids` | array of string | false | | | +| `user_id` | string | false | | | +| `username` | string | false | | | -## codersdk.WorkspaceAgentMetadataDescription +## codersdk.UserLatencyInsightsReport ```json { - "display_name": "string", - "interval": 0, - "key": "string", - "script": "string", - "timeout": 0 + "end_time": "2019-08-24T14:15:22Z", + "start_time": "2019-08-24T14:15:22Z", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "users": [ + { + "avatar_url": "http://example.com", + "latency_ms": { + "p50": 31.312, + "p95": 119.832 + }, + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", + "username": "string" + } + ] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------- | -------- | ------------ | ----------- | -| `display_name` | string | false | | | -| `interval` | integer | false | | | -| `key` | string | false | | | -| `script` | string | false | | | -| `timeout` | integer | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ----------------------------------------------------- | -------- | ------------ | ----------- | +| `end_time` | string | false | | | +| `start_time` | string | false | | | +| `template_ids` | array of string | false | | | +| `users` | array of [codersdk.UserLatency](#codersdkuserlatency) | false | | | -## codersdk.WorkspaceAgentPortShare +## codersdk.UserLatencyInsightsResponse ```json { - "agent_name": "string", - "port": 0, - "share_level": "owner", - "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9" + "report": { + "end_time": "2019-08-24T14:15:22Z", + "start_time": "2019-08-24T14:15:22Z", + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "users": [ + { + "avatar_url": "http://example.com", + "latency_ms": { + "p50": 31.312, + "p95": 119.832 + }, + "template_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", + "username": "string" + } + ] + } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | -| `agent_name` | string | false | | | -| `port` | integer | false | | | -| `share_level` | [codersdk.WorkspaceAgentPortShareLevel](#codersdkworkspaceagentportsharelevel) | false | | | -| `workspace_id` | string | false | | | - -## codersdk.WorkspaceAgentPortShareLevel - -```json -"owner" -``` - -### Properties - -#### Enumerated Values - -| Value | -| --------------- | -| `owner` | -| `authenticated` | -| `public` | +| Name | Type | Required | Restrictions | Description | +| -------- | ------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `report` | [codersdk.UserLatencyInsightsReport](#codersdkuserlatencyinsightsreport) | false | | | -## codersdk.WorkspaceAgentPortShares +## codersdk.UserLoginType ```json { - "shares": [ - { - "agent_name": "string", - "port": 0, - "share_level": "owner", - "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9" - } - ] + "login_type": "" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------- | ----------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `shares` | array of [codersdk.WorkspaceAgentPortShare](#codersdkworkspaceagentportshare) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------ | ---------------------------------------- | -------- | ------------ | ----------- | +| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | | -## codersdk.WorkspaceAgentScript +## codersdk.UserParameter ```json { - "cron": "string", - "log_path": "string", - "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", - "run_on_start": true, - "run_on_stop": true, - "script": "string", - "start_blocks_login": true, - "timeout": 0 + "name": "string", + "value": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------------- | ------- | -------- | ------------ | ----------- | -| `cron` | string | false | | | -| `log_path` | string | false | | | -| `log_source_id` | string | false | | | -| `run_on_start` | boolean | false | | | -| `run_on_stop` | boolean | false | | | -| `script` | string | false | | | -| `start_blocks_login` | boolean | false | | | -| `timeout` | integer | false | | | - -## codersdk.WorkspaceAgentStartupScriptBehavior - -```json -"blocking" -``` - -### Properties - -#### Enumerated Values - -| Value | -| -------------- | -| `blocking` | -| `non-blocking` | +| Name | Type | Required | Restrictions | Description | +| ------- | ------ | -------- | ------------ | ----------- | +| `name` | string | false | | | +| `value` | string | false | | | -## codersdk.WorkspaceAgentStatus +## codersdk.UserQuietHoursScheduleConfig ```json -"connecting" +{ + "allow_user_custom": true, + "default_schedule": "string" +} ``` ### Properties -#### Enumerated Values - -| Value | -| -------------- | -| `connecting` | -| `connected` | -| `disconnected` | -| `timeout` | +| Name | Type | Required | Restrictions | Description | +| ------------------- | ------- | -------- | ------------ | ----------- | +| `allow_user_custom` | boolean | false | | | +| `default_schedule` | string | false | | | -## codersdk.WorkspaceApp +## codersdk.UserQuietHoursScheduleResponse ```json { - "command": "string", - "display_name": "string", - "external": true, - "health": "disabled", - "healthcheck": { - "interval": 0, - "threshold": 0, - "url": "string" - }, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "sharing_level": "owner", - "slug": "string", - "subdomain": true, - "subdomain_name": "string", - "url": "string" + "next": "2019-08-24T14:15:22Z", + "raw_schedule": "string", + "time": "string", + "timezone": "string", + "user_can_set": true, + "user_set": true } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------------- | ---------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `command` | string | false | | | -| `display_name` | string | false | | Display name is a friendly name for the app. | -| `external` | boolean | false | | External specifies whether the URL should be opened externally on the client or not. | -| `health` | [codersdk.WorkspaceAppHealth](#codersdkworkspaceapphealth) | false | | | -| `healthcheck` | [codersdk.Healthcheck](#codersdkhealthcheck) | false | | Healthcheck specifies the configuration for checking app health. | -| `icon` | string | false | | Icon is a relative path or external URL that specifies an icon to be displayed in the dashboard. | -| `id` | string | false | | | -| `sharing_level` | [codersdk.WorkspaceAppSharingLevel](#codersdkworkspaceappsharinglevel) | false | | | -| `slug` | string | false | | Slug is a unique identifier within the agent. | -| `subdomain` | boolean | false | | Subdomain denotes whether the app should be accessed via a path on the `coder server` or via a hostname-based dev URL. If this is set to true and there is no app wildcard configured on the server, the app will not be accessible in the UI. | -| `subdomain_name` | string | false | | Subdomain name is the application domain exposed on the `coder server`. | -| `url` | string | false | | URL is the address being proxied to inside the workspace. If external is specified, this will be opened on the client. | - -#### Enumerated Values - -| Property | Value | -| --------------- | --------------- | -| `sharing_level` | `owner` | -| `sharing_level` | `authenticated` | -| `sharing_level` | `public` | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `next` | string | false | | Next is the next time that the quiet hours window will start. | +| `raw_schedule` | string | false | | | +| `time` | string | false | | Time is the time of day that the quiet hours window starts in the given Timezone each day. | +| `timezone` | string | false | | raw format from the cron expression, UTC if unspecified | +| `user_can_set` | boolean | false | | User can set is true if the user is allowed to set their own quiet hours schedule. If false, the user cannot set a custom schedule and the default schedule will always be used. | +| `user_set` | boolean | false | | User set is true if the user has set their own quiet hours schedule. If false, the user is using the default schedule. | -## codersdk.WorkspaceAppHealth +## codersdk.UserStatus ```json -"disabled" +"active" ``` ### Properties #### Enumerated Values -| Value | -| -------------- | -| `disabled` | -| `initializing` | -| `healthy` | -| `unhealthy` | +| Value | +| ----------- | +| `active` | +| `dormant` | +| `suspended` | -## codersdk.WorkspaceAppSharingLevel +## codersdk.ValidationError ```json -"owner" +{ + "detail": "string", + "field": "string" +} ``` ### Properties -#### Enumerated Values - -| Value | -| --------------- | -| `owner` | -| `authenticated` | -| `public` | - -## codersdk.WorkspaceBuild +| Name | Type | Required | Restrictions | Description | +| -------- | ------ | -------- | ------------ | ----------- | +| `detail` | string | true | | | +| `field` | string | true | | | -```json -{ - "build_number": 0, - "created_at": "2019-08-24T14:15:22Z", - "daily_cost": 0, - "deadline": "2019-08-24T14:15:22Z", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", - "initiator_name": "string", - "job": { - "canceled_at": "2019-08-24T14:15:22Z", - "completed_at": "2019-08-24T14:15:22Z", - "created_at": "2019-08-24T14:15:22Z", - "error": "string", - "error_code": "REQUIRED_TEMPLATE_VARIABLES", - "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "queue_position": 0, - "queue_size": 0, - "started_at": "2019-08-24T14:15:22Z", - "status": "pending", - "tags": { - "property1": "string", - "property2": "string" - }, - "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" - }, - "max_deadline": "2019-08-24T14:15:22Z", - "reason": "initiator", - "resources": [ - { - "agents": [ - { - "api_version": "string", - "apps": [ - { - "command": "string", - "display_name": "string", - "external": true, - "health": "disabled", - "healthcheck": { - "interval": 0, - "threshold": 0, - "url": "string" - }, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "sharing_level": "owner", - "slug": "string", - "subdomain": true, - "subdomain_name": "string", - "url": "string" - } - ], - "architecture": "string", - "connection_timeout_seconds": 0, - "created_at": "2019-08-24T14:15:22Z", - "directory": "string", - "disconnected_at": "2019-08-24T14:15:22Z", - "display_apps": ["vscode"], - "environment_variables": { - "property1": "string", - "property2": "string" - }, - "expanded_directory": "string", - "first_connected_at": "2019-08-24T14:15:22Z", - "health": { - "healthy": false, - "reason": "agent has lost connection" - }, - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "instance_id": "string", - "last_connected_at": "2019-08-24T14:15:22Z", - "latency": { - "property1": { - "latency_ms": 0, - "preferred": true - }, - "property2": { - "latency_ms": 0, - "preferred": true - } - }, - "lifecycle_state": "created", - "log_sources": [ - { - "created_at": "2019-08-24T14:15:22Z", - "display_name": "string", - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" - } - ], - "logs_length": 0, - "logs_overflowed": true, - "name": "string", - "operating_system": "string", - "ready_at": "2019-08-24T14:15:22Z", - "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", - "scripts": [ - { - "cron": "string", - "log_path": "string", - "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", - "run_on_start": true, - "run_on_stop": true, - "script": "string", - "start_blocks_login": true, - "timeout": 0 - } - ], - "started_at": "2019-08-24T14:15:22Z", - "startup_script_behavior": "blocking", - "status": "connecting", - "subsystems": ["envbox"], - "troubleshooting_url": "string", - "updated_at": "2019-08-24T14:15:22Z", - "version": "string" - } - ], - "created_at": "2019-08-24T14:15:22Z", - "daily_cost": 0, - "hide": true, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", - "metadata": [ - { - "key": "string", - "sensitive": true, - "value": "string" - } - ], - "name": "string", - "type": "string", - "workspace_transition": "start" - } - ], - "status": "pending", - "template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1", - "template_version_name": "string", - "transition": "start", - "updated_at": "2019-08-24T14:15:22Z", - "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", - "workspace_name": "string", - "workspace_owner_avatar_url": "string", - "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string" +## codersdk.ValidationMonotonicOrder + +```json +"increasing" +``` + +### Properties + +#### Enumerated Values + +| Value | +| ------------ | +| `increasing` | +| `decreasing` | + +## codersdk.VariableValue + +```json +{ + "name": "string", + "value": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------------------------- | ----------------------------------------------------------------- | -------- | ------------ | ----------- | -| `build_number` | integer | false | | | -| `created_at` | string | false | | | -| `daily_cost` | integer | false | | | -| `deadline` | string | false | | | -| `id` | string | false | | | -| `initiator_id` | string | false | | | -| `initiator_name` | string | false | | | -| `job` | [codersdk.ProvisionerJob](#codersdkprovisionerjob) | false | | | -| `max_deadline` | string | false | | | -| `reason` | [codersdk.BuildReason](#codersdkbuildreason) | false | | | -| `resources` | array of [codersdk.WorkspaceResource](#codersdkworkspaceresource) | false | | | -| `status` | [codersdk.WorkspaceStatus](#codersdkworkspacestatus) | false | | | -| `template_version_id` | string | false | | | -| `template_version_name` | string | false | | | -| `transition` | [codersdk.WorkspaceTransition](#codersdkworkspacetransition) | false | | | -| `updated_at` | string | false | | | -| `workspace_id` | string | false | | | -| `workspace_name` | string | false | | | -| `workspace_owner_avatar_url` | string | false | | | -| `workspace_owner_id` | string | false | | | -| `workspace_owner_name` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------- | ------ | -------- | ------------ | ----------- | +| `name` | string | false | | | +| `value` | string | false | | | + +## codersdk.WebsocketReport + +```json +{ + "body": "string", + "code": 0, + "dismissed": true, + "error": "string", + "healthy": true, + "severity": "ok", + "warnings": ["string"] +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------- | ---------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------- | +| `body` | string | false | | | +| `code` | integer | false | | | +| `dismissed` | boolean | false | | | +| `error` | string | false | | | +| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | +| `severity` | [health.Severity](#healthseverity) | false | | | +| `warnings` | array of string | false | | | #### Enumerated Values -| Property | Value | -| ------------ | ----------- | -| `reason` | `initiator` | -| `reason` | `autostart` | -| `reason` | `autostop` | -| `status` | `pending` | -| `status` | `starting` | -| `status` | `running` | -| `status` | `stopping` | -| `status` | `stopped` | -| `status` | `failed` | -| `status` | `canceling` | -| `status` | `canceled` | -| `status` | `deleting` | -| `status` | `deleted` | -| `transition` | `start` | -| `transition` | `stop` | -| `transition` | `delete` | +| Property | Value | +| ---------- | --------- | +| `severity` | `ok` | +| `severity` | `warning` | +| `severity` | `error` | -## codersdk.WorkspaceBuildParameter +## codersdk.Workspace ```json { + "allow_renames": true, + "automatic_updates": "always", + "autostart_schedule": "string", + "created_at": "2019-08-24T14:15:22Z", + "deleting_at": "2019-08-24T14:15:22Z", + "dormant_at": "2019-08-24T14:15:22Z", + "favorite": true, + "health": { + "failing_agents": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "healthy": false + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_used_at": "2019-08-24T14:15:22Z", + "latest_build": { + "build_number": 0, + "created_at": "2019-08-24T14:15:22Z", + "daily_cost": 0, + "deadline": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", + "initiator_name": "string", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "error_code": "REQUIRED_TEMPLATE_VARIABLES", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "queue_position": 0, + "queue_size": 0, + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" + }, + "max_deadline": "2019-08-24T14:15:22Z", + "reason": "initiator", + "resources": [ + { + "agents": [ + { + "api_version": "string", + "apps": [ + { + "command": "string", + "display_name": "string", + "external": true, + "health": "disabled", + "healthcheck": { + "interval": 0, + "threshold": 0, + "url": "string" + }, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "sharing_level": "owner", + "slug": "string", + "subdomain": true, + "subdomain_name": "string", + "url": "string" + } + ], + "architecture": "string", + "connection_timeout_seconds": 0, + "created_at": "2019-08-24T14:15:22Z", + "directory": "string", + "disconnected_at": "2019-08-24T14:15:22Z", + "display_apps": ["vscode"], + "environment_variables": { + "property1": "string", + "property2": "string" + }, + "expanded_directory": "string", + "first_connected_at": "2019-08-24T14:15:22Z", + "health": { + "healthy": false, + "reason": "agent has lost connection" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "instance_id": "string", + "last_connected_at": "2019-08-24T14:15:22Z", + "latency": { + "property1": { + "latency_ms": 0, + "preferred": true + }, + "property2": { + "latency_ms": 0, + "preferred": true + } + }, + "lifecycle_state": "created", + "log_sources": [ + { + "created_at": "2019-08-24T14:15:22Z", + "display_name": "string", + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" + } + ], + "logs_length": 0, + "logs_overflowed": true, + "name": "string", + "operating_system": "string", + "ready_at": "2019-08-24T14:15:22Z", + "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", + "scripts": [ + { + "cron": "string", + "log_path": "string", + "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", + "run_on_start": true, + "run_on_stop": true, + "script": "string", + "start_blocks_login": true, + "timeout": 0 + } + ], + "started_at": "2019-08-24T14:15:22Z", + "startup_script_behavior": "blocking", + "status": "connecting", + "subsystems": ["envbox"], + "troubleshooting_url": "string", + "updated_at": "2019-08-24T14:15:22Z", + "version": "string" + } + ], + "created_at": "2019-08-24T14:15:22Z", + "daily_cost": 0, + "hide": true, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", + "metadata": [ + { + "key": "string", + "sensitive": true, + "value": "string" + } + ], + "name": "string", + "type": "string", + "workspace_transition": "start" + } + ], + "status": "pending", + "template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1", + "template_version_name": "string", + "transition": "start", + "updated_at": "2019-08-24T14:15:22Z", + "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", + "workspace_name": "string", + "workspace_owner_avatar_url": "string", + "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", + "workspace_owner_name": "string" + }, "name": "string", - "value": "string" + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "outdated": true, + "owner_avatar_url": "string", + "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05", + "owner_name": "string", + "template_active_version_id": "b0da9c29-67d8-4c87-888c-bafe356f7f3c", + "template_allow_user_cancel_workspace_jobs": true, + "template_display_name": "string", + "template_icon": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "template_name": "string", + "template_require_active_version": true, + "ttl_ms": 0, + "updated_at": "2019-08-24T14:15:22Z" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------- | ------ | -------- | ------------ | ----------- | -| `name` | string | false | | | -| `value` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------------------------------- | ------------------------------------------------------ | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allow_renames` | boolean | false | | | +| `automatic_updates` | [codersdk.AutomaticUpdates](#codersdkautomaticupdates) | false | | | +| `autostart_schedule` | string | false | | | +| `created_at` | string | false | | | +| `deleting_at` | string | false | | Deleting at indicates the time at which the workspace will be permanently deleted. A workspace is eligible for deletion if it is dormant (a non-nil dormant_at value) and a value has been specified for time_til_dormant_autodelete on its template. | +| `dormant_at` | string | false | | Dormant at being non-nil indicates a workspace that is dormant. A dormant workspace is no longer accessible must be activated. It is subject to deletion if it breaches the duration of the time*til* field on its template. | +| `favorite` | boolean | false | | | +| `health` | [codersdk.WorkspaceHealth](#codersdkworkspacehealth) | false | | Health shows the health of the workspace and information about what is causing an unhealthy status. | +| `id` | string | false | | | +| `last_used_at` | string | false | | | +| `latest_build` | [codersdk.WorkspaceBuild](#codersdkworkspacebuild) | false | | | +| `name` | string | false | | | +| `organization_id` | string | false | | | +| `outdated` | boolean | false | | | +| `owner_avatar_url` | string | false | | | +| `owner_id` | string | false | | | +| `owner_name` | string | false | | | +| `template_active_version_id` | string | false | | | +| `template_allow_user_cancel_workspace_jobs` | boolean | false | | | +| `template_display_name` | string | false | | | +| `template_icon` | string | false | | | +| `template_id` | string | false | | | +| `template_name` | string | false | | | +| `template_require_active_version` | boolean | false | | | +| `ttl_ms` | integer | false | | | +| `updated_at` | string | false | | | -## codersdk.WorkspaceConnectionLatencyMS +#### Enumerated Values + +| Property | Value | +| ------------------- | -------- | +| `automatic_updates` | `always` | +| `automatic_updates` | `never` | + +## codersdk.WorkspaceAgent ```json { - "p50": 0, - "p95": 0 + "api_version": "string", + "apps": [ + { + "command": "string", + "display_name": "string", + "external": true, + "health": "disabled", + "healthcheck": { + "interval": 0, + "threshold": 0, + "url": "string" + }, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "sharing_level": "owner", + "slug": "string", + "subdomain": true, + "subdomain_name": "string", + "url": "string" + } + ], + "architecture": "string", + "connection_timeout_seconds": 0, + "created_at": "2019-08-24T14:15:22Z", + "directory": "string", + "disconnected_at": "2019-08-24T14:15:22Z", + "display_apps": ["vscode"], + "environment_variables": { + "property1": "string", + "property2": "string" + }, + "expanded_directory": "string", + "first_connected_at": "2019-08-24T14:15:22Z", + "health": { + "healthy": false, + "reason": "agent has lost connection" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "instance_id": "string", + "last_connected_at": "2019-08-24T14:15:22Z", + "latency": { + "property1": { + "latency_ms": 0, + "preferred": true + }, + "property2": { + "latency_ms": 0, + "preferred": true + } + }, + "lifecycle_state": "created", + "log_sources": [ + { + "created_at": "2019-08-24T14:15:22Z", + "display_name": "string", + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" + } + ], + "logs_length": 0, + "logs_overflowed": true, + "name": "string", + "operating_system": "string", + "ready_at": "2019-08-24T14:15:22Z", + "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", + "scripts": [ + { + "cron": "string", + "log_path": "string", + "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", + "run_on_start": true, + "run_on_stop": true, + "script": "string", + "start_blocks_login": true, + "timeout": 0 + } + ], + "started_at": "2019-08-24T14:15:22Z", + "startup_script_behavior": "blocking", + "status": "connecting", + "subsystems": ["envbox"], + "troubleshooting_url": "string", + "updated_at": "2019-08-24T14:15:22Z", + "version": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ----- | ------ | -------- | ------------ | ----------- | -| `p50` | number | false | | | -| `p95` | number | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------------------------- | -------------------------------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `api_version` | string | false | | | +| `apps` | array of [codersdk.WorkspaceApp](#codersdkworkspaceapp) | false | | | +| `architecture` | string | false | | | +| `connection_timeout_seconds` | integer | false | | | +| `created_at` | string | false | | | +| `directory` | string | false | | | +| `disconnected_at` | string | false | | | +| `display_apps` | array of [codersdk.DisplayApp](#codersdkdisplayapp) | false | | | +| `environment_variables` | object | false | | | +| » `[any property]` | string | false | | | +| `expanded_directory` | string | false | | | +| `first_connected_at` | string | false | | | +| `health` | [codersdk.WorkspaceAgentHealth](#codersdkworkspaceagenthealth) | false | | Health reports the health of the agent. | +| `id` | string | false | | | +| `instance_id` | string | false | | | +| `last_connected_at` | string | false | | | +| `latency` | object | false | | Latency is mapped by region name (e.g. "New York City", "Seattle"). | +| » `[any property]` | [codersdk.DERPRegion](#codersdkderpregion) | false | | | +| `lifecycle_state` | [codersdk.WorkspaceAgentLifecycle](#codersdkworkspaceagentlifecycle) | false | | | +| `log_sources` | array of [codersdk.WorkspaceAgentLogSource](#codersdkworkspaceagentlogsource) | false | | | +| `logs_length` | integer | false | | | +| `logs_overflowed` | boolean | false | | | +| `name` | string | false | | | +| `operating_system` | string | false | | | +| `ready_at` | string | false | | | +| `resource_id` | string | false | | | +| `scripts` | array of [codersdk.WorkspaceAgentScript](#codersdkworkspaceagentscript) | false | | | +| `started_at` | string | false | | | +| `startup_script_behavior` | [codersdk.WorkspaceAgentStartupScriptBehavior](#codersdkworkspaceagentstartupscriptbehavior) | false | | Startup script behavior is a legacy field that is deprecated in favor of the `coder_script` resource. It's only referenced by old clients. Deprecated: Remove in the future! | +| `status` | [codersdk.WorkspaceAgentStatus](#codersdkworkspaceagentstatus) | false | | | +| `subsystems` | array of [codersdk.AgentSubsystem](#codersdkagentsubsystem) | false | | | +| `troubleshooting_url` | string | false | | | +| `updated_at` | string | false | | | +| `version` | string | false | | | -## codersdk.WorkspaceDeploymentStats +## codersdk.WorkspaceAgentConnectionInfo ```json { - "building": 0, - "connection_latency_ms": { - "p50": 0, - "p95": 0 - }, - "failed": 0, - "pending": 0, - "running": 0, - "rx_bytes": 0, - "stopped": 0, - "tx_bytes": 0 + "derp_force_websockets": true, + "derp_map": { + "homeParams": { + "regionScore": { + "property1": 0, + "property2": 0 + } + }, + "omitDefaultRegions": true, + "regions": { + "property1": { + "avoid": true, + "embeddedRelay": true, + "nodes": [ + { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + } + ], + "regionCode": "string", + "regionID": 0, + "regionName": "string" + }, + "property2": { + "avoid": true, + "embeddedRelay": true, + "nodes": [ + { + "canPort80": true, + "certName": "string", + "derpport": 0, + "forceHTTP": true, + "hostName": "string", + "insecureForTests": true, + "ipv4": "string", + "ipv6": "string", + "name": "string", + "regionID": 0, + "stunonly": true, + "stunport": 0, + "stuntestIP": "string" + } + ], + "regionCode": "string", + "regionID": 0, + "regionName": "string" + } + } + }, + "disable_direct_connections": true } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ----------------------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | -| `building` | integer | false | | | -| `connection_latency_ms` | [codersdk.WorkspaceConnectionLatencyMS](#codersdkworkspaceconnectionlatencyms) | false | | | -| `failed` | integer | false | | | -| `pending` | integer | false | | | -| `running` | integer | false | | | -| `rx_bytes` | integer | false | | | -| `stopped` | integer | false | | | -| `tx_bytes` | integer | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------------------------- | ---------------------------------- | -------- | ------------ | ----------- | +| `derp_force_websockets` | boolean | false | | | +| `derp_map` | [tailcfg.DERPMap](#tailcfgderpmap) | false | | | +| `disable_direct_connections` | boolean | false | | | -## codersdk.WorkspaceHealth +## codersdk.WorkspaceAgentHealth ```json { - "failing_agents": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "healthy": false + "healthy": false, + "reason": "agent has lost connection" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------------- | --------------- | -------- | ------------ | -------------------------------------------------------------------- | -| `failing_agents` | array of string | false | | Failing agents lists the IDs of the agents that are failing, if any. | -| `healthy` | boolean | false | | Healthy is true if the workspace is healthy. | +| Name | Type | Required | Restrictions | Description | +| --------- | ------- | -------- | ------------ | --------------------------------------------------------------------------------------------- | +| `healthy` | boolean | false | | Healthy is true if the agent is healthy. | +| `reason` | string | false | | Reason is a human-readable explanation of the agent's health. It is empty if Healthy is true. | -## codersdk.WorkspaceProxy +## codersdk.WorkspaceAgentLifecycle ```json -{ - "created_at": "2019-08-24T14:15:22Z", - "deleted": true, - "derp_enabled": true, - "derp_only": true, - "display_name": "string", - "healthy": true, - "icon_url": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "name": "string", - "path_app_url": "string", - "status": { - "checked_at": "2019-08-24T14:15:22Z", - "report": { - "errors": ["string"], - "warnings": ["string"] - }, - "status": "ok" - }, - "updated_at": "2019-08-24T14:15:22Z", - "version": "string", - "wildcard_hostname": "string" -} +"created" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------- | -------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `created_at` | string | false | | | -| `deleted` | boolean | false | | | -| `derp_enabled` | boolean | false | | | -| `derp_only` | boolean | false | | | -| `display_name` | string | false | | | -| `healthy` | boolean | false | | | -| `icon_url` | string | false | | | -| `id` | string | false | | | -| `name` | string | false | | | -| `path_app_url` | string | false | | Path app URL is the URL to the base path for path apps. Optional unless wildcard_hostname is set. E.g. https://us.example.com | -| `status` | [codersdk.WorkspaceProxyStatus](#codersdkworkspaceproxystatus) | false | | Status is the latest status check of the proxy. This will be empty for deleted proxies. This value can be used to determine if a workspace proxy is healthy and ready to use. | -| `updated_at` | string | false | | | -| `version` | string | false | | | -| `wildcard_hostname` | string | false | | Wildcard hostname is the wildcard hostname for subdomain apps. E.g. _.us.example.com E.g. _--suffix.au.example.com Optional. Does not need to be on the same domain as PathAppURL. | - -## codersdk.WorkspaceProxyStatus - -```json -{ - "checked_at": "2019-08-24T14:15:22Z", - "report": { - "errors": ["string"], - "warnings": ["string"] - }, - "status": "ok" -} -``` - -### Properties +#### Enumerated Values -| Name | Type | Required | Restrictions | Description | -| ------------ | -------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------- | -| `checked_at` | string | false | | | -| `report` | [codersdk.ProxyHealthReport](#codersdkproxyhealthreport) | false | | Report provides more information about the health of the workspace proxy. | -| `status` | [codersdk.ProxyHealthStatus](#codersdkproxyhealthstatus) | false | | | +| Value | +| ------------------ | +| `created` | +| `starting` | +| `start_timeout` | +| `start_error` | +| `ready` | +| `shutting_down` | +| `shutdown_timeout` | +| `shutdown_error` | +| `off` | -## codersdk.WorkspaceQuota +## codersdk.WorkspaceAgentListeningPort ```json { - "budget": 0, - "credits_consumed": 0 + "network": "string", + "port": 0, + "process_name": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ------- | -------- | ------------ | ----------- | -| `budget` | integer | false | | | -| `credits_consumed` | integer | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------- | -------- | ------------ | ------------------------ | +| `network` | string | false | | only "tcp" at the moment | +| `port` | integer | false | | | +| `process_name` | string | false | | may be empty | -## codersdk.WorkspaceResource +## codersdk.WorkspaceAgentListeningPortsResponse ```json { - "agents": [ - { - "api_version": "string", - "apps": [ - { - "command": "string", - "display_name": "string", - "external": true, - "health": "disabled", - "healthcheck": { - "interval": 0, - "threshold": 0, - "url": "string" - }, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "sharing_level": "owner", - "slug": "string", - "subdomain": true, - "subdomain_name": "string", - "url": "string" - } - ], - "architecture": "string", - "connection_timeout_seconds": 0, - "created_at": "2019-08-24T14:15:22Z", - "directory": "string", - "disconnected_at": "2019-08-24T14:15:22Z", - "display_apps": ["vscode"], - "environment_variables": { - "property1": "string", - "property2": "string" - }, - "expanded_directory": "string", - "first_connected_at": "2019-08-24T14:15:22Z", - "health": { - "healthy": false, - "reason": "agent has lost connection" - }, - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "instance_id": "string", - "last_connected_at": "2019-08-24T14:15:22Z", - "latency": { - "property1": { - "latency_ms": 0, - "preferred": true - }, - "property2": { - "latency_ms": 0, - "preferred": true - } - }, - "lifecycle_state": "created", - "log_sources": [ - { - "created_at": "2019-08-24T14:15:22Z", - "display_name": "string", - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" - } - ], - "logs_length": 0, - "logs_overflowed": true, - "name": "string", - "operating_system": "string", - "ready_at": "2019-08-24T14:15:22Z", - "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", - "scripts": [ - { - "cron": "string", - "log_path": "string", - "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", - "run_on_start": true, - "run_on_stop": true, - "script": "string", - "start_blocks_login": true, - "timeout": 0 - } - ], - "started_at": "2019-08-24T14:15:22Z", - "startup_script_behavior": "blocking", - "status": "connecting", - "subsystems": ["envbox"], - "troubleshooting_url": "string", - "updated_at": "2019-08-24T14:15:22Z", - "version": "string" - } - ], - "created_at": "2019-08-24T14:15:22Z", - "daily_cost": 0, - "hide": true, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", - "metadata": [ + "ports": [ { - "key": "string", - "sensitive": true, - "value": "string" + "network": "string", + "port": 0, + "process_name": "string" } - ], - "name": "string", - "type": "string", - "workspace_transition": "start" + ] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------------------- | --------------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `agents` | array of [codersdk.WorkspaceAgent](#codersdkworkspaceagent) | false | | | -| `created_at` | string | false | | | -| `daily_cost` | integer | false | | | -| `hide` | boolean | false | | | -| `icon` | string | false | | | -| `id` | string | false | | | -| `job_id` | string | false | | | -| `metadata` | array of [codersdk.WorkspaceResourceMetadata](#codersdkworkspaceresourcemetadata) | false | | | -| `name` | string | false | | | -| `type` | string | false | | | -| `workspace_transition` | [codersdk.WorkspaceTransition](#codersdkworkspacetransition) | false | | | - -#### Enumerated Values - -| Property | Value | -| ---------------------- | -------- | -| `workspace_transition` | `start` | -| `workspace_transition` | `stop` | -| `workspace_transition` | `delete` | +| Name | Type | Required | Restrictions | Description | +| ------- | ------------------------------------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `ports` | array of [codersdk.WorkspaceAgentListeningPort](#codersdkworkspaceagentlisteningport) | false | | If there are no ports in the list, nothing should be displayed in the UI. There must not be a "no ports available" message or anything similar, as there will always be no ports displayed on platforms where our port detection logic is unsupported. | -## codersdk.WorkspaceResourceMetadata +## codersdk.WorkspaceAgentLog ```json { - "key": "string", - "sensitive": true, - "value": "string" + "created_at": "2019-08-24T14:15:22Z", + "id": 0, + "level": "trace", + "output": "string", + "source_id": "ae50a35c-df42-4eff-ba26-f8bc28d2af81" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ----------- | ------- | -------- | ------------ | ----------- | -| `key` | string | false | | | -| `sensitive` | boolean | false | | | -| `value` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------ | -------------------------------------- | -------- | ------------ | ----------- | +| `created_at` | string | false | | | +| `id` | integer | false | | | +| `level` | [codersdk.LogLevel](#codersdkloglevel) | false | | | +| `output` | string | false | | | +| `source_id` | string | false | | | -## codersdk.WorkspaceStatus +## codersdk.WorkspaceAgentLogSource ```json -"pending" +{ + "created_at": "2019-08-24T14:15:22Z", + "display_name": "string", + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" +} ``` ### Properties -#### Enumerated Values - -| Value | -| ----------- | -| `pending` | -| `starting` | -| `running` | -| `stopping` | -| `stopped` | -| `failed` | -| `canceling` | -| `canceled` | -| `deleting` | -| `deleted` | +| Name | Type | Required | Restrictions | Description | +| -------------------- | ------ | -------- | ------------ | ----------- | +| `created_at` | string | false | | | +| `display_name` | string | false | | | +| `icon` | string | false | | | +| `id` | string | false | | | +| `workspace_agent_id` | string | false | | | -## codersdk.WorkspaceTransition +## codersdk.WorkspaceAgentMetadataDescription ```json -"start" +{ + "display_name": "string", + "interval": 0, + "key": "string", + "script": "string", + "timeout": 0 +} ``` ### Properties -#### Enumerated Values - -| Value | -| -------- | -| `start` | -| `stop` | -| `delete` | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------- | -------- | ------------ | ----------- | +| `display_name` | string | false | | | +| `interval` | integer | false | | | +| `key` | string | false | | | +| `script` | string | false | | | +| `timeout` | integer | false | | | -## codersdk.WorkspacesResponse +## codersdk.WorkspaceAgentPortShare ```json { - "count": 0, - "workspaces": [ - { - "allow_renames": true, - "automatic_updates": "always", - "autostart_schedule": "string", - "created_at": "2019-08-24T14:15:22Z", - "deleting_at": "2019-08-24T14:15:22Z", - "dormant_at": "2019-08-24T14:15:22Z", - "favorite": true, - "health": { - "failing_agents": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], - "healthy": false - }, - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "last_used_at": "2019-08-24T14:15:22Z", - "latest_build": { - "build_number": 0, - "created_at": "2019-08-24T14:15:22Z", - "daily_cost": 0, - "deadline": "2019-08-24T14:15:22Z", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", - "initiator_name": "string", - "job": { - "canceled_at": "2019-08-24T14:15:22Z", - "completed_at": "2019-08-24T14:15:22Z", - "created_at": "2019-08-24T14:15:22Z", - "error": "string", - "error_code": "REQUIRED_TEMPLATE_VARIABLES", - "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "queue_position": 0, - "queue_size": 0, - "started_at": "2019-08-24T14:15:22Z", - "status": "pending", - "tags": { - "property1": "string", - "property2": "string" - }, - "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" - }, - "max_deadline": "2019-08-24T14:15:22Z", - "reason": "initiator", - "resources": [ - { - "agents": [ - { - "api_version": "string", - "apps": [ - { - "command": "string", - "display_name": "string", - "external": true, - "health": "disabled", - "healthcheck": {}, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "sharing_level": "owner", - "slug": "string", - "subdomain": true, - "subdomain_name": "string", - "url": "string" - } - ], - "architecture": "string", - "connection_timeout_seconds": 0, - "created_at": "2019-08-24T14:15:22Z", - "directory": "string", - "disconnected_at": "2019-08-24T14:15:22Z", - "display_apps": ["vscode"], - "environment_variables": { - "property1": "string", - "property2": "string" - }, - "expanded_directory": "string", - "first_connected_at": "2019-08-24T14:15:22Z", - "health": { - "healthy": false, - "reason": "agent has lost connection" - }, - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "instance_id": "string", - "last_connected_at": "2019-08-24T14:15:22Z", - "latency": { - "property1": { - "latency_ms": 0, - "preferred": true - }, - "property2": { - "latency_ms": 0, - "preferred": true - } - }, - "lifecycle_state": "created", - "log_sources": [ - { - "created_at": "2019-08-24T14:15:22Z", - "display_name": "string", - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" - } - ], - "logs_length": 0, - "logs_overflowed": true, - "name": "string", - "operating_system": "string", - "ready_at": "2019-08-24T14:15:22Z", - "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", - "scripts": [ - { - "cron": "string", - "log_path": "string", - "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", - "run_on_start": true, - "run_on_stop": true, - "script": "string", - "start_blocks_login": true, - "timeout": 0 - } - ], - "started_at": "2019-08-24T14:15:22Z", - "startup_script_behavior": "blocking", - "status": "connecting", - "subsystems": ["envbox"], - "troubleshooting_url": "string", - "updated_at": "2019-08-24T14:15:22Z", - "version": "string" - } - ], - "created_at": "2019-08-24T14:15:22Z", - "daily_cost": 0, - "hide": true, - "icon": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", - "metadata": [ - { - "key": "string", - "sensitive": true, - "value": "string" - } - ], - "name": "string", - "type": "string", - "workspace_transition": "start" - } - ], - "status": "pending", - "template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1", - "template_version_name": "string", - "transition": "start", - "updated_at": "2019-08-24T14:15:22Z", - "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", - "workspace_name": "string", - "workspace_owner_avatar_url": "string", - "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string" - }, - "name": "string", - "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", - "outdated": true, - "owner_avatar_url": "string", - "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05", - "owner_name": "string", - "template_active_version_id": "b0da9c29-67d8-4c87-888c-bafe356f7f3c", - "template_allow_user_cancel_workspace_jobs": true, - "template_display_name": "string", - "template_icon": "string", - "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", - "template_name": "string", - "template_require_active_version": true, - "ttl_ms": 0, - "updated_at": "2019-08-24T14:15:22Z" - } - ] + "agent_name": "string", + "port": 0, + "share_level": "owner", + "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------ | ------------------------------------------------- | -------- | ------------ | ----------- | -| `count` | integer | false | | | -| `workspaces` | array of [codersdk.Workspace](#codersdkworkspace) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `agent_name` | string | false | | | +| `port` | integer | false | | | +| `share_level` | [codersdk.WorkspaceAgentPortShareLevel](#codersdkworkspaceagentportsharelevel) | false | | | +| `workspace_id` | string | false | | | -## derp.BytesSentRecv +## codersdk.WorkspaceAgentPortShareLevel ```json -{ - "key": {}, - "recv": 0, - "sent": 0 -} +"owner" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------ | -------------------------------- | -------- | ------------ | -------------------------------------------------------------------- | -| `key` | [key.NodePublic](#keynodepublic) | false | | Key is the public key of the client which sent/received these bytes. | -| `recv` | integer | false | | | -| `sent` | integer | false | | | +#### Enumerated Values -## derp.ServerInfoMessage +| Value | +| --------------- | +| `owner` | +| `authenticated` | +| `public` | + +## codersdk.WorkspaceAgentPortShares ```json { - "tokenBucketBytesBurst": 0, - "tokenBucketBytesPerSecond": 0 + "shares": [ + { + "agent_name": "string", + "port": 0, + "share_level": "owner", + "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9" + } + ] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------------------------------------------------------------------------------ | ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------ | -| `tokenBucketBytesBurst` | integer | false | | Tokenbucketbytesburst is how many bytes the server will allow to burst, temporarily violating TokenBucketBytesPerSecond. | -| Zero means unspecified. There might be a limit, but the client need not try to respect it. | -| `tokenBucketBytesPerSecond` | integer | false | | Tokenbucketbytespersecond is how many bytes per second the server says it will accept, including all framing bytes. | -| Zero means unspecified. There might be a limit, but the client need not try to respect it. | +| Name | Type | Required | Restrictions | Description | +| -------- | ----------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `shares` | array of [codersdk.WorkspaceAgentPortShare](#codersdkworkspaceagentportshare) | false | | | -## derphealth.NodeReport +## codersdk.WorkspaceAgentScript ```json { - "can_exchange_messages": true, - "client_errs": [["string"]], - "client_logs": [["string"]], - "error": "string", - "healthy": true, - "node": { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - }, - "node_info": { - "tokenBucketBytesBurst": 0, - "tokenBucketBytesPerSecond": 0 - }, - "round_trip_ping": "string", - "round_trip_ping_ms": 0, - "severity": "ok", - "stun": { - "canSTUN": true, - "enabled": true, - "error": "string" - }, - "uses_websocket": true, - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] + "cron": "string", + "log_path": "string", + "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", + "run_on_start": true, + "run_on_stop": true, + "script": "string", + "start_blocks_login": true, + "timeout": 0 } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ----------------------- | ------------------------------------------------ | -------- | ------------ | ------------------------------------------------------------------------------------------- | -| `can_exchange_messages` | boolean | false | | | -| `client_errs` | array of array | false | | | -| `client_logs` | array of array | false | | | -| `error` | string | false | | | -| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | -| `node` | [tailcfg.DERPNode](#tailcfgderpnode) | false | | | -| `node_info` | [derp.ServerInfoMessage](#derpserverinfomessage) | false | | | -| `round_trip_ping` | string | false | | | -| `round_trip_ping_ms` | integer | false | | | -| `severity` | [health.Severity](#healthseverity) | false | | | -| `stun` | [derphealth.StunReport](#derphealthstunreport) | false | | | -| `uses_websocket` | boolean | false | | | -| `warnings` | array of [health.Message](#healthmessage) | false | | | +| Name | Type | Required | Restrictions | Description | +| -------------------- | ------- | -------- | ------------ | ----------- | +| `cron` | string | false | | | +| `log_path` | string | false | | | +| `log_source_id` | string | false | | | +| `run_on_start` | boolean | false | | | +| `run_on_stop` | boolean | false | | | +| `script` | string | false | | | +| `start_blocks_login` | boolean | false | | | +| `timeout` | integer | false | | | + +## codersdk.WorkspaceAgentStartupScriptBehavior + +```json +"blocking" +``` + +### Properties #### Enumerated Values -| Property | Value | -| ---------- | --------- | -| `severity` | `ok` | -| `severity` | `warning` | -| `severity` | `error` | +| Value | +| -------------- | +| `blocking` | +| `non-blocking` | + +## codersdk.WorkspaceAgentStatus + +```json +"connecting" +``` + +### Properties + +#### Enumerated Values + +| Value | +| -------------- | +| `connecting` | +| `connected` | +| `disconnected` | +| `timeout` | -## derphealth.RegionReport +## codersdk.WorkspaceApp ```json { - "error": "string", - "healthy": true, - "node_reports": [ - { - "can_exchange_messages": true, - "client_errs": [["string"]], - "client_logs": [["string"]], - "error": "string", - "healthy": true, - "node": { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - }, - "node_info": { - "tokenBucketBytesBurst": 0, - "tokenBucketBytesPerSecond": 0 - }, - "round_trip_ping": "string", - "round_trip_ping_ms": 0, - "severity": "ok", - "stun": { - "canSTUN": true, - "enabled": true, - "error": "string" - }, - "uses_websocket": true, - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - } - ], - "region": { - "avoid": true, - "embeddedRelay": true, - "nodes": [ - { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - } - ], - "regionCode": "string", - "regionID": 0, - "regionName": "string" + "command": "string", + "display_name": "string", + "external": true, + "health": "disabled", + "healthcheck": { + "interval": 0, + "threshold": 0, + "url": "string" }, - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "sharing_level": "owner", + "slug": "string", + "subdomain": true, + "subdomain_name": "string", + "url": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------- | -| `error` | string | false | | | -| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | -| `node_reports` | array of [derphealth.NodeReport](#derphealthnodereport) | false | | | -| `region` | [tailcfg.DERPRegion](#tailcfgderpregion) | false | | | -| `severity` | [health.Severity](#healthseverity) | false | | | -| `warnings` | array of [health.Message](#healthmessage) | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------------- | ---------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `command` | string | false | | | +| `display_name` | string | false | | Display name is a friendly name for the app. | +| `external` | boolean | false | | External specifies whether the URL should be opened externally on the client or not. | +| `health` | [codersdk.WorkspaceAppHealth](#codersdkworkspaceapphealth) | false | | | +| `healthcheck` | [codersdk.Healthcheck](#codersdkhealthcheck) | false | | Healthcheck specifies the configuration for checking app health. | +| `icon` | string | false | | Icon is a relative path or external URL that specifies an icon to be displayed in the dashboard. | +| `id` | string | false | | | +| `sharing_level` | [codersdk.WorkspaceAppSharingLevel](#codersdkworkspaceappsharinglevel) | false | | | +| `slug` | string | false | | Slug is a unique identifier within the agent. | +| `subdomain` | boolean | false | | Subdomain denotes whether the app should be accessed via a path on the `coder server` or via a hostname-based dev URL. If this is set to true and there is no app wildcard configured on the server, the app will not be accessible in the UI. | +| `subdomain_name` | string | false | | Subdomain name is the application domain exposed on the `coder server`. | +| `url` | string | false | | URL is the address being proxied to inside the workspace. If external is specified, this will be opened on the client. | + +#### Enumerated Values + +| Property | Value | +| --------------- | --------------- | +| `sharing_level` | `owner` | +| `sharing_level` | `authenticated` | +| `sharing_level` | `public` | + +## codersdk.WorkspaceAppHealth + +```json +"disabled" +``` + +### Properties + +#### Enumerated Values + +| Value | +| -------------- | +| `disabled` | +| `initializing` | +| `healthy` | +| `unhealthy` | + +## codersdk.WorkspaceAppSharingLevel + +```json +"owner" +``` + +### Properties #### Enumerated Values -| Property | Value | -| ---------- | --------- | -| `severity` | `ok` | -| `severity` | `warning` | -| `severity` | `error` | +| Value | +| --------------- | +| `owner` | +| `authenticated` | +| `public` | -## derphealth.Report +## codersdk.WorkspaceBuild ```json { - "dismissed": true, - "error": "string", - "healthy": true, - "netcheck": { - "captivePortal": "string", - "globalV4": "string", - "globalV6": "string", - "hairPinning": "string", - "icmpv4": true, - "ipv4": true, - "ipv4CanSend": true, - "ipv6": true, - "ipv6CanSend": true, - "mappingVariesByDestIP": "string", - "oshasIPv6": true, - "pcp": "string", - "pmp": "string", - "preferredDERP": 0, - "regionLatency": { - "property1": 0, - "property2": 0 - }, - "regionV4Latency": { - "property1": 0, - "property2": 0 - }, - "regionV6Latency": { - "property1": 0, - "property2": 0 + "build_number": 0, + "created_at": "2019-08-24T14:15:22Z", + "daily_cost": 0, + "deadline": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", + "initiator_name": "string", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "error_code": "REQUIRED_TEMPLATE_VARIABLES", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "queue_position": 0, + "queue_size": 0, + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" }, - "udp": true, - "upnP": "string" + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" }, - "netcheck_err": "string", - "netcheck_logs": ["string"], - "regions": { - "property1": { - "error": "string", - "healthy": true, - "node_reports": [ + "max_deadline": "2019-08-24T14:15:22Z", + "reason": "initiator", + "resources": [ + { + "agents": [ { - "can_exchange_messages": true, - "client_errs": [["string"]], - "client_logs": [["string"]], - "error": "string", - "healthy": true, - "node": { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - }, - "node_info": { - "tokenBucketBytesBurst": 0, - "tokenBucketBytesPerSecond": 0 - }, - "round_trip_ping": "string", - "round_trip_ping_ms": 0, - "severity": "ok", - "stun": { - "canSTUN": true, - "enabled": true, - "error": "string" - }, - "uses_websocket": true, - "warnings": [ + "api_version": "string", + "apps": [ { - "code": "EUNKNOWN", - "message": "string" + "command": "string", + "display_name": "string", + "external": true, + "health": "disabled", + "healthcheck": { + "interval": 0, + "threshold": 0, + "url": "string" + }, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "sharing_level": "owner", + "slug": "string", + "subdomain": true, + "subdomain_name": "string", + "url": "string" } - ] - } - ], - "region": { - "avoid": true, - "embeddedRelay": true, - "nodes": [ - { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - } - ], - "regionCode": "string", - "regionID": 0, - "regionName": "string" - }, - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - }, - "property2": { - "error": "string", - "healthy": true, - "node_reports": [ - { - "can_exchange_messages": true, - "client_errs": [["string"]], - "client_logs": [["string"]], - "error": "string", - "healthy": true, - "node": { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - }, - "node_info": { - "tokenBucketBytesBurst": 0, - "tokenBucketBytesPerSecond": 0 + ], + "architecture": "string", + "connection_timeout_seconds": 0, + "created_at": "2019-08-24T14:15:22Z", + "directory": "string", + "disconnected_at": "2019-08-24T14:15:22Z", + "display_apps": ["vscode"], + "environment_variables": { + "property1": "string", + "property2": "string" }, - "round_trip_ping": "string", - "round_trip_ping_ms": 0, - "severity": "ok", - "stun": { - "canSTUN": true, - "enabled": true, - "error": "string" + "expanded_directory": "string", + "first_connected_at": "2019-08-24T14:15:22Z", + "health": { + "healthy": false, + "reason": "agent has lost connection" }, - "uses_websocket": true, - "warnings": [ + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "instance_id": "string", + "last_connected_at": "2019-08-24T14:15:22Z", + "latency": { + "property1": { + "latency_ms": 0, + "preferred": true + }, + "property2": { + "latency_ms": 0, + "preferred": true + } + }, + "lifecycle_state": "created", + "log_sources": [ { - "code": "EUNKNOWN", - "message": "string" + "created_at": "2019-08-24T14:15:22Z", + "display_name": "string", + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" } - ] + ], + "logs_length": 0, + "logs_overflowed": true, + "name": "string", + "operating_system": "string", + "ready_at": "2019-08-24T14:15:22Z", + "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", + "scripts": [ + { + "cron": "string", + "log_path": "string", + "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", + "run_on_start": true, + "run_on_stop": true, + "script": "string", + "start_blocks_login": true, + "timeout": 0 + } + ], + "started_at": "2019-08-24T14:15:22Z", + "startup_script_behavior": "blocking", + "status": "connecting", + "subsystems": ["envbox"], + "troubleshooting_url": "string", + "updated_at": "2019-08-24T14:15:22Z", + "version": "string" } ], - "region": { - "avoid": true, - "embeddedRelay": true, - "nodes": [ - { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - } - ], - "regionCode": "string", - "regionID": 0, - "regionName": "string" - }, - "severity": "ok", - "warnings": [ + "created_at": "2019-08-24T14:15:22Z", + "daily_cost": 0, + "hide": true, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", + "metadata": [ { - "code": "EUNKNOWN", - "message": "string" + "key": "string", + "sensitive": true, + "value": "string" } - ] - } - }, - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" + ], + "name": "string", + "type": "string", + "workspace_transition": "start" } - ] + ], + "status": "pending", + "template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1", + "template_version_name": "string", + "transition": "start", + "updated_at": "2019-08-24T14:15:22Z", + "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", + "workspace_name": "string", + "workspace_owner_avatar_url": "string", + "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", + "workspace_owner_name": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | -------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------- | -| `dismissed` | boolean | false | | | -| `error` | string | false | | | -| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | -| `netcheck` | [netcheck.Report](#netcheckreport) | false | | | -| `netcheck_err` | string | false | | | -| `netcheck_logs` | array of string | false | | | -| `regions` | object | false | | | -| » `[any property]` | [derphealth.RegionReport](#derphealthregionreport) | false | | | -| `severity` | [health.Severity](#healthseverity) | false | | | -| `warnings` | array of [health.Message](#healthmessage) | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------------------------- | ----------------------------------------------------------------- | -------- | ------------ | ----------- | +| `build_number` | integer | false | | | +| `created_at` | string | false | | | +| `daily_cost` | integer | false | | | +| `deadline` | string | false | | | +| `id` | string | false | | | +| `initiator_id` | string | false | | | +| `initiator_name` | string | false | | | +| `job` | [codersdk.ProvisionerJob](#codersdkprovisionerjob) | false | | | +| `max_deadline` | string | false | | | +| `reason` | [codersdk.BuildReason](#codersdkbuildreason) | false | | | +| `resources` | array of [codersdk.WorkspaceResource](#codersdkworkspaceresource) | false | | | +| `status` | [codersdk.WorkspaceStatus](#codersdkworkspacestatus) | false | | | +| `template_version_id` | string | false | | | +| `template_version_name` | string | false | | | +| `transition` | [codersdk.WorkspaceTransition](#codersdkworkspacetransition) | false | | | +| `updated_at` | string | false | | | +| `workspace_id` | string | false | | | +| `workspace_name` | string | false | | | +| `workspace_owner_avatar_url` | string | false | | | +| `workspace_owner_id` | string | false | | | +| `workspace_owner_name` | string | false | | | #### Enumerated Values -| Property | Value | -| ---------- | --------- | -| `severity` | `ok` | -| `severity` | `warning` | -| `severity` | `error` | +| Property | Value | +| ------------ | ----------- | +| `reason` | `initiator` | +| `reason` | `autostart` | +| `reason` | `autostop` | +| `status` | `pending` | +| `status` | `starting` | +| `status` | `running` | +| `status` | `stopping` | +| `status` | `stopped` | +| `status` | `failed` | +| `status` | `canceling` | +| `status` | `canceled` | +| `status` | `deleting` | +| `status` | `deleted` | +| `transition` | `start` | +| `transition` | `stop` | +| `transition` | `delete` | -## derphealth.StunReport +## codersdk.WorkspaceBuildParameter ```json { - "canSTUN": true, - "enabled": true, - "error": "string" + "name": "string", + "value": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------- | ------- | -------- | ------------ | ----------- | -| `canSTUN` | boolean | false | | | -| `enabled` | boolean | false | | | -| `error` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------- | ------ | -------- | ------------ | ----------- | +| `name` | string | false | | | +| `value` | string | false | | | -## health.Code +## codersdk.WorkspaceConnectionLatencyMS ```json -"EUNKNOWN" +{ + "p50": 0, + "p95": 0 +} ``` ### Properties -#### Enumerated Values +| Name | Type | Required | Restrictions | Description | +| ----- | ------ | -------- | ------------ | ----------- | +| `p50` | number | false | | | +| `p95` | number | false | | | -| Value | -| ---------- | -| `EUNKNOWN` | -| `EWP01` | -| `EWP02` | -| `EWP03` | -| `EWP04` | -| `EDB01` | -| `EDB02` | -| `EWS01` | -| `EWS02` | -| `EWS03` | -| `EACS01` | -| `EACS02` | -| `EACS03` | -| `EACS04` | -| `EDERP01` | -| `EDERP02` | -| `EPD01` | -| `EPD02` | -| `EPD03` | +## codersdk.WorkspaceDeploymentStats -## health.Message +```json +{ + "building": 0, + "connection_latency_ms": { + "p50": 0, + "p95": 0 + }, + "failed": 0, + "pending": 0, + "running": 0, + "rx_bytes": 0, + "stopped": 0, + "tx_bytes": 0 +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------------------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `building` | integer | false | | | +| `connection_latency_ms` | [codersdk.WorkspaceConnectionLatencyMS](#codersdkworkspaceconnectionlatencyms) | false | | | +| `failed` | integer | false | | | +| `pending` | integer | false | | | +| `running` | integer | false | | | +| `rx_bytes` | integer | false | | | +| `stopped` | integer | false | | | +| `tx_bytes` | integer | false | | | + +## codersdk.WorkspaceHealth ```json { - "code": "EUNKNOWN", - "message": "string" + "failing_agents": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "healthy": false } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------- | -------------------------- | -------- | ------------ | ----------- | -| `code` | [health.Code](#healthcode) | false | | | -| `message` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------------- | --------------- | -------- | ------------ | -------------------------------------------------------------------- | +| `failing_agents` | array of string | false | | Failing agents lists the IDs of the agents that are failing, if any. | +| `healthy` | boolean | false | | Healthy is true if the workspace is healthy. | -## health.Severity +## codersdk.WorkspaceProxy ```json -"ok" +{ + "created_at": "2019-08-24T14:15:22Z", + "deleted": true, + "derp_enabled": true, + "derp_only": true, + "display_name": "string", + "healthy": true, + "icon_url": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "path_app_url": "string", + "status": { + "checked_at": "2019-08-24T14:15:22Z", + "report": { + "errors": ["string"], + "warnings": ["string"] + }, + "status": "ok" + }, + "updated_at": "2019-08-24T14:15:22Z", + "version": "string", + "wildcard_hostname": "string" +} ``` ### Properties -#### Enumerated Values - -| Value | -| --------- | -| `ok` | -| `warning` | -| `error` | +| Name | Type | Required | Restrictions | Description | +| ------------------- | -------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created_at` | string | false | | | +| `deleted` | boolean | false | | | +| `derp_enabled` | boolean | false | | | +| `derp_only` | boolean | false | | | +| `display_name` | string | false | | | +| `healthy` | boolean | false | | | +| `icon_url` | string | false | | | +| `id` | string | false | | | +| `name` | string | false | | | +| `path_app_url` | string | false | | Path app URL is the URL to the base path for path apps. Optional unless wildcard_hostname is set. E.g. https://us.example.com | +| `status` | [codersdk.WorkspaceProxyStatus](#codersdkworkspaceproxystatus) | false | | Status is the latest status check of the proxy. This will be empty for deleted proxies. This value can be used to determine if a workspace proxy is healthy and ready to use. | +| `updated_at` | string | false | | | +| `version` | string | false | | | +| `wildcard_hostname` | string | false | | Wildcard hostname is the wildcard hostname for subdomain apps. E.g. _.us.example.com E.g. _--suffix.au.example.com Optional. Does not need to be on the same domain as PathAppURL. | -## healthcheck.AccessURLReport +## codersdk.WorkspaceProxyReport ```json { - "access_url": "string", "dismissed": true, "error": "string", "healthy": true, - "healthz_response": "string", - "reachable": true, "severity": "ok", - "status_code": 0, "warnings": [ { "code": "EUNKNOWN", "message": "string" } - ] + ], + "workspace_proxies": { + "regions": [ + { + "created_at": "2019-08-24T14:15:22Z", + "deleted": true, + "derp_enabled": true, + "derp_only": true, + "display_name": "string", + "healthy": true, + "icon_url": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "path_app_url": "string", + "status": { + "checked_at": "2019-08-24T14:15:22Z", + "report": { + "errors": ["string"], + "warnings": ["string"] + }, + "status": "ok" + }, + "updated_at": "2019-08-24T14:15:22Z", + "version": "string", + "wildcard_hostname": "string" + } + ] + } } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ----------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------- | -| `access_url` | string | false | | | -| `dismissed` | boolean | false | | | -| `error` | string | false | | | -| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | -| `healthz_response` | string | false | | | -| `reachable` | boolean | false | | | -| `severity` | [health.Severity](#healthseverity) | false | | | -| `status_code` | integer | false | | | -| `warnings` | array of [health.Message](#healthmessage) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------- | ---------------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `dismissed` | boolean | false | | | +| `error` | string | false | | | +| `healthy` | boolean | false | | | +| `severity` | [health.Severity](#healthseverity) | false | | | +| `warnings` | array of [health.Message](#healthmessage) | false | | | +| `workspace_proxies` | [codersdk.RegionsResponse-codersdk_WorkspaceProxy](#codersdkregionsresponse-codersdk_workspaceproxy) | false | | | -#### Enumerated Values +## codersdk.WorkspaceProxyStatus -| Property | Value | -| ---------- | --------- | -| `severity` | `ok` | -| `severity` | `warning` | -| `severity` | `error` | +```json +{ + "checked_at": "2019-08-24T14:15:22Z", + "report": { + "errors": ["string"], + "warnings": ["string"] + }, + "status": "ok" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | -------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------- | +| `checked_at` | string | false | | | +| `report` | [codersdk.ProxyHealthReport](#codersdkproxyhealthreport) | false | | Report provides more information about the health of the workspace proxy. | +| `status` | [codersdk.ProxyHealthStatus](#codersdkproxyhealthstatus) | false | | | -## healthcheck.DatabaseReport +## codersdk.WorkspaceQuota ```json { - "dismissed": true, - "error": "string", - "healthy": true, - "latency": "string", - "latency_ms": 0, - "reachable": true, - "severity": "ok", - "threshold_ms": 0, - "warnings": [ + "budget": 0, + "credits_consumed": 0 +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------- | -------- | ------------ | ----------- | +| `budget` | integer | false | | | +| `credits_consumed` | integer | false | | | + +## codersdk.WorkspaceResource + +```json +{ + "agents": [ { - "code": "EUNKNOWN", - "message": "string" + "api_version": "string", + "apps": [ + { + "command": "string", + "display_name": "string", + "external": true, + "health": "disabled", + "healthcheck": { + "interval": 0, + "threshold": 0, + "url": "string" + }, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "sharing_level": "owner", + "slug": "string", + "subdomain": true, + "subdomain_name": "string", + "url": "string" + } + ], + "architecture": "string", + "connection_timeout_seconds": 0, + "created_at": "2019-08-24T14:15:22Z", + "directory": "string", + "disconnected_at": "2019-08-24T14:15:22Z", + "display_apps": ["vscode"], + "environment_variables": { + "property1": "string", + "property2": "string" + }, + "expanded_directory": "string", + "first_connected_at": "2019-08-24T14:15:22Z", + "health": { + "healthy": false, + "reason": "agent has lost connection" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "instance_id": "string", + "last_connected_at": "2019-08-24T14:15:22Z", + "latency": { + "property1": { + "latency_ms": 0, + "preferred": true + }, + "property2": { + "latency_ms": 0, + "preferred": true + } + }, + "lifecycle_state": "created", + "log_sources": [ + { + "created_at": "2019-08-24T14:15:22Z", + "display_name": "string", + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" + } + ], + "logs_length": 0, + "logs_overflowed": true, + "name": "string", + "operating_system": "string", + "ready_at": "2019-08-24T14:15:22Z", + "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", + "scripts": [ + { + "cron": "string", + "log_path": "string", + "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", + "run_on_start": true, + "run_on_stop": true, + "script": "string", + "start_blocks_login": true, + "timeout": 0 + } + ], + "started_at": "2019-08-24T14:15:22Z", + "startup_script_behavior": "blocking", + "status": "connecting", + "subsystems": ["envbox"], + "troubleshooting_url": "string", + "updated_at": "2019-08-24T14:15:22Z", + "version": "string" } - ] + ], + "created_at": "2019-08-24T14:15:22Z", + "daily_cost": 0, + "hide": true, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", + "metadata": [ + { + "key": "string", + "sensitive": true, + "value": "string" + } + ], + "name": "string", + "type": "string", + "workspace_transition": "start" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------- | ----------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------- | -| `dismissed` | boolean | false | | | -| `error` | string | false | | | -| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | -| `latency` | string | false | | | -| `latency_ms` | integer | false | | | -| `reachable` | boolean | false | | | -| `severity` | [health.Severity](#healthseverity) | false | | | -| `threshold_ms` | integer | false | | | -| `warnings` | array of [health.Message](#healthmessage) | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------------------- | --------------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `agents` | array of [codersdk.WorkspaceAgent](#codersdkworkspaceagent) | false | | | +| `created_at` | string | false | | | +| `daily_cost` | integer | false | | | +| `hide` | boolean | false | | | +| `icon` | string | false | | | +| `id` | string | false | | | +| `job_id` | string | false | | | +| `metadata` | array of [codersdk.WorkspaceResourceMetadata](#codersdkworkspaceresourcemetadata) | false | | | +| `name` | string | false | | | +| `type` | string | false | | | +| `workspace_transition` | [codersdk.WorkspaceTransition](#codersdkworkspacetransition) | false | | | #### Enumerated Values -| Property | Value | -| ---------- | --------- | -| `severity` | `ok` | -| `severity` | `warning` | -| `severity` | `error` | +| Property | Value | +| ---------------------- | -------- | +| `workspace_transition` | `start` | +| `workspace_transition` | `stop` | +| `workspace_transition` | `delete` | -## healthcheck.ProvisionerDaemonsReport +## codersdk.WorkspaceResourceMetadata ```json { - "dismissed": true, - "error": "string", - "items": [ - { - "provisioner_daemon": { - "api_version": "string", - "created_at": "2019-08-24T14:15:22Z", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "last_seen_at": "2019-08-24T14:15:22Z", - "name": "string", - "provisioners": ["string"], - "tags": { - "property1": "string", - "property2": "string" - }, - "version": "string" - }, - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - } - ], - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] + "key": "string", + "sensitive": true, + "value": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ----------- | --------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `dismissed` | boolean | false | | | -| `error` | string | false | | | -| `items` | array of [healthcheck.ProvisionerDaemonsReportItem](#healthcheckprovisionerdaemonsreportitem) | false | | | -| `severity` | [health.Severity](#healthseverity) | false | | | -| `warnings` | array of [health.Message](#healthmessage) | false | | | +| Name | Type | Required | Restrictions | Description | +| ----------- | ------- | -------- | ------------ | ----------- | +| `key` | string | false | | | +| `sensitive` | boolean | false | | | +| `value` | string | false | | | -## healthcheck.ProvisionerDaemonsReportItem +## codersdk.WorkspaceStatus ```json -{ - "provisioner_daemon": { - "api_version": "string", - "created_at": "2019-08-24T14:15:22Z", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "last_seen_at": "2019-08-24T14:15:22Z", - "name": "string", - "provisioners": ["string"], - "tags": { - "property1": "string", - "property2": "string" - }, - "version": "string" - }, - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] -} +"pending" ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| -------------------- | -------------------------------------------------------- | -------- | ------------ | ----------- | -| `provisioner_daemon` | [codersdk.ProvisionerDaemon](#codersdkprovisionerdaemon) | false | | | -| `warnings` | array of [health.Message](#healthmessage) | false | | | - -## healthcheck.Report +#### Enumerated Values -```json -{ - "access_url": { - "access_url": "string", - "dismissed": true, - "error": "string", - "healthy": true, - "healthz_response": "string", - "reachable": true, - "severity": "ok", - "status_code": 0, - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - }, - "coder_version": "string", - "database": { - "dismissed": true, - "error": "string", - "healthy": true, - "latency": "string", - "latency_ms": 0, - "reachable": true, - "severity": "ok", - "threshold_ms": 0, - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - }, - "derp": { - "dismissed": true, - "error": "string", - "healthy": true, - "netcheck": { - "captivePortal": "string", - "globalV4": "string", - "globalV6": "string", - "hairPinning": "string", - "icmpv4": true, - "ipv4": true, - "ipv4CanSend": true, - "ipv6": true, - "ipv6CanSend": true, - "mappingVariesByDestIP": "string", - "oshasIPv6": true, - "pcp": "string", - "pmp": "string", - "preferredDERP": 0, - "regionLatency": { - "property1": 0, - "property2": 0 - }, - "regionV4Latency": { - "property1": 0, - "property2": 0 - }, - "regionV6Latency": { - "property1": 0, - "property2": 0 - }, - "udp": true, - "upnP": "string" - }, - "netcheck_err": "string", - "netcheck_logs": ["string"], - "regions": { - "property1": { - "error": "string", - "healthy": true, - "node_reports": [ - { - "can_exchange_messages": true, - "client_errs": [["string"]], - "client_logs": [["string"]], - "error": "string", - "healthy": true, - "node": { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - }, - "node_info": { - "tokenBucketBytesBurst": 0, - "tokenBucketBytesPerSecond": 0 - }, - "round_trip_ping": "string", - "round_trip_ping_ms": 0, - "severity": "ok", - "stun": { - "canSTUN": true, - "enabled": true, - "error": "string" - }, - "uses_websocket": true, - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - } - ], - "region": { - "avoid": true, - "embeddedRelay": true, - "nodes": [ - { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - } - ], - "regionCode": "string", - "regionID": 0, - "regionName": "string" - }, - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] +| Value | +| ----------- | +| `pending` | +| `starting` | +| `running` | +| `stopping` | +| `stopped` | +| `failed` | +| `canceling` | +| `canceled` | +| `deleting` | +| `deleted` | + +## codersdk.WorkspaceTransition + +```json +"start" +``` + +### Properties + +#### Enumerated Values + +| Value | +| -------- | +| `start` | +| `stop` | +| `delete` | + +## codersdk.WorkspacesResponse + +```json +{ + "count": 0, + "workspaces": [ + { + "allow_renames": true, + "automatic_updates": "always", + "autostart_schedule": "string", + "created_at": "2019-08-24T14:15:22Z", + "deleting_at": "2019-08-24T14:15:22Z", + "dormant_at": "2019-08-24T14:15:22Z", + "favorite": true, + "health": { + "failing_agents": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "healthy": false }, - "property2": { - "error": "string", - "healthy": true, - "node_reports": [ - { - "can_exchange_messages": true, - "client_errs": [["string"]], - "client_logs": [["string"]], - "error": "string", - "healthy": true, - "node": { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - }, - "node_info": { - "tokenBucketBytesBurst": 0, - "tokenBucketBytesPerSecond": 0 - }, - "round_trip_ping": "string", - "round_trip_ping_ms": 0, - "severity": "ok", - "stun": { - "canSTUN": true, - "enabled": true, - "error": "string" - }, - "uses_websocket": true, - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - } - ], - "region": { - "avoid": true, - "embeddedRelay": true, - "nodes": [ - { - "canPort80": true, - "certName": "string", - "derpport": 0, - "forceHTTP": true, - "hostName": "string", - "insecureForTests": true, - "ipv4": "string", - "ipv6": "string", - "name": "string", - "regionID": 0, - "stunonly": true, - "stunport": 0, - "stuntestIP": "string" - } - ], - "regionCode": "string", - "regionID": 0, - "regionName": "string" - }, - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - } - }, - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - }, - "failing_sections": ["DERP"], - "healthy": true, - "provisioner_daemons": { - "dismissed": true, - "error": "string", - "items": [ - { - "provisioner_daemon": { - "api_version": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_used_at": "2019-08-24T14:15:22Z", + "latest_build": { + "build_number": 0, + "created_at": "2019-08-24T14:15:22Z", + "daily_cost": 0, + "deadline": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", + "initiator_name": "string", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "error_code": "REQUIRED_TEMPLATE_VARIABLES", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "last_seen_at": "2019-08-24T14:15:22Z", - "name": "string", - "provisioners": ["string"], + "queue_position": 0, + "queue_size": 0, + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", "tags": { "property1": "string", "property2": "string" }, - "version": "string" + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" }, - "warnings": [ + "max_deadline": "2019-08-24T14:15:22Z", + "reason": "initiator", + "resources": [ { - "code": "EUNKNOWN", - "message": "string" + "agents": [ + { + "api_version": "string", + "apps": [ + { + "command": "string", + "display_name": "string", + "external": true, + "health": "disabled", + "healthcheck": {}, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "sharing_level": "owner", + "slug": "string", + "subdomain": true, + "subdomain_name": "string", + "url": "string" + } + ], + "architecture": "string", + "connection_timeout_seconds": 0, + "created_at": "2019-08-24T14:15:22Z", + "directory": "string", + "disconnected_at": "2019-08-24T14:15:22Z", + "display_apps": ["vscode"], + "environment_variables": { + "property1": "string", + "property2": "string" + }, + "expanded_directory": "string", + "first_connected_at": "2019-08-24T14:15:22Z", + "health": { + "healthy": false, + "reason": "agent has lost connection" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "instance_id": "string", + "last_connected_at": "2019-08-24T14:15:22Z", + "latency": { + "property1": { + "latency_ms": 0, + "preferred": true + }, + "property2": { + "latency_ms": 0, + "preferred": true + } + }, + "lifecycle_state": "created", + "log_sources": [ + { + "created_at": "2019-08-24T14:15:22Z", + "display_name": "string", + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "workspace_agent_id": "7ad2e618-fea7-4c1a-b70a-f501566a72f1" + } + ], + "logs_length": 0, + "logs_overflowed": true, + "name": "string", + "operating_system": "string", + "ready_at": "2019-08-24T14:15:22Z", + "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", + "scripts": [ + { + "cron": "string", + "log_path": "string", + "log_source_id": "4197ab25-95cf-4b91-9c78-f7f2af5d353a", + "run_on_start": true, + "run_on_stop": true, + "script": "string", + "start_blocks_login": true, + "timeout": 0 + } + ], + "started_at": "2019-08-24T14:15:22Z", + "startup_script_behavior": "blocking", + "status": "connecting", + "subsystems": ["envbox"], + "troubleshooting_url": "string", + "updated_at": "2019-08-24T14:15:22Z", + "version": "string" + } + ], + "created_at": "2019-08-24T14:15:22Z", + "daily_cost": 0, + "hide": true, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", + "metadata": [ + { + "key": "string", + "sensitive": true, + "value": "string" + } + ], + "name": "string", + "type": "string", + "workspace_transition": "start" } - ] - } - ], - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ] - }, - "severity": "ok", - "time": "string", - "websocket": { - "body": "string", - "code": 0, - "dismissed": true, - "error": "string", - "healthy": true, - "severity": "ok", - "warnings": ["string"] - }, - "workspace_proxy": { - "dismissed": true, - "error": "string", - "healthy": true, - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ], - "workspace_proxies": { - "regions": [ - { - "created_at": "2019-08-24T14:15:22Z", - "deleted": true, - "derp_enabled": true, - "derp_only": true, - "display_name": "string", - "healthy": true, - "icon_url": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "name": "string", - "path_app_url": "string", - "status": { - "checked_at": "2019-08-24T14:15:22Z", - "report": { - "errors": ["string"], - "warnings": ["string"] - }, - "status": "ok" - }, - "updated_at": "2019-08-24T14:15:22Z", - "version": "string", - "wildcard_hostname": "string" - } - ] + ], + "status": "pending", + "template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1", + "template_version_name": "string", + "transition": "start", + "updated_at": "2019-08-24T14:15:22Z", + "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", + "workspace_name": "string", + "workspace_owner_avatar_url": "string", + "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", + "workspace_owner_name": "string" + }, + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "outdated": true, + "owner_avatar_url": "string", + "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05", + "owner_name": "string", + "template_active_version_id": "b0da9c29-67d8-4c87-888c-bafe356f7f3c", + "template_allow_user_cancel_workspace_jobs": true, + "template_display_name": "string", + "template_icon": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "template_name": "string", + "template_require_active_version": true, + "ttl_ms": 0, + "updated_at": "2019-08-24T14:15:22Z" } - } + ] } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| --------------------- | ---------------------------------------------------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------- | -| `access_url` | [healthcheck.AccessURLReport](#healthcheckaccessurlreport) | false | | | -| `coder_version` | string | false | | The Coder version of the server that the report was generated on. | -| `database` | [healthcheck.DatabaseReport](#healthcheckdatabasereport) | false | | | -| `derp` | [derphealth.Report](#derphealthreport) | false | | | -| `failing_sections` | array of [codersdk.HealthSection](#codersdkhealthsection) | false | | Failing sections is a list of sections that have failed their healthcheck. | -| `healthy` | boolean | false | | Healthy is true if the report returns no errors. Deprecated: use `Severity` instead | -| `provisioner_daemons` | [healthcheck.ProvisionerDaemonsReport](#healthcheckprovisionerdaemonsreport) | false | | | -| `severity` | [health.Severity](#healthseverity) | false | | Severity indicates the status of Coder health. | -| `time` | string | false | | Time is the time the report was generated at. | -| `websocket` | [healthcheck.WebsocketReport](#healthcheckwebsocketreport) | false | | | -| `workspace_proxy` | [healthcheck.WorkspaceProxyReport](#healthcheckworkspaceproxyreport) | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------ | ------------------------------------------------- | -------- | ------------ | ----------- | +| `count` | integer | false | | | +| `workspaces` | array of [codersdk.Workspace](#codersdkworkspace) | false | | | -#### Enumerated Values +## derp.BytesSentRecv -| Property | Value | -| ---------- | --------- | -| `severity` | `ok` | -| `severity` | `warning` | -| `severity` | `error` | +```json +{ + "key": {}, + "recv": 0, + "sent": 0 +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------ | -------------------------------- | -------- | ------------ | -------------------------------------------------------------------- | +| `key` | [key.NodePublic](#keynodepublic) | false | | Key is the public key of the client which sent/received these bytes. | +| `recv` | integer | false | | | +| `sent` | integer | false | | | -## healthcheck.WebsocketReport +## derp.ServerInfoMessage ```json { - "body": "string", - "code": 0, - "dismissed": true, - "error": "string", - "healthy": true, - "severity": "ok", - "warnings": ["string"] + "tokenBucketBytesBurst": 0, + "tokenBucketBytesPerSecond": 0 } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ----------- | ---------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------- | -| `body` | string | false | | | -| `code` | integer | false | | | -| `dismissed` | boolean | false | | | -| `error` | string | false | | | -| `healthy` | boolean | false | | Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead. | -| `severity` | [health.Severity](#healthseverity) | false | | | -| `warnings` | array of string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------------------------------------------------------------------------------ | ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `tokenBucketBytesBurst` | integer | false | | Tokenbucketbytesburst is how many bytes the server will allow to burst, temporarily violating TokenBucketBytesPerSecond. | +| Zero means unspecified. There might be a limit, but the client need not try to respect it. | +| `tokenBucketBytesPerSecond` | integer | false | | Tokenbucketbytespersecond is how many bytes per second the server says it will accept, including all framing bytes. | +| Zero means unspecified. There might be a limit, but the client need not try to respect it. | + +## health.Code + +```json +"EUNKNOWN" +``` + +### Properties #### Enumerated Values -| Property | Value | -| ---------- | --------- | -| `severity` | `ok` | -| `severity` | `warning` | -| `severity` | `error` | +| Value | +| ---------- | +| `EUNKNOWN` | +| `EWP01` | +| `EWP02` | +| `EWP03` | +| `EWP04` | +| `EDB01` | +| `EDB02` | +| `EWS01` | +| `EWS02` | +| `EWS03` | +| `EACS01` | +| `EACS02` | +| `EACS03` | +| `EACS04` | +| `EDERP01` | +| `EDERP02` | +| `EPD01` | +| `EPD02` | +| `EPD03` | -## healthcheck.WorkspaceProxyReport +## health.Message ```json { - "dismissed": true, - "error": "string", - "healthy": true, - "severity": "ok", - "warnings": [ - { - "code": "EUNKNOWN", - "message": "string" - } - ], - "workspace_proxies": { - "regions": [ - { - "created_at": "2019-08-24T14:15:22Z", - "deleted": true, - "derp_enabled": true, - "derp_only": true, - "display_name": "string", - "healthy": true, - "icon_url": "string", - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "name": "string", - "path_app_url": "string", - "status": { - "checked_at": "2019-08-24T14:15:22Z", - "report": { - "errors": ["string"], - "warnings": ["string"] - }, - "status": "ok" - }, - "updated_at": "2019-08-24T14:15:22Z", - "version": "string", - "wildcard_hostname": "string" - } - ] - } + "code": "EUNKNOWN", + "message": "string" } ``` ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------- | ---------------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | -| `dismissed` | boolean | false | | | -| `error` | string | false | | | -| `healthy` | boolean | false | | | -| `severity` | [health.Severity](#healthseverity) | false | | | -| `warnings` | array of [health.Message](#healthmessage) | false | | | -| `workspace_proxies` | [codersdk.RegionsResponse-codersdk_WorkspaceProxy](#codersdkregionsresponse-codersdk_workspaceproxy) | false | | | +| Name | Type | Required | Restrictions | Description | +| --------- | -------------------------- | -------- | ------------ | ----------- | +| `code` | [health.Code](#healthcode) | false | | | +| `message` | string | false | | | + +## health.Severity + +```json +"ok" +``` + +### Properties + +#### Enumerated Values + +| Value | +| --------- | +| `ok` | +| `warning` | +| `error` | ## key.NodePublic diff --git a/scripts/apitypings/main.go b/scripts/apitypings/main.go index 5840afd3d6ab6..6d2993dcdee21 100644 --- a/scripts/apitypings/main.go +++ b/scripts/apitypings/main.go @@ -28,13 +28,13 @@ import ( var ( // baseDirs are the directories to introspect for types to generate. - baseDirs = [...]string{"./codersdk", "./coderd/healthcheck"} + baseDirs = [...]string{"./codersdk"} // externalTypes are types that are not in the baseDirs, but we want to // support. These are usually types that are used in the baseDirs. // Do not include things like "Database", as that would break the idea // of splitting db and api types. // Only include dirs that are client facing packages. - externalTypeDirs = [...]string{"./cli/clibase", "./coderd/healthcheck/health", "./coderd/healthcheck/derphealth"} + externalTypeDirs = [...]string{"./cli/clibase", "./coderd/healthcheck/health"} indent = " " ) diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 731b7b3a412d2..c24005c754775 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -27,6 +27,19 @@ export interface APIKeyWithOwner extends APIKey { readonly username: string; } +// From codersdk/health.go +export interface AccessURLReport { + readonly healthy: boolean; + readonly severity: HealthSeverity; + readonly warnings: HealthMessage[]; + readonly dismissed: boolean; + readonly access_url: string; + readonly reachable: boolean; + readonly status_code: number; + readonly healthz_response: string; + readonly error?: string; +} + // From codersdk/licenses.go export interface AddLicenseRequest { readonly license: string; @@ -346,12 +359,60 @@ export interface DERPConfig { readonly path: string; } +// From codersdk/health.go +export interface DERPHealthReport { + readonly healthy: boolean; + readonly severity: HealthSeverity; + readonly warnings: HealthMessage[]; + readonly dismissed: boolean; + readonly regions: Record; + // Named type "tailscale.com/net/netcheck.Report" unknown, using "any" + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type + readonly netcheck?: any; + readonly netcheck_err?: string; + readonly netcheck_logs: string[]; + readonly error?: string; +} + +// From codersdk/health.go +export interface DERPNodeReport { + readonly healthy: boolean; + readonly severity: HealthSeverity; + readonly warnings: HealthMessage[]; + // Named type "tailscale.com/tailcfg.DERPNode" unknown, using "any" + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type + readonly node?: any; + // Named type "tailscale.com/derp.ServerInfoMessage" unknown, using "any" + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type + readonly node_info: any; + readonly can_exchange_messages: boolean; + readonly round_trip_ping: string; + readonly round_trip_ping_ms: number; + readonly uses_websocket: boolean; + readonly client_logs: string[][]; + readonly client_errs: string[][]; + readonly error?: string; + readonly stun: STUNReport; +} + // From codersdk/workspaceagents.go export interface DERPRegion { readonly preferred: boolean; readonly latency_ms: number; } +// From codersdk/health.go +export interface DERPRegionReport { + readonly healthy: boolean; + readonly severity: HealthSeverity; + readonly warnings: HealthMessage[]; + // Named type "tailscale.com/tailcfg.DERPRegion" unknown, using "any" + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type + readonly region?: any; + readonly node_reports: DERPNodeReport[]; + readonly error?: string; +} + // From codersdk/deployment.go export interface DERPServerConfig { readonly enable: boolean; @@ -369,6 +430,19 @@ export interface DangerousConfig { readonly allow_all_cors: boolean; } +// From codersdk/health.go +export interface DatabaseReport { + readonly healthy: boolean; + readonly severity: HealthSeverity; + readonly warnings: HealthMessage[]; + readonly dismissed: boolean; + readonly reachable: boolean; + readonly latency: string; + readonly latency_ms: number; + readonly threshold_ms: number; + readonly error?: string; +} + // From codersdk/workspaceagentportshare.go export interface DeleteWorkspaceAgentPortShareRequest { readonly agent_name: string; @@ -605,6 +679,21 @@ export interface HealthcheckConfig { readonly threshold_database: number; } +// From codersdk/health.go +export interface HealthcheckReport { + readonly time: string; + readonly healthy: boolean; + readonly severity: HealthSeverity; + readonly failing_sections: HealthSection[]; + readonly derp: DERPHealthReport; + readonly access_url: AccessURLReport; + readonly websocket: WebsocketReport; + readonly database: DatabaseReport; + readonly workspace_proxy: WorkspaceProxyReport; + readonly provisioner_daemons: ProvisionerDaemonsReport; + readonly coder_version: string; +} + // From codersdk/workspaceagents.go export interface IssueReconnectingPTYSignedTokenRequest { readonly url: string; @@ -860,6 +949,21 @@ export interface ProvisionerDaemon { readonly tags: Record; } +// From codersdk/health.go +export interface ProvisionerDaemonsReport { + readonly severity: HealthSeverity; + readonly warnings: HealthMessage[]; + readonly dismissed: boolean; + readonly error?: string; + readonly items: ProvisionerDaemonsReportItem[]; +} + +// From codersdk/health.go +export interface ProvisionerDaemonsReportItem { + readonly provisioner_daemon: ProvisionerDaemon; + readonly warnings: HealthMessage[]; +} + // From codersdk/provisionerdaemons.go export interface ProvisionerJob { readonly id: string; @@ -979,6 +1083,13 @@ export interface SSHConfigResponse { readonly ssh_config_options: Record; } +// From codersdk/health.go +export interface STUNReport { + readonly Enabled: boolean; + readonly CanSTUN: boolean; + readonly Error?: string; +} + // From codersdk/serversentevents.go export interface ServerSentEvent { readonly type: ServerSentEventType; @@ -1509,6 +1620,17 @@ export interface VariableValue { readonly value: string; } +// From codersdk/health.go +export interface WebsocketReport { + readonly healthy: boolean; + readonly severity: HealthSeverity; + readonly warnings: string[]; + readonly dismissed: boolean; + readonly body: string; + readonly code: number; + readonly error?: string; +} + // From codersdk/workspaces.go export interface Workspace { readonly id: string; @@ -1762,6 +1884,16 @@ export interface WorkspaceProxyBuildInfo { readonly dashboard_url: string; } +// From codersdk/health.go +export interface WorkspaceProxyReport { + readonly healthy: boolean; + readonly severity: HealthSeverity; + readonly warnings: HealthMessage[]; + readonly dismissed: boolean; + readonly error?: string; + readonly workspace_proxies: RegionsResponse; +} + // From codersdk/workspaceproxy.go export interface WorkspaceProxyStatus { readonly status: ProxyHealthStatus; @@ -2286,85 +2418,6 @@ export const WorkspaceTransitions: WorkspaceTransition[] = [ // From codersdk/workspaceproxy.go export type RegionTypes = Region | WorkspaceProxy; -// The code below is generated from coderd/healthcheck. - -// From healthcheck/accessurl.go -export interface HealthcheckAccessURLReport { - readonly healthy: boolean; - readonly severity: HealthSeverity; - readonly warnings: HealthMessage[]; - readonly dismissed: boolean; - readonly access_url: string; - readonly reachable: boolean; - readonly status_code: number; - readonly healthz_response: string; - readonly error?: string; -} - -// From healthcheck/database.go -export interface HealthcheckDatabaseReport { - readonly healthy: boolean; - readonly severity: HealthSeverity; - readonly warnings: HealthMessage[]; - readonly dismissed: boolean; - readonly reachable: boolean; - readonly latency: string; - readonly latency_ms: number; - readonly threshold_ms: number; - readonly error?: string; -} - -// From healthcheck/provisioner.go -export interface HealthcheckProvisionerDaemonsReport { - readonly severity: HealthSeverity; - readonly warnings: HealthMessage[]; - readonly dismissed: boolean; - readonly error?: string; - readonly items: HealthcheckProvisionerDaemonsReportItem[]; -} - -// From healthcheck/provisioner.go -export interface HealthcheckProvisionerDaemonsReportItem { - readonly provisioner_daemon: ProvisionerDaemon; - readonly warnings: HealthMessage[]; -} - -// From healthcheck/healthcheck.go -export interface HealthcheckReport { - readonly time: string; - readonly healthy: boolean; - readonly severity: HealthSeverity; - readonly failing_sections: HealthSection[]; - readonly derp: DerphealthReport; - readonly access_url: HealthcheckAccessURLReport; - readonly websocket: HealthcheckWebsocketReport; - readonly database: HealthcheckDatabaseReport; - readonly workspace_proxy: HealthcheckWorkspaceProxyReport; - readonly provisioner_daemons: HealthcheckProvisionerDaemonsReport; - readonly coder_version: string; -} - -// From healthcheck/websocket.go -export interface HealthcheckWebsocketReport { - readonly healthy: boolean; - readonly severity: HealthSeverity; - readonly warnings: string[]; - readonly dismissed: boolean; - readonly body: string; - readonly code: number; - readonly error?: string; -} - -// From healthcheck/workspaceproxy.go -export interface HealthcheckWorkspaceProxyReport { - readonly healthy: boolean; - readonly severity: HealthSeverity; - readonly warnings: HealthMessage[]; - readonly dismissed: boolean; - readonly error?: string; - readonly workspace_proxies: RegionsResponse; -} - // The code below is generated from cli/clibase. // From clibase/clibase.go @@ -2464,60 +2517,3 @@ export const HealthCodes: HealthCode[] = [ // From health/model.go export type HealthSeverity = "error" | "ok" | "warning"; export const HealthSeveritys: HealthSeverity[] = ["error", "ok", "warning"]; - -// The code below is generated from coderd/healthcheck/derphealth. - -// From derphealth/derp.go -export interface DerphealthNodeReport { - readonly healthy: boolean; - readonly severity: HealthSeverity; - readonly warnings: HealthMessage[]; - // Named type "tailscale.com/tailcfg.DERPNode" unknown, using "any" - // eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type - readonly node?: any; - // Named type "tailscale.com/derp.ServerInfoMessage" unknown, using "any" - // eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type - readonly node_info: any; - readonly can_exchange_messages: boolean; - readonly round_trip_ping: string; - readonly round_trip_ping_ms: number; - readonly uses_websocket: boolean; - readonly client_logs: string[][]; - readonly client_errs: string[][]; - readonly error?: string; - readonly stun: DerphealthStunReport; -} - -// From derphealth/derp.go -export interface DerphealthRegionReport { - readonly healthy: boolean; - readonly severity: HealthSeverity; - readonly warnings: HealthMessage[]; - // Named type "tailscale.com/tailcfg.DERPRegion" unknown, using "any" - // eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type - readonly region?: any; - readonly node_reports: DerphealthNodeReport[]; - readonly error?: string; -} - -// From derphealth/derp.go -export interface DerphealthReport { - readonly healthy: boolean; - readonly severity: HealthSeverity; - readonly warnings: HealthMessage[]; - readonly dismissed: boolean; - readonly regions: Record; - // Named type "tailscale.com/net/netcheck.Report" unknown, using "any" - // eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type - readonly netcheck?: any; - readonly netcheck_err?: string; - readonly netcheck_logs: string[]; - readonly error?: string; -} - -// From derphealth/derp.go -export interface DerphealthStunReport { - readonly Enabled: boolean; - readonly CanSTUN: boolean; - readonly Error?: string; -} From dd485b3c6f309e9cbf1b25942fdf86e329b4d844 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Fri, 23 Feb 2024 12:44:43 +0000 Subject: [PATCH 2/3] address PR comments --- cli/netcheck_test.go | 3 +-- coderd/healthcheck/accessurl.go | 3 +-- coderd/healthcheck/database.go | 3 +-- coderd/healthcheck/derphealth/derp.go | 24 +++++++++++++++++------- coderd/healthcheck/websocket.go | 3 +-- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/cli/netcheck_test.go b/cli/netcheck_test.go index bf9608d826a26..a2004a22242bc 100644 --- a/cli/netcheck_test.go +++ b/cli/netcheck_test.go @@ -5,12 +5,11 @@ import ( "encoding/json" "testing" - "github.com/coder/coder/v2/codersdk" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/coder/coder/v2/cli/clitest" + "github.com/coder/coder/v2/codersdk" "github.com/coder/coder/v2/pty/ptytest" ) diff --git a/coderd/healthcheck/accessurl.go b/coderd/healthcheck/accessurl.go index 2e8d7e23301c2..53ca693a9b8ad 100644 --- a/coderd/healthcheck/accessurl.go +++ b/coderd/healthcheck/accessurl.go @@ -7,9 +7,8 @@ import ( "net/url" "time" - "github.com/coder/coder/v2/codersdk" - "github.com/coder/coder/v2/coderd/healthcheck/health" + "github.com/coder/coder/v2/codersdk" ) type AccessURLReport codersdk.AccessURLReport diff --git a/coderd/healthcheck/database.go b/coderd/healthcheck/database.go index 6ae2b60e566a3..5d8455da87c05 100644 --- a/coderd/healthcheck/database.go +++ b/coderd/healthcheck/database.go @@ -4,12 +4,11 @@ import ( "context" "time" - "github.com/coder/coder/v2/codersdk" - "golang.org/x/exp/slices" "github.com/coder/coder/v2/coderd/database" "github.com/coder/coder/v2/coderd/healthcheck/health" + "github.com/coder/coder/v2/codersdk" ) const ( diff --git a/coderd/healthcheck/derphealth/derp.go b/coderd/healthcheck/derphealth/derp.go index 41cf9571cd3b5..ab4e9adf70c7e 100644 --- a/coderd/healthcheck/derphealth/derp.go +++ b/coderd/healthcheck/derphealth/derp.go @@ -11,8 +11,6 @@ import ( "sync/atomic" "time" - "github.com/coder/coder/v2/codersdk" - "golang.org/x/exp/slices" "golang.org/x/xerrors" "tailscale.com/derp" @@ -27,6 +25,7 @@ import ( "github.com/coder/coder/v2/coderd/healthcheck/health" "github.com/coder/coder/v2/coderd/util/ptr" "github.com/coder/coder/v2/coderd/util/slice" + "github.com/coder/coder/v2/codersdk" ) const ( @@ -71,11 +70,19 @@ func (r *Report) Run(ctx context.Context, opts *ReportOptions) { for _, region := range opts.DERPMap.Regions { var ( region = region - regionReport RegionReport + regionReport = RegionReport{ + DERPRegionReport: codersdk.DERPRegionReport{ + Region: region, + }, + } ) - regionReport.Region = region go func() { defer wg.Done() + defer func() { + if err := recover(); err != nil { + regionReport.Error = ptr.Ref(fmt.Sprint(err)) + } + }() regionReport.Run(ctx) @@ -126,10 +133,13 @@ func (r *RegionReport) Run(ctx context.Context) { for _, node := range r.Region.Nodes { var ( node = node - nodeReport NodeReport + nodeReport = NodeReport{ + DERPNodeReport: codersdk.DERPNodeReport{ + Node: node, + Healthy: true, + }, + } ) - nodeReport.Node = node - nodeReport.Healthy = true go func() { defer wg.Done() diff --git a/coderd/healthcheck/websocket.go b/coderd/healthcheck/websocket.go index eefa509df0f83..582a5023ef09c 100644 --- a/coderd/healthcheck/websocket.go +++ b/coderd/healthcheck/websocket.go @@ -9,12 +9,11 @@ import ( "strconv" "time" - "github.com/coder/coder/v2/codersdk" - "golang.org/x/xerrors" "nhooyr.io/websocket" "github.com/coder/coder/v2/coderd/healthcheck/health" + "github.com/coder/coder/v2/codersdk" ) type WebsocketReport codersdk.WebsocketReport From 9d3389abb4e017fe8d73bb1a939abba0f73c91b1 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Fri, 23 Feb 2024 12:52:13 +0000 Subject: [PATCH 3/3] remove unnecessary type embedding --- cli/netcheck.go | 2 +- coderd/healthcheck/derphealth/derp.go | 4 +--- coderd/healthcheck/healthcheck.go | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cli/netcheck.go b/cli/netcheck.go index 1130a1e0373fd..5ca7a3d99975b 100644 --- a/cli/netcheck.go +++ b/cli/netcheck.go @@ -38,7 +38,7 @@ func (r *RootCmd) netcheck() *clibase.Cmd { DERPMap: connInfo.DERPMap, }) - raw, err := json.MarshalIndent(report.DERPHealthReport, "", " ") + raw, err := json.MarshalIndent(report, "", " ") if err != nil { return err } diff --git a/coderd/healthcheck/derphealth/derp.go b/coderd/healthcheck/derphealth/derp.go index ab4e9adf70c7e..d3f99fbed095e 100644 --- a/coderd/healthcheck/derphealth/derp.go +++ b/coderd/healthcheck/derphealth/derp.go @@ -40,9 +40,7 @@ type ReportOptions struct { DERPMap *tailcfg.DERPMap } -type Report struct { - codersdk.DERPHealthReport -} +type Report codersdk.DERPHealthReport type RegionReport struct { codersdk.DERPRegionReport diff --git a/coderd/healthcheck/healthcheck.go b/coderd/healthcheck/healthcheck.go index 3f523ae24e726..0b058dea35663 100644 --- a/coderd/healthcheck/healthcheck.go +++ b/coderd/healthcheck/healthcheck.go @@ -37,7 +37,7 @@ type defaultChecker struct{} func (defaultChecker) DERP(ctx context.Context, opts *derphealth.ReportOptions) codersdk.DERPHealthReport { var report derphealth.Report report.Run(ctx, opts) - return report.DERPHealthReport + return codersdk.DERPHealthReport(report) } func (defaultChecker) AccessURL(ctx context.Context, opts *AccessURLReportOptions) codersdk.AccessURLReport {