diff --git a/.swaggo b/.swaggo new file mode 100644 index 0000000000000..4dcbb3ff4b9dc --- /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 547787c1d5b30..40a981afd59d8 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 e674cf6222bdd..9b45d84e515da 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,7 +546,7 @@ const docTemplate = `{ } } }, - "/templates/{id}": { + "/parameters/{scope}/{id}": { "get": { "security": [ { @@ -371,15 +557,27 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Templates" + "Parameters" ], - "summary": "Update template metadata by ID", - "operationId": "update-template-metadata", + "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": "Template ID", + "description": "ID", "name": "id", "in": "path", "required": true @@ -389,66 +587,127 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Template" + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.Parameter" + } } } } }, - "delete": { + "post": { "security": [ { "CoderSessionToken": [] } ], + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ - "Templates" + "Parameters" ], - "summary": "Delete template by ID", - "operationId": "delete-template-by-id", + "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": "Template ID", + "description": "ID", "name": "id", "in": "path", "required": true } ], "responses": { - "200": { - "description": "OK", + "201": { + "description": "Created", "schema": { - "$ref": "#/definitions/codersdk.Response" + "$ref": "#/definitions/codersdk.Parameter" } } } } }, - "/updatecheck": { - "get": { + "/parameters/{scope}/{id}/{name}": { + "delete": { + "security": [ + { + "CoderSessionToken": [] + } + ], "produces": [ "application/json" ], "tags": [ - "General" + "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 + } ], - "summary": "Update check", - "operationId": "update-check", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.UpdateCheckResponse" + "$ref": "#/definitions/codersdk.Response" } } } } }, - "/users/{user}/workspace/{workspacename}": { + "/templates/{id}": { "get": { "security": [ { @@ -459,44 +718,30 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Workspaces" + "Templates" ], - "summary": "Get workspace metadata by owner and workspace name", - "operationId": "get-workspace-metadata-by-owner-and-workspace-name", + "summary": "Get template metadata by ID", + "operationId": "get-template-metadata-by-id", "parameters": [ { "type": "string", - "description": "Owner username", - "name": "user", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Workspace name", - "name": "workspacename", + "format": "uuid", + "description": "Template ID", + "name": "id", "in": "path", "required": true - }, - { - "type": "boolean", - "description": "Return data instead of HTTP 404 if the workspace is deleted", - "name": "include_deleted", - "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Workspace" + "$ref": "#/definitions/codersdk.Template" } } } - } - }, - "/workspaces": { - "get": { + }, + "delete": { "security": [ { "CoderSessionToken": [] @@ -506,17 +751,152 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Workspaces" + "Templates" ], - "summary": "List workspaces", - "operationId": "get-workspaces", + "summary": "Delete template by ID", + "operationId": "delete-template-by-id", "parameters": [ { "type": "string", - "description": "Filter by owner username", - "name": "owner", - "in": "query" - }, + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Response" + } + } + } + }, + "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": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "General" + ], + "summary": "Update check", + "operationId": "update-check", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.UpdateCheckResponse" + } + } + } + } + }, + "/users/{user}/workspace/{workspacename}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Workspaces" + ], + "summary": "Get workspace metadata by owner and workspace name", + "operationId": "get-workspace-metadata-by-owner-and-workspace-name", + "parameters": [ + { + "type": "string", + "description": "Owner username", + "name": "user", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Workspace name", + "name": "workspacename", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "Return data instead of HTTP 404 if the workspace is deleted", + "name": "include_deleted", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Workspace" + } + } + } + } + }, + "/workspaces": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Workspaces" + ], + "summary": "List workspaces", + "operationId": "get-workspaces", + "parameters": [ + { + "type": "string", + "description": "Filter by owner username", + "name": "owner", + "in": "query" + }, { "type": "string", "description": "Filter by template name", @@ -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", @@ -858,179 +1331,737 @@ const docTemplate = `{ "description": "AuthorizationObject can represent a \"set\" of objects, such as: all workspaces in an organization, all workspaces owned by me, all workspaces across the entire product.", "type": "object", "properties": { - "organization_id": { - "description": "OrganizationID (optional) adds the set constraint to all resources owned by a given organization.", + "organization_id": { + "description": "OrganizationID (optional) adds the set constraint to all resources owned by a given organization.", + "type": "string" + }, + "owner_id": { + "description": "OwnerID (optional) adds the set constraint to all resources owned by a given user.", + "type": "string" + }, + "resource_id": { + "description": "ResourceID (optional) reduces the set to a singular resource. This assigns\na resource ID to the resource type, eg: a single workspace.\nThe rbac library will not fetch the resource from the database, so if you\nare using this option, you should also set the owner ID and organization ID\nif possible. Be as specific as possible using all the fields relevant.", + "type": "string" + }, + "resource_type": { + "description": "ResourceType is the name of the resource.\n` + "`" + `./coderd/rbac/object.go` + "`" + ` has the list of valid resource types.", + "type": "string" + } + } + }, + "codersdk.AuthorizationRequest": { + "type": "object", + "properties": { + "checks": { + "description": "Checks is a map keyed with an arbitrary string to a permission check.\nThe key can be any string that is helpful to the caller, and allows\nmultiple permission checks to be run in a single request.\nThe key ensures that each permission check has the same key in the\nresponse.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/codersdk.AuthorizationCheck" + } + } + } + }, + "codersdk.AuthorizationResponse": { + "type": "object", + "additionalProperties": { + "type": "boolean" + } + }, + "codersdk.BuildInfoResponse": { + "type": "object", + "properties": { + "external_url": { + "description": "ExternalURL references the current Coder version.\nFor production builds, this will link directly to a release. For development builds, this will link to a commit.", + "type": "string" + }, + "version": { + "description": "Version returns the semantic version of the build.", + "type": "string" + } + } + }, + "codersdk.CreateParameterRequest": { + "description": "CreateParameterRequest is a structure used to create a new parameter value for a scope.", + "type": "object", + "required": [ + "destination_scheme", + "name", + "source_scheme", + "source_value" + ], + "properties": { + "copy_from_parameter": { + "description": "CloneID allows copying the value of another parameter.\nThe other param must be related to the same template_id for this to\nsucceed.\nNo other fields are required if using this, as all fields will be copied\nfrom the other parameter.", + "type": "string" + }, + "destination_scheme": { + "type": "string", + "enum": [ + "none", + "environment_variable", + "provisioner_variable" + ] + }, + "name": { + "type": "string" + }, + "source_scheme": { + "type": "string", + "enum": [ + "none", + "data" + ] + }, + "source_value": { + "type": "string" + } + } + }, + "codersdk.CreateTemplateRequest": { + "type": "object", + "required": [ + "name", + "template_version_id" + ], + "properties": { + "allow_user_cancel_workspace_jobs": { + "description": "Allow users to cancel in-progress workspace jobs.\n*bool as the default value is \"true\".", + "type": "boolean" + }, + "default_ttl_ms": { + "description": "DefaultTTLMillis allows optionally specifying the default TTL\nfor all workspaces created from this template.", + "type": "integer" + }, + "description": { + "description": "Description is a description of what the template contains. It must be\nless than 128 bytes.", + "type": "string" + }, + "display_name": { + "description": "DisplayName is the displayed name of the template.", + "type": "string" + }, + "icon": { + "description": "Icon is a relative path or external URL that specifies\nan icon to be displayed in the dashboard.", + "type": "string" + }, + "name": { + "description": "Name is the name of the template.", + "type": "string" + }, + "parameter_values": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.CreateParameterRequest" + } + }, + "template_version_id": { + "description": "VersionID is an in-progress or completed job to use as an initial version\nof the template.\n\nThis is required on creation to enable a user-flow of validating a\ntemplate works. There is no reason the data-model cannot support empty\ntemplates, but it doesn't make sense for users.", + "type": "string" + } + } + }, + "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": { + "latency_ms": { + "type": "number" + }, + "preferred": { + "type": "boolean" + } + } + }, + "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": { + "host": { + "description": "Host is the externally accessible URL for the Coder instance.", + "type": "string" + } + } + }, + "codersdk.GitAuthConfig": { + "type": "object", + "properties": { + "auth_url": { "type": "string" }, - "owner_id": { - "description": "OwnerID (optional) adds the set constraint to all resources owned by a given user.", + "client_id": { "type": "string" }, - "resource_id": { - "description": "ResourceID (optional) reduces the set to a singular resource. This assigns\na resource ID to the resource type, eg: a single workspace.\nThe rbac library will not fetch the resource from the database, so if you\nare using this option, you should also set the owner ID and organization ID\nif possible. Be as specific as possible using all the fields relevant.", + "id": { "type": "string" }, - "resource_type": { - "description": "ResourceType is the name of the resource.\n` + "`" + `./coderd/rbac/object.go` + "`" + ` has the list of valid resource types.", + "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.AuthorizationRequest": { + "codersdk.Healthcheck": { "type": "object", "properties": { - "checks": { - "description": "Checks is a map keyed with an arbitrary string to a permission check.\nThe key can be any string that is helpful to the caller, and allows\nmultiple permission checks to be run in a single request.\nThe key ensures that each permission check has the same key in the\nresponse.", - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/codersdk.AuthorizationCheck" - } + "interval": { + "description": "Interval specifies the seconds between each health check.", + "type": "integer" + }, + "threshold": { + "description": "Threshold specifies the number of consecutive failed health checks before returning \"unhealthy\".", + "type": "integer" + }, + "url": { + "description": "URL specifies the endpoint to check for the app health.", + "type": "string" } } }, - "codersdk.AuthorizationResponse": { + "codersdk.OAuth2Config": { "type": "object", - "additionalProperties": { - "type": "boolean" + "properties": { + "github": { + "$ref": "#/definitions/codersdk.OAuth2GithubConfig" + } } }, - "codersdk.BuildInfoResponse": { + "codersdk.OAuth2GithubConfig": { "type": "object", "properties": { - "external_url": { - "description": "ExternalURL references the current Coder version.\nFor production builds, this will link directly to a release. For development builds, this will link to a commit.", - "type": "string" + "allow_everyone": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" }, - "version": { - "description": "Version returns the semantic version of the build.", - "type": "string" + "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.CreateParameterRequest": { - "description": "CreateParameterRequest is a structure used to create a new parameter value for a scope.", + "codersdk.OIDCConfig": { "type": "object", - "required": [ - "destination_scheme", - "name", - "source_scheme", - "source_value" - ], "properties": { - "copy_from_parameter": { - "description": "CloneID allows copying the value of another parameter.\nThe other param must be related to the same template_id for this to\nsucceed.\nNo other fields are required if using this, as all fields will be copied\nfrom the other parameter.", - "type": "string" + "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" }, + "scope": { + "type": "string", + "enum": [ + "template", + "workspace", + "import_job" + ] + }, + "scope_id": { + "type": "string", + "format": "uuid" + }, "source_scheme": { "type": "string", "enum": [ + "none", "data" ] }, - "source_value": { - "type": "string" + "updated_at": { + "type": "string", + "format": "date-time" } } }, - "codersdk.CreateTemplateRequest": { + "codersdk.PprofConfig": { "type": "object", - "required": [ - "name", - "template_version_id" - ], "properties": { - "allow_user_cancel_workspace_jobs": { - "description": "Allow users to cancel in-progress workspace jobs.\n*bool as the default value is \"true\".", - "type": "boolean" - }, - "default_ttl_ms": { - "description": "DefaultTTLMillis allows optionally specifying the default TTL\nfor all workspaces created from this template.", - "type": "integer" - }, - "description": { - "description": "Description is a description of what the template contains. It must be\nless than 128 bytes.", - "type": "string" - }, - "display_name": { - "description": "DisplayName is the displayed name of the template.", - "type": "string" - }, - "icon": { - "description": "Icon is a relative path or external URL that specifies\nan icon to be displayed in the dashboard.", - "type": "string" - }, - "name": { - "description": "Name is the name of the template.", - "type": "string" - }, - "parameter_values": { - "type": "array", - "items": { - "$ref": "#/definitions/codersdk.CreateParameterRequest" - } + "address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" }, - "template_version_id": { - "description": "VersionID is an in-progress or completed job to use as an initial version\nof the template.\n\nThis is required on creation to enable a user-flow of validating a\ntemplate works. There is no reason the data-model cannot support empty\ntemplates, but it doesn't make sense for users.", - "type": "string" + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" } } }, - "codersdk.DERPRegion": { + "codersdk.PrometheusConfig": { "type": "object", "properties": { - "latency_ms": { - "type": "number" + "address": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" }, - "preferred": { - "type": "boolean" - } - } - }, - "codersdk.GetAppHostResponse": { - "type": "object", - "properties": { - "host": { - "description": "Host is the externally accessible URL for the Coder instance.", - "type": "string" + "enable": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" } } }, - "codersdk.Healthcheck": { + "codersdk.ProvisionerConfig": { "type": "object", "properties": { - "interval": { - "description": "Interval specifies the seconds between each health check.", - "type": "integer" + "daemon_poll_interval": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" }, - "threshold": { - "description": "Threshold specifies the number of consecutive failed health checks before returning \"unhealthy\".", - "type": "integer" + "daemon_poll_jitter": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-time_Duration" }, - "url": { - "description": "URL specifies the endpoint to check for the app health.", - "type": "string" - } - } - }, - "codersdk.NullTime": { - "type": "object", - "properties": { - "time": { - "type": "string" + "daemons": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-int" }, - "valid": { - "description": "Valid is true if Time is not NULL", - "type": "boolean" + "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 f33bec806f70a..8474aebfee1cd 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,10 +1056,103 @@ } } }, - "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.", + "codersdk.AuditDiff": { "type": "object", - "properties": { + "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", + "properties": { "action": { "type": "string", "enum": ["create", "read", "update", "delete"] @@ -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 eaac13a66cfbb..72b27690fb179 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 d68332c9089f7..9b84120d77af5 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 8d01745f919c6..c128d1bd6ed69 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 ba3fd2349f48a..29adb4bf5e43b 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 74e3560703131..662a3069683c7 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 e3d25851ea89f..da8f88df04ade 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 6d728fbfbcab2..91e0a25c571dc 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 c813096412a11..f17635540d43c 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 80055484df0f6..743c3b778ae36 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 0000000000000..8b3946c715665 --- /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 0000000000000..c72493caabc71 --- /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 8d5ef5dad967d..f8293d32c8709 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 0000000000000..1612ac333a3df --- /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 601a1fc7a396a..511cd2402aede 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 @@ -63,35 +241,1650 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in ### Properties -| Name | Type | Required | Restrictions | Description | -| ----------------- | ------ | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `organization_id` | string | false | | Organization ID (optional) adds the set constraint to all resources owned by a given organization. | -| `owner_id` | string | false | | Owner ID (optional) adds the set constraint to all resources owned by a given user. | -| `resource_id` | string | false | | Resource ID (optional) reduces the set to a singular resource. This assigns a resource ID to the resource type, eg: a single workspace. The rbac library will not fetch the resource from the database, so if you are using this option, you should also set the owner ID and organization ID if possible. Be as specific as possible using all the fields relevant. | -| `resource_type` | string | false | | Resource type is the name of the resource. `./coderd/rbac/object.go` has the list of valid resource types. | +| Name | Type | Required | Restrictions | Description | +| ----------------- | ------ | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `organization_id` | string | false | | Organization ID (optional) adds the set constraint to all resources owned by a given organization. | +| `owner_id` | string | false | | Owner ID (optional) adds the set constraint to all resources owned by a given user. | +| `resource_id` | string | false | | Resource ID (optional) reduces the set to a singular resource. This assigns a resource ID to the resource type, eg: a single workspace. The rbac library will not fetch the resource from the database, so if you are using this option, you should also set the owner ID and organization ID if possible. Be as specific as possible using all the fields relevant. | +| `resource_type` | string | false | | Resource type is the name of the resource. `./coderd/rbac/object.go` has the list of valid resource types. | + +## codersdk.AuthorizationRequest + +```json +{ + "checks": { + "property1": { + "action": "create", + "object": { + "organization_id": "string", + "owner_id": "string", + "resource_id": "string", + "resource_type": "string" + } + }, + "property2": { + "action": "create", + "object": { + "organization_id": "string", + "owner_id": "string", + "resource_id": "string", + "resource_type": "string" + } + } + } +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------ | ---------------------------------------------------------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `checks` | object | false | | Checks is a map keyed with an arbitrary string to a permission check. The key can be any string that is helpful to the caller, and allows multiple permission checks to be run in a single request. The key ensures that each permission check has the same key in the response. | +| » `[any property]` | [codersdk.AuthorizationCheck](#codersdkauthorizationcheck) | false | | It is used to check if the currently authenticated user (or the specified user) can do a given action to a given set of objects. | + +## codersdk.AuthorizationResponse + +```json +{ + "property1": true, + "property2": true +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ---------------- | ------- | -------- | ------------ | ----------- | +| `[any property]` | boolean | false | | | + +## codersdk.BuildInfoResponse + +```json +{ + "external_url": "string", + "version": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------------- | ------ | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `external_url` | string | false | | External URL references the current Coder version. For production builds, this will link directly to a release. For development builds, this will link to a commit. | +| `version` | string | false | | Version returns the semantic version of the build. | + +## codersdk.CreateParameterRequest + +```json +{ + "copy_from_parameter": "string", + "destination_scheme": "none", + "name": "string", + "source_scheme": "none", + "source_value": "string" +} +``` + +CreateParameterRequest is a structure used to create a new parameter value for a scope. + +### Properties + +| Name | Type | Required | Restrictions | Description | +| --------------------- | ------ | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `copy_from_parameter` | string | false | | Copy from parameter allows copying the value of another parameter. The other param must be related to the same template_id for this to succeed. No other fields are required if using this, as all fields will be copied from the other parameter. | +| `destination_scheme` | string | true | | | +| `name` | string | true | | | +| `source_scheme` | string | true | | | +| `source_value` | string | true | | | + +#### Enumerated Values + +| Property | Value | +| -------------------- | ---------------------- | +| `destination_scheme` | `none` | +| `destination_scheme` | `environment_variable` | +| `destination_scheme` | `provisioner_variable` | +| `source_scheme` | `none` | +| `source_scheme` | `data` | + +## codersdk.CreateTemplateRequest + +```json +{ + "allow_user_cancel_workspace_jobs": true, + "default_ttl_ms": 0, + "description": "string", + "display_name": "string", + "icon": "string", + "name": "string", + "parameter_values": [ + { + "copy_from_parameter": "string", + "destination_scheme": "none", + "name": "string", + "source_scheme": "none", + "source_value": "string" + } + ], + "template_version_id": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------- | +| `allow_user_cancel_workspace_jobs` | boolean | false | | Allow users to cancel in-progress workspace jobs. \*bool as the default value is "true". | +| `default_ttl_ms` | integer | false | | Default ttl ms allows optionally specifying the default TTL for all workspaces created from this template. | +| `description` | string | false | | Description is a description of what the template contains. It must be less than 128 bytes. | +| `display_name` | string | false | | Display name is the displayed name of the template. | +| `icon` | string | false | | Icon is a relative path or external URL that specifies an icon to be displayed in the dashboard. | +| `name` | string | true | | Name is the name of the template. | +| `parameter_values` | array of [codersdk.CreateParameterRequest](#codersdkcreateparameterrequest) | false | | Parameter values is a structure used to create a new parameter value for a scope.] | +| `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 +{ + "latency_ms": 0, + "preferred": true +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | ------- | -------- | ------------ | ----------- | +| `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 +{ + "host": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------ | ------ | -------- | ------------ | ------------------------------------------------------------- | +| `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 +{ + "interval": 0, + "threshold": 0, + "url": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------- | ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------ | +| `interval` | integer | false | | Interval specifies the seconds between each health check. | +| `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.AuthorizationRequest +## codersdk.OAuth2Config ```json { - "checks": { - "property1": { - "action": "create", - "object": { - "organization_id": "string", - "owner_id": "string", - "resource_id": "string", - "resource_type": "string" - } + "github": { + "allow_everyone": { + "default": true, + "enterprise": true, + "flag": "string", + "hidden": true, + "name": "string", + "secret": true, + "shorthand": "string", + "usage": "string", + "value": true }, - "property2": { - "action": "create", - "object": { - "organization_id": "string", - "owner_id": "string", - "resource_id": "string", - "resource_type": "string" - } + "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" } } } @@ -99,158 +1892,376 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------ | ---------------------------------------------------------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `checks` | object | false | | Checks is a map keyed with an arbitrary string to a permission check. The key can be any string that is helpful to the caller, and allows multiple permission checks to be run in a single request. The key ensures that each permission check has the same key in the response. | -| » `[any property]` | [codersdk.AuthorizationCheck](#codersdkauthorizationcheck) | false | | It is used to check if the currently authenticated user (or the specified user) can do a given action to a given set of objects. | +| Name | Type | Required | Restrictions | Description | +| -------- | ---------------------------------------------------------- | -------- | ------------ | ----------- | +| `github` | [codersdk.OAuth2GithubConfig](#codersdkoauth2githubconfig) | false | | | -## codersdk.AuthorizationResponse +## codersdk.OAuth2GithubConfig ```json { - "property1": true, - "property2": true + "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 | -| ---------------- | ------- | -------- | ------------ | ----------- | -| `[any property]` | boolean | false | | | +| 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.BuildInfoResponse +## codersdk.OIDCConfig ```json { - "external_url": "string", - "version": "string" + "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 | -| -------------- | ------ | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `external_url` | string | false | | External URL references the current Coder version. For production builds, this will link directly to a release. For development builds, this will link to a commit. | -| `version` | string | false | | Version returns the semantic version of the build. | +| 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.CreateParameterRequest +## codersdk.Parameter ```json { - "copy_from_parameter": "string", - "destination_scheme": "environment_variable", + "created_at": "2019-08-24T14:15:22Z", + "destination_scheme": "none", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", - "source_scheme": "data", - "source_value": "string" + "scope": "template", + "scope_id": "5d3fe357-12dd-4f62-b004-6d1fb3b8454f", + "source_scheme": "none", + "updated_at": "2019-08-24T14:15:22Z" } ``` -CreateParameterRequest is a structure used to create a new parameter value for a scope. +Parameter represents a set value for the scope. ### Properties -| Name | Type | Required | Restrictions | Description | -| --------------------- | ------ | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `copy_from_parameter` | string | false | | Copy from parameter allows copying the value of another parameter. The other param must be related to the same template_id for this to succeed. No other fields are required if using this, as all fields will be copied from the other parameter. | -| `destination_scheme` | string | true | | | -| `name` | string | true | | | -| `source_scheme` | string | true | | | -| `source_value` | string | true | | | +| 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.CreateTemplateRequest - -```json -{ - "allow_user_cancel_workspace_jobs": true, - "default_ttl_ms": 0, - "description": "string", - "display_name": "string", - "icon": "string", - "name": "string", - "parameter_values": [ - { - "copy_from_parameter": "string", - "destination_scheme": "environment_variable", - "name": "string", - "source_scheme": "data", - "source_value": "string" - } - ], - "template_version_id": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------- | -| `allow_user_cancel_workspace_jobs` | boolean | false | | Allow users to cancel in-progress workspace jobs. \*bool as the default value is "true". | -| `default_ttl_ms` | integer | false | | Default ttl ms allows optionally specifying the default TTL for all workspaces created from this template. | -| `description` | string | false | | Description is a description of what the template contains. It must be less than 128 bytes. | -| `display_name` | string | false | | Display name is the displayed name of the template. | -| `icon` | string | false | | Icon is a relative path or external URL that specifies an icon to be displayed in the dashboard. | -| `name` | string | true | | Name is the name of the template. | -| `parameter_values` | array of [codersdk.CreateParameterRequest](#codersdkcreateparameterrequest) | false | | Parameter values is a structure used to create a new parameter value for a scope.] | -| `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.DERPRegion +## codersdk.PprofConfig ```json { - "latency_ms": 0, - "preferred": true + "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 | -| ------------ | ------- | -------- | ------------ | ----------- | -| `latency_ms` | number | false | | | -| `preferred` | boolean | false | | | +| Name | Type | Required | Restrictions | Description | +| --------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `address` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `enable` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | -## codersdk.GetAppHostResponse +## codersdk.PrometheusConfig ```json { - "host": "string" + "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 | -| ------ | ------ | -------- | ------------ | ------------------------------------------------------------- | -| `host` | string | false | | Host is the externally accessible URL for the Coder instance. | +| Name | Type | Required | Restrictions | Description | +| --------- | ------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `address` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +| `enable` | [codersdk.DeploymentConfigField-bool](#codersdkdeploymentconfigfield-bool) | false | | | -## codersdk.Healthcheck +## codersdk.ProvisionerConfig ```json { - "interval": 0, - "threshold": 0, - "url": "string" + "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 | -| ----------- | ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------ | -| `interval` | integer | false | | Interval specifies the seconds between each health check. | -| `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. | +| 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 @@ -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 23a7260494db6..cd94737c526c3 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 fcbfcda60d60e..4739d86a90715 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 5e3e78386ea03..5e20465ae272e 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 041b3d92a0344..7300ae4ab29aa 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 d040a95fa4490..59236d94a9fbd 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 f0363bcbabf45..8e8129757c843 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 47d81bd3d1863..8a1107a605fba 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 426d10227ccd3..8fe3e36c4f240 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||''}}| {{~}} {{~}} {{?}}