From e67d131514096c24d3cdb67673a240bd5e958cb6 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Tue, 3 Jan 2023 19:21:10 +0100 Subject: [PATCH] docs: audit, deploymentconfig, files, parameters (#5506) * docs: audit, deploymentconfig, files, parameters * Fix: mark as binary * Fix: show format in docs * Fix: use .swaggo * Fix: swagger notice * Swagger notice --- .swaggo | 2 + Makefile | 2 +- coderd/apidoc/docs.go | 1186 ++++++++- coderd/apidoc/swagger.json | 1116 +++++++- coderd/audit.go | 19 + coderd/deploymentconfig.go | 7 + coderd/files.go | 18 + coderd/parameters.go | 30 + coderd/templates.go | 2 +- codersdk/audit.go | 4 +- codersdk/files.go | 2 +- codersdk/parameters.go | 32 +- codersdk/workspacebuilds.go | 2 +- docs/api/audit.md | 129 + docs/api/files.md | 75 + docs/api/general.md | 863 +++++- docs/api/parameters.md | 208 ++ docs/api/schemas.md | 2363 ++++++++++++++++- docs/api/templates.md | 78 +- docs/api/workspaces.md | 20 +- docs/manifest.json | 12 + .../markdown-template/code_shell.dot | 6 +- scripts/apidocgen/markdown-template/main.dot | 3 - .../apidocgen/markdown-template/operation.dot | 16 +- .../markdown-template/parameters.def | 3 + .../apidocgen/markdown-template/responses.def | 14 +- 26 files changed, 6118 insertions(+), 94 deletions(-) create mode 100644 .swaggo create mode 100644 docs/api/audit.md create mode 100644 docs/api/files.md create mode 100644 docs/api/parameters.md diff --git a/.swaggo b/.swaggo new file mode 100644 index 0000000000..4dcbb3ff4b --- /dev/null +++ b/.swaggo @@ -0,0 +1,2 @@ +// Replace all NullTime with string +replace github.com/coder/coder/codersdk.NullTime string diff --git a/Makefile b/Makefile index 547787c1d5..40a981afd5 100644 --- a/Makefile +++ b/Makefile @@ -483,7 +483,7 @@ docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/me cd site yarn run format:write:only ../docs/admin/prometheus.md -coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen -not \( -path './scripts/apidocgen/node_modules' -prune \) -type f) $(wildcard coderd/*.go) $(wildcard codersdk/*.go) +coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen -not \( -path './scripts/apidocgen/node_modules' -prune \) -type f) $(wildcard coderd/*.go) $(wildcard codersdk/*.go) .swaggo ./scripts/apidocgen/generate.sh cd site yarn run format:write:only ../docs/api ../docs/manifest.json ../coderd/apidoc/swagger.json diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index e674cf6222..9b45d84e51 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -97,6 +97,92 @@ const docTemplate = `{ } } }, + "/audit": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Audit" + ], + "summary": "Get audit logs", + "operationId": "get-audit-logs", + "parameters": [ + { + "type": "string", + "description": "Search query", + "name": "q", + "in": "query", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "After ID", + "name": "after_id", + "in": "query" + }, + { + "type": "integer", + "description": "Page limit", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "description": "Page offset", + "name": "offset", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.AuditLogResponse" + } + } + } + } + }, + "/audit/testgenerate": { + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Audit" + ], + "summary": "Generate fake audit log", + "operationId": "generate-fake-audit-logs", + "parameters": [ + { + "description": "Audit log request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateTestAuditLogRequest" + } + } + ], + "responses": { + "204": { + "description": "No Content" + } + } + } + }, "/authcheck": { "post": { "security": [ @@ -156,6 +242,31 @@ const docTemplate = `{ } } }, + "/config/deployment": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "General" + ], + "summary": "Get deployment config", + "operationId": "get-deployment-config", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.DeploymentConfig" + } + } + } + } + }, "/csp/reports": { "post": { "security": [ @@ -192,6 +303,81 @@ const docTemplate = `{ } } }, + "/files": { + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "description": "Swagger notice: Swagger 2.0 doesn't support file upload with a ` + "`" + `content-type` + "`" + ` different than ` + "`" + `application/x-www-form-urlencoded` + "`" + `.", + "consumes": [ + "application/x-tar" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Files" + ], + "summary": "Upload file", + "operationId": "update-file", + "parameters": [ + { + "type": "string", + "default": "application/x-tar", + "description": "Content-Type must be ` + "`" + `application/x-tar` + "`" + `", + "name": "Content-Type", + "in": "header", + "required": true + }, + { + "type": "file", + "description": "File to be uploaded", + "name": "file", + "in": "formData", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.UploadResponse" + } + } + } + } + }, + "/files/{fileID}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "tags": [ + "Files" + ], + "summary": "Get file by ID", + "operationId": "get-file-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "File ID", + "name": "fileID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/organizations/{organization-id}/templates/": { "post": { "security": [ @@ -360,6 +546,167 @@ const docTemplate = `{ } } }, + "/parameters/{scope}/{id}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Parameters" + ], + "summary": "Get parameters", + "operationId": "get-parameters", + "parameters": [ + { + "enum": [ + "template", + "workspace", + "import_job" + ], + "type": "string", + "description": "Scope", + "name": "scope", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.Parameter" + } + } + } + } + }, + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Parameters" + ], + "summary": "Create parameter", + "operationId": "create-parameter", + "parameters": [ + { + "description": "Parameter request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateParameterRequest" + } + }, + { + "enum": [ + "template", + "workspace", + "import_job" + ], + "type": "string", + "description": "Scope", + "name": "scope", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.Parameter" + } + } + } + } + }, + "/parameters/{scope}/{id}/{name}": { + "delete": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Parameters" + ], + "summary": "Delete parameter", + "operationId": "delete-parameter", + "parameters": [ + { + "enum": [ + "template", + "workspace", + "import_job" + ], + "type": "string", + "description": "Scope", + "name": "scope", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Response" + } + } + } + } + }, "/templates/{id}": { "get": { "security": [ @@ -373,8 +720,8 @@ const docTemplate = `{ "tags": [ "Templates" ], - "summary": "Update template metadata by ID", - "operationId": "update-template-metadata", + "summary": "Get template metadata by ID", + "operationId": "get-template-metadata-by-id", "parameters": [ { "type": "string", @@ -426,6 +773,39 @@ const docTemplate = `{ } } } + }, + "patch": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Update template metadata by ID", + "operationId": "update-template-metadata", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Template" + } + } + } } }, "/updatecheck": { @@ -835,6 +1215,99 @@ const docTemplate = `{ } } }, + "codersdk.AuditDiff": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/codersdk.AuditDiffField" + } + }, + "codersdk.AuditDiffField": { + "type": "object", + "properties": { + "new": {}, + "old": {}, + "secret": { + "type": "boolean" + } + } + }, + "codersdk.AuditLog": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "additional_fields": { + "type": "array", + "items": { + "type": "integer" + } + }, + "description": { + "type": "string" + }, + "diff": { + "$ref": "#/definitions/codersdk.AuditDiff" + }, + "id": { + "type": "string" + }, + "ip": { + "$ref": "#/definitions/netip.Addr" + }, + "is_deleted": { + "type": "boolean" + }, + "organization_id": { + "type": "string" + }, + "request_id": { + "type": "string" + }, + "resource_icon": { + "type": "string" + }, + "resource_id": { + "type": "string" + }, + "resource_link": { + "type": "string" + }, + "resource_target": { + "description": "ResourceTarget is the name of the resource.", + "type": "string" + }, + "resource_type": { + "type": "string" + }, + "status_code": { + "type": "integer" + }, + "time": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/codersdk.User" + }, + "user_agent": { + "type": "string" + } + } + }, + "codersdk.AuditLogResponse": { + "type": "object", + "properties": { + "audit_logs": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.AuditLog" + } + }, + "count": { + "type": "integer" + } + } + }, "codersdk.AuthorizationCheck": { "description": "AuthorizationCheck is used to check if the currently authenticated user (or the specified user) can do a given action to a given set of objects.", "type": "object", @@ -924,6 +1397,7 @@ const docTemplate = `{ "destination_scheme": { "type": "string", "enum": [ + "none", "environment_variable", "provisioner_variable" ] @@ -934,6 +1408,7 @@ const docTemplate = `{ "source_scheme": { "type": "string", "enum": [ + "none", "data" ] }, @@ -985,6 +1460,63 @@ const docTemplate = `{ } } }, + "codersdk.CreateTestAuditLogRequest": { + "type": "object", + "properties": { + "action": { + "type": "string", + "enum": [ + "create", + "write", + "delete", + "start", + "stop" + ] + }, + "resource_id": { + "type": "string" + }, + "resource_type": { + "type": "string", + "enum": [ + "organization", + "template", + "template_version", + "user", + "workspace", + "workspace_build", + "git_ssh_key", + "api_key", + "group" + ] + }, + "time": { + "type": "string" + } + } + }, + "codersdk.DERP": { + "type": "object", + "properties": { + "config": { + "$ref": "#/definitions/codersdk.DERPConfig" + }, + "server": { + "$ref": "#/definitions/codersdk.DERPServerConfig" + } + } + }, + "codersdk.DERPConfig": { + "type": "object", + "properties": { + "path": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, "codersdk.DERPRegion": { "type": "object", "properties": { @@ -996,6 +1528,335 @@ const docTemplate = `{ } } }, + "codersdk.DERPServerConfig": { + "type": "object", + "properties": { + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "region_code": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "region_id": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-int" + }, + "region_name": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "relay_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "stun_addresses": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + } + } + }, + "codersdk.DeploymentConfig": { + "type": "object", + "properties": { + "access_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "address": { + "description": "DEPRECATED: Use HTTPAddress or TLS.Address instead.", + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "agent_fallback_troubleshooting_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "agent_stat_refresh_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "api_rate_limit": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-int" + }, + "audit_logging": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "auto_import_templates": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "autobuild_poll_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "browser_only": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "cache_directory": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "derp": { + "$ref": "#/definitions/codersdk.DERP" + }, + "experimental": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "gitauth": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_codersdk_GitAuthConfig" + }, + "http_address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "in_memory_database": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "max_token_lifetime": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "metrics_cache_refresh_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "oauth2": { + "$ref": "#/definitions/codersdk.OAuth2Config" + }, + "oidc": { + "$ref": "#/definitions/codersdk.OIDCConfig" + }, + "pg_connection_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "pprof": { + "$ref": "#/definitions/codersdk.PprofConfig" + }, + "prometheus": { + "$ref": "#/definitions/codersdk.PrometheusConfig" + }, + "provisioner": { + "$ref": "#/definitions/codersdk.ProvisionerConfig" + }, + "proxy_trusted_headers": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "proxy_trusted_origins": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "scim_api_key": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "secure_auth_cookie": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "ssh_keygen_algorithm": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "swagger": { + "$ref": "#/definitions/codersdk.SwaggerConfig" + }, + "telemetry": { + "$ref": "#/definitions/codersdk.TelemetryConfig" + }, + "tls": { + "$ref": "#/definitions/codersdk.TLSConfig" + }, + "trace": { + "$ref": "#/definitions/codersdk.TraceConfig" + }, + "update_check": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "wildcard_access_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, + "codersdk.DeploymentConfigField-array_codersdk_GitAuthConfig": { + "type": "object", + "properties": { + "default": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.GitAuthConfig" + } + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/codersdk.GitAuthConfig" + } + } + }, + "codersdk.DeploymentConfigField-array_string": { + "type": "object", + "properties": { + "default": { + "type": "array", + "items": { + "type": "string" + } + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "codersdk.DeploymentConfigField-bool": { + "type": "object", + "properties": { + "default": { + "type": "boolean" + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + "codersdk.DeploymentConfigField-int": { + "type": "object", + "properties": { + "default": { + "type": "integer" + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "integer" + } + } + }, + "codersdk.DeploymentConfigField-string": { + "type": "object", + "properties": { + "default": { + "type": "string" + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "codersdk.DeploymentConfigField-time_Duration": { + "type": "object", + "properties": { + "default": { + "type": "integer" + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "integer" + } + } + }, "codersdk.GetAppHostResponse": { "type": "object", "properties": { @@ -1005,6 +1866,41 @@ const docTemplate = `{ } } }, + "codersdk.GitAuthConfig": { + "type": "object", + "properties": { + "auth_url": { + "type": "string" + }, + "client_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "no_refresh": { + "type": "boolean" + }, + "regex": { + "type": "string" + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + } + }, + "token_url": { + "type": "string" + }, + "type": { + "type": "string" + }, + "validate_url": { + "type": "string" + } + } + }, "codersdk.Healthcheck": { "type": "object", "properties": { @@ -1022,15 +1918,150 @@ const docTemplate = `{ } } }, - "codersdk.NullTime": { + "codersdk.OAuth2Config": { "type": "object", "properties": { - "time": { + "github": { + "$ref": "#/definitions/codersdk.OAuth2GithubConfig" + } + } + }, + "codersdk.OAuth2GithubConfig": { + "type": "object", + "properties": { + "allow_everyone": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "allow_signups": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "allowed_orgs": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "allowed_teams": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "client_id": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_secret": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "enterprise_base_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, + "codersdk.OIDCConfig": { + "type": "object", + "properties": { + "allow_signups": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "client_id": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_secret": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "email_domain": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "ignore_email_verified": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "issuer_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "scopes": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + } + } + }, + "codersdk.Parameter": { + "description": "Parameter represents a set value for the scope.", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time" + }, + "destination_scheme": { + "type": "string", + "enum": [ + "none", + "environment_variable", + "provisioner_variable" + ] + }, + "id": { + "type": "string", + "format": "uuid" + }, + "name": { "type": "string" }, - "valid": { - "description": "Valid is true if Time is not NULL", - "type": "boolean" + "scope": { + "type": "string", + "enum": [ + "template", + "workspace", + "import_job" + ] + }, + "scope_id": { + "type": "string", + "format": "uuid" + }, + "source_scheme": { + "type": "string", + "enum": [ + "none", + "data" + ] + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "codersdk.PprofConfig": { + "type": "object", + "properties": { + "address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + } + } + }, + "codersdk.PrometheusConfig": { + "type": "object", + "properties": { + "address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + } + } + }, + "codersdk.ProvisionerConfig": { + "type": "object", + "properties": { + "daemon_poll_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "daemon_poll_jitter": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "daemons": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-int" + }, + "force_cancel_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" } } }, @@ -1103,6 +2134,74 @@ const docTemplate = `{ } } }, + "codersdk.Role": { + "type": "object", + "properties": { + "display_name": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "codersdk.SwaggerConfig": { + "type": "object", + "properties": { + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + } + } + }, + "codersdk.TLSConfig": { + "type": "object", + "properties": { + "address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "cert_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "client_auth": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_ca_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_cert_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_key_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "key_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "min_version": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "redirect_http": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + } + } + }, + "codersdk.TelemetryConfig": { + "type": "object", + "properties": { + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "trace": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, "codersdk.Template": { "type": "object", "properties": { @@ -1171,6 +2270,20 @@ const docTemplate = `{ "$ref": "#/definitions/codersdk.TransitionStats" } }, + "codersdk.TraceConfig": { + "type": "object", + "properties": { + "capture_logs": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "honeycomb_api_key": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, "codersdk.TransitionStats": { "type": "object", "properties": { @@ -1225,6 +2338,59 @@ const docTemplate = `{ } } }, + "codersdk.UploadResponse": { + "type": "object", + "properties": { + "hash": { + "type": "string", + "format": "uuid" + } + } + }, + "codersdk.User": { + "type": "object", + "required": [ + "created_at", + "email", + "id", + "username" + ], + "properties": { + "avatar_url": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "last_seen_at": { + "type": "string" + }, + "organization_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.Role" + } + }, + "status": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "codersdk.ValidationError": { "type": "object", "required": [ @@ -1433,7 +2599,8 @@ const docTemplate = `{ "type": "integer" }, "deadline": { - "$ref": "#/definitions/codersdk.NullTime" + "type": "string", + "format": "date-time" }, "id": { "type": "string", @@ -1587,6 +2754,9 @@ const docTemplate = `{ } } } + }, + "netip.Addr": { + "type": "object" } }, "securityDefinitions": { diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index f33bec806f..8474aebfee 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -79,6 +79,84 @@ } } }, + "/audit": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Audit"], + "summary": "Get audit logs", + "operationId": "get-audit-logs", + "parameters": [ + { + "type": "string", + "description": "Search query", + "name": "q", + "in": "query", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "After ID", + "name": "after_id", + "in": "query" + }, + { + "type": "integer", + "description": "Page limit", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "description": "Page offset", + "name": "offset", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.AuditLogResponse" + } + } + } + } + }, + "/audit/testgenerate": { + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": ["application/json"], + "tags": ["Audit"], + "summary": "Generate fake audit log", + "operationId": "generate-fake-audit-logs", + "parameters": [ + { + "description": "Audit log request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateTestAuditLogRequest" + } + } + ], + "responses": { + "204": { + "description": "No Content" + } + } + } + }, "/authcheck": { "post": { "security": [ @@ -128,6 +206,27 @@ } } }, + "/config/deployment": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["General"], + "summary": "Get deployment config", + "operationId": "get-deployment-config", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.DeploymentConfig" + } + } + } + } + }, "/csp/reports": { "post": { "security": [ @@ -158,6 +257,73 @@ } } }, + "/files": { + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "description": "Swagger notice: Swagger 2.0 doesn't support file upload with a `content-type` different than `application/x-www-form-urlencoded`.", + "consumes": ["application/x-tar"], + "produces": ["application/json"], + "tags": ["Files"], + "summary": "Upload file", + "operationId": "update-file", + "parameters": [ + { + "type": "string", + "default": "application/x-tar", + "description": "Content-Type must be `application/x-tar`", + "name": "Content-Type", + "in": "header", + "required": true + }, + { + "type": "file", + "description": "File to be uploaded", + "name": "file", + "in": "formData", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.UploadResponse" + } + } + } + } + }, + "/files/{fileID}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "tags": ["Files"], + "summary": "Get file by ID", + "operationId": "get-file-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "File ID", + "name": "fileID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/organizations/{organization-id}/templates/": { "post": { "security": [ @@ -308,6 +474,141 @@ } } }, + "/parameters/{scope}/{id}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Parameters"], + "summary": "Get parameters", + "operationId": "get-parameters", + "parameters": [ + { + "enum": ["template", "workspace", "import_job"], + "type": "string", + "description": "Scope", + "name": "scope", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.Parameter" + } + } + } + } + }, + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Parameters"], + "summary": "Create parameter", + "operationId": "create-parameter", + "parameters": [ + { + "description": "Parameter request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateParameterRequest" + } + }, + { + "enum": ["template", "workspace", "import_job"], + "type": "string", + "description": "Scope", + "name": "scope", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.Parameter" + } + } + } + } + }, + "/parameters/{scope}/{id}/{name}": { + "delete": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Parameters"], + "summary": "Delete parameter", + "operationId": "delete-parameter", + "parameters": [ + { + "enum": ["template", "workspace", "import_job"], + "type": "string", + "description": "Scope", + "name": "scope", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Response" + } + } + } + } + }, "/templates/{id}": { "get": { "security": [ @@ -317,8 +618,8 @@ ], "produces": ["application/json"], "tags": ["Templates"], - "summary": "Update template metadata by ID", - "operationId": "update-template-metadata", + "summary": "Get template metadata by ID", + "operationId": "get-template-metadata-by-id", "parameters": [ { "type": "string", @@ -366,6 +667,35 @@ } } } + }, + "patch": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Update template metadata by ID", + "operationId": "update-template-metadata", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Template" + } + } + } } }, "/updatecheck": { @@ -726,6 +1056,99 @@ } } }, + "codersdk.AuditDiff": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/codersdk.AuditDiffField" + } + }, + "codersdk.AuditDiffField": { + "type": "object", + "properties": { + "new": {}, + "old": {}, + "secret": { + "type": "boolean" + } + } + }, + "codersdk.AuditLog": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "additional_fields": { + "type": "array", + "items": { + "type": "integer" + } + }, + "description": { + "type": "string" + }, + "diff": { + "$ref": "#/definitions/codersdk.AuditDiff" + }, + "id": { + "type": "string" + }, + "ip": { + "$ref": "#/definitions/netip.Addr" + }, + "is_deleted": { + "type": "boolean" + }, + "organization_id": { + "type": "string" + }, + "request_id": { + "type": "string" + }, + "resource_icon": { + "type": "string" + }, + "resource_id": { + "type": "string" + }, + "resource_link": { + "type": "string" + }, + "resource_target": { + "description": "ResourceTarget is the name of the resource.", + "type": "string" + }, + "resource_type": { + "type": "string" + }, + "status_code": { + "type": "integer" + }, + "time": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/codersdk.User" + }, + "user_agent": { + "type": "string" + } + } + }, + "codersdk.AuditLogResponse": { + "type": "object", + "properties": { + "audit_logs": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.AuditLog" + } + }, + "count": { + "type": "integer" + } + } + }, "codersdk.AuthorizationCheck": { "description": "AuthorizationCheck is used to check if the currently authenticated user (or the specified user) can do a given action to a given set of objects.", "type": "object", @@ -809,14 +1232,14 @@ }, "destination_scheme": { "type": "string", - "enum": ["environment_variable", "provisioner_variable"] + "enum": ["none", "environment_variable", "provisioner_variable"] }, "name": { "type": "string" }, "source_scheme": { "type": "string", - "enum": ["data"] + "enum": ["none", "data"] }, "source_value": { "type": "string" @@ -863,6 +1286,57 @@ } } }, + "codersdk.CreateTestAuditLogRequest": { + "type": "object", + "properties": { + "action": { + "type": "string", + "enum": ["create", "write", "delete", "start", "stop"] + }, + "resource_id": { + "type": "string" + }, + "resource_type": { + "type": "string", + "enum": [ + "organization", + "template", + "template_version", + "user", + "workspace", + "workspace_build", + "git_ssh_key", + "api_key", + "group" + ] + }, + "time": { + "type": "string" + } + } + }, + "codersdk.DERP": { + "type": "object", + "properties": { + "config": { + "$ref": "#/definitions/codersdk.DERPConfig" + }, + "server": { + "$ref": "#/definitions/codersdk.DERPServerConfig" + } + } + }, + "codersdk.DERPConfig": { + "type": "object", + "properties": { + "path": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, "codersdk.DERPRegion": { "type": "object", "properties": { @@ -874,6 +1348,335 @@ } } }, + "codersdk.DERPServerConfig": { + "type": "object", + "properties": { + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "region_code": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "region_id": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-int" + }, + "region_name": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "relay_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "stun_addresses": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + } + } + }, + "codersdk.DeploymentConfig": { + "type": "object", + "properties": { + "access_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "address": { + "description": "DEPRECATED: Use HTTPAddress or TLS.Address instead.", + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "agent_fallback_troubleshooting_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "agent_stat_refresh_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "api_rate_limit": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-int" + }, + "audit_logging": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "auto_import_templates": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "autobuild_poll_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "browser_only": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "cache_directory": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "derp": { + "$ref": "#/definitions/codersdk.DERP" + }, + "experimental": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "gitauth": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_codersdk_GitAuthConfig" + }, + "http_address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "in_memory_database": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "max_token_lifetime": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "metrics_cache_refresh_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "oauth2": { + "$ref": "#/definitions/codersdk.OAuth2Config" + }, + "oidc": { + "$ref": "#/definitions/codersdk.OIDCConfig" + }, + "pg_connection_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "pprof": { + "$ref": "#/definitions/codersdk.PprofConfig" + }, + "prometheus": { + "$ref": "#/definitions/codersdk.PrometheusConfig" + }, + "provisioner": { + "$ref": "#/definitions/codersdk.ProvisionerConfig" + }, + "proxy_trusted_headers": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "proxy_trusted_origins": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "scim_api_key": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "secure_auth_cookie": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "ssh_keygen_algorithm": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "swagger": { + "$ref": "#/definitions/codersdk.SwaggerConfig" + }, + "telemetry": { + "$ref": "#/definitions/codersdk.TelemetryConfig" + }, + "tls": { + "$ref": "#/definitions/codersdk.TLSConfig" + }, + "trace": { + "$ref": "#/definitions/codersdk.TraceConfig" + }, + "update_check": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "wildcard_access_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, + "codersdk.DeploymentConfigField-array_codersdk_GitAuthConfig": { + "type": "object", + "properties": { + "default": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.GitAuthConfig" + } + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/codersdk.GitAuthConfig" + } + } + }, + "codersdk.DeploymentConfigField-array_string": { + "type": "object", + "properties": { + "default": { + "type": "array", + "items": { + "type": "string" + } + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "codersdk.DeploymentConfigField-bool": { + "type": "object", + "properties": { + "default": { + "type": "boolean" + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + "codersdk.DeploymentConfigField-int": { + "type": "object", + "properties": { + "default": { + "type": "integer" + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "integer" + } + } + }, + "codersdk.DeploymentConfigField-string": { + "type": "object", + "properties": { + "default": { + "type": "string" + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "codersdk.DeploymentConfigField-time_Duration": { + "type": "object", + "properties": { + "default": { + "type": "integer" + }, + "enterprise": { + "type": "boolean" + }, + "flag": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "boolean" + }, + "shorthand": { + "type": "string" + }, + "usage": { + "type": "string" + }, + "value": { + "type": "integer" + } + } + }, "codersdk.GetAppHostResponse": { "type": "object", "properties": { @@ -883,6 +1686,41 @@ } } }, + "codersdk.GitAuthConfig": { + "type": "object", + "properties": { + "auth_url": { + "type": "string" + }, + "client_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "no_refresh": { + "type": "boolean" + }, + "regex": { + "type": "string" + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + } + }, + "token_url": { + "type": "string" + }, + "type": { + "type": "string" + }, + "validate_url": { + "type": "string" + } + } + }, "codersdk.Healthcheck": { "type": "object", "properties": { @@ -900,15 +1738,139 @@ } } }, - "codersdk.NullTime": { + "codersdk.OAuth2Config": { "type": "object", "properties": { - "time": { + "github": { + "$ref": "#/definitions/codersdk.OAuth2GithubConfig" + } + } + }, + "codersdk.OAuth2GithubConfig": { + "type": "object", + "properties": { + "allow_everyone": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "allow_signups": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "allowed_orgs": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "allowed_teams": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "client_id": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_secret": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "enterprise_base_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, + "codersdk.OIDCConfig": { + "type": "object", + "properties": { + "allow_signups": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "client_id": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_secret": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "email_domain": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "ignore_email_verified": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "issuer_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "scopes": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + } + } + }, + "codersdk.Parameter": { + "description": "Parameter represents a set value for the scope.", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time" + }, + "destination_scheme": { + "type": "string", + "enum": ["none", "environment_variable", "provisioner_variable"] + }, + "id": { + "type": "string", + "format": "uuid" + }, + "name": { "type": "string" }, - "valid": { - "description": "Valid is true if Time is not NULL", - "type": "boolean" + "scope": { + "type": "string", + "enum": ["template", "workspace", "import_job"] + }, + "scope_id": { + "type": "string", + "format": "uuid" + }, + "source_scheme": { + "type": "string", + "enum": ["none", "data"] + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "codersdk.PprofConfig": { + "type": "object", + "properties": { + "address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + } + } + }, + "codersdk.PrometheusConfig": { + "type": "object", + "properties": { + "address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + } + } + }, + "codersdk.ProvisionerConfig": { + "type": "object", + "properties": { + "daemon_poll_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "daemon_poll_jitter": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" + }, + "daemons": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-int" + }, + "force_cancel_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" } } }, @@ -979,6 +1941,74 @@ } } }, + "codersdk.Role": { + "type": "object", + "properties": { + "display_name": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "codersdk.SwaggerConfig": { + "type": "object", + "properties": { + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + } + } + }, + "codersdk.TLSConfig": { + "type": "object", + "properties": { + "address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "cert_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "client_auth": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_ca_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_cert_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "client_key_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "key_file": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "min_version": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "redirect_http": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + } + } + }, + "codersdk.TelemetryConfig": { + "type": "object", + "properties": { + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "trace": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, "codersdk.Template": { "type": "object", "properties": { @@ -1047,6 +2077,20 @@ "$ref": "#/definitions/codersdk.TransitionStats" } }, + "codersdk.TraceConfig": { + "type": "object", + "properties": { + "capture_logs": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "honeycomb_api_key": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, "codersdk.TransitionStats": { "type": "object", "properties": { @@ -1101,6 +2145,54 @@ } } }, + "codersdk.UploadResponse": { + "type": "object", + "properties": { + "hash": { + "type": "string", + "format": "uuid" + } + } + }, + "codersdk.User": { + "type": "object", + "required": ["created_at", "email", "id", "username"], + "properties": { + "avatar_url": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "last_seen_at": { + "type": "string" + }, + "organization_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.Role" + } + }, + "status": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "codersdk.ValidationError": { "type": "object", "required": ["detail", "field"], @@ -1306,7 +2398,8 @@ "type": "integer" }, "deadline": { - "$ref": "#/definitions/codersdk.NullTime" + "type": "string", + "format": "date-time" }, "id": { "type": "string", @@ -1452,6 +2545,9 @@ } } } + }, + "netip.Addr": { + "type": "object" } }, "securityDefinitions": { diff --git a/coderd/audit.go b/coderd/audit.go index eaac13a66c..72b27690fb 100644 --- a/coderd/audit.go +++ b/coderd/audit.go @@ -24,6 +24,17 @@ import ( "github.com/coder/coder/codersdk" ) +// @Summary Get audit logs +// @ID get-audit-logs +// @Security CoderSessionToken +// @Produce json +// @Tags Audit +// @Param q query string true "Search query" +// @Param after_id query string false "After ID" format(uuid) +// @Param limit query int false "Page limit" +// @Param offset query int false "Page offset" +// @Success 200 {object} codersdk.AuditLogResponse +// @Router /audit [get] func (api *API) auditLogs(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() if !api.Authorize(r, rbac.ActionRead, rbac.ResourceAuditLog) { @@ -77,6 +88,14 @@ func (api *API) auditLogs(rw http.ResponseWriter, r *http.Request) { }) } +// @Summary Generate fake audit log +// @ID generate-fake-audit-logs +// @Security CoderSessionToken +// @Accept json +// @Tags Audit +// @Param request body codersdk.CreateTestAuditLogRequest true "Audit log request" +// @Success 204 +// @Router /audit/testgenerate [post] func (api *API) generateFakeAuditLog(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() if !api.Authorize(r, rbac.ActionCreate, rbac.ResourceAuditLog) { diff --git a/coderd/deploymentconfig.go b/coderd/deploymentconfig.go index d68332c908..9b84120d77 100644 --- a/coderd/deploymentconfig.go +++ b/coderd/deploymentconfig.go @@ -7,6 +7,13 @@ import ( "github.com/coder/coder/coderd/rbac" ) +// @Summary Get deployment config +// @ID get-deployment-config +// @Security CoderSessionToken +// @Produce json +// @Tags General +// @Success 200 {object} codersdk.DeploymentConfig +// @Router /config/deployment [get] func (api *API) deploymentConfig(rw http.ResponseWriter, r *http.Request) { if !api.Authorize(r, rbac.ActionRead, rbac.ResourceDeploymentConfig) { httpapi.Forbidden(rw) diff --git a/coderd/files.go b/coderd/files.go index 8d01745f91..c128d1bd6e 100644 --- a/coderd/files.go +++ b/coderd/files.go @@ -23,6 +23,17 @@ const ( tarMimeType = "application/x-tar" ) +// @Summary Upload file +// @Description Swagger notice: Swagger 2.0 doesn't support file upload with a `content-type` different than `application/x-www-form-urlencoded`. +// @ID update-file +// @Security CoderSessionToken +// @Produce json +// @Accept application/x-tar +// @Tags Files +// @Param Content-Type header string true "Content-Type must be `application/x-tar`" default(application/x-tar) +// @Param file formData file true "File to be uploaded" +// @Success 201 {object} codersdk.UploadResponse +// @Router /files [post] func (api *API) postFile(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() apiKey := httpmw.APIKey(r) @@ -88,6 +99,13 @@ func (api *API) postFile(rw http.ResponseWriter, r *http.Request) { }) } +// @Summary Get file by ID +// @ID get-file-by-id +// @Security CoderSessionToken +// @Tags Files +// @Param fileID path string true "File ID" format(uuid) +// @Success 200 +// @Router /files/{fileID} [get] func (api *API) fileByID(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() diff --git a/coderd/parameters.go b/coderd/parameters.go index ba3fd2349f..29adb4bf5e 100644 --- a/coderd/parameters.go +++ b/coderd/parameters.go @@ -18,6 +18,17 @@ import ( "github.com/coder/coder/codersdk" ) +// @Summary Create parameter +// @ID create-parameter +// @Security CoderSessionToken +// @Accept json +// @Produce json +// @Tags Parameters +// @Param request body codersdk.CreateParameterRequest true "Parameter request" +// @Param scope path string true "Scope" Enums(template,workspace,import_job) +// @Param id path string true "ID" format(uuid) +// @Success 201 {object} codersdk.Parameter +// @Router /parameters/{scope}/{id} [post] func (api *API) postParameter(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() scope, scopeID, valid := readScopeAndID(ctx, rw, r) @@ -78,6 +89,15 @@ func (api *API) postParameter(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusCreated, convertParameterValue(parameterValue)) } +// @Summary Get parameters +// @ID get-parameters +// @Security CoderSessionToken +// @Produce json +// @Tags Parameters +// @Param scope path string true "Scope" Enums(template,workspace,import_job) +// @Param id path string true "ID" format(uuid) +// @Success 200 {array} codersdk.Parameter +// @Router /parameters/{scope}/{id} [get] func (api *API) parameters(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() scope, scopeID, valid := readScopeAndID(ctx, rw, r) @@ -116,6 +136,16 @@ func (api *API) parameters(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, apiParameterValues) } +// @Summary Delete parameter +// @ID delete-parameter +// @Security CoderSessionToken +// @Produce json +// @Tags Parameters +// @Param scope path string true "Scope" Enums(template,workspace,import_job) +// @Param id path string true "ID" format(uuid) +// @Param name path string true "Name" +// @Success 200 {object} codersdk.Response +// @Router /parameters/{scope}/{id}/{name} [delete] func (api *API) deleteParameter(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() scope, scopeID, valid := readScopeAndID(ctx, rw, r) diff --git a/coderd/templates.go b/coderd/templates.go index 74e3560703..662a306968 100644 --- a/coderd/templates.go +++ b/coderd/templates.go @@ -478,7 +478,7 @@ func (api *API) templateByOrganizationAndName(rw http.ResponseWriter, r *http.Re // @Tags Templates // @Param id path string true "Template ID" format(uuid) // @Success 200 {object} codersdk.Template -// @Router /templates/{id} [get] +// @Router /templates/{id} [patch] func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) { var ( ctx = r.Context() diff --git a/codersdk/audit.go b/codersdk/audit.go index e3d25851ea..da8f88df04 100644 --- a/codersdk/audit.go +++ b/codersdk/audit.go @@ -121,8 +121,8 @@ type AuditLogResponse struct { } type CreateTestAuditLogRequest struct { - Action AuditAction `json:"action,omitempty"` - ResourceType ResourceType `json:"resource_type,omitempty"` + Action AuditAction `json:"action,omitempty" enums:"create,write,delete,start,stop"` + ResourceType ResourceType `json:"resource_type,omitempty" enums:"organization,template,template_version,user,workspace,workspace_build,git_ssh_key,api_key,group"` ResourceID uuid.UUID `json:"resource_id,omitempty"` Time time.Time `json:"time,omitempty"` } diff --git a/codersdk/files.go b/codersdk/files.go index 6d728fbfbc..91e0a25c57 100644 --- a/codersdk/files.go +++ b/codersdk/files.go @@ -16,7 +16,7 @@ const ( // UploadResponse contains the hash to reference the uploaded file. type UploadResponse struct { - ID uuid.UUID `json:"hash"` + ID uuid.UUID `json:"hash" format:"uuid"` } // Upload uploads an arbitrary file with the content type provided. diff --git a/codersdk/parameters.go b/codersdk/parameters.go index c813096412..f17635540d 100644 --- a/codersdk/parameters.go +++ b/codersdk/parameters.go @@ -44,32 +44,34 @@ const ( type ComputedParameter struct { Parameter SourceValue string `json:"source_value"` - SchemaID uuid.UUID `json:"schema_id"` + SchemaID uuid.UUID `json:"schema_id" format:"uuid"` DefaultSourceValue bool `json:"default_source_value"` } // Parameter represents a set value for the scope. +// +// @Description Parameter represents a set value for the scope. type Parameter struct { - ID uuid.UUID `json:"id" table:"id"` - Scope ParameterScope `json:"scope" table:"scope"` - ScopeID uuid.UUID `json:"scope_id" table:"scope id"` + ID uuid.UUID `json:"id" table:"id" format:"uuid"` + Scope ParameterScope `json:"scope" table:"scope" enums:"template,workspace,import_job"` + ScopeID uuid.UUID `json:"scope_id" table:"scope id" format:"uuid"` Name string `json:"name" table:"name"` - SourceScheme ParameterSourceScheme `json:"source_scheme" table:"source scheme" validate:"ne=none"` - DestinationScheme ParameterDestinationScheme `json:"destination_scheme" table:"destination scheme" validate:"ne=none"` - CreatedAt time.Time `json:"created_at" table:"created at"` - UpdatedAt time.Time `json:"updated_at" table:"updated at"` + SourceScheme ParameterSourceScheme `json:"source_scheme" table:"source scheme" validate:"ne=none" enums:"none,data"` + DestinationScheme ParameterDestinationScheme `json:"destination_scheme" table:"destination scheme" validate:"ne=none" enums:"none,environment_variable,provisioner_variable"` + CreatedAt time.Time `json:"created_at" table:"created at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" table:"updated at" format:"date-time"` } type ParameterSchema struct { - ID uuid.UUID `json:"id"` - CreatedAt time.Time `json:"created_at"` - JobID uuid.UUID `json:"job_id"` + ID uuid.UUID `json:"id" format:"uuid"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + JobID uuid.UUID `json:"job_id" format:"uuid"` Name string `json:"name"` Description string `json:"description"` - DefaultSourceScheme ParameterSourceScheme `json:"default_source_scheme"` + DefaultSourceScheme ParameterSourceScheme `json:"default_source_scheme" enums:"none,data"` DefaultSourceValue string `json:"default_source_value"` AllowOverrideSource bool `json:"allow_override_source"` - DefaultDestinationScheme ParameterDestinationScheme `json:"default_destination_scheme"` + DefaultDestinationScheme ParameterDestinationScheme `json:"default_destination_scheme" enums:"none,environment_variable,provisioner_variable"` AllowOverrideDestination bool `json:"allow_override_destination"` DefaultRefresh string `json:"default_refresh"` RedisplayValue bool `json:"redisplay_value"` @@ -96,8 +98,8 @@ type CreateParameterRequest struct { Name string `json:"name" validate:"required"` SourceValue string `json:"source_value" validate:"required"` - SourceScheme ParameterSourceScheme `json:"source_scheme" validate:"oneof=data,required"` - DestinationScheme ParameterDestinationScheme `json:"destination_scheme" validate:"oneof=environment_variable provisioner_variable,required"` + SourceScheme ParameterSourceScheme `json:"source_scheme" validate:"oneof=data,required" enums:"none,data"` + DestinationScheme ParameterDestinationScheme `json:"destination_scheme" validate:"oneof=environment_variable provisioner_variable,required" enums:"none,environment_variable,provisioner_variable"` } func (c *Client) CreateParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, req CreateParameterRequest) (Parameter, error) { diff --git a/codersdk/workspacebuilds.go b/codersdk/workspacebuilds.go index 80055484df..743c3b778a 100644 --- a/codersdk/workspacebuilds.go +++ b/codersdk/workspacebuilds.go @@ -67,7 +67,7 @@ type WorkspaceBuild struct { Job ProvisionerJob `json:"job"` Reason BuildReason `db:"reason" json:"reason"` Resources []WorkspaceResource `json:"resources"` - Deadline NullTime `json:"deadline,omitempty"` + Deadline NullTime `json:"deadline,omitempty" format:"date-time"` Status WorkspaceStatus `json:"status" enums:"pending,starting,running,stopping,stopped,failed,canceling,canceled,deleting,deleted"` DailyCost int32 `json:"daily_cost"` } diff --git a/docs/api/audit.md b/docs/api/audit.md new file mode 100644 index 0000000000..8b3946c715 --- /dev/null +++ b/docs/api/audit.md @@ -0,0 +1,129 @@ +# Audit + +> This page is incomplete, stay tuned. + +## Get audit logs + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/audit?q=string \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /audit` + +### Parameters + +| Name | In | Type | Required | Description | +| ---------- | ----- | ------------ | -------- | ------------ | +| `q` | query | string | true | Search query | +| `after_id` | query | string(uuid) | false | After ID | +| `limit` | query | integer | false | Page limit | +| `offset` | query | integer | false | Page offset | + +### Example responses + +> 200 Response + +```json +{ + "audit_logs": [ + { + "action": "string", + "additional_fields": [0], + "description": "string", + "diff": { + "property1": { + "new": null, + "old": null, + "secret": true + }, + "property2": { + "new": null, + "old": null, + "secret": true + } + }, + "id": "string", + "ip": {}, + "is_deleted": true, + "organization_id": "string", + "request_id": "string", + "resource_icon": "string", + "resource_id": "string", + "resource_link": "string", + "resource_target": "string", + "resource_type": "string", + "status_code": 0, + "time": "string", + "user": { + "avatar_url": "string", + "created_at": "string", + "email": "string", + "id": "string", + "last_seen_at": "string", + "organization_ids": ["string"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "string", + "username": "string" + }, + "user_agent": "string" + } + ], + "count": 0 +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ---------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.AuditLogResponse](schemas.md#codersdkauditlogresponse) | + +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. + +## Generate fake audit log + +### Code samples + +```shell +# Example request using curl +curl -X POST http://coder-server:8080/api/v2/audit/testgenerate \ + -H 'Content-Type: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`POST /audit/testgenerate` + +> Body parameter + +```json +{ + "action": "create", + "resource_id": "string", + "resource_type": "organization", + "time": "string" +} +``` + +### Parameters + +| Name | In | Type | Required | Description | +| ------ | ---- | ---------------------------------------------------------------------------------- | -------- | ----------------- | +| `body` | body | [codersdk.CreateTestAuditLogRequest](schemas.md#codersdkcreatetestauditlogrequest) | true | Audit log request | + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | --------------------------------------------------------------- | ----------- | ------ | +| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | | + +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. diff --git a/docs/api/files.md b/docs/api/files.md new file mode 100644 index 0000000000..c72493caab --- /dev/null +++ b/docs/api/files.md @@ -0,0 +1,75 @@ +# Files + +> This page is incomplete, stay tuned. + +## Upload file + +### Code samples + +```shell +# Example request using curl +curl -X POST http://coder-server:8080/api/v2/files \ + -H 'Accept: application/json' \ + -H 'Content-Type: application/x-tar' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`POST /files` + +> Body parameter + +```yaml +file: string +``` + +### Parameters + +| Name | In | Type | Required | Description | +| -------------- | ------ | ------ | -------- | ---------------------------------------- | +| `Content-Type` | header | string | true | Content-Type must be `application/x-tar` | +| `body` | body | object | true | | +| `» file` | body | binary | true | File to be uploaded | + +### Example responses + +> 201 Response + +```json +{ + "hash": "19686d84-b10d-4f90-b18e-84fd3fa038fd" +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------------ | ----------- | ------------------------------------------------------------ | +| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.UploadResponse](schemas.md#codersdkuploadresponse) | + +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. + +## Get file by ID + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/files/{fileID} \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /files/{fileID}` + +### Parameters + +| Name | In | Type | Required | Description | +| -------- | ---- | ------------ | -------- | ----------- | +| `fileID` | path | string(uuid) | true | File ID | + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ------ | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | | + +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. diff --git a/docs/api/general.md b/docs/api/general.md index 8d5ef5dad9..f8293d32c8 100644 --- a/docs/api/general.md +++ b/docs/api/general.md @@ -37,8 +37,6 @@ curl -X GET http://coder-server:8080/api/v2/ \ | ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------ | | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Response](schemas.md#codersdkresponse) | -undefined - ## Build info ### Code samples @@ -68,7 +66,864 @@ curl -X GET http://coder-server:8080/api/v2/buildinfo \ | ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------ | | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.BuildInfoResponse](schemas.md#codersdkbuildinforesponse) | -undefined +## Get deployment config + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/config/deployment \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /config/deployment` + +### Example responses + +> 200 Response + +```json +{ + "access_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "agent_fallback_troubleshooting_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "agent_stat_refresh_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "api_rate_limit": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "audit_logging": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "auto_import_templates": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "autobuild_poll_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "browser_only": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "cache_directory": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "derp": { + "config": { + "path": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + }, + "server": { + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "region_code": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "region_id": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "region_name": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "relay_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "stun_addresses": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + } + }, + "experimental": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "gitauth": { + "default": [ + { + "auth_url": "string", + "client_id": "string", + "id": "string", + "no_refresh": true, + "regex": "string", + "scopes": ["string"], + "token_url": "string", + "type": "string", + "validate_url": "string" + } + ], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": { + "auth_url": "string", + "client_id": "string", + "id": "string", + "no_refresh": true, + "regex": "string", + "scopes": ["string"], + "token_url": "string", + "type": "string", + "validate_url": "string" + } + }, + "http_address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "in_memory_database": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "max_token_lifetime": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "metrics_cache_refresh_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "oauth2": { + "github": { + "allow_everyone": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "allow_signups": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "allowed_orgs": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "allowed_teams": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_id": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_secret": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enterprise_base_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + } + }, + "oidc": { + "allow_signups": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "client_id": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_secret": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "email_domain": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "ignore_email_verified": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "issuer_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "scopes": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + }, + "pg_connection_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "pprof": { + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } + }, + "prometheus": { + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } + }, + "provisioner": { + "daemon_poll_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "daemon_poll_jitter": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "daemons": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "force_cancel_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + } + }, + "proxy_trusted_headers": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "proxy_trusted_origins": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "scim_api_key": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "secure_auth_cookie": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "ssh_keygen_algorithm": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "swagger": { + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } + }, + "telemetry": { + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "trace": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + }, + "tls": { + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "cert_file": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_auth": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_ca_file": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_cert_file": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_key_file": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "key_file": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "min_version": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "redirect_http": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } + }, + "trace": { + "capture_logs": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "honeycomb_api_key": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + }, + "update_check": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "wildcard_access_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ---------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.DeploymentConfig](schemas.md#codersdkdeploymentconfig) | + +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. ## Report CSP violations @@ -134,5 +989,3 @@ curl -X GET http://coder-server:8080/api/v2/updatecheck \ | Status | Meaning | Description | Schema | | ------ | ------------------------------------------------------- | ----------- | ---------------------------------------------------------------------- | | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.UpdateCheckResponse](schemas.md#codersdkupdatecheckresponse) | - -undefined diff --git a/docs/api/parameters.md b/docs/api/parameters.md new file mode 100644 index 0000000000..1612ac333a --- /dev/null +++ b/docs/api/parameters.md @@ -0,0 +1,208 @@ +# Parameters + +> This page is incomplete, stay tuned. + +## Get parameters + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/parameters/{scope}/{id} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /parameters/{scope}/{id}` + +### Parameters + +| Name | In | Type | Required | Description | +| ------- | ---- | ------------ | -------- | ----------- | +| `scope` | path | string | true | Scope | +| `id` | path | string(uuid) | true | ID | + +#### Enumerated Values + +| Parameter | Value | +| --------- | ------------ | +| `scope` | `template` | +| `scope` | `workspace` | +| `scope` | `import_job` | + +### Example responses + +> 200 Response + +```json +[ + { + "created_at": "2019-08-24T14:15:22Z", + "destination_scheme": "none", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "scope": "template", + "scope_id": "5d3fe357-12dd-4f62-b004-6d1fb3b8454f", + "source_scheme": "none", + "updated_at": "2019-08-24T14:15:22Z" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ----------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.Parameter](schemas.md#codersdkparameter) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| ---------------------- | ----------------- | -------- | ------------ | ------------------------------------------------- | +| `[array item]` | array | false | | [Parameter represents a set value for the scope.] | +| `» created_at` | string(date-time) | false | | | +| `» destination_scheme` | string | false | | | +| `» id` | string(uuid) | false | | | +| `» name` | string | false | | | +| `» scope` | string | false | | | +| `» scope_id` | string(uuid) | false | | | +| `» source_scheme` | string | false | | | +| `» updated_at` | string(date-time) | false | | | + +#### Enumerated Values + +| Property | Value | +| -------------------- | ---------------------- | +| `destination_scheme` | `none` | +| `destination_scheme` | `environment_variable` | +| `destination_scheme` | `provisioner_variable` | +| `scope` | `template` | +| `scope` | `workspace` | +| `scope` | `import_job` | +| `source_scheme` | `none` | +| `source_scheme` | `data` | + +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. + +## Create parameter + +### Code samples + +```shell +# Example request using curl +curl -X POST http://coder-server:8080/api/v2/parameters/{scope}/{id} \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`POST /parameters/{scope}/{id}` + +> Body parameter + +```json +{ + "copy_from_parameter": "string", + "destination_scheme": "none", + "name": "string", + "source_scheme": "none", + "source_value": "string" +} +``` + +### Parameters + +| Name | In | Type | Required | Description | +| ------- | ---- | ---------------------------------------------------------------------------- | -------- | ----------------- | +| `scope` | path | string | true | Scope | +| `id` | path | string(uuid) | true | ID | +| `body` | body | [codersdk.CreateParameterRequest](schemas.md#codersdkcreateparameterrequest) | true | Parameter request | + +#### Enumerated Values + +| Parameter | Value | +| --------- | ------------ | +| `scope` | `template` | +| `scope` | `workspace` | +| `scope` | `import_job` | + +### Example responses + +> 201 Response + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "destination_scheme": "none", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "scope": "template", + "scope_id": "5d3fe357-12dd-4f62-b004-6d1fb3b8454f", + "source_scheme": "none", + "updated_at": "2019-08-24T14:15:22Z" +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------------ | ----------- | -------------------------------------------------- | +| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.Parameter](schemas.md#codersdkparameter) | + +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. + +## Delete parameter + +### Code samples + +```shell +# Example request using curl +curl -X DELETE http://coder-server:8080/api/v2/parameters/{scope}/{id}/{name} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`DELETE /parameters/{scope}/{id}/{name}` + +### Parameters + +| Name | In | Type | Required | Description | +| ------- | ---- | ------------ | -------- | ----------- | +| `scope` | path | string | true | Scope | +| `id` | path | string(uuid) | true | ID | +| `name` | path | string | true | Name | + +#### Enumerated Values + +| Parameter | Value | +| --------- | ------------ | +| `scope` | `template` | +| `scope` | `workspace` | +| `scope` | `import_job` | + +### Example responses + +> 200 Response + +```json +{ + "detail": "string", + "message": "string", + "validations": [ + { + "detail": "string", + "field": "string" + } + ] +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------ | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Response](schemas.md#codersdkresponse) | + +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. diff --git a/docs/api/schemas.md b/docs/api/schemas.md index 601a1fc7a3..511cd2402a 100644 --- a/docs/api/schemas.md +++ b/docs/api/schemas.md @@ -16,6 +16,184 @@ | ------------ | ------ | -------- | ------------ | ----------- | | `csp-report` | object | false | | | +## codersdk.AuditDiff + +```json +{ + "property1": { + "new": null, + "old": null, + "secret": true + }, + "property2": { + "new": null, + "old": null, + "secret": true + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ---------------- | -------------------------------------------------- | -------- | ------------ | ----------- | +| `[any property]` | [codersdk.AuditDiffField](#codersdkauditdifffield) | false | | | + +## codersdk.AuditDiffField + +```json +{ + "new": null, + "old": null, + "secret": true +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------- | ------- | -------- | ------------ | ----------- | +| `new` | any | false | | | +| `old` | any | false | | | +| `secret` | boolean | false | | | + +## codersdk.AuditLog + +```json +{ + "action": "string", + "additional_fields": [0], + "description": "string", + "diff": { + "property1": { + "new": null, + "old": null, + "secret": true + }, + "property2": { + "new": null, + "old": null, + "secret": true + } + }, + "id": "string", + "ip": {}, + "is_deleted": true, + "organization_id": "string", + "request_id": "string", + "resource_icon": "string", + "resource_id": "string", + "resource_link": "string", + "resource_target": "string", + "resource_type": "string", + "status_code": 0, + "time": "string", + "user": { + "avatar_url": "string", + "created_at": "string", + "email": "string", + "id": "string", + "last_seen_at": "string", + "organization_ids": ["string"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "string", + "username": "string" + }, + "user_agent": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------- | ---------------------------------------- | -------- | ------------ | -------------------------------------------- | +| `action` | string | false | | | +| `additional_fields` | array of integer | false | | | +| `description` | string | false | | | +| `diff` | [codersdk.AuditDiff](#codersdkauditdiff) | false | | | +| `id` | string | false | | | +| `ip` | [netip.Addr](#netipaddr) | false | | | +| `is_deleted` | boolean | false | | | +| `organization_id` | string | false | | | +| `request_id` | string | false | | | +| `resource_icon` | string | false | | | +| `resource_id` | string | false | | | +| `resource_link` | string | false | | | +| `resource_target` | string | false | | Resource target is the name of the resource. | +| `resource_type` | string | false | | | +| `status_code` | integer | false | | | +| `time` | string | false | | | +| `user` | [codersdk.User](#codersdkuser) | false | | | +| `user_agent` | string | false | | | + +## codersdk.AuditLogResponse + +```json +{ + "audit_logs": [ + { + "action": "string", + "additional_fields": [0], + "description": "string", + "diff": { + "property1": { + "new": null, + "old": null, + "secret": true + }, + "property2": { + "new": null, + "old": null, + "secret": true + } + }, + "id": "string", + "ip": {}, + "is_deleted": true, + "organization_id": "string", + "request_id": "string", + "resource_icon": "string", + "resource_id": "string", + "resource_link": "string", + "resource_target": "string", + "resource_type": "string", + "status_code": 0, + "time": "string", + "user": { + "avatar_url": "string", + "created_at": "string", + "email": "string", + "id": "string", + "last_seen_at": "string", + "organization_ids": ["string"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "string", + "username": "string" + }, + "user_agent": "string" + } + ], + "count": 0 +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | ----------------------------------------------- | -------- | ------------ | ----------- | +| `audit_logs` | array of [codersdk.AuditLog](#codersdkauditlog) | false | | | +| `count` | integer | false | | | + ## codersdk.AuthorizationCheck ```json @@ -140,9 +318,9 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in ```json { "copy_from_parameter": "string", - "destination_scheme": "environment_variable", + "destination_scheme": "none", "name": "string", - "source_scheme": "data", + "source_scheme": "none", "source_value": "string" } ``` @@ -163,8 +341,10 @@ CreateParameterRequest is a structure used to create a new parameter value for a | Property | Value | | -------------------- | ---------------------- | +| `destination_scheme` | `none` | | `destination_scheme` | `environment_variable` | | `destination_scheme` | `provisioner_variable` | +| `source_scheme` | `none` | | `source_scheme` | `data` | ## codersdk.CreateTemplateRequest @@ -180,9 +360,9 @@ CreateParameterRequest is a structure used to create a new parameter value for a "parameter_values": [ { "copy_from_parameter": "string", - "destination_scheme": "environment_variable", + "destination_scheme": "none", "name": "string", - "source_scheme": "data", + "source_scheme": "none", "source_value": "string" } ], @@ -204,6 +384,187 @@ CreateParameterRequest is a structure used to create a new parameter value for a | `template_version_id` | string | true | | Template version ID is an in-progress or completed job to use as an initial version of the template. | | This is required on creation to enable a user-flow of validating a template works. There is no reason the data-model cannot support empty templates, but it doesn't make sense for users. | +## codersdk.CreateTestAuditLogRequest + +```json +{ + "action": "create", + "resource_id": "string", + "resource_type": "organization", + "time": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| --------------- | ------ | -------- | ------------ | ----------- | +| `action` | string | false | | | +| `resource_id` | string | false | | | +| `resource_type` | string | false | | | +| `time` | string | false | | | + +#### Enumerated Values + +| Property | Value | +| --------------- | ------------------ | +| `action` | `create` | +| `action` | `write` | +| `action` | `delete` | +| `action` | `start` | +| `action` | `stop` | +| `resource_type` | `organization` | +| `resource_type` | `template` | +| `resource_type` | `template_version` | +| `resource_type` | `user` | +| `resource_type` | `workspace` | +| `resource_type` | `workspace_build` | +| `resource_type` | `git_ssh_key` | +| `resource_type` | `api_key` | +| `resource_type` | `group` | + +## codersdk.DERP + +```json +{ + "config": { + "path": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + }, + "server": { + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "region_code": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "region_id": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "region_name": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "relay_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "stun_addresses": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------- | ------------------------------------------------------ | -------- | ------------ | ----------- | +| `config` | [codersdk.DERPConfig](#codersdkderpconfig) | false | | | +| `server` | [codersdk.DERPServerConfig](#codersdkderpserverconfig) | false | | | + +## codersdk.DERPConfig + +```json +{ + "path": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------ | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `path` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `url` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | + ## codersdk.DERPRegion ```json @@ -220,6 +581,1167 @@ CreateParameterRequest is a structure used to create a new parameter value for a | `latency_ms` | number | false | | | | `preferred` | boolean | false | | | +## codersdk.DERPServerConfig + +```json +{ + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "region_code": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "region_id": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "region_name": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "relay_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "stun_addresses": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ---------------- | ------------------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `enable` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `region_code` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `region_id` | [codersdk.DeploymentConfigField-int](#codersdkdeploymentconfigfield-int) | false | | | +| `region_name` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `relay_url` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `stun_addresses` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | + +## codersdk.DeploymentConfig + +```json +{ + "access_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "agent_fallback_troubleshooting_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "agent_stat_refresh_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "api_rate_limit": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "audit_logging": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "auto_import_templates": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "autobuild_poll_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "browser_only": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "cache_directory": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "derp": { + "config": { + "path": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + }, + "server": { + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "region_code": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "region_id": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "region_name": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "relay_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "stun_addresses": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + } + }, + "experimental": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "gitauth": { + "default": [ + { + "auth_url": "string", + "client_id": "string", + "id": "string", + "no_refresh": true, + "regex": "string", + "scopes": ["string"], + "token_url": "string", + "type": "string", + "validate_url": "string" + } + ], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": { + "auth_url": "string", + "client_id": "string", + "id": "string", + "no_refresh": true, + "regex": "string", + "scopes": ["string"], + "token_url": "string", + "type": "string", + "validate_url": "string" + } + }, + "http_address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "in_memory_database": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "max_token_lifetime": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "metrics_cache_refresh_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "oauth2": { + "github": { + "allow_everyone": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "allow_signups": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "allowed_orgs": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "allowed_teams": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_id": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_secret": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enterprise_base_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + } + }, + "oidc": { + "allow_signups": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "client_id": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_secret": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "email_domain": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "ignore_email_verified": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "issuer_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "scopes": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + }, + "pg_connection_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "pprof": { + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } + }, + "prometheus": { + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } + }, + "provisioner": { + "daemon_poll_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "daemon_poll_jitter": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "daemons": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "force_cancel_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + } + }, + "proxy_trusted_headers": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "proxy_trusted_origins": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "scim_api_key": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "secure_auth_cookie": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "ssh_keygen_algorithm": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "swagger": { + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } + }, + "telemetry": { + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "trace": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + }, + "tls": { + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "cert_file": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_auth": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_ca_file": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_cert_file": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_key_file": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "key_file": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "min_version": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "redirect_http": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } + }, + "trace": { + "capture_logs": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "honeycomb_api_key": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + }, + "update_check": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "wildcard_access_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `access_url` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `address` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `agent_fallback_troubleshooting_url` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `agent_stat_refresh_interval` | [codersdk.DeploymentConfigField-time_Duration](#codersdkdeploymentconfigfield-time_duration) | false | | | +| `api_rate_limit` | [codersdk.DeploymentConfigField-int](#codersdkdeploymentconfigfield-int) | false | | | +| `audit_logging` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `auto_import_templates` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | +| `autobuild_poll_interval` | [codersdk.DeploymentConfigField-time_Duration](#codersdkdeploymentconfigfield-time_duration) | false | | | +| `browser_only` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `cache_directory` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `derp` | [codersdk.DERP](#codersdkderp) | false | | | +| `experimental` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `gitauth` | [codersdk.DeploymentConfigField-array_codersdk_GitAuthConfig](#codersdkdeploymentconfigfield-array_codersdk_gitauthconfig) | false | | | +| `http_address` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `in_memory_database` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `max_token_lifetime` | [codersdk.DeploymentConfigField-time_Duration](#codersdkdeploymentconfigfield-time_duration) | false | | | +| `metrics_cache_refresh_interval` | [codersdk.DeploymentConfigField-time_Duration](#codersdkdeploymentconfigfield-time_duration) | false | | | +| `oauth2` | [codersdk.OAuth2Config](#codersdkoauth2config) | false | | | +| `oidc` | [codersdk.OIDCConfig](#codersdkoidcconfig) | false | | | +| `pg_connection_url` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `pprof` | [codersdk.PprofConfig](#codersdkpprofconfig) | false | | | +| `prometheus` | [codersdk.PrometheusConfig](#codersdkprometheusconfig) | false | | | +| `provisioner` | [codersdk.ProvisionerConfig](#codersdkprovisionerconfig) | false | | | +| `proxy_trusted_headers` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | +| `proxy_trusted_origins` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | +| `scim_api_key` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `secure_auth_cookie` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `ssh_keygen_algorithm` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `swagger` | [codersdk.SwaggerConfig](#codersdkswaggerconfig) | false | | | +| `telemetry` | [codersdk.TelemetryConfig](#codersdktelemetryconfig) | false | | | +| `tls` | [codersdk.TLSConfig](#codersdktlsconfig) | false | | | +| `trace` | [codersdk.TraceConfig](#codersdktraceconfig) | false | | | +| `update_check` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `wildcard_access_url` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | + +## codersdk.DeploymentConfigField-array_codersdk_GitAuthConfig + +```json +{ + "default": [ + { + "auth_url": "string", + "client_id": "string", + "id": "string", + "no_refresh": true, + "regex": "string", + "scopes": ["string"], + "token_url": "string", + "type": "string", + "validate_url": "string" + } + ], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": { + "auth_url": "string", + "client_id": "string", + "id": "string", + "no_refresh": true, + "regex": "string", + "scopes": ["string"], + "token_url": "string", + "type": "string", + "validate_url": "string" + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | --------------------------------------------------------- | -------- | ------------ | ----------- | +| `default` | array of [codersdk.GitAuthConfig](#codersdkgitauthconfig) | false | | | +| `enterprise` | boolean | false | | | +| `flag` | string | false | | | +| `hidden` | boolean | false | | | +| `name` | string | false | | | +| `secret` | boolean | false | | | +| `shorthand` | string | false | | | +| `usage` | string | false | | | +| `value` | [codersdk.GitAuthConfig](#codersdkgitauthconfig) | false | | | + +## codersdk.DeploymentConfigField-array_string + +```json +{ + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | --------------- | -------- | ------------ | ----------- | +| `default` | array of string | false | | | +| `enterprise` | boolean | false | | | +| `flag` | string | false | | | +| `hidden` | boolean | false | | | +| `name` | string | false | | | +| `secret` | boolean | false | | | +| `shorthand` | string | false | | | +| `usage` | string | false | | | +| `value` | string | false | | | + +## codersdk.DeploymentConfigField-bool + +```json +{ + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | ------- | -------- | ------------ | ----------- | +| `default` | boolean | false | | | +| `enterprise` | boolean | false | | | +| `flag` | string | false | | | +| `hidden` | boolean | false | | | +| `name` | string | false | | | +| `secret` | boolean | false | | | +| `shorthand` | string | false | | | +| `usage` | string | false | | | +| `value` | boolean | false | | | + +## codersdk.DeploymentConfigField-int + +```json +{ + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | ------- | -------- | ------------ | ----------- | +| `default` | integer | false | | | +| `enterprise` | boolean | false | | | +| `flag` | string | false | | | +| `hidden` | boolean | false | | | +| `name` | string | false | | | +| `secret` | boolean | false | | | +| `shorthand` | string | false | | | +| `usage` | string | false | | | +| `value` | integer | false | | | + +## codersdk.DeploymentConfigField-string + +```json +{ + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | ------- | -------- | ------------ | ----------- | +| `default` | string | false | | | +| `enterprise` | boolean | false | | | +| `flag` | string | false | | | +| `hidden` | boolean | false | | | +| `name` | string | false | | | +| `secret` | boolean | false | | | +| `shorthand` | string | false | | | +| `usage` | string | false | | | +| `value` | string | false | | | + +## codersdk.DeploymentConfigField-time_Duration + +```json +{ + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | ------- | -------- | ------------ | ----------- | +| `default` | integer | false | | | +| `enterprise` | boolean | false | | | +| `flag` | string | false | | | +| `hidden` | boolean | false | | | +| `name` | string | false | | | +| `secret` | boolean | false | | | +| `shorthand` | string | false | | | +| `usage` | string | false | | | +| `value` | integer | false | | | + ## codersdk.GetAppHostResponse ```json @@ -234,6 +1756,36 @@ CreateParameterRequest is a structure used to create a new parameter value for a | ------ | ------ | -------- | ------------ | ------------------------------------------------------------- | | `host` | string | false | | Host is the externally accessible URL for the Coder instance. | +## codersdk.GitAuthConfig + +```json +{ + "auth_url": "string", + "client_id": "string", + "id": "string", + "no_refresh": true, + "regex": "string", + "scopes": ["string"], + "token_url": "string", + "type": "string", + "validate_url": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------------- | --------------- | -------- | ------------ | ----------- | +| `auth_url` | string | false | | | +| `client_id` | string | false | | | +| `id` | string | false | | | +| `no_refresh` | boolean | false | | | +| `regex` | string | false | | | +| `scopes` | array of string | false | | | +| `token_url` | string | false | | | +| `type` | string | false | | | +| `validate_url` | string | false | | | + ## codersdk.Healthcheck ```json @@ -252,6 +1804,465 @@ CreateParameterRequest is a structure used to create a new parameter value for a | `threshold` | integer | false | | Threshold specifies the number of consecutive failed health checks before returning "unhealthy". | | `url` | string | false | | URL specifies the endpoint to check for the app health. | +## codersdk.OAuth2Config + +```json +{ + "github": { + "allow_everyone": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "allow_signups": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "allowed_orgs": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "allowed_teams": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_id": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_secret": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enterprise_base_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------- | ---------------------------------------------------------- | -------- | ------------ | ----------- | +| `github` | [codersdk.OAuth2GithubConfig](#codersdkoauth2githubconfig) | false | | | + +## codersdk.OAuth2GithubConfig + +```json +{ + "allow_everyone": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "allow_signups": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "allowed_orgs": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "allowed_teams": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_id": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_secret": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enterprise_base_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| --------------------- | ------------------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `allow_everyone` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `allow_signups` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `allowed_orgs` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | +| `allowed_teams` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | +| `client_id` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `client_secret` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `enterprise_base_url` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | + +## codersdk.OIDCConfig + +```json +{ + "allow_signups": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "client_id": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_secret": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "email_domain": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "ignore_email_verified": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "issuer_url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "scopes": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------------------- | ------------------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `allow_signups` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `client_id` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `client_secret` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `email_domain` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | +| `ignore_email_verified` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `issuer_url` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `scopes` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | + +## codersdk.Parameter + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "destination_scheme": "none", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "scope": "template", + "scope_id": "5d3fe357-12dd-4f62-b004-6d1fb3b8454f", + "source_scheme": "none", + "updated_at": "2019-08-24T14:15:22Z" +} +``` + +Parameter represents a set value for the scope. + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------------------- | ------ | -------- | ------------ | ----------- | +| `created_at` | string | false | | | +| `destination_scheme` | string | false | | | +| `id` | string | false | | | +| `name` | string | false | | | +| `scope` | string | false | | | +| `scope_id` | string | false | | | +| `source_scheme` | string | false | | | +| `updated_at` | string | false | | | + +#### Enumerated Values + +| Property | Value | +| -------------------- | ---------------------- | +| `destination_scheme` | `none` | +| `destination_scheme` | `environment_variable` | +| `destination_scheme` | `provisioner_variable` | +| `scope` | `template` | +| `scope` | `workspace` | +| `scope` | `import_job` | +| `source_scheme` | `none` | +| `source_scheme` | `data` | + +## codersdk.PprofConfig + +```json +{ + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| --------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `address` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `enable` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | + +## codersdk.PrometheusConfig + +```json +{ + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| --------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `address` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `enable` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | + +## codersdk.ProvisionerConfig + +```json +{ + "daemon_poll_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "daemon_poll_jitter": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "daemons": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + }, + "force_cancel_interval": { + "default": 0, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": 0 + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------------------- | -------------------------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `daemon_poll_interval` | [codersdk.DeploymentConfigField-time_Duration](#codersdkdeploymentconfigfield-time_duration) | false | | | +| `daemon_poll_jitter` | [codersdk.DeploymentConfigField-time_Duration](#codersdkdeploymentconfigfield-time_duration) | false | | | +| `daemons` | [codersdk.DeploymentConfigField-int](#codersdkdeploymentconfigfield-int) | false | | | +| `force_cancel_interval` | [codersdk.DeploymentConfigField-time_Duration](#codersdkdeploymentconfigfield-time_duration) | false | | | + ## codersdk.ProvisionerJob ```json @@ -325,6 +2336,226 @@ CreateParameterRequest is a structure used to create a new parameter value for a | `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.Role + +```json +{ + "display_name": "string", + "name": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------------- | ------ | -------- | ------------ | ----------- | +| `display_name` | string | false | | | +| `name` | string | false | | | + +## codersdk.SwaggerConfig + +```json +{ + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------- | -------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `enable` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | + +## codersdk.TLSConfig + +```json +{ + "address": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "cert_file": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_auth": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_ca_file": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_cert_file": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "client_key_file": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "key_file": { + "default": ["string"], + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "min_version": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + }, + "redirect_http": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------ | ------------------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `address` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `cert_file` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | +| `client_auth` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `client_ca_file` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `client_cert_file` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `client_key_file` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `enable` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `key_file` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | +| `min_version` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `redirect_http` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | + +## codersdk.TelemetryConfig + +```json +{ + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "trace": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "url": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `enable` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `trace` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `url` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | + ## codersdk.Template ```json @@ -401,6 +2632,54 @@ CreateParameterRequest is a structure used to create a new parameter value for a | ---------------- | ---------------------------------------------------- | -------- | ------------ | ----------- | | `[any property]` | [codersdk.TransitionStats](#codersdktransitionstats) | false | | | +## codersdk.TraceConfig + +```json +{ + "capture_logs": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "enable": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true + }, + "honeycomb_api_key": { + "default": "string", + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": "string" + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `capture_logs` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `enable` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | +| `honeycomb_api_key` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | + ## codersdk.TransitionStats ```json @@ -477,6 +2756,55 @@ CreateParameterRequest is a structure used to create a new parameter value for a | -------- | ------- | -------- | ------------ | ----------- | | `ttl_ms` | integer | false | | | +## codersdk.UploadResponse + +```json +{ + "hash": "19686d84-b10d-4f90-b18e-84fd3fa038fd" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------ | ------ | -------- | ------------ | ----------- | +| `hash` | string | false | | | + +## codersdk.User + +```json +{ + "avatar_url": "string", + "created_at": "string", + "email": "string", + "id": "string", + "last_seen_at": "string", + "organization_ids": ["string"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "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 | | | +| `organization_ids` | array of string | false | | | +| `roles` | array of [codersdk.Role](#codersdkrole) | false | | | +| `status` | string | false | | | +| `username` | string | true | | | + ## codersdk.ValidationError ```json @@ -505,10 +2833,7 @@ CreateParameterRequest is a structure used to create a new parameter value for a "build_number": 0, "created_at": "2019-08-24T14:15:22Z", "daily_cost": 0, - "deadline": { - "time": "string", - "valid": true - }, + "deadline": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", "initiator_name": "string", @@ -776,10 +3101,7 @@ CreateParameterRequest is a structure used to create a new parameter value for a "build_number": 0, "created_at": "2019-08-24T14:15:22Z", "daily_cost": 0, - "deadline": { - "time": "string", - "valid": true - }, + "deadline": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", "initiator_name": "string", @@ -892,7 +3214,7 @@ CreateParameterRequest is a structure used to create a new parameter value for a | `build_number` | integer | false | | | | `created_at` | string | false | | | | `daily_cost` | integer | false | | | -| `deadline` | string(time) or `null` | false | | | +| `deadline` | string | false | | | | `id` | string | false | | | | `initiator_id` | string | false | | | | `initiator_name` | string | false | | | @@ -1061,10 +3383,7 @@ CreateParameterRequest is a structure used to create a new parameter value for a "build_number": 0, "created_at": "2019-08-24T14:15:22Z", "daily_cost": 0, - "deadline": { - "time": "string", - "valid": true - }, + "deadline": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", "initiator_name": "string", @@ -1186,3 +3505,13 @@ CreateParameterRequest is a structure used to create a new parameter value for a | ------------ | ------------------------------------------------- | -------- | ------------ | ----------- | | `count` | integer | false | | | | `workspaces` | array of [codersdk.Workspace](#codersdkworkspace) | false | | | + +## netip.Addr + +```json +{} +``` + +### Properties + +_None_ diff --git a/docs/api/templates.md b/docs/api/templates.md index 23a7260494..cd94737c52 100644 --- a/docs/api/templates.md +++ b/docs/api/templates.md @@ -29,9 +29,9 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization-id}/tem "parameter_values": [ { "copy_from_parameter": "string", - "destination_scheme": "environment_variable", + "destination_scheme": "none", "name": "string", - "source_scheme": "data", + "source_scheme": "none", "source_value": "string" } ], @@ -165,18 +165,18 @@ Status Code **200** | `»» [any property]` | `codersdk.TransitionStats` | false | | | | `»»» p50` | integer | false | | | | `»»» p95` | integer | false | | | -| `» created_at` | string | false | | | -| `» created_by_id` | string | false | | | +| `» created_at` | string(date-time) | false | | | +| `» created_by_id` | string(uuid) | false | | | | `» created_by_name` | string | false | | | | `» default_ttl_ms` | integer | false | | | | `» description` | string | false | | | | `» display_name` | string | false | | | | `» icon` | string | false | | | -| `» id` | string | false | | | +| `» id` | string(uuid) | false | | | | `» name` | string | false | | | -| `» organization_id` | string | false | | | +| `» organization_id` | string(uuid) | false | | | | `» provisioner` | string | false | | | -| `» updated_at` | string | false | | | +| `» updated_at` | string(date-time) | false | | | | `» workspace_owner_count` | integer | false | | | To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. @@ -244,7 +244,7 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templat To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. -## Update template metadata by ID +## Get template metadata by ID ### Code samples @@ -349,3 +349,65 @@ curl -X DELETE http://coder-server:8080/api/v2/templates/{id} \ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Response](schemas.md#codersdkresponse) | To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. + +## Update template metadata by ID + +### Code samples + +```shell +# Example request using curl +curl -X PATCH http://coder-server:8080/api/v2/templates/{id} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`PATCH /templates/{id}` + +### Parameters + +| Name | In | Type | Required | Description | +| ---- | ---- | ------------ | -------- | ----------- | +| `id` | path | string(uuid) | true | Template ID | + +### Example responses + +> 200 Response + +```json +{ + "active_user_count": 0, + "active_version_id": "string", + "allow_user_cancel_workspace_jobs": true, + "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, + "description": "string", + "display_name": "string", + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "provisioner": "string", + "updated_at": "2019-08-24T14:15:22Z", + "workspace_owner_count": 0 +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------ | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Template](schemas.md#codersdktemplate) | + +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. diff --git a/docs/api/workspaces.md b/docs/api/workspaces.md index fcbfcda60d..4739d86a90 100644 --- a/docs/api/workspaces.md +++ b/docs/api/workspaces.md @@ -36,10 +36,7 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/member "build_number": 0, "created_at": "2019-08-24T14:15:22Z", "daily_cost": 0, - "deadline": { - "time": "string", - "valid": true - }, + "deadline": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", "initiator_name": "string", @@ -200,10 +197,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam "build_number": 0, "created_at": "2019-08-24T14:15:22Z", "daily_cost": 0, - "deadline": { - "time": "string", - "valid": true - }, + "deadline": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", "initiator_name": "string", @@ -387,10 +381,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces \ "build_number": 0, "created_at": "2019-08-24T14:15:22Z", "daily_cost": 0, - "deadline": { - "time": "string", - "valid": true - }, + "deadline": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", "initiator_name": "string", @@ -548,10 +539,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{id} \ "build_number": 0, "created_at": "2019-08-24T14:15:22Z", "daily_cost": 0, - "deadline": { - "time": "string", - "valid": true - }, + "deadline": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", "initiator_name": "string", diff --git a/docs/manifest.json b/docs/manifest.json index 5e3e78386e..5e20465ae2 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -337,10 +337,18 @@ "title": "Applications", "path": "./api/applications.md" }, + { + "title": "Audit", + "path": "./api/audit.md" + }, { "title": "Authorization", "path": "./api/authorization.md" }, + { + "title": "Files", + "path": "./api/files.md" + }, { "title": "Templates", "path": "./api/templates.md" @@ -349,6 +357,10 @@ "title": "Workspaces", "path": "./api/workspaces.md" }, + { + "title": "Parameters", + "path": "./api/parameters.md" + }, { "title": "Schemas", "path": "./api/schemas.md" diff --git a/scripts/apidocgen/markdown-template/code_shell.dot b/scripts/apidocgen/markdown-template/code_shell.dot index 041b3d92a0..7300ae4ab2 100644 --- a/scripts/apidocgen/markdown-template/code_shell.dot +++ b/scripts/apidocgen/markdown-template/code_shell.dot @@ -1,4 +1,8 @@ # Example request using curl curl -X {{=data.methodUpper}} http://coder-server:8080{{=data.url}}{{=data.requiredQueryString}}{{?data.allHeaders.length}} \{{?}} -{{~data.allHeaders :p:index}} -H '{{=p.name}}: {{=p.exampleValues.object}}'{{?index < data.allHeaders.length-1}} \ +{{~data.allHeaders :p:index}}{{ + if (p.name == "Content-Type" && p.exampleValues.object == "application/x-www-form-urlencoded") { + continue; + } +}} -H '{{=p.name}}: {{=p.exampleValues.object}}'{{?index < data.allHeaders.length-1}} \ {{?}}{{~}} diff --git a/scripts/apidocgen/markdown-template/main.dot b/scripts/apidocgen/markdown-template/main.dot index d040a95fa4..59236d94a9 100644 --- a/scripts/apidocgen/markdown-template/main.dot +++ b/scripts/apidocgen/markdown-template/main.dot @@ -5,9 +5,6 @@ } const pRef = p.$ref.replace("#/components/schemas/",""); - if (pRef == "codersdk.NullTime") { - return "string(time) or `null`"; - } return "[" + pRef + "](#" + pRef.replace(".","").toLowerCase() + ")"; } diff --git a/scripts/apidocgen/markdown-template/operation.dot b/scripts/apidocgen/markdown-template/operation.dot index f0363bcbab..8e8129757c 100644 --- a/scripts/apidocgen/markdown-template/operation.dot +++ b/scripts/apidocgen/markdown-template/operation.dot @@ -1,7 +1,17 @@ {{ function renderCodeSample(data) { const originalCodeSample = data.utils.getCodeSamples(data); - return originalCodeSample.replace("\n```\n", "```\n") + return originalCodeSample.replace("\n```\n", "```\n"); + } + + function renderDescription(data) { + if (!data.operation.description) { + return ""; + } + if (data.operation.description.startsWith("Swagger notice:")) { + return ""; + } + return data.operation.description; } }} {{= data.tags.section }} @@ -27,7 +37,7 @@ {{? data.operation.summary && !data.options.tocSummary}}*{{= data.operation.summary }}*{{?}} -{{? data.operation.description}}{{= data.operation.description }}{{?}} +{{= renderDescription(data)}} {{? data.operation.requestBody}} > Body parameter @@ -48,7 +58,5 @@ {{ data.security = data.operation.security ? data.operation.security : data.api.security; }} {{? data.security && data.security.length }} {{#def.authentication}} -{{??}} -{{#def.authentication_none}} {{?}} {{= data.tags.endSection }} diff --git a/scripts/apidocgen/markdown-template/parameters.def b/scripts/apidocgen/markdown-template/parameters.def index 47d81bd3d1..8a1107a605 100644 --- a/scripts/apidocgen/markdown-template/parameters.def +++ b/scripts/apidocgen/markdown-template/parameters.def @@ -5,6 +5,9 @@ const href = aType.replace(".","").toLowerCase(); return "[" + aType + "](schemas.md#" + href + ")"; } + if (p.safeType == 'string(binary)') { + return 'binary'; + } return p.safeType; } }} diff --git a/scripts/apidocgen/markdown-template/responses.def b/scripts/apidocgen/markdown-template/responses.def index 426d10227c..8fe3e36c4f 100644 --- a/scripts/apidocgen/markdown-template/responses.def +++ b/scripts/apidocgen/markdown-template/responses.def @@ -32,6 +32,18 @@ let displayName = p.displayName.replace("**additionalProperties**", "[any property]"); return displayName; } + + function renderResponsePropertyType(p) { + if (p.$ref) { + return '`' + p.$ref + '`'; + } + + if (p.type == 'array') { + return p.type; + } + + return p.safeType; + } }} {{ data.responses = data.utils.getResponses(data); }} {{ data.responseSchemas = false; }} @@ -85,7 +97,7 @@ Status Code **{{=response.status}}** {{?}} |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -{{~block.rows :p}}|`{{=renderDisplayName(p)}}`|{{? p.$ref}}`{{=p.$ref}}`{{?}}{{? !p.$ref}}{{=p.type}}{{?}}|{{=p.required}}|{{=p.restrictions||''}}|{{=p.description||''}}| +{{~block.rows :p}}|`{{=renderDisplayName(p)}}`|{{=renderResponsePropertyType(p)}}|{{=p.required}}|{{=p.restrictions||''}}|{{=p.description||''}}| {{~}} {{~}} {{?}}