diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 7e7f19de034d6..8c74f2680154b 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -378,8 +378,117 @@ const docTemplate = `{ } } }, - "/organizations/{organization-id}/templates/": { + "/organizations": { "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Organizations" + ], + "summary": "Create organization", + "operationId": "create-organization", + "parameters": [ + { + "description": "Create organization request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateOrganizationRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.Organization" + } + } + } + } + }, + "/organizations/{organization}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Organizations" + ], + "summary": "Get organization by ID", + "operationId": "get-organization-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Organization" + } + } + } + } + }, + "/organizations/{organization}/members/roles": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Members" + ], + "summary": "Get member roles by organization", + "operationId": "get-member-roles-by-organization", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.AssignableRoles" + } + } + } + } + } + }, + "/organizations/{organization}/members/{user}/roles": { + "put": { "security": [ { "CoderSessionToken": [] @@ -392,24 +501,31 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Templates" + "Members" ], - "summary": "Create template by organization", - "operationId": "create-template-by-organization", + "summary": "Assign role to organization member", + "operationId": "assign-role-to-organization-member", "parameters": [ { - "description": "Request body", + "description": "Update roles request", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/codersdk.CreateTemplateRequest" + "$ref": "#/definitions/codersdk.UpdateRoles" } }, { "type": "string", "description": "Organization ID", - "name": "organization-id", + "name": "organization", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Username, UUID, or me", + "name": "user", "in": "path", "required": true } @@ -418,7 +534,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Template" + "$ref": "#/definitions/codersdk.OrganizationMember" } } } @@ -437,8 +553,8 @@ const docTemplate = `{ "tags": [ "Workspaces" ], - "summary": "Create workspace by organization", - "operationId": "create-workspace-by-organization", + "summary": "Create user workspace by organization", + "operationId": "create-user-workspace-by-organization", "parameters": [ { "type": "string", @@ -450,7 +566,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Username", + "description": "Username, UUID, or me", "name": "user", "in": "path", "required": true @@ -502,9 +618,91 @@ const docTemplate = `{ } } } + }, + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Create template by organization", + "operationId": "create-template-by-organization", + "parameters": [ + { + "description": "Request body", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateTemplateRequest" + } + }, + { + "type": "string", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Template" + } + } + } + } + }, + "/organizations/{organization}/templates/examples": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Get template examples by organization", + "operationId": "get-template-examples-by-organization", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.TemplateExample" + } + } + } + } } }, - "/organizations/{organization}/templates/{template-name}": { + "/organizations/{organization}/templates/{templatename}": { "get": { "security": [ { @@ -517,21 +715,775 @@ const docTemplate = `{ "tags": [ "Templates" ], - "summary": "Get templates by organization and template name", - "operationId": "get-templates-by-organization-and-template-name", + "summary": "Get templates by organization and template name", + "operationId": "get-templates-by-organization-and-template-name", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Template name", + "name": "templatename", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Template" + } + } + } + } + }, + "/organizations/{organization}/templateversions": { + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Create template version by organization", + "operationId": "create-template-version-by-organization", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + }, + { + "description": "Create template version request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateTemplateVersionDryRunRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "/organizations/{organization}/templateversions/{templateversionname}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Get template version by organization and name", + "operationId": "get-template-version-by-organization-and-name", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Template version name", + "name": "templateversionname", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "/organizations/{organization}/templateversions/{templateversionname}/previous": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Get previous template version by organization and name", + "operationId": "get-previous-template-version-by-organization-and-name", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Template version name", + "name": "templateversionname", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "/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": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Get template metadata by ID", + "operationId": "get-template-metadata-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Template" + } + } + } + }, + "delete": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Delete template by ID", + "operationId": "delete-template-by-id", + "parameters": [ + { + "type": "string", + "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" + } + } + } + } + }, + "/templates/{id}/daus": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Get template DAUs by ID", + "operationId": "get-template-daus-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.TemplateDAUsResponse" + } + } + } + } + }, + "/templates/{id}/versions": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "List template versions by template ID", + "operationId": "list-template-versions-by-template-ID", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "patch": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Update active template version by template ID", + "operationId": "update-active-template-version-by-template-ID", + "parameters": [ + { + "description": "Modified template version", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.UpdateActiveTemplateVersion" + } + }, + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Response" + } + } + } + } + }, + "/templates/{id}/versions/{templateversionname}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Get template version by template ID and name", + "operationId": "get-template-version-by-template-id-and-name", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Template version name", + "name": "templateversionname", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + } + }, + "/templateversions/{templateversion}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Get template version by ID", + "operationId": "get-template-version-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "/templateversions/{templateversion}/cancel": { + "patch": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Cancel template version by ID", + "operationId": "cancel-template-version-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Response" + } + } + } + } + }, + "/templateversions/{templateversion}/dry-run": { + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Create template version dry-run", + "operationId": "create-template-version-dry-run", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", + "in": "path", + "required": true + }, + { + "description": "Dry-run request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateTemplateVersionDryRunRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.ProvisionerJob" + } + } + } + } + }, + "/templateversions/{templateversion}/dry-run/{jobid}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Get template version dry-run by job ID", + "operationId": "get-template-version-dry-run-by-job-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "Job ID", + "name": "jobid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.ProvisionerJob" + } + } + } + } + }, + "/templateversions/{templateversion}/dry-run/{jobid}/cancel": { + "patch": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Templates" + ], + "summary": "Cancel template version dry-run by job ID", + "operationId": "cancel-template-version-dry-run-by-job-id", "parameters": [ { "type": "string", "format": "uuid", - "description": "Organization ID", - "name": "organization", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Template name", - "name": "template-name", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true } @@ -540,13 +1492,13 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Template" + "$ref": "#/definitions/codersdk.Response" } } } } }, - "/parameters/{scope}/{id}": { + "/templateversions/{templateversion}/dry-run/{jobid}/logs": { "get": { "security": [ { @@ -557,30 +1509,44 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Parameters" + "Templates" ], - "summary": "Get parameters", - "operationId": "get-parameters", + "summary": "Get template version dry-run logs by job ID", + "operationId": "get-template-version-dry-run-logs-by-job-id", "parameters": [ { - "enum": [ - "template", - "workspace", - "import_job" - ], "type": "string", - "description": "Scope", - "name": "scope", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true }, { "type": "string", "format": "uuid", - "description": "ID", - "name": "id", + "description": "Job ID", + "name": "jobid", "in": "path", "required": true + }, + { + "type": "integer", + "description": "Before Unix timestamp", + "name": "before", + "in": "query" + }, + { + "type": "integer", + "description": "After Unix timestamp", + "name": "after", + "in": "query" + }, + { + "type": "boolean", + "description": "Follow log stream", + "name": "follow", + "in": "query" } ], "responses": { @@ -589,72 +1555,61 @@ const docTemplate = `{ "schema": { "type": "array", "items": { - "$ref": "#/definitions/codersdk.Parameter" + "$ref": "#/definitions/codersdk.ProvisionerJobLog" } } } } - }, - "post": { + } + }, + "/templateversions/{templateversion}/dry-run/{jobid}/resources": { + "get": { "security": [ { "CoderSessionToken": [] } ], - "consumes": [ - "application/json" - ], "produces": [ "application/json" ], "tags": [ - "Parameters" + "Templates" ], - "summary": "Create parameter", - "operationId": "create-parameter", + "summary": "Get template version dry-run resources by job ID", + "operationId": "get-template-version-dry-run-resources-by-job-id", "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", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true }, { "type": "string", "format": "uuid", - "description": "ID", - "name": "id", + "description": "Job ID", + "name": "jobid", "in": "path", "required": true } ], "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Parameter" + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.WorkspaceResource" + } } } } } }, - "/parameters/{scope}/{id}/{name}": { - "delete": { + "/templateversions/{templateversion}/logs": { + "get": { "security": [ { "CoderSessionToken": [] @@ -664,50 +1619,52 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Parameters" + "Templates" ], - "summary": "Delete parameter", - "operationId": "delete-parameter", + "summary": "Get logs by template version", + "operationId": "get-logs-by-template-version", "parameters": [ { - "enum": [ - "template", - "workspace", - "import_job" - ], "type": "string", - "description": "Scope", - "name": "scope", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true }, { - "type": "string", - "format": "uuid", - "description": "ID", - "name": "id", - "in": "path", - "required": true + "type": "integer", + "description": "Before Unix timestamp", + "name": "before", + "in": "query" }, { - "type": "string", - "description": "Name", - "name": "name", - "in": "path", - "required": true + "type": "integer", + "description": "After Unix timestamp", + "name": "after", + "in": "query" + }, + { + "type": "boolean", + "description": "Follow log stream", + "name": "follow", + "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Response" + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.ProvisionerJobLog" + } } } } } }, - "/templates/{id}": { + "/templateversions/{templateversion}/parameters": { "get": { "security": [ { @@ -720,14 +1677,14 @@ const docTemplate = `{ "tags": [ "Templates" ], - "summary": "Get template metadata by ID", - "operationId": "get-template-metadata-by-id", + "summary": "Get parameters by template version", + "operationId": "get-parameters-by-template-version", "parameters": [ { "type": "string", "format": "uuid", - "description": "Template ID", - "name": "id", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true } @@ -736,12 +1693,17 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Template" + "type": "array", + "items": { + "$ref": "#/definitions/parameter.ComputedValue" + } } } } - }, - "delete": { + } + }, + "/templateversions/{templateversion}/resources": { + "get": { "security": [ { "CoderSessionToken": [] @@ -753,14 +1715,14 @@ const docTemplate = `{ "tags": [ "Templates" ], - "summary": "Delete template by ID", - "operationId": "delete-template-by-id", + "summary": "Get resources by template version", + "operationId": "get-resources-by-template-version", "parameters": [ { "type": "string", "format": "uuid", - "description": "Template ID", - "name": "id", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true } @@ -769,12 +1731,17 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Response" + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.WorkspaceResource" + } } } } - }, - "patch": { + } + }, + "/templateversions/{templateversion}/schema": { + "get": { "security": [ { "CoderSessionToken": [] @@ -786,14 +1753,14 @@ const docTemplate = `{ "tags": [ "Templates" ], - "summary": "Update template metadata by ID", - "operationId": "update-template-metadata", + "summary": "Get schema by template version", + "operationId": "get-schema-by-template-version", "parameters": [ { "type": "string", "format": "uuid", - "description": "Template ID", - "name": "id", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true } @@ -802,7 +1769,10 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Template" + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.ParameterSchema" + } } } } @@ -1918,6 +2888,20 @@ const docTemplate = `{ } } }, + "codersdk.AssignableRoles": { + "type": "object", + "properties": { + "assignable": { + "type": "boolean" + }, + "display_name": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "codersdk.AuditAction": { "type": "string", "enum": [ @@ -2132,6 +3116,17 @@ const docTemplate = `{ "BuildReasonAutostop" ] }, + "codersdk.CreateOrganizationRequest": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + } + }, "codersdk.CreateParameterRequest": { "description": "CreateParameterRequest is a structure used to create a new parameter value for a scope.", "type": "object", @@ -2144,7 +3139,8 @@ const docTemplate = `{ "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" + "type": "string", + "format": "uuid" }, "destination_scheme": { "enum": [ @@ -2220,6 +3216,20 @@ const docTemplate = `{ } } }, + "codersdk.CreateTemplateVersionDryRunRequest": { + "type": "object", + "properties": { + "parameter_values": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.CreateParameterRequest" + } + }, + "workspace_name": { + "type": "string" + } + } + }, "codersdk.CreateTestAuditLogRequest": { "type": "object", "properties": { @@ -2307,6 +3317,17 @@ const docTemplate = `{ } } }, + "codersdk.DAUEntry": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "date": { + "type": "string" + } + } + }, "codersdk.DERP": { "type": "object", "properties": { @@ -2825,17 +3846,70 @@ const docTemplate = `{ "email_domain": { "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" }, - "ignore_email_verified": { - "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + "ignore_email_verified": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + }, + "issuer_url": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + }, + "scopes": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + }, + "username_field": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, + "codersdk.Organization": { + "type": "object", + "required": [ + "created_at", + "id", + "name", + "updated_at" + ], + "properties": { + "created_at": { + "type": "string", + "format": "date-time" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "name": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "codersdk.OrganizationMember": { + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time" + }, + "organization_id": { + "type": "string", + "format": "uuid" }, - "issuer_url": { - "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.Role" + } }, - "scopes": { - "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + "updated_at": { + "type": "string", + "format": "date-time" }, - "username_field": { - "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + "user_id": { + "type": "string", + "format": "uuid" } } }, @@ -2912,6 +3986,86 @@ const docTemplate = `{ "ParameterDestinationSchemeProvisionerVariable" ] }, + "codersdk.ParameterSchema": { + "type": "object", + "properties": { + "allow_override_destination": { + "type": "boolean" + }, + "allow_override_source": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "default_destination_scheme": { + "enum": [ + "none", + "environment_variable", + "provisioner_variable" + ], + "allOf": [ + { + "$ref": "#/definitions/codersdk.ParameterDestinationScheme" + } + ] + }, + "default_refresh": { + "type": "string" + }, + "default_source_scheme": { + "enum": [ + "none", + "data" + ], + "allOf": [ + { + "$ref": "#/definitions/codersdk.ParameterSourceScheme" + } + ] + }, + "default_source_value": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "job_id": { + "type": "string", + "format": "uuid" + }, + "name": { + "type": "string" + }, + "redisplay_value": { + "type": "boolean" + }, + "validation_condition": { + "type": "string" + }, + "validation_contains": { + "description": "This is a special array of items provided if the validation condition\nexplicitly states the value must be one of a set.", + "type": "array", + "items": { + "type": "string" + } + }, + "validation_error": { + "type": "string" + }, + "validation_type_system": { + "type": "string" + }, + "validation_value_type": { + "type": "string" + } + } + }, "codersdk.ParameterScope": { "type": "string", "enum": [ @@ -3313,6 +4467,83 @@ const docTemplate = `{ "$ref": "#/definitions/codersdk.TransitionStats" } }, + "codersdk.TemplateDAUsResponse": { + "type": "object", + "properties": { + "entries": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.DAUEntry" + } + } + } + }, + "codersdk.TemplateExample": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "id": { + "type": "string" + }, + "markdown": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string" + } + } + }, + "codersdk.TemplateVersion": { + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time" + }, + "created_by": { + "$ref": "#/definitions/codersdk.User" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "job": { + "$ref": "#/definitions/codersdk.ProvisionerJob" + }, + "name": { + "type": "string" + }, + "organization_id": { + "type": "string", + "format": "uuid" + }, + "readme": { + "type": "string" + }, + "template_id": { + "type": "string", + "format": "uuid" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, "codersdk.TraceConfig": { "type": "object", "properties": { @@ -3340,6 +4571,17 @@ const docTemplate = `{ } } }, + "codersdk.UpdateActiveTemplateVersion": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } + }, "codersdk.UpdateCheckResponse": { "type": "object", "properties": { @@ -3357,6 +4599,17 @@ const docTemplate = `{ } } }, + "codersdk.UpdateRoles": { + "type": "object", + "properties": { + "roles": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "codersdk.UpdateWorkspaceAutostartRequest": { "type": "object", "properties": { @@ -3400,24 +4653,29 @@ const docTemplate = `{ ], "properties": { "avatar_url": { - "type": "string" + "type": "string", + "format": "uri" }, "created_at": { - "type": "string" + "type": "string", + "format": "date-time" }, "email": { "type": "string" }, "id": { - "type": "string" + "type": "string", + "format": "uuid" }, "last_seen_at": { - "type": "string" + "type": "string", + "format": "date-time" }, "organization_ids": { "type": "array", "items": { - "type": "string" + "type": "string", + "format": "uuid" } }, "roles": { @@ -3427,7 +4685,15 @@ const docTemplate = `{ } }, "status": { - "$ref": "#/definitions/codersdk.UserStatus" + "enum": [ + "active", + "suspended" + ], + "allOf": [ + { + "$ref": "#/definitions/codersdk.UserStatus" + } + ] }, "username": { "type": "string" @@ -4002,6 +5268,81 @@ const docTemplate = `{ } } }, + "database.ParameterDestinationScheme": { + "type": "string", + "enum": [ + "none", + "environment_variable", + "provisioner_variable" + ], + "x-enum-varnames": [ + "ParameterDestinationSchemeNone", + "ParameterDestinationSchemeEnvironmentVariable", + "ParameterDestinationSchemeProvisionerVariable" + ] + }, + "database.ParameterScope": { + "type": "string", + "enum": [ + "template", + "import_job", + "workspace" + ], + "x-enum-varnames": [ + "ParameterScopeTemplate", + "ParameterScopeImportJob", + "ParameterScopeWorkspace" + ] + }, + "database.ParameterSourceScheme": { + "type": "string", + "enum": [ + "none", + "data" + ], + "x-enum-varnames": [ + "ParameterSourceSchemeNone", + "ParameterSourceSchemeData" + ] + }, + "parameter.ComputedValue": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "default_source_value": { + "type": "boolean" + }, + "destination_scheme": { + "$ref": "#/definitions/database.ParameterDestinationScheme" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "schema_id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/database.ParameterScope" + }, + "scope_id": { + "type": "string" + }, + "source_scheme": { + "$ref": "#/definitions/database.ParameterSourceScheme" + }, + "source_value": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, "tailcfg.DERPMap": { "type": "object", "properties": { diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index af5c7fdc510a3..13a0b54bc458b 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -324,8 +324,105 @@ } } }, - "/organizations/{organization-id}/templates/": { + "/organizations": { "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Organizations"], + "summary": "Create organization", + "operationId": "create-organization", + "parameters": [ + { + "description": "Create organization request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateOrganizationRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.Organization" + } + } + } + } + }, + "/organizations/{organization}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Organizations"], + "summary": "Get organization by ID", + "operationId": "get-organization-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Organization" + } + } + } + } + }, + "/organizations/{organization}/members/roles": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Members"], + "summary": "Get member roles by organization", + "operationId": "get-member-roles-by-organization", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.AssignableRoles" + } + } + } + } + } + }, + "/organizations/{organization}/members/{user}/roles": { + "put": { "security": [ { "CoderSessionToken": [] @@ -333,23 +430,30 @@ ], "consumes": ["application/json"], "produces": ["application/json"], - "tags": ["Templates"], - "summary": "Create template by organization", - "operationId": "create-template-by-organization", + "tags": ["Members"], + "summary": "Assign role to organization member", + "operationId": "assign-role-to-organization-member", "parameters": [ { - "description": "Request body", + "description": "Update roles request", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/codersdk.CreateTemplateRequest" + "$ref": "#/definitions/codersdk.UpdateRoles" } }, { "type": "string", "description": "Organization ID", - "name": "organization-id", + "name": "organization", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Username, UUID, or me", + "name": "user", "in": "path", "required": true } @@ -358,7 +462,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Template" + "$ref": "#/definitions/codersdk.OrganizationMember" } } } @@ -373,8 +477,8 @@ ], "produces": ["application/json"], "tags": ["Workspaces"], - "summary": "Create workspace by organization", - "operationId": "create-workspace-by-organization", + "summary": "Create user workspace by organization", + "operationId": "create-user-workspace-by-organization", "parameters": [ { "type": "string", @@ -386,7 +490,7 @@ }, { "type": "string", - "description": "Username", + "description": "Username, UUID, or me", "name": "user", "in": "path", "required": true @@ -417,8 +521,750 @@ { "type": "string", "format": "uuid", - "description": "Organization ID", - "name": "organization", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.Template" + } + } + } + } + }, + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Create template by organization", + "operationId": "create-template-by-organization", + "parameters": [ + { + "description": "Request body", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateTemplateRequest" + } + }, + { + "type": "string", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Template" + } + } + } + } + }, + "/organizations/{organization}/templates/examples": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Get template examples by organization", + "operationId": "get-template-examples-by-organization", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.TemplateExample" + } + } + } + } + } + }, + "/organizations/{organization}/templates/{templatename}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Get templates by organization and template name", + "operationId": "get-templates-by-organization-and-template-name", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Template name", + "name": "templatename", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Template" + } + } + } + } + }, + "/organizations/{organization}/templateversions": { + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Create template version by organization", + "operationId": "create-template-version-by-organization", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + }, + { + "description": "Create template version request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateTemplateVersionDryRunRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "/organizations/{organization}/templateversions/{templateversionname}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Get template version by organization and name", + "operationId": "get-template-version-by-organization-and-name", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Template version name", + "name": "templateversionname", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "/organizations/{organization}/templateversions/{templateversionname}/previous": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Get previous template version by organization and name", + "operationId": "get-previous-template-version-by-organization-and-name", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Organization ID", + "name": "organization", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Template version name", + "name": "templateversionname", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "/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": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Get template metadata by ID", + "operationId": "get-template-metadata-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Template" + } + } + } + }, + "delete": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Delete template by ID", + "operationId": "delete-template-by-id", + "parameters": [ + { + "type": "string", + "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" + } + } + } + } + }, + "/templates/{id}/daus": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Get template DAUs by ID", + "operationId": "get-template-daus-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.TemplateDAUsResponse" + } + } + } + } + }, + "/templates/{id}/versions": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "List template versions by template ID", + "operationId": "list-template-versions-by-template-ID", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "patch": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Update active template version by template ID", + "operationId": "update-active-template-version-by-template-ID", + "parameters": [ + { + "description": "Modified template version", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.UpdateActiveTemplateVersion" + } + }, + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Response" + } + } + } + } + }, + "/templates/{id}/versions/{templateversionname}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Get template version by template ID and name", + "operationId": "get-template-version-by-template-id-and-name", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Template version name", + "name": "templateversionname", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + } + }, + "/templateversions/{templateversion}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Get template version by ID", + "operationId": "get-template-version-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.TemplateVersion" + } + } + } + } + }, + "/templateversions/{templateversion}/cancel": { + "patch": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Cancel template version by ID", + "operationId": "cancel-template-version-by-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/codersdk.Response" + } + } + } + } + }, + "/templateversions/{templateversion}/dry-run": { + "post": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Create template version dry-run", + "operationId": "create-template-version-dry-run", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", + "in": "path", + "required": true + }, + { + "description": "Dry-run request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/codersdk.CreateTemplateVersionDryRunRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/codersdk.ProvisionerJob" + } + } + } + } + }, + "/templateversions/{templateversion}/dry-run/{jobid}": { + "get": { + "security": [ + { + "CoderSessionToken": [] + } + ], + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Templates"], + "summary": "Get template version dry-run by job ID", + "operationId": "get-template-version-dry-run-by-job-id", + "parameters": [ + { + "type": "string", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "uuid", + "description": "Job ID", + "name": "jobid", "in": "path", "required": true } @@ -427,17 +1273,14 @@ "200": { "description": "OK", "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/codersdk.Template" - } + "$ref": "#/definitions/codersdk.ProvisionerJob" } } } } }, - "/organizations/{organization}/templates/{template-name}": { - "get": { + "/templateversions/{templateversion}/dry-run/{jobid}/cancel": { + "patch": { "security": [ { "CoderSessionToken": [] @@ -445,21 +1288,14 @@ ], "produces": ["application/json"], "tags": ["Templates"], - "summary": "Get templates by organization and template name", - "operationId": "get-templates-by-organization-and-template-name", + "summary": "Cancel template version dry-run by job ID", + "operationId": "cancel-template-version-dry-run-by-job-id", "parameters": [ { "type": "string", "format": "uuid", - "description": "Organization ID", - "name": "organization", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Template name", - "name": "template-name", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true } @@ -468,13 +1304,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Template" + "$ref": "#/definitions/codersdk.Response" } } } } }, - "/parameters/{scope}/{id}": { + "/templateversions/{templateversion}/dry-run/{jobid}/logs": { "get": { "security": [ { @@ -482,25 +1318,43 @@ } ], "produces": ["application/json"], - "tags": ["Parameters"], - "summary": "Get parameters", - "operationId": "get-parameters", + "tags": ["Templates"], + "summary": "Get template version dry-run logs by job ID", + "operationId": "get-template-version-dry-run-logs-by-job-id", "parameters": [ { - "enum": ["template", "workspace", "import_job"], "type": "string", - "description": "Scope", - "name": "scope", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true }, { "type": "string", "format": "uuid", - "description": "ID", - "name": "id", + "description": "Job ID", + "name": "jobid", "in": "path", "required": true + }, + { + "type": "integer", + "description": "Before Unix timestamp", + "name": "before", + "in": "query" + }, + { + "type": "integer", + "description": "After Unix timestamp", + "name": "after", + "in": "query" + }, + { + "type": "boolean", + "description": "Follow log stream", + "name": "follow", + "in": "query" } ], "responses": { @@ -509,107 +1363,108 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/codersdk.Parameter" + "$ref": "#/definitions/codersdk.ProvisionerJobLog" } } } } - }, - "post": { + } + }, + "/templateversions/{templateversion}/dry-run/{jobid}/resources": { + "get": { "security": [ { "CoderSessionToken": [] } ], - "consumes": ["application/json"], "produces": ["application/json"], - "tags": ["Parameters"], - "summary": "Create parameter", - "operationId": "create-parameter", + "tags": ["Templates"], + "summary": "Get template version dry-run resources by job ID", + "operationId": "get-template-version-dry-run-resources-by-job-id", "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", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true }, { "type": "string", "format": "uuid", - "description": "ID", - "name": "id", + "description": "Job ID", + "name": "jobid", "in": "path", "required": true } ], "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Parameter" + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.WorkspaceResource" + } } } } } }, - "/parameters/{scope}/{id}/{name}": { - "delete": { + "/templateversions/{templateversion}/logs": { + "get": { "security": [ { "CoderSessionToken": [] } ], "produces": ["application/json"], - "tags": ["Parameters"], - "summary": "Delete parameter", - "operationId": "delete-parameter", + "tags": ["Templates"], + "summary": "Get logs by template version", + "operationId": "get-logs-by-template-version", "parameters": [ { - "enum": ["template", "workspace", "import_job"], "type": "string", - "description": "Scope", - "name": "scope", + "format": "uuid", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true }, { - "type": "string", - "format": "uuid", - "description": "ID", - "name": "id", - "in": "path", - "required": true + "type": "integer", + "description": "Before Unix timestamp", + "name": "before", + "in": "query" }, { - "type": "string", - "description": "Name", - "name": "name", - "in": "path", - "required": true + "type": "integer", + "description": "After Unix timestamp", + "name": "after", + "in": "query" + }, + { + "type": "boolean", + "description": "Follow log stream", + "name": "follow", + "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Response" + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.ProvisionerJobLog" + } } } } } }, - "/templates/{id}": { + "/templateversions/{templateversion}/parameters": { "get": { "security": [ { @@ -618,14 +1473,14 @@ ], "produces": ["application/json"], "tags": ["Templates"], - "summary": "Get template metadata by ID", - "operationId": "get-template-metadata-by-id", + "summary": "Get parameters by template version", + "operationId": "get-parameters-by-template-version", "parameters": [ { "type": "string", "format": "uuid", - "description": "Template ID", - "name": "id", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true } @@ -634,12 +1489,17 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Template" + "type": "array", + "items": { + "$ref": "#/definitions/parameter.ComputedValue" + } } } } - }, - "delete": { + } + }, + "/templateversions/{templateversion}/resources": { + "get": { "security": [ { "CoderSessionToken": [] @@ -647,14 +1507,14 @@ ], "produces": ["application/json"], "tags": ["Templates"], - "summary": "Delete template by ID", - "operationId": "delete-template-by-id", + "summary": "Get resources by template version", + "operationId": "get-resources-by-template-version", "parameters": [ { "type": "string", "format": "uuid", - "description": "Template ID", - "name": "id", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true } @@ -663,12 +1523,17 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Response" + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.WorkspaceResource" + } } } } - }, - "patch": { + } + }, + "/templateversions/{templateversion}/schema": { + "get": { "security": [ { "CoderSessionToken": [] @@ -676,14 +1541,14 @@ ], "produces": ["application/json"], "tags": ["Templates"], - "summary": "Update template metadata by ID", - "operationId": "update-template-metadata", + "summary": "Get schema by template version", + "operationId": "get-schema-by-template-version", "parameters": [ { "type": "string", "format": "uuid", - "description": "Template ID", - "name": "id", + "description": "Template version ID", + "name": "templateversion", "in": "path", "required": true } @@ -692,7 +1557,10 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/codersdk.Template" + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.ParameterSchema" + } } } } @@ -1682,6 +2550,20 @@ } } }, + "codersdk.AssignableRoles": { + "type": "object", + "properties": { + "assignable": { + "type": "boolean" + }, + "display_name": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "codersdk.AuditAction": { "type": "string", "enum": ["create", "write", "delete", "start", "stop"], @@ -1878,6 +2760,15 @@ "BuildReasonAutostop" ] }, + "codersdk.CreateOrganizationRequest": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + } + } + }, "codersdk.CreateParameterRequest": { "description": "CreateParameterRequest is a structure used to create a new parameter value for a scope.", "type": "object", @@ -1890,7 +2781,8 @@ "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" + "type": "string", + "format": "uuid" }, "destination_scheme": { "enum": ["none", "environment_variable", "provisioner_variable"], @@ -1956,6 +2848,20 @@ } } }, + "codersdk.CreateTemplateVersionDryRunRequest": { + "type": "object", + "properties": { + "parameter_values": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.CreateParameterRequest" + } + }, + "workspace_name": { + "type": "string" + } + } + }, "codersdk.CreateTestAuditLogRequest": { "type": "object", "properties": { @@ -2030,6 +2936,17 @@ } } }, + "codersdk.DAUEntry": { + "type": "object", + "properties": { + "amount": { + "type": "integer" + }, + "date": { + "type": "string" + } + } + }, "codersdk.DERP": { "type": "object", "properties": { @@ -2514,37 +3431,85 @@ "client_secret": { "$ref": "#/definitions/codersdk.DeploymentConfigField-string" }, - "enterprise_base_url": { - "$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" + }, + "username_field": { + "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + } + } + }, + "codersdk.Organization": { + "type": "object", + "required": ["created_at", "id", "name", "updated_at"], + "properties": { + "created_at": { + "type": "string", + "format": "date-time" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "name": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" } } }, - "codersdk.OIDCConfig": { + "codersdk.OrganizationMember": { "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" + "created_at": { + "type": "string", + "format": "date-time" }, - "ignore_email_verified": { - "$ref": "#/definitions/codersdk.DeploymentConfigField-bool" + "organization_id": { + "type": "string", + "format": "uuid" }, - "issuer_url": { - "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.Role" + } }, - "scopes": { - "$ref": "#/definitions/codersdk.DeploymentConfigField-array_string" + "updated_at": { + "type": "string", + "format": "date-time" }, - "username_field": { - "$ref": "#/definitions/codersdk.DeploymentConfigField-string" + "user_id": { + "type": "string", + "format": "uuid" } } }, @@ -2606,6 +3571,79 @@ "ParameterDestinationSchemeProvisionerVariable" ] }, + "codersdk.ParameterSchema": { + "type": "object", + "properties": { + "allow_override_destination": { + "type": "boolean" + }, + "allow_override_source": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "default_destination_scheme": { + "enum": ["none", "environment_variable", "provisioner_variable"], + "allOf": [ + { + "$ref": "#/definitions/codersdk.ParameterDestinationScheme" + } + ] + }, + "default_refresh": { + "type": "string" + }, + "default_source_scheme": { + "enum": ["none", "data"], + "allOf": [ + { + "$ref": "#/definitions/codersdk.ParameterSourceScheme" + } + ] + }, + "default_source_value": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "job_id": { + "type": "string", + "format": "uuid" + }, + "name": { + "type": "string" + }, + "redisplay_value": { + "type": "boolean" + }, + "validation_condition": { + "type": "string" + }, + "validation_contains": { + "description": "This is a special array of items provided if the validation condition\nexplicitly states the value must be one of a set.", + "type": "array", + "items": { + "type": "string" + } + }, + "validation_error": { + "type": "string" + }, + "validation_type_system": { + "type": "string" + }, + "validation_value_type": { + "type": "string" + } + } + }, "codersdk.ParameterScope": { "type": "string", "enum": ["template", "workspace", "import_job"], @@ -2990,6 +4028,83 @@ "$ref": "#/definitions/codersdk.TransitionStats" } }, + "codersdk.TemplateDAUsResponse": { + "type": "object", + "properties": { + "entries": { + "type": "array", + "items": { + "$ref": "#/definitions/codersdk.DAUEntry" + } + } + } + }, + "codersdk.TemplateExample": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "id": { + "type": "string" + }, + "markdown": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string" + } + } + }, + "codersdk.TemplateVersion": { + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time" + }, + "created_by": { + "$ref": "#/definitions/codersdk.User" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "job": { + "$ref": "#/definitions/codersdk.ProvisionerJob" + }, + "name": { + "type": "string" + }, + "organization_id": { + "type": "string", + "format": "uuid" + }, + "readme": { + "type": "string" + }, + "template_id": { + "type": "string", + "format": "uuid" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, "codersdk.TraceConfig": { "type": "object", "properties": { @@ -3017,6 +4132,15 @@ } } }, + "codersdk.UpdateActiveTemplateVersion": { + "type": "object", + "required": ["id"], + "properties": { + "id": { + "type": "string" + } + } + }, "codersdk.UpdateCheckResponse": { "type": "object", "properties": { @@ -3034,6 +4158,17 @@ } } }, + "codersdk.UpdateRoles": { + "type": "object", + "properties": { + "roles": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "codersdk.UpdateWorkspaceAutostartRequest": { "type": "object", "properties": { @@ -3072,24 +4207,29 @@ "required": ["created_at", "email", "id", "username"], "properties": { "avatar_url": { - "type": "string" + "type": "string", + "format": "uri" }, "created_at": { - "type": "string" + "type": "string", + "format": "date-time" }, "email": { "type": "string" }, "id": { - "type": "string" + "type": "string", + "format": "uuid" }, "last_seen_at": { - "type": "string" + "type": "string", + "format": "date-time" }, "organization_ids": { "type": "array", "items": { - "type": "string" + "type": "string", + "format": "uuid" } }, "roles": { @@ -3099,7 +4239,12 @@ } }, "status": { - "$ref": "#/definitions/codersdk.UserStatus" + "enum": ["active", "suspended"], + "allOf": [ + { + "$ref": "#/definitions/codersdk.UserStatus" + } + ] }, "username": { "type": "string" @@ -3626,6 +4771,70 @@ } } }, + "database.ParameterDestinationScheme": { + "type": "string", + "enum": ["none", "environment_variable", "provisioner_variable"], + "x-enum-varnames": [ + "ParameterDestinationSchemeNone", + "ParameterDestinationSchemeEnvironmentVariable", + "ParameterDestinationSchemeProvisionerVariable" + ] + }, + "database.ParameterScope": { + "type": "string", + "enum": ["template", "import_job", "workspace"], + "x-enum-varnames": [ + "ParameterScopeTemplate", + "ParameterScopeImportJob", + "ParameterScopeWorkspace" + ] + }, + "database.ParameterSourceScheme": { + "type": "string", + "enum": ["none", "data"], + "x-enum-varnames": [ + "ParameterSourceSchemeNone", + "ParameterSourceSchemeData" + ] + }, + "parameter.ComputedValue": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "default_source_value": { + "type": "boolean" + }, + "destination_scheme": { + "$ref": "#/definitions/database.ParameterDestinationScheme" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "schema_id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/database.ParameterScope" + }, + "scope_id": { + "type": "string" + }, + "source_scheme": { + "$ref": "#/definitions/database.ParameterSourceScheme" + }, + "source_value": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, "tailcfg.DERPMap": { "type": "object", "properties": { diff --git a/coderd/coderd.go b/coderd/coderd.go index 552ed14f0e8cd..eb03a71cddefd 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -420,7 +420,6 @@ func New(options *Options) *API { apiKeyMiddleware, httpmw.ExtractTemplateVersionParam(options.Database), ) - r.Get("/", api.templateVersion) r.Patch("/cancel", api.patchCancelTemplateVersion) r.Get("/schema", api.templateVersionSchema) diff --git a/coderd/members.go b/coderd/members.go index 2ae7fa9de6469..9141cadb6a0b3 100644 --- a/coderd/members.go +++ b/coderd/members.go @@ -16,6 +16,17 @@ import ( "github.com/coder/coder/codersdk" ) +// @Summary Assign role to organization member +// @ID assign-role-to-organization-member +// @Security CoderSessionToken +// @Accept json +// @Produce json +// @Tags Members +// @Param request body codersdk.UpdateRoles true "Update roles request" +// @Param organization path string true "Organization ID" +// @Param user path string true "Username, UUID, or me" +// @Success 200 {object} codersdk.OrganizationMember +// @Router /organizations/{organization}/members/{user}/roles [put] func (api *API) putMemberRoles(rw http.ResponseWriter, r *http.Request) { var ( ctx = r.Context() diff --git a/coderd/organizations.go b/coderd/organizations.go index 27da001482f2d..84bf1197348dd 100644 --- a/coderd/organizations.go +++ b/coderd/organizations.go @@ -16,6 +16,14 @@ import ( "github.com/coder/coder/codersdk" ) +// @Summary Get organization by ID +// @ID get-organization-by-id +// @Security CoderSessionToken +// @Produce json +// @Tags Organizations +// @Param organization path string true "Organization ID" format(uuid) +// @Success 200 {object} codersdk.Organization +// @Router /organizations/{organization} [get] func (api *API) organization(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() organization := httpmw.OrganizationParam(r) @@ -29,6 +37,14 @@ func (api *API) organization(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, convertOrganization(organization)) } +// @Summary Create organization +// @ID create-organization +// @Security CoderSessionToken +// @Produce json +// @Tags Organizations +// @Param request body codersdk.CreateOrganizationRequest true "Create organization request" +// @Success 201 {object} codersdk.Organization +// @Router /organizations [post] func (api *API) postOrganizations(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() apiKey := httpmw.APIKey(r) diff --git a/coderd/roles.go b/coderd/roles.go index 4e5ae05d99470..9eb1518d9ec6e 100644 --- a/coderd/roles.go +++ b/coderd/roles.go @@ -23,6 +23,15 @@ func (api *API) assignableSiteRoles(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, assignableRoles(actorRoles.Roles, roles)) } +// @Summary Get member roles by organization +// @ID get-member-roles-by-organization +// @Security CoderSessionToken +// @Produce json +// @Tags Members +// @Param organization path string true "Organization ID" format(uuid) +// @Success 200 {array} codersdk.AssignableRoles +// @Router /organizations/{organization}/members/roles [get] +// // assignableSiteRoles returns all site wide roles that can be assigned. func (api *API) assignableOrgRoles(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() diff --git a/coderd/templates.go b/coderd/templates.go index 9b089b007552b..c15a278810dfd 100644 --- a/coderd/templates.go +++ b/coderd/templates.go @@ -138,9 +138,9 @@ func (api *API) deleteTemplate(rw http.ResponseWriter, r *http.Request) { // @Produce json // @Tags Templates // @Param request body codersdk.CreateTemplateRequest true "Request body" -// @Param organization-id path string true "Organization ID" +// @Param organization path string true "Organization ID" // @Success 200 {object} codersdk.Template -// @Router /organizations/{organization-id}/templates/ [post] +// @Router /organizations/{organization}/templates [post] // Returns a single template. // Create a new template in an organization. func (api *API) postTemplateByOrganization(rw http.ResponseWriter, r *http.Request) { @@ -336,7 +336,7 @@ func (api *API) postTemplateByOrganization(rw http.ResponseWriter, r *http.Reque // @Produce json // @Tags Templates // @Param organization path string true "Organization ID" format(uuid) -// @Success 200 {object} []codersdk.Template +// @Success 200 {array} codersdk.Template // @Router /organizations/{organization}/templates [get] func (api *API) templatesByOrganization(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -402,9 +402,9 @@ func (api *API) templatesByOrganization(rw http.ResponseWriter, r *http.Request) // @Produce json // @Tags Templates // @Param organization path string true "Organization ID" format(uuid) -// @Param template-name path string true "Template name" +// @Param templatename path string true "Template name" // @Success 200 {object} codersdk.Template -// @Router /organizations/{organization}/templates/{template-name} [get] +// @Router /organizations/{organization}/templates/{templatename} [get] func (api *API) templateByOrganizationAndName(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() organization := httpmw.OrganizationParam(r) @@ -588,6 +588,14 @@ func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, api.convertTemplate(updated, count, createdByNameMap[updated.ID.String()])) } +// @Summary Get template DAUs by ID +// @ID get-template-daus-by-id +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param id path string true "Template ID" format(uuid) +// @Success 200 {object} codersdk.TemplateDAUsResponse +// @Router /templates/{id}/daus [get] func (api *API) templateDAUs(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() template := httpmw.TemplateParam(r) @@ -606,6 +614,14 @@ func (api *API) templateDAUs(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, resp) } +// @Summary Get template examples by organization +// @ID get-template-examples-by-organization +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param organization path string true "Organization ID" format(uuid) +// @Success 200 {array} codersdk.TemplateExample +// @Router /organizations/{organization}/templates/examples [get] func (api *API) templateExamples(rw http.ResponseWriter, r *http.Request) { var ( ctx = r.Context() diff --git a/coderd/templateversions.go b/coderd/templateversions.go index 070500a26d8c9..46c0973cbb47a 100644 --- a/coderd/templateversions.go +++ b/coderd/templateversions.go @@ -28,6 +28,14 @@ import ( "github.com/coder/coder/examples" ) +// @Summary Get template version by ID +// @ID get-template-version-by-id +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Success 200 {object} codersdk.TemplateVersion +// @Router /templateversions/{templateversion} [get] func (api *API) templateVersion(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() var ( @@ -61,6 +69,14 @@ func (api *API) templateVersion(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, convertTemplateVersion(templateVersion, convertProvisionerJob(job), user)) } +// @Summary Cancel template version by ID +// @ID cancel-template-version-by-id +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Success 200 {object} codersdk.Response +// @Router /templateversions/{templateversion}/cancel [patch] func (api *API) patchCancelTemplateVersion(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() var ( @@ -116,6 +132,14 @@ func (api *API) patchCancelTemplateVersion(rw http.ResponseWriter, r *http.Reque }) } +// @Summary Get schema by template version +// @ID get-schema-by-template-version +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Success 200 {array} codersdk.ParameterSchema +// @Router /templateversions/{templateversion}/schema [get] func (api *API) templateVersionSchema(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() var ( @@ -168,6 +192,14 @@ func (api *API) templateVersionSchema(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, apiSchemas) } +// @Summary Get parameters by template version +// @ID get-parameters-by-template-version +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Success 200 {array} parameter.ComputedValue +// @Router /templateversions/{templateversion}/parameters [get] func (api *API) templateVersionParameters(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() var ( @@ -213,6 +245,16 @@ func (api *API) templateVersionParameters(rw http.ResponseWriter, r *http.Reques httpapi.Write(ctx, rw, http.StatusOK, values) } +// @Summary Create template version dry-run +// @ID create-template-version-dry-run +// @Security CoderSessionToken +// @Accept json +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Param request body codersdk.CreateTemplateVersionDryRunRequest true "Dry-run request" +// @Success 201 {object} codersdk.ProvisionerJob +// @Router /templateversions/{templateversion}/dry-run [post] func (api *API) postTemplateVersionDryRun(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() var ( @@ -308,6 +350,16 @@ func (api *API) postTemplateVersionDryRun(rw http.ResponseWriter, r *http.Reques httpapi.Write(ctx, rw, http.StatusCreated, convertProvisionerJob(provisionerJob)) } +// @Summary Get template version dry-run by job ID +// @ID get-template-version-dry-run-by-job-id +// @Security CoderSessionToken +// @Accept json +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Param jobid path string true "Job ID" format(uuid) +// @Success 200 {object} codersdk.ProvisionerJob +// @Router /templateversions/{templateversion}/dry-run/{jobid} [get] func (api *API) templateVersionDryRun(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() job, ok := api.fetchTemplateVersionDryRunJob(rw, r) @@ -318,6 +370,15 @@ func (api *API) templateVersionDryRun(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, convertProvisionerJob(job)) } +// @Summary Get template version dry-run resources by job ID +// @ID get-template-version-dry-run-resources-by-job-id +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Param jobid path string true "Job ID" format(uuid) +// @Success 200 {array} codersdk.WorkspaceResource +// @Router /templateversions/{templateversion}/dry-run/{jobid}/resources [get] func (api *API) templateVersionDryRunResources(rw http.ResponseWriter, r *http.Request) { job, ok := api.fetchTemplateVersionDryRunJob(rw, r) if !ok { @@ -327,6 +388,18 @@ func (api *API) templateVersionDryRunResources(rw http.ResponseWriter, r *http.R api.provisionerJobResources(rw, r, job) } +// @Summary Get template version dry-run logs by job ID +// @ID get-template-version-dry-run-logs-by-job-id +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Param jobid path string true "Job ID" format(uuid) +// @Param before query int false "Before Unix timestamp" +// @Param after query int false "After Unix timestamp" +// @Param follow query bool false "Follow log stream" +// @Success 200 {array} codersdk.ProvisionerJobLog +// @Router /templateversions/{templateversion}/dry-run/{jobid}/logs [get] func (api *API) templateVersionDryRunLogs(rw http.ResponseWriter, r *http.Request) { job, ok := api.fetchTemplateVersionDryRunJob(rw, r) if !ok { @@ -336,6 +409,14 @@ func (api *API) templateVersionDryRunLogs(rw http.ResponseWriter, r *http.Reques api.provisionerJobLogs(rw, r, job) } +// @Summary Cancel template version dry-run by job ID +// @ID cancel-template-version-dry-run-by-job-id +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Success 200 {object} codersdk.Response +// @Router /templateversions/{templateversion}/dry-run/{jobid}/cancel [patch] func (api *API) patchTemplateVersionDryRunCancel(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() templateVersion := httpmw.TemplateVersionParam(r) @@ -454,6 +535,14 @@ func (api *API) fetchTemplateVersionDryRunJob(rw http.ResponseWriter, r *http.Re return job, true } +// @Summary List template versions by template ID +// @ID list-template-versions-by-template-ID +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param id path string true "Template ID" format(uuid) +// @Success 200 {array} codersdk.TemplateVersion +// @Router /templates/{id}/versions [get] func (api *API) templateVersionsByTemplate(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() template := httpmw.TemplateParam(r) @@ -551,6 +640,15 @@ func (api *API) templateVersionsByTemplate(rw http.ResponseWriter, r *http.Reque httpapi.Write(ctx, rw, http.StatusOK, apiVersions) } +// @Summary Get template version by template ID and name +// @ID get-template-version-by-template-id-and-name +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param id path string true "Template ID" format(uuid) +// @Param templateversionname path string true "Template version name" +// @Success 200 {array} codersdk.TemplateVersion +// @Router /templates/{id}/versions/{templateversionname} [get] func (api *API) templateVersionByName(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() template := httpmw.TemplateParam(r) @@ -601,6 +699,15 @@ func (api *API) templateVersionByName(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, convertTemplateVersion(templateVersion, convertProvisionerJob(job), user)) } +// @Summary Get template version by organization and name +// @ID get-template-version-by-organization-and-name +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param organization path string true "Organization ID" format(uuid) +// @Param templateversionname path string true "Template version name" +// @Success 200 {object} codersdk.TemplateVersion +// @Router /organizations/{organization}/templateversions/{templateversionname} [get] func (api *API) templateVersionByOrganizationAndName(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() organization := httpmw.OrganizationParam(r) @@ -643,6 +750,15 @@ func (api *API) templateVersionByOrganizationAndName(rw http.ResponseWriter, r * httpapi.Write(ctx, rw, http.StatusOK, convertTemplateVersion(templateVersion, convertProvisionerJob(job), user)) } +// @Summary Get previous template version by organization and name +// @ID get-previous-template-version-by-organization-and-name +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param organization path string true "Organization ID" format(uuid) +// @Param templateversionname path string true "Template version name" +// @Success 200 {object} codersdk.TemplateVersion +// @Router /organizations/{organization}/templateversions/{templateversionname}/previous [get] func (api *API) previousTemplateVersionByOrganizationAndName(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() organization := httpmw.OrganizationParam(r) @@ -708,6 +824,16 @@ func (api *API) previousTemplateVersionByOrganizationAndName(rw http.ResponseWri httpapi.Write(ctx, rw, http.StatusOK, convertTemplateVersion(previousTemplateVersion, convertProvisionerJob(job), user)) } +// @Summary Update active template version by template ID +// @ID update-active-template-version-by-template-ID +// @Security CoderSessionToken +// @Accept json +// @Produce json +// @Tags Templates +// @Param request body codersdk.UpdateActiveTemplateVersion true "Modified template version" +// @Param id path string true "Template ID" format(uuid) +// @Success 200 {object} codersdk.Response +// @Router /templates/{id}/versions [patch] func (api *API) patchActiveTemplateVersion(rw http.ResponseWriter, r *http.Request) { var ( ctx = r.Context() @@ -782,7 +908,18 @@ func (api *API) patchActiveTemplateVersion(rw http.ResponseWriter, r *http.Reque }) } -// Creates a new version of a template. An import job is queued to parse the storage method provided. +// @Summary Create template version by organization +// @ID create-template-version-by-organization +// @Security CoderSessionToken +// @Accept json +// @Produce json +// @Tags Templates +// @Param organization path string true "Organization ID" format(uuid) +// @Param request body codersdk.CreateTemplateVersionDryRunRequest true "Create template version request" +// @Success 201 {object} codersdk.TemplateVersion +// @Router /organizations/{organization}/templateversions [post] +// +// postTemplateVersionsByOrganization creates a new version of a template. An import job is queued to parse the storage method provided. func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *http.Request) { var ( ctx = r.Context() @@ -1067,6 +1204,15 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht httpapi.Write(ctx, rw, http.StatusCreated, convertTemplateVersion(templateVersion, convertProvisionerJob(provisionerJob), user)) } +// @Summary Get resources by template version +// @ID get-resources-by-template-version +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Success 200 {array} codersdk.WorkspaceResource +// @Router /templateversions/{templateversion}/resources [get] +// // templateVersionResources returns the workspace agent resources associated // with a template version. A template can specify more than one resource to be // provisioned, each resource can have an agent that dials back to coderd. The @@ -1095,6 +1241,18 @@ func (api *API) templateVersionResources(rw http.ResponseWriter, r *http.Request api.provisionerJobResources(rw, r, job) } +// @Summary Get logs by template version +// @ID get-logs-by-template-version +// @Security CoderSessionToken +// @Produce json +// @Tags Templates +// @Param templateversion path string true "Template version ID" format(uuid) +// @Param before query int false "Before Unix timestamp" +// @Param after query int false "After Unix timestamp" +// @Param follow query bool false "Follow log stream" +// @Success 200 {array} codersdk.ProvisionerJobLog +// @Router /templateversions/{templateversion}/logs [get] +// // templateVersionLogs returns the logs returned by the provisioner for the given // template version. These logs are only associated with the template version, // and not any build logs for a workspace. diff --git a/coderd/workspaces.go b/coderd/workspaces.go index 23e605b298de1..6edd0d13c629b 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -266,15 +266,16 @@ func (api *API) workspaceByOwnerAndName(rw http.ResponseWriter, r *http.Request) )) } -// @Summary Create workspace by organization -// @ID create-workspace-by-organization +// @Summary Create user workspace by organization +// @ID create-user-workspace-by-organization // @Security CoderSessionToken // @Produce json // @Tags Workspaces // @Param organization path string true "Organization ID" format(uuid) -// @Param user path string true "Username" +// @Param user path string true "Username, UUID, or me" // @Success 200 {object} codersdk.Workspace // @Router /organizations/{organization}/members/{user}/workspaces [post] +// // Create a new workspace for the currently authenticated user. func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Request) { var ( diff --git a/codersdk/organizationmember.go b/codersdk/organizationmember.go index e35280ffa7e75..4ec90fb29cbde 100644 --- a/codersdk/organizationmember.go +++ b/codersdk/organizationmember.go @@ -7,9 +7,9 @@ import ( ) type OrganizationMember struct { - UserID uuid.UUID `db:"user_id" json:"user_id"` - OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` - CreatedAt time.Time `db:"created_at" json:"created_at"` - UpdatedAt time.Time `db:"updated_at" json:"updated_at"` + UserID uuid.UUID `db:"user_id" json:"user_id" format:"uuid"` + OrganizationID uuid.UUID `db:"organization_id" json:"organization_id" format:"uuid"` + CreatedAt time.Time `db:"created_at" json:"created_at" format:"date-time"` + UpdatedAt time.Time `db:"updated_at" json:"updated_at" format:"date-time"` Roles []Role `db:"roles" json:"roles"` } diff --git a/codersdk/organizations.go b/codersdk/organizations.go index 2c15e78db1c69..39b50da013ec5 100644 --- a/codersdk/organizations.go +++ b/codersdk/organizations.go @@ -26,10 +26,10 @@ const ( // Organization is the JSON representation of a Coder organization. type Organization struct { - ID uuid.UUID `json:"id" validate:"required"` + ID uuid.UUID `json:"id" validate:"required" format:"uuid"` Name string `json:"name" validate:"required"` - CreatedAt time.Time `json:"created_at" validate:"required"` - UpdatedAt time.Time `json:"updated_at" validate:"required"` + CreatedAt time.Time `json:"created_at" validate:"required" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" validate:"required" format:"date-time"` } // CreateTemplateVersionRequest enables callers to create a new Template Version. diff --git a/codersdk/parameters.go b/codersdk/parameters.go index f17635540d43c..23b4408c2e9bf 100644 --- a/codersdk/parameters.go +++ b/codersdk/parameters.go @@ -94,7 +94,7 @@ type CreateParameterRequest struct { // succeed. // No other fields are required if using this, as all fields will be copied // from the other parameter. - CloneID uuid.UUID `json:"copy_from_parameter,omitempty" validate:""` + CloneID uuid.UUID `json:"copy_from_parameter,omitempty" validate:"" format:"uuid"` Name string `json:"name" validate:"required"` SourceValue string `json:"source_value" validate:"required"` diff --git a/codersdk/templates.go b/codersdk/templates.go index 7dc5e18252021..a2a232a48e50d 100644 --- a/codersdk/templates.go +++ b/codersdk/templates.go @@ -214,6 +214,7 @@ type DAUEntry struct { Amount int `json:"amount"` } +// TemplateDAUsResponse contains statistics of daily active users of the template. type TemplateDAUsResponse struct { Entries []DAUEntry `json:"entries"` } diff --git a/codersdk/templateversions.go b/codersdk/templateversions.go index b9ea141f50654..1be7881ba5ae2 100644 --- a/codersdk/templateversions.go +++ b/codersdk/templateversions.go @@ -13,11 +13,11 @@ import ( // TemplateVersion represents a single version of a template. type TemplateVersion struct { - ID uuid.UUID `json:"id"` - TemplateID *uuid.UUID `json:"template_id,omitempty"` - OrganizationID uuid.UUID `json:"organization_id,omitempty"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at"` + ID uuid.UUID `json:"id" format:"uuid"` + TemplateID *uuid.UUID `json:"template_id,omitempty" format:"uuid"` + OrganizationID uuid.UUID `json:"organization_id,omitempty" format:"uuid"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` Name string `json:"name"` Job ProvisionerJob `json:"job"` Readme string `json:"readme"` diff --git a/codersdk/users.go b/codersdk/users.go index 6561c506fee0b..4b1f24afac933 100644 --- a/codersdk/users.go +++ b/codersdk/users.go @@ -35,16 +35,16 @@ type UsersRequest struct { // User represents a user in Coder. type User struct { - ID uuid.UUID `json:"id" validate:"required" table:"id"` + ID uuid.UUID `json:"id" validate:"required" table:"id" format:"uuid"` Username string `json:"username" validate:"required" table:"username"` Email string `json:"email" validate:"required" table:"email"` - CreatedAt time.Time `json:"created_at" validate:"required" table:"created at"` - LastSeenAt time.Time `json:"last_seen_at"` + CreatedAt time.Time `json:"created_at" validate:"required" table:"created at" format:"date-time"` + LastSeenAt time.Time `json:"last_seen_at" format:"date-time"` - Status UserStatus `json:"status" table:"status"` - OrganizationIDs []uuid.UUID `json:"organization_ids"` + Status UserStatus `json:"status" table:"status" enums:"active,suspended"` + OrganizationIDs []uuid.UUID `json:"organization_ids" format:"uuid"` Roles []Role `json:"roles"` - AvatarURL string `json:"avatar_url"` + AvatarURL string `json:"avatar_url" format:"uri"` } type GetUsersResponse struct { @@ -61,15 +61,15 @@ type CreateFirstUserRequest struct { // CreateFirstUserResponse contains IDs for newly created user info. type CreateFirstUserResponse struct { - UserID uuid.UUID `json:"user_id"` - OrganizationID uuid.UUID `json:"organization_id"` + UserID uuid.UUID `json:"user_id" format:"uuid"` + OrganizationID uuid.UUID `json:"organization_id" format:"uuid"` } type CreateUserRequest struct { Email string `json:"email" validate:"required,email"` Username string `json:"username" validate:"required,username"` Password string `json:"password" validate:"required"` - OrganizationID uuid.UUID `json:"organization_id" validate:"required"` + OrganizationID uuid.UUID `json:"organization_id" validate:"required" format:"uuid"` } type UpdateUserProfileRequest struct { diff --git a/docs/api/audit.md b/docs/api/audit.md index fa5a3796c7a3e..7fc76e15e0a0e 100644 --- a/docs/api/audit.md +++ b/docs/api/audit.md @@ -60,12 +60,12 @@ curl -X GET http://coder-server:8080/api/v2/audit?q=string \ "status_code": 0, "time": "string", "user": { - "avatar_url": "string", - "created_at": "string", + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", "email": "string", - "id": "string", - "last_seen_at": "string", - "organization_ids": ["string"], + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], "roles": [ { "display_name": "string", diff --git a/docs/api/builds.md b/docs/api/builds.md index d55f1659de325..a2828d0642ffa 100644 --- a/docs/api/builds.md +++ b/docs/api/builds.md @@ -891,7 +891,7 @@ curl -X POST http://coder-server:8080/api/v2/workspaces/{id}/builds \ "orphan": true, "parameter_values": [ { - "copy_from_parameter": "string", + "copy_from_parameter": "000e07d6-021d-446c-be14-48a9c20bca0b", "destination_scheme": "none", "name": "string", "source_scheme": "none", diff --git a/docs/api/members.md b/docs/api/members.md new file mode 100644 index 0000000000000..389c6dcdba0e9 --- /dev/null +++ b/docs/api/members.md @@ -0,0 +1,112 @@ +# Members + +> This page is incomplete, stay tuned. + +## Get member roles by organization + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/members/roles \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /organizations/{organization}/members/roles` + +### Parameters + +| Name | In | Type | Required | Description | +| -------------- | ---- | ------------ | -------- | --------------- | +| `organization` | path | string(uuid) | true | Organization ID | + +### Example responses + +> 200 Response + +```json +[ + { + "assignable": true, + "display_name": "string", + "name": "string" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ----------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.AssignableRoles](schemas.md#codersdkassignableroles) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| ---------------- | ------- | -------- | ------------ | ----------- | +| `[array item]` | array | false | | | +| `» assignable` | boolean | false | | | +| `» display_name` | string | false | | | +| `» name` | string | false | | | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Assign role to organization member + +### Code samples + +```shell +# Example request using curl +curl -X PUT http://coder-server:8080/api/v2/organizations/{organization}/members/{user}/roles \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`PUT /organizations/{organization}/members/{user}/roles` + +> Body parameter + +```json +{ + "roles": ["string"] +} +``` + +### Parameters + +| Name | In | Type | Required | Description | +| -------------- | ---- | ------------------------------------------------------ | -------- | --------------------- | +| `organization` | path | string | true | Organization ID | +| `user` | path | string | true | Username, UUID, or me | +| `body` | body | [codersdk.UpdateRoles](schemas.md#codersdkupdateroles) | true | Update roles request | + +### Example responses + +> 200 Response + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "updated_at": "2019-08-24T14:15:22Z", + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5" +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | -------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.OrganizationMember](schemas.md#codersdkorganizationmember) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). diff --git a/docs/api/organizations.md b/docs/api/organizations.md new file mode 100644 index 0000000000000..18d4d70192efa --- /dev/null +++ b/docs/api/organizations.md @@ -0,0 +1,92 @@ +# Organizations + +> This page is incomplete, stay tuned. + +## Create organization + +### Code samples + +```shell +# Example request using curl +curl -X POST http://coder-server:8080/api/v2/organizations \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`POST /organizations` + +> Body parameter + +```json +{ + "name": "string" +} +``` + +### Parameters + +| Name | In | Type | Required | Description | +| ------ | ---- | ---------------------------------------------------------------------------------- | -------- | --------------------------- | +| `body` | body | [codersdk.CreateOrganizationRequest](schemas.md#codersdkcreateorganizationrequest) | true | Create organization request | + +### Example responses + +> 201 Response + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "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.Organization](schemas.md#codersdkorganization) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get organization by ID + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/organizations/{organization} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /organizations/{organization}` + +### Parameters + +| Name | In | Type | Required | Description | +| -------------- | ---- | ------------ | -------- | --------------- | +| `organization` | path | string(uuid) | true | Organization ID | + +### Example responses + +> 200 Response + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "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 | [codersdk.Organization](schemas.md#codersdkorganization) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). diff --git a/docs/api/parameters.md b/docs/api/parameters.md index 051eb02c1cca9..8fc57730e8910 100644 --- a/docs/api/parameters.md +++ b/docs/api/parameters.md @@ -104,7 +104,7 @@ curl -X POST http://coder-server:8080/api/v2/parameters/{scope}/{id} \ ```json { - "copy_from_parameter": "string", + "copy_from_parameter": "000e07d6-021d-446c-be14-48a9c20bca0b", "destination_scheme": "none", "name": "string", "source_scheme": "none", diff --git a/docs/api/schemas.md b/docs/api/schemas.md index 07a5c9ee3af20..ae540089802fa 100644 --- a/docs/api/schemas.md +++ b/docs/api/schemas.md @@ -90,6 +90,24 @@ | ----------------- | ------- | -------- | ------------ | ------------------------------------------------------------------------------ | | `report_interval` | integer | false | | Report interval is the duration after which the agent should send stats again. | +## codersdk.AssignableRoles + +```json +{ + "assignable": true, + "display_name": "string", + "name": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------------- | ------- | -------- | ------------ | ----------- | +| `assignable` | boolean | false | | | +| `display_name` | string | false | | | +| `name` | string | false | | | + ## codersdk.AuditAction ```json @@ -181,12 +199,12 @@ "status_code": 0, "time": "string", "user": { - "avatar_url": "string", - "created_at": "string", + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", "email": "string", - "id": "string", - "last_seen_at": "string", - "organization_ids": ["string"], + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], "roles": [ { "display_name": "string", @@ -257,12 +275,12 @@ "status_code": 0, "time": "string", "user": { - "avatar_url": "string", - "created_at": "string", + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", "email": "string", - "id": "string", - "last_seen_at": "string", - "organization_ids": ["string"], + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], "roles": [ { "display_name": "string", @@ -437,11 +455,25 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in | `autostart` | | `autostop` | +## codersdk.CreateOrganizationRequest + +```json +{ + "name": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------ | ------ | -------- | ------------ | ----------- | +| `name` | string | true | | | + ## codersdk.CreateParameterRequest ```json { - "copy_from_parameter": "string", + "copy_from_parameter": "000e07d6-021d-446c-be14-48a9c20bca0b", "destination_scheme": "none", "name": "string", "source_scheme": "none", @@ -483,7 +515,7 @@ CreateParameterRequest is a structure used to create a new parameter value for a "name": "string", "parameter_values": [ { - "copy_from_parameter": "string", + "copy_from_parameter": "000e07d6-021d-446c-be14-48a9c20bca0b", "destination_scheme": "none", "name": "string", "source_scheme": "none", @@ -508,6 +540,30 @@ CreateParameterRequest is a structure used to create a new parameter value for a | `template_version_id` | string | true | | Template version ID is an in-progress or completed job to use as an initial version of the template. | | This is required on creation to enable a user-flow of validating a template works. There is no reason the data-model cannot support empty templates, but it doesn't make sense for users. | +## codersdk.CreateTemplateVersionDryRunRequest + +```json +{ + "parameter_values": [ + { + "copy_from_parameter": "000e07d6-021d-446c-be14-48a9c20bca0b", + "destination_scheme": "none", + "name": "string", + "source_scheme": "none", + "source_value": "string" + } + ], + "workspace_name": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------------ | --------------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------- | +| `parameter_values` | array of [codersdk.CreateParameterRequest](#codersdkcreateparameterrequest) | false | | Parameter values is a structure used to create a new parameter value for a scope.] | +| `workspace_name` | string | false | | | + ## codersdk.CreateTestAuditLogRequest ```json @@ -555,7 +611,7 @@ CreateParameterRequest is a structure used to create a new parameter value for a "orphan": true, "parameter_values": [ { - "copy_from_parameter": "string", + "copy_from_parameter": "000e07d6-021d-446c-be14-48a9c20bca0b", "destination_scheme": "none", "name": "string", "source_scheme": "none", @@ -588,6 +644,22 @@ CreateParameterRequest is a structure used to create a new parameter value for a | `transition` | `stop` | | `transition` | `delete` | +## codersdk.DAUEntry + +```json +{ + "amount": 0, + "date": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| -------- | ------- | -------- | ------------ | ----------- | +| `amount` | integer | false | | | +| `date` | string | false | | | + ## codersdk.DERP ```json @@ -2328,6 +2400,53 @@ CreateParameterRequest is a structure used to create a new parameter value for a | `scopes` | [codersdk.DeploymentConfigField-array_string](#codersdkdeploymentconfigfield-array_string) | false | | | | `username_field` | [codersdk.DeploymentConfigField-string](#codersdkdeploymentconfigfield-string) | false | | | +## codersdk.Organization + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "name": "string", + "updated_at": "2019-08-24T14:15:22Z" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------ | ------ | -------- | ------------ | ----------- | +| `created_at` | string | true | | | +| `id` | string | true | | | +| `name` | string | true | | | +| `updated_at` | string | true | | | + +## codersdk.OrganizationMember + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "updated_at": "2019-08-24T14:15:22Z", + "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------------- | --------------------------------------- | -------- | ------------ | ----------- | +| `created_at` | string | false | | | +| `organization_id` | string | false | | | +| `roles` | array of [codersdk.Role](#codersdkrole) | false | | | +| `updated_at` | string | false | | | +| `user_id` | string | false | | | + ## codersdk.Parameter ```json @@ -2387,6 +2506,62 @@ Parameter represents a set value for the scope. | `environment_variable` | | `provisioner_variable` | +## codersdk.ParameterSchema + +```json +{ + "allow_override_destination": true, + "allow_override_source": true, + "created_at": "2019-08-24T14:15:22Z", + "default_destination_scheme": "none", + "default_refresh": "string", + "default_source_scheme": "none", + "default_source_value": "string", + "description": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", + "name": "string", + "redisplay_value": true, + "validation_condition": "string", + "validation_contains": ["string"], + "validation_error": "string", + "validation_type_system": "string", + "validation_value_type": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ---------------------------- | -------------------------------------------------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------- | +| `allow_override_destination` | boolean | false | | | +| `allow_override_source` | boolean | false | | | +| `created_at` | string | false | | | +| `default_destination_scheme` | [codersdk.ParameterDestinationScheme](#codersdkparameterdestinationscheme) | false | | | +| `default_refresh` | string | false | | | +| `default_source_scheme` | [codersdk.ParameterSourceScheme](#codersdkparametersourcescheme) | false | | | +| `default_source_value` | string | false | | | +| `description` | string | false | | | +| `id` | string | false | | | +| `job_id` | string | false | | | +| `name` | string | false | | | +| `redisplay_value` | boolean | false | | | +| `validation_condition` | string | false | | | +| `validation_contains` | array of string | false | | This is a special array of items provided if the validation condition explicitly states the value must be one of a set. | +| `validation_error` | string | false | | | +| `validation_type_system` | string | false | | | +| `validation_value_type` | string | false | | | + +#### Enumerated Values + +| Property | Value | +| ---------------------------- | ---------------------- | +| `default_destination_scheme` | `none` | +| `default_destination_scheme` | `environment_variable` | +| `default_destination_scheme` | `provisioner_variable` | +| `default_source_scheme` | `none` | +| `default_source_scheme` | `data` | + ## codersdk.ParameterScope ```json @@ -3065,6 +3240,110 @@ Parameter represents a set value for the scope. | ---------------- | ---------------------------------------------------- | -------- | ------------ | ----------- | | `[any property]` | [codersdk.TransitionStats](#codersdktransitionstats) | false | | | +## codersdk.TemplateDAUsResponse + +```json +{ + "entries": [ + { + "amount": 0, + "date": "string" + } + ] +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| --------- | ----------------------------------------------- | -------- | ------------ | ----------- | +| `entries` | array of [codersdk.DAUEntry](#codersdkdauentry) | false | | | + +## codersdk.TemplateExample + +```json +{ + "description": "string", + "icon": "string", + "id": "string", + "markdown": "string", + "name": "string", + "tags": ["string"], + "url": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------------- | --------------- | -------- | ------------ | ----------- | +| `description` | string | false | | | +| `icon` | string | false | | | +| `id` | string | false | | | +| `markdown` | string | false | | | +| `name` | string | false | | | +| `tags` | array of string | false | | | +| `url` | string | false | | | + +## codersdk.TemplateVersion + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "created_by": { + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", + "email": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "active", + "username": "string" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" + }, + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "readme": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "updated_at": "2019-08-24T14:15:22Z" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ----------------- | -------------------------------------------------- | -------- | ------------ | ----------- | +| `created_at` | string | false | | | +| `created_by` | [codersdk.User](#codersdkuser) | false | | | +| `id` | string | false | | | +| `job` | [codersdk.ProvisionerJob](#codersdkprovisionerjob) | false | | | +| `name` | string | false | | | +| `organization_id` | string | false | | | +| `readme` | string | false | | | +| `template_id` | string | false | | | +| `updated_at` | string | false | | | + ## codersdk.TraceConfig ```json @@ -3129,6 +3408,20 @@ Parameter represents a set value for the scope. | `p50` | integer | false | | | | `p95` | integer | false | | | +## codersdk.UpdateActiveTemplateVersion + +```json +{ + "id": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ---- | ------ | -------- | ------------ | ----------- | +| `id` | string | true | | | + ## codersdk.UpdateCheckResponse ```json @@ -3147,6 +3440,20 @@ Parameter represents a set value for the scope. | `url` | string | false | | URL to download the latest release of Coder. | | `version` | string | false | | Version is the semantic version for the latest release of Coder. | +## codersdk.UpdateRoles + +```json +{ + "roles": ["string"] +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ------- | --------------- | -------- | ------------ | ----------- | +| `roles` | array of string | false | | | + ## codersdk.UpdateWorkspaceAutostartRequest ```json @@ -3207,12 +3514,12 @@ Parameter represents a set value for the scope. ```json { - "avatar_url": "string", - "created_at": "string", + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", "email": "string", - "id": "string", - "last_seen_at": "string", - "organization_ids": ["string"], + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], "roles": [ { "display_name": "string", @@ -3238,6 +3545,13 @@ Parameter represents a set value for the scope. | `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | | `username` | string | true | | | +#### Enumerated Values + +| Property | Value | +| -------- | ----------- | +| `status` | `active` | +| `status` | `suspended` | + ## codersdk.UserStatus ```json @@ -4195,6 +4509,87 @@ Parameter represents a set value for the scope. | `count` | integer | false | | | | `workspaces` | array of [codersdk.Workspace](#codersdkworkspace) | false | | | +## database.ParameterDestinationScheme + +```json +"none" +``` + +### Properties + +#### Enumerated Values + +| Value | +| ---------------------- | +| `none` | +| `environment_variable` | +| `provisioner_variable` | + +## database.ParameterScope + +```json +"template" +``` + +### Properties + +#### Enumerated Values + +| Value | +| ------------ | +| `template` | +| `import_job` | +| `workspace` | + +## database.ParameterSourceScheme + +```json +"none" +``` + +### Properties + +#### Enumerated Values + +| Value | +| ------ | +| `none` | +| `data` | + +## parameter.ComputedValue + +```json +{ + "created_at": "string", + "default_source_value": true, + "destination_scheme": "none", + "id": "string", + "name": "string", + "schema_id": "string", + "scope": "template", + "scope_id": "string", + "source_scheme": "none", + "source_value": "string", + "updated_at": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +| ---------------------- | -------------------------------------------------------------------------- | -------- | ------------ | ----------- | +| `created_at` | string | false | | | +| `default_source_value` | boolean | false | | | +| `destination_scheme` | [database.ParameterDestinationScheme](#databaseparameterdestinationscheme) | false | | | +| `id` | string | false | | | +| `name` | string | false | | | +| `schema_id` | string | false | | | +| `scope` | [database.ParameterScope](#databaseparameterscope) | false | | | +| `scope_id` | string | false | | | +| `source_scheme` | [database.ParameterSourceScheme](#databaseparametersourcescheme) | false | | | +| `source_value` | string | false | | | +| `updated_at` | string | false | | | + ## tailcfg.DERPMap ```json diff --git a/docs/api/templates.md b/docs/api/templates.md index 43ea098e8aebc..9cc37f5170ffc 100644 --- a/docs/api/templates.md +++ b/docs/api/templates.md @@ -2,93 +2,6 @@ > This page is incomplete, stay tuned. -## Create template by organization - -### Code samples - -```shell -# Example request using curl -curl -X POST http://coder-server:8080/api/v2/organizations/{organization-id}/templates/ \ - -H 'Content-Type: application/json' \ - -H 'Accept: application/json' \ - -H 'Coder-Session-Token: API_KEY' -``` - -`POST /organizations/{organization-id}/templates/` - -> Body parameter - -```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" -} -``` - -### Parameters - -| Name | In | Type | Required | Description | -| ----------------- | ---- | -------------------------------------------------------------------------- | -------- | --------------- | -| `organization-id` | path | string | true | Organization ID | -| `body` | body | [codersdk.CreateTemplateRequest](schemas.md#codersdkcreatetemplaterequest) | true | Request body | - -### 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": "terraform", - "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. [Learn more](authentication.md). - ## Get templates by organization ### Code samples @@ -187,25 +100,49 @@ Status Code **200** To perform this operation, you must be authenticated. [Learn more](authentication.md). -## Get templates by organization and template name +## Create template by organization ### Code samples ```shell # Example request using curl -curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templates/{template-name} \ +curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/templates \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Coder-Session-Token: API_KEY' ``` -`GET /organizations/{organization}/templates/{template-name}` +`POST /organizations/{organization}/templates` + +> Body parameter + +```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": "000e07d6-021d-446c-be14-48a9c20bca0b", + "destination_scheme": "none", + "name": "string", + "source_scheme": "none", + "source_value": "string" + } + ], + "template_version_id": "string" +} +``` ### Parameters -| Name | In | Type | Required | Description | -| --------------- | ---- | ------------ | -------- | --------------- | -| `organization` | path | string(uuid) | true | Organization ID | -| `template-name` | path | string | true | Template name | +| Name | In | Type | Required | Description | +| -------------- | ---- | -------------------------------------------------------------------------- | -------- | --------------- | +| `organization` | path | string | true | Organization ID | +| `body` | body | [codersdk.CreateTemplateRequest](schemas.md#codersdkcreatetemplaterequest) | true | Request body | ### Example responses @@ -250,24 +187,85 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templat To perform this operation, you must be authenticated. [Learn more](authentication.md). -## Get template metadata by ID +## Get template examples by organization ### Code samples ```shell # Example request using curl -curl -X GET http://coder-server:8080/api/v2/templates/{id} \ +curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templates/examples \ -H 'Accept: application/json' \ -H 'Coder-Session-Token: API_KEY' ``` -`GET /templates/{id}` +`GET /organizations/{organization}/templates/examples` ### Parameters -| Name | In | Type | Required | Description | -| ---- | ---- | ------------ | -------- | ----------- | -| `id` | path | string(uuid) | true | Template ID | +| Name | In | Type | Required | Description | +| -------------- | ---- | ------------ | -------- | --------------- | +| `organization` | path | string(uuid) | true | Organization ID | + +### Example responses + +> 200 Response + +```json +[ + { + "description": "string", + "icon": "string", + "id": "string", + "markdown": "string", + "name": "string", + "tags": ["string"], + "url": "string" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ----------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.TemplateExample](schemas.md#codersdktemplateexample) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| --------------- | ------ | -------- | ------------ | ----------- | +| `[array item]` | array | false | | | +| `» description` | string | false | | | +| `» icon` | string | false | | | +| `» id` | string | false | | | +| `» markdown` | string | false | | | +| `» name` | string | false | | | +| `» tags` | array | false | | | +| `» url` | string | false | | | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get templates by organization and template name + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templates/{templatename} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /organizations/{organization}/templates/{templatename}` + +### Parameters + +| Name | In | Type | Required | Description | +| -------------- | ---- | ------------ | -------- | --------------- | +| `organization` | path | string(uuid) | true | Organization ID | +| `templatename` | path | string | true | Template name | ### Example responses @@ -312,68 +310,118 @@ curl -X GET http://coder-server:8080/api/v2/templates/{id} \ To perform this operation, you must be authenticated. [Learn more](authentication.md). -## Delete template by ID +## Create template version by organization ### Code samples ```shell # Example request using curl -curl -X DELETE http://coder-server:8080/api/v2/templates/{id} \ +curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/templateversions \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Coder-Session-Token: API_KEY' ``` -`DELETE /templates/{id}` +`POST /organizations/{organization}/templateversions` + +> Body parameter + +```json +{ + "parameter_values": [ + { + "copy_from_parameter": "000e07d6-021d-446c-be14-48a9c20bca0b", + "destination_scheme": "none", + "name": "string", + "source_scheme": "none", + "source_value": "string" + } + ], + "workspace_name": "string" +} +``` ### Parameters -| Name | In | Type | Required | Description | -| ---- | ---- | ------------ | -------- | ----------- | -| `id` | path | string(uuid) | true | Template ID | +| Name | In | Type | Required | Description | +| -------------- | ---- | ---------------------------------------------------------------------------------------------------- | -------- | ------------------------------- | +| `organization` | path | string(uuid) | true | Organization ID | +| `body` | body | [codersdk.CreateTemplateVersionDryRunRequest](schemas.md#codersdkcreatetemplateversiondryrunrequest) | true | Create template version request | ### Example responses -> 200 Response +> 201 Response ```json { - "detail": "string", - "message": "string", - "validations": [ - { - "detail": "string", - "field": "string" - } - ] + "created_at": "2019-08-24T14:15:22Z", + "created_by": { + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", + "email": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "active", + "username": "string" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" + }, + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "readme": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "updated_at": "2019-08-24T14:15:22Z" } ``` ### Responses -| Status | Meaning | Description | Schema | -| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------ | -| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Response](schemas.md#codersdkresponse) | +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------------ | ----------- | -------------------------------------------------------------- | +| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.TemplateVersion](schemas.md#codersdktemplateversion) | To perform this operation, you must be authenticated. [Learn more](authentication.md). -## Update template metadata by ID +## Get template version by organization and name ### Code samples ```shell # Example request using curl -curl -X PATCH http://coder-server:8080/api/v2/templates/{id} \ +curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templateversions/{templateversionname} \ -H 'Accept: application/json' \ -H 'Coder-Session-Token: API_KEY' ``` -`PATCH /templates/{id}` +`GET /organizations/{organization}/templateversions/{templateversionname}` ### Parameters -| Name | In | Type | Required | Description | -| ---- | ---- | ------------ | -------- | ----------- | -| `id` | path | string(uuid) | true | Template ID | +| Name | In | Type | Required | Description | +| --------------------- | ---- | ------------ | -------- | --------------------- | +| `organization` | path | string(uuid) | true | Organization ID | +| `templateversionname` | path | string | true | Template version name | ### Example responses @@ -381,39 +429,1620 @@ curl -X PATCH http://coder-server:8080/api/v2/templates/{id} \ ```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", + "created_by": { + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", + "email": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "active", + "username": "string" + }, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" + }, "name": "string", "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", - "provisioner": "terraform", - "updated_at": "2019-08-24T14:15:22Z", - "workspace_owner_count": 0 + "readme": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "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 | [codersdk.Template](schemas.md#codersdktemplate) | +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | -------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.TemplateVersion](schemas.md#codersdktemplateversion) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get previous template version by organization and name + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templateversions/{templateversionname}/previous \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /organizations/{organization}/templateversions/{templateversionname}/previous` + +### Parameters + +| Name | In | Type | Required | Description | +| --------------------- | ---- | ------------ | -------- | --------------------- | +| `organization` | path | string(uuid) | true | Organization ID | +| `templateversionname` | path | string | true | Template version name | + +### Example responses + +> 200 Response + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "created_by": { + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", + "email": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "active", + "username": "string" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" + }, + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "readme": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "updated_at": "2019-08-24T14:15:22Z" +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | -------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.TemplateVersion](schemas.md#codersdktemplateversion) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get template metadata by ID + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templates/{id} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /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": "terraform", + "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. [Learn more](authentication.md). + +## Delete template by ID + +### Code samples + +```shell +# Example request using curl +curl -X DELETE http://coder-server:8080/api/v2/templates/{id} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`DELETE /templates/{id}` + +### Parameters + +| Name | In | Type | Required | Description | +| ---- | ---- | ------------ | -------- | ----------- | +| `id` | path | string(uuid) | true | Template ID | + +### 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. [Learn more](authentication.md). + +## 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": "terraform", + "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. [Learn more](authentication.md). + +## Get template DAUs by ID + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templates/{id}/daus \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templates/{id}/daus` + +### Parameters + +| Name | In | Type | Required | Description | +| ---- | ---- | ------------ | -------- | ----------- | +| `id` | path | string(uuid) | true | Template ID | + +### Example responses + +> 200 Response + +```json +{ + "entries": [ + { + "amount": 0, + "date": "string" + } + ] +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------------ | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.TemplateDAUsResponse](schemas.md#codersdktemplatedausresponse) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## List template versions by template ID + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templates/{id}/versions \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templates/{id}/versions` + +### Parameters + +| Name | In | Type | Required | Description | +| ---- | ---- | ------------ | -------- | ----------- | +| `id` | path | string(uuid) | true | Template ID | + +### Example responses + +> 200 Response + +```json +[ + { + "created_at": "2019-08-24T14:15:22Z", + "created_by": { + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", + "email": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "active", + "username": "string" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" + }, + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "readme": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "updated_at": "2019-08-24T14:15:22Z" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ----------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.TemplateVersion](schemas.md#codersdktemplateversion) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| --------------------- | ------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `[array item]` | array | false | | | +| `» created_at` | string(date-time) | false | | | +| `» created_by` | [codersdk.User](schemas.md#codersdkuser) | false | | | +| `»» avatar_url` | string(uri) | false | | | +| `»» created_at` | string(date-time) | true | | | +| `»» email` | string | true | | | +| `»» id` | string(uuid) | true | | | +| `»» last_seen_at` | string(date-time) | false | | | +| `»» organization_ids` | array | false | | | +| `»» roles` | array | false | | | +| `»»» display_name` | string | false | | | +| `»»» name` | string | false | | | +| `»» status` | [codersdk.UserStatus](schemas.md#codersdkuserstatus) | false | | | +| `»» username` | string | true | | | +| `» id` | string(uuid) | false | | | +| `» job` | [codersdk.ProvisionerJob](schemas.md#codersdkprovisionerjob) | false | | | +| `»» canceled_at` | string(date-time) | false | | | +| `»» completed_at` | string(date-time) | false | | | +| `»» created_at` | string(date-time) | false | | | +| `»» error` | string | false | | | +| `»» file_id` | string(uuid) | false | | | +| `»» id` | string(uuid) | false | | | +| `»» started_at` | string(date-time) | false | | | +| `»» status` | [codersdk.ProvisionerJobStatus](schemas.md#codersdkprovisionerjobstatus) | false | | | +| `»» tags` | object | false | | | +| `»»» [any property]` | string | false | | | +| `»» worker_id` | string(uuid) | false | | | +| `» name` | string | false | | | +| `» organization_id` | string(uuid) | false | | | +| `» readme` | string | false | | | +| `» template_id` | string(uuid) | false | | | +| `» updated_at` | string(date-time) | false | | | + +#### Enumerated Values + +| Property | Value | +| -------- | ----------- | +| `status` | `active` | +| `status` | `suspended` | +| `status` | `pending` | +| `status` | `running` | +| `status` | `succeeded` | +| `status` | `canceling` | +| `status` | `canceled` | +| `status` | `failed` | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Update active template version by template ID + +### Code samples + +```shell +# Example request using curl +curl -X PATCH http://coder-server:8080/api/v2/templates/{id}/versions \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`PATCH /templates/{id}/versions` + +> Body parameter + +```json +{ + "id": "string" +} +``` + +### Parameters + +| Name | In | Type | Required | Description | +| ------ | ---- | -------------------------------------------------------------------------------------- | -------- | ------------------------- | +| `id` | path | string(uuid) | true | Template ID | +| `body` | body | [codersdk.UpdateActiveTemplateVersion](schemas.md#codersdkupdateactivetemplateversion) | true | Modified template version | + +### 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. [Learn more](authentication.md). + +## Get template version by template ID and name + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templates/{id}/versions/{templateversionname} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templates/{id}/versions/{templateversionname}` + +### Parameters + +| Name | In | Type | Required | Description | +| --------------------- | ---- | ------------ | -------- | --------------------- | +| `id` | path | string(uuid) | true | Template ID | +| `templateversionname` | path | string | true | Template version name | + +### Example responses + +> 200 Response + +```json +[ + { + "created_at": "2019-08-24T14:15:22Z", + "created_by": { + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", + "email": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "active", + "username": "string" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" + }, + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "readme": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "updated_at": "2019-08-24T14:15:22Z" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ----------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.TemplateVersion](schemas.md#codersdktemplateversion) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| --------------------- | ------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `[array item]` | array | false | | | +| `» created_at` | string(date-time) | false | | | +| `» created_by` | [codersdk.User](schemas.md#codersdkuser) | false | | | +| `»» avatar_url` | string(uri) | false | | | +| `»» created_at` | string(date-time) | true | | | +| `»» email` | string | true | | | +| `»» id` | string(uuid) | true | | | +| `»» last_seen_at` | string(date-time) | false | | | +| `»» organization_ids` | array | false | | | +| `»» roles` | array | false | | | +| `»»» display_name` | string | false | | | +| `»»» name` | string | false | | | +| `»» status` | [codersdk.UserStatus](schemas.md#codersdkuserstatus) | false | | | +| `»» username` | string | true | | | +| `» id` | string(uuid) | false | | | +| `» job` | [codersdk.ProvisionerJob](schemas.md#codersdkprovisionerjob) | false | | | +| `»» canceled_at` | string(date-time) | false | | | +| `»» completed_at` | string(date-time) | false | | | +| `»» created_at` | string(date-time) | false | | | +| `»» error` | string | false | | | +| `»» file_id` | string(uuid) | false | | | +| `»» id` | string(uuid) | false | | | +| `»» started_at` | string(date-time) | false | | | +| `»» status` | [codersdk.ProvisionerJobStatus](schemas.md#codersdkprovisionerjobstatus) | false | | | +| `»» tags` | object | false | | | +| `»»» [any property]` | string | false | | | +| `»» worker_id` | string(uuid) | false | | | +| `» name` | string | false | | | +| `» organization_id` | string(uuid) | false | | | +| `» readme` | string | false | | | +| `» template_id` | string(uuid) | false | | | +| `» updated_at` | string(date-time) | false | | | + +#### Enumerated Values + +| Property | Value | +| -------- | ----------- | +| `status` | `active` | +| `status` | `suspended` | +| `status` | `pending` | +| `status` | `running` | +| `status` | `succeeded` | +| `status` | `canceling` | +| `status` | `canceled` | +| `status` | `failed` | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get template version by ID + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templateversions/{templateversion}` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ---- | ------------ | -------- | ------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | + +### Example responses + +> 200 Response + +```json +{ + "created_at": "2019-08-24T14:15:22Z", + "created_by": { + "avatar_url": "http://example.com", + "created_at": "2019-08-24T14:15:22Z", + "email": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "last_seen_at": "2019-08-24T14:15:22Z", + "organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], + "roles": [ + { + "display_name": "string", + "name": "string" + } + ], + "status": "active", + "username": "string" + }, + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job": { + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" + }, + "name": "string", + "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", + "readme": "string", + "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", + "updated_at": "2019-08-24T14:15:22Z" +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | -------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.TemplateVersion](schemas.md#codersdktemplateversion) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Cancel template version by ID + +### Code samples + +```shell +# Example request using curl +curl -X PATCH http://coder-server:8080/api/v2/templateversions/{templateversion}/cancel \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`PATCH /templateversions/{templateversion}/cancel` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ---- | ------------ | -------- | ------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | + +### 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. [Learn more](authentication.md). + +## Create template version dry-run + +### Code samples + +```shell +# Example request using curl +curl -X POST http://coder-server:8080/api/v2/templateversions/{templateversion}/dry-run \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`POST /templateversions/{templateversion}/dry-run` + +> Body parameter + +```json +{ + "parameter_values": [ + { + "copy_from_parameter": "000e07d6-021d-446c-be14-48a9c20bca0b", + "destination_scheme": "none", + "name": "string", + "source_scheme": "none", + "source_value": "string" + } + ], + "workspace_name": "string" +} +``` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ---- | ---------------------------------------------------------------------------------------------------- | -------- | ------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | +| `body` | body | [codersdk.CreateTemplateVersionDryRunRequest](schemas.md#codersdkcreatetemplateversiondryrunrequest) | true | Dry-run request | + +### Example responses + +> 201 Response + +```json +{ + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------------ | ----------- | ------------------------------------------------------------ | +| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.ProvisionerJob](schemas.md#codersdkprovisionerjob) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get template version dry-run by job ID + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/dry-run/{jobid} \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templateversions/{templateversion}/dry-run/{jobid}` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ---- | ------------ | -------- | ------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | +| `jobid` | path | string(uuid) | true | Job ID | + +### Example responses + +> 200 Response + +```json +{ + "canceled_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "created_at": "2019-08-24T14:15:22Z", + "error": "string", + "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "started_at": "2019-08-24T14:15:22Z", + "status": "pending", + "tags": { + "property1": "string", + "property2": "string" + }, + "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------ | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ProvisionerJob](schemas.md#codersdkprovisionerjob) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Cancel template version dry-run by job ID + +### Code samples + +```shell +# Example request using curl +curl -X PATCH http://coder-server:8080/api/v2/templateversions/{templateversion}/dry-run/{jobid}/cancel \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`PATCH /templateversions/{templateversion}/dry-run/{jobid}/cancel` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ---- | ------------ | -------- | ------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | + +### 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. [Learn more](authentication.md). + +## Get template version dry-run logs by job ID + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/dry-run/{jobid}/logs \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templateversions/{templateversion}/dry-run/{jobid}/logs` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ----- | ------------ | -------- | --------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | +| `jobid` | path | string(uuid) | true | Job ID | +| `before` | query | integer | false | Before Unix timestamp | +| `after` | query | integer | false | After Unix timestamp | +| `follow` | query | boolean | false | Follow log stream | + +### Example responses + +> 200 Response + +```json +[ + { + "created_at": "2019-08-24T14:15:22Z", + "id": 0, + "log_level": "trace", + "log_source": "provisioner_daemon", + "output": "string", + "stage": "string" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.ProvisionerJobLog](schemas.md#codersdkprovisionerjoblog) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| -------------- | -------------------------------------------------- | -------- | ------------ | ----------- | +| `[array item]` | array | false | | | +| `» created_at` | string(date-time) | false | | | +| `» id` | integer | false | | | +| `» log_level` | [codersdk.LogLevel](schemas.md#codersdkloglevel) | false | | | +| `» log_source` | [codersdk.LogSource](schemas.md#codersdklogsource) | false | | | +| `» output` | string | false | | | +| `» stage` | string | false | | | + +#### Enumerated Values + +| Property | Value | +| ------------ | -------------------- | +| `log_level` | `trace` | +| `log_level` | `debug` | +| `log_level` | `info` | +| `log_level` | `warn` | +| `log_level` | `error` | +| `log_source` | `provisioner_daemon` | +| `log_source` | `provisioner` | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get template version dry-run resources by job ID + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/dry-run/{jobid}/resources \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templateversions/{templateversion}/dry-run/{jobid}/resources` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ---- | ------------ | -------- | ------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | +| `jobid` | path | string(uuid) | true | Job ID | + +### Example responses + +> 200 Response + +```json +[ + { + "agents": [ + { + "apps": [ + { + "command": "string", + "display_name": "string", + "external": true, + "health": "disabled", + "healthcheck": { + "interval": 0, + "threshold": 0, + "url": "string" + }, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "sharing_level": "owner", + "slug": "string", + "subdomain": true, + "url": "string" + } + ], + "architecture": "string", + "connection_timeout_seconds": 0, + "created_at": "2019-08-24T14:15:22Z", + "directory": "string", + "disconnected_at": "2019-08-24T14:15:22Z", + "environment_variables": { + "property1": "string", + "property2": "string" + }, + "first_connected_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "instance_id": "string", + "last_connected_at": "2019-08-24T14:15:22Z", + "latency": { + "property1": { + "latency_ms": 0, + "preferred": true + }, + "property2": { + "latency_ms": 0, + "preferred": true + } + }, + "name": "string", + "operating_system": "string", + "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", + "startup_script": "string", + "status": "connecting", + "troubleshooting_url": "string", + "updated_at": "2019-08-24T14:15:22Z", + "version": "string" + } + ], + "created_at": "2019-08-24T14:15:22Z", + "daily_cost": 0, + "hide": true, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", + "metadata": [ + { + "key": "string", + "sensitive": true, + "value": "string" + } + ], + "name": "string", + "type": "string", + "workspace_transition": "start" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.WorkspaceResource](schemas.md#codersdkworkspaceresource) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| ------------------------------- | -------------------------------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `[array item]` | array | false | | | +| `» agents` | array | false | | | +| `»» apps` | array | false | | | +| `»»» command` | string | false | | | +| `»»» display_name` | string | false | | DisplayName is a friendly name for the app. | +| `»»» external` | boolean | false | | External specifies whether the URL should be opened externally on
the client or not. | +| `»»» health` | [codersdk.WorkspaceAppHealth](schemas.md#codersdkworkspaceapphealth) | false | | | +| `»»» healthcheck` | [codersdk.Healthcheck](schemas.md#codersdkhealthcheck) | false | | Healthcheck specifies the configuration for checking app health. | +| `»»»» 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. | +| `»»» icon` | string | false | | Icon is a relative path or external URL that specifies
an icon to be displayed in the dashboard. | +| `»»» id` | string(uuid) | false | | | +| `»»» sharing_level` | [codersdk.WorkspaceAppSharingLevel](schemas.md#codersdkworkspaceappsharinglevel) | false | | | +| `»»» slug` | string | false | | Slug is a unique identifier within the agent. | +| `»»» subdomain` | boolean | false | | Subdomain denotes whether the app should be accessed via a path on the
`coder server` or via a hostname-based dev URL. If this is set to true
and there is no app wildcard configured on the server, the app will not
be accessible in the UI. | +| `»»» url` | string | false | | URL is the address being proxied to inside the workspace.
If external is specified, this will be opened on the client. | +| `»» architecture` | string | false | | | +| `»» connection_timeout_seconds` | integer | false | | | +| `»» created_at` | string(date-time) | false | | | +| `»» directory` | string | false | | | +| `»» disconnected_at` | string(date-time) | false | | | +| `»» environment_variables` | object | false | | | +| `»»» [any property]` | string | false | | | +| `»» first_connected_at` | string(date-time) | false | | | +| `»» id` | string(uuid) | false | | | +| `»» instance_id` | string | false | | | +| `»» last_connected_at` | string(date-time) | false | | | +| `»» latency` | object | false | | DERPLatency is mapped by region name (e.g. "New York City", "Seattle"). | +| `»»» [any property]` | [codersdk.DERPRegion](schemas.md#codersdkderpregion) | false | | | +| `»»»» latency_ms` | number | false | | | +| `»»»» preferred` | boolean | false | | | +| `»» name` | string | false | | | +| `»» operating_system` | string | false | | | +| `»» resource_id` | string(uuid) | false | | | +| `»» startup_script` | string | false | | | +| `»» status` | [codersdk.WorkspaceAgentStatus](schemas.md#codersdkworkspaceagentstatus) | false | | | +| `»» troubleshooting_url` | string | false | | | +| `»» updated_at` | string(date-time) | false | | | +| `»» version` | string | false | | | +| `» created_at` | string(date-time) | false | | | +| `» daily_cost` | integer | false | | | +| `» hide` | boolean | false | | | +| `» icon` | string | false | | | +| `» id` | string(uuid) | false | | | +| `» job_id` | string(uuid) | false | | | +| `» metadata` | array | false | | | +| `»» key` | string | false | | | +| `»» sensitive` | boolean | false | | | +| `»» value` | string | false | | | +| `» name` | string | false | | | +| `» type` | string | false | | | +| `» workspace_transition` | [codersdk.WorkspaceTransition](schemas.md#codersdkworkspacetransition) | false | | | + +#### Enumerated Values + +| Property | Value | +| ---------------------- | --------------- | +| `health` | `disabled` | +| `health` | `initializing` | +| `health` | `healthy` | +| `health` | `unhealthy` | +| `sharing_level` | `owner` | +| `sharing_level` | `authenticated` | +| `sharing_level` | `public` | +| `status` | `connecting` | +| `status` | `connected` | +| `status` | `disconnected` | +| `status` | `timeout` | +| `workspace_transition` | `start` | +| `workspace_transition` | `stop` | +| `workspace_transition` | `delete` | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get logs by template version + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/logs \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templateversions/{templateversion}/logs` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ----- | ------------ | -------- | --------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | +| `before` | query | integer | false | Before Unix timestamp | +| `after` | query | integer | false | After Unix timestamp | +| `follow` | query | boolean | false | Follow log stream | + +### Example responses + +> 200 Response + +```json +[ + { + "created_at": "2019-08-24T14:15:22Z", + "id": 0, + "log_level": "trace", + "log_source": "provisioner_daemon", + "output": "string", + "stage": "string" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.ProvisionerJobLog](schemas.md#codersdkprovisionerjoblog) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| -------------- | -------------------------------------------------- | -------- | ------------ | ----------- | +| `[array item]` | array | false | | | +| `» created_at` | string(date-time) | false | | | +| `» id` | integer | false | | | +| `» log_level` | [codersdk.LogLevel](schemas.md#codersdkloglevel) | false | | | +| `» log_source` | [codersdk.LogSource](schemas.md#codersdklogsource) | false | | | +| `» output` | string | false | | | +| `» stage` | string | false | | | + +#### Enumerated Values + +| Property | Value | +| ------------ | -------------------- | +| `log_level` | `trace` | +| `log_level` | `debug` | +| `log_level` | `info` | +| `log_level` | `warn` | +| `log_level` | `error` | +| `log_source` | `provisioner_daemon` | +| `log_source` | `provisioner` | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get parameters by template version + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/parameters \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templateversions/{templateversion}/parameters` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ---- | ------------ | -------- | ------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | + +### Example responses + +> 200 Response + +```json +[ + { + "created_at": "string", + "default_source_value": true, + "destination_scheme": "none", + "id": "string", + "name": "string", + "schema_id": "string", + "scope": "template", + "scope_id": "string", + "source_scheme": "none", + "source_value": "string", + "updated_at": "string" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [parameter.ComputedValue](schemas.md#parametercomputedvalue) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| ------------------------ | ------------------------------------------------------------------------------------ | -------- | ------------ | ----------- | +| `[array item]` | array | false | | | +| `» created_at` | string | false | | | +| `» default_source_value` | boolean | false | | | +| `» destination_scheme` | [database.ParameterDestinationScheme](schemas.md#databaseparameterdestinationscheme) | false | | | +| `» id` | string | false | | | +| `» name` | string | false | | | +| `» schema_id` | string | false | | | +| `» scope` | [database.ParameterScope](schemas.md#databaseparameterscope) | false | | | +| `» scope_id` | string | false | | | +| `» source_scheme` | [database.ParameterSourceScheme](schemas.md#databaseparametersourcescheme) | false | | | +| `» source_value` | string | false | | | +| `» updated_at` | string | false | | | + +#### Enumerated Values + +| Property | Value | +| -------------------- | ---------------------- | +| `destination_scheme` | `none` | +| `destination_scheme` | `environment_variable` | +| `destination_scheme` | `provisioner_variable` | +| `scope` | `template` | +| `scope` | `import_job` | +| `scope` | `workspace` | +| `source_scheme` | `none` | +| `source_scheme` | `data` | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get resources by template version + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/resources \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templateversions/{templateversion}/resources` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ---- | ------------ | -------- | ------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | + +### Example responses + +> 200 Response + +```json +[ + { + "agents": [ + { + "apps": [ + { + "command": "string", + "display_name": "string", + "external": true, + "health": "disabled", + "healthcheck": { + "interval": 0, + "threshold": 0, + "url": "string" + }, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "sharing_level": "owner", + "slug": "string", + "subdomain": true, + "url": "string" + } + ], + "architecture": "string", + "connection_timeout_seconds": 0, + "created_at": "2019-08-24T14:15:22Z", + "directory": "string", + "disconnected_at": "2019-08-24T14:15:22Z", + "environment_variables": { + "property1": "string", + "property2": "string" + }, + "first_connected_at": "2019-08-24T14:15:22Z", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "instance_id": "string", + "last_connected_at": "2019-08-24T14:15:22Z", + "latency": { + "property1": { + "latency_ms": 0, + "preferred": true + }, + "property2": { + "latency_ms": 0, + "preferred": true + } + }, + "name": "string", + "operating_system": "string", + "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", + "startup_script": "string", + "status": "connecting", + "troubleshooting_url": "string", + "updated_at": "2019-08-24T14:15:22Z", + "version": "string" + } + ], + "created_at": "2019-08-24T14:15:22Z", + "daily_cost": 0, + "hide": true, + "icon": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", + "metadata": [ + { + "key": "string", + "sensitive": true, + "value": "string" + } + ], + "name": "string", + "type": "string", + "workspace_transition": "start" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.WorkspaceResource](schemas.md#codersdkworkspaceresource) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| ------------------------------- | -------------------------------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `[array item]` | array | false | | | +| `» agents` | array | false | | | +| `»» apps` | array | false | | | +| `»»» command` | string | false | | | +| `»»» display_name` | string | false | | DisplayName is a friendly name for the app. | +| `»»» external` | boolean | false | | External specifies whether the URL should be opened externally on
the client or not. | +| `»»» health` | [codersdk.WorkspaceAppHealth](schemas.md#codersdkworkspaceapphealth) | false | | | +| `»»» healthcheck` | [codersdk.Healthcheck](schemas.md#codersdkhealthcheck) | false | | Healthcheck specifies the configuration for checking app health. | +| `»»»» 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. | +| `»»» icon` | string | false | | Icon is a relative path or external URL that specifies
an icon to be displayed in the dashboard. | +| `»»» id` | string(uuid) | false | | | +| `»»» sharing_level` | [codersdk.WorkspaceAppSharingLevel](schemas.md#codersdkworkspaceappsharinglevel) | false | | | +| `»»» slug` | string | false | | Slug is a unique identifier within the agent. | +| `»»» subdomain` | boolean | false | | Subdomain denotes whether the app should be accessed via a path on the
`coder server` or via a hostname-based dev URL. If this is set to true
and there is no app wildcard configured on the server, the app will not
be accessible in the UI. | +| `»»» url` | string | false | | URL is the address being proxied to inside the workspace.
If external is specified, this will be opened on the client. | +| `»» architecture` | string | false | | | +| `»» connection_timeout_seconds` | integer | false | | | +| `»» created_at` | string(date-time) | false | | | +| `»» directory` | string | false | | | +| `»» disconnected_at` | string(date-time) | false | | | +| `»» environment_variables` | object | false | | | +| `»»» [any property]` | string | false | | | +| `»» first_connected_at` | string(date-time) | false | | | +| `»» id` | string(uuid) | false | | | +| `»» instance_id` | string | false | | | +| `»» last_connected_at` | string(date-time) | false | | | +| `»» latency` | object | false | | DERPLatency is mapped by region name (e.g. "New York City", "Seattle"). | +| `»»» [any property]` | [codersdk.DERPRegion](schemas.md#codersdkderpregion) | false | | | +| `»»»» latency_ms` | number | false | | | +| `»»»» preferred` | boolean | false | | | +| `»» name` | string | false | | | +| `»» operating_system` | string | false | | | +| `»» resource_id` | string(uuid) | false | | | +| `»» startup_script` | string | false | | | +| `»» status` | [codersdk.WorkspaceAgentStatus](schemas.md#codersdkworkspaceagentstatus) | false | | | +| `»» troubleshooting_url` | string | false | | | +| `»» updated_at` | string(date-time) | false | | | +| `»» version` | string | false | | | +| `» created_at` | string(date-time) | false | | | +| `» daily_cost` | integer | false | | | +| `» hide` | boolean | false | | | +| `» icon` | string | false | | | +| `» id` | string(uuid) | false | | | +| `» job_id` | string(uuid) | false | | | +| `» metadata` | array | false | | | +| `»» key` | string | false | | | +| `»» sensitive` | boolean | false | | | +| `»» value` | string | false | | | +| `» name` | string | false | | | +| `» type` | string | false | | | +| `» workspace_transition` | [codersdk.WorkspaceTransition](schemas.md#codersdkworkspacetransition) | false | | | + +#### Enumerated Values + +| Property | Value | +| ---------------------- | --------------- | +| `health` | `disabled` | +| `health` | `initializing` | +| `health` | `healthy` | +| `health` | `unhealthy` | +| `sharing_level` | `owner` | +| `sharing_level` | `authenticated` | +| `sharing_level` | `public` | +| `status` | `connecting` | +| `status` | `connected` | +| `status` | `disconnected` | +| `status` | `timeout` | +| `workspace_transition` | `start` | +| `workspace_transition` | `stop` | +| `workspace_transition` | `delete` | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Get schema by template version + +### Code samples + +```shell +# Example request using curl +curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/schema \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`GET /templateversions/{templateversion}/schema` + +### Parameters + +| Name | In | Type | Required | Description | +| ----------------- | ---- | ------------ | -------- | ------------------- | +| `templateversion` | path | string(uuid) | true | Template version ID | + +### Example responses + +> 200 Response + +```json +[ + { + "allow_override_destination": true, + "allow_override_source": true, + "created_at": "2019-08-24T14:15:22Z", + "default_destination_scheme": "none", + "default_refresh": "string", + "default_source_scheme": "none", + "default_source_value": "string", + "description": "string", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f", + "name": "string", + "redisplay_value": true, + "validation_condition": "string", + "validation_contains": ["string"], + "validation_error": "string", + "validation_type_system": "string", + "validation_value_type": "string" + } +] +``` + +### Responses + +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ----------------------------------------------------------------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.ParameterSchema](schemas.md#codersdkparameterschema) | + +

Response Schema

+ +Status Code **200** + +| Name | Type | Required | Restrictions | Description | +| ------------------------------ | ------------------------------------------------------------------------------------ | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------- | +| `[array item]` | array | false | | | +| `» allow_override_destination` | boolean | false | | | +| `» allow_override_source` | boolean | false | | | +| `» created_at` | string(date-time) | false | | | +| `» default_destination_scheme` | [codersdk.ParameterDestinationScheme](schemas.md#codersdkparameterdestinationscheme) | false | | | +| `» default_refresh` | string | false | | | +| `» default_source_scheme` | [codersdk.ParameterSourceScheme](schemas.md#codersdkparametersourcescheme) | false | | | +| `» default_source_value` | string | false | | | +| `» description` | string | false | | | +| `» id` | string(uuid) | false | | | +| `» job_id` | string(uuid) | false | | | +| `» name` | string | false | | | +| `» redisplay_value` | boolean | false | | | +| `» validation_condition` | string | false | | | +| `» validation_contains` | array | false | | This is a special array of items provided if the validation condition
explicitly states the value must be one of a set. | +| `» validation_error` | string | false | | | +| `» validation_type_system` | string | false | | | +| `» validation_value_type` | string | false | | | + +#### Enumerated Values + +| Property | Value | +| ---------------------------- | ---------------------- | +| `default_destination_scheme` | `none` | +| `default_destination_scheme` | `environment_variable` | +| `default_destination_scheme` | `provisioner_variable` | +| `default_source_scheme` | `none` | +| `default_source_scheme` | `data` | To perform this operation, you must be authenticated. [Learn more](authentication.md). diff --git a/docs/api/workspaces.md b/docs/api/workspaces.md index bd362e8249fb4..ab06dbfe4e779 100644 --- a/docs/api/workspaces.md +++ b/docs/api/workspaces.md @@ -2,7 +2,7 @@ > This page is incomplete, stay tuned. -## Create workspace by organization +## Create user workspace by organization ### Code samples @@ -17,10 +17,10 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/member ### Parameters -| Name | In | Type | Required | Description | -| -------------- | ---- | ------------ | -------- | --------------- | -| `organization` | path | string(uuid) | true | Organization ID | -| `user` | path | string | true | Username | +| Name | In | Type | Required | Description | +| -------------- | ---- | ------------ | -------- | --------------------- | +| `organization` | path | string(uuid) | true | Organization ID | +| `user` | path | string | true | Username, UUID, or me | ### Example responses diff --git a/docs/manifest.json b/docs/manifest.json index 079735f2800bb..603771bedcb0b 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -350,13 +350,21 @@ "path": "./api/files.md" }, { - "title": "Templates", - "path": "./api/templates.md" + "title": "Organizations", + "path": "./api/organizations.md" + }, + { + "title": "Members", + "path": "./api/members.md" }, { "title": "Workspaces", "path": "./api/workspaces.md" }, + { + "title": "Templates", + "path": "./api/templates.md" + }, { "title": "Parameters", "path": "./api/parameters.md"