feat: archive template versions to hide them from the ui (#10179)

* api + cli implementation
This commit is contained in:
Steven Masley
2023-10-11 09:26:22 -05:00
committed by GitHub
parent edbd51955c
commit 1e950fa9a8
35 changed files with 1472 additions and 38 deletions

129
coderd/apidoc/docs.go generated
View File

@ -2365,6 +2365,53 @@ const docTemplate = `{
}
}
},
"/templates/{template}/versions/archive": {
"post": {
"security": [
{
"CoderSessionToken": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Templates"
],
"summary": "Archive template unused versions by template id",
"operationId": "archive-template-unused-versions-by-template-id",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Template ID",
"name": "template",
"in": "path",
"required": true
},
{
"description": "Archive request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/codersdk.ArchiveTemplateVersionsRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.Response"
}
}
}
}
},
"/templates/{template}/versions/{templateversionname}": {
"get": {
"security": [
@ -2490,6 +2537,41 @@ const docTemplate = `{
}
}
},
"/templateversions/{templateversion}/archive": {
"post": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Templates"
],
"summary": "Archive template version",
"operationId": "archive-template-version",
"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}/cancel": {
"patch": {
"security": [
@ -2996,6 +3078,41 @@ const docTemplate = `{
}
}
},
"/templateversions/{templateversion}/unarchive": {
"post": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Templates"
],
"summary": "Unarchive template version",
"operationId": "unarchive-template-version",
"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}/variables": {
"get": {
"security": [
@ -7145,6 +7262,15 @@ const docTemplate = `{
}
}
},
"codersdk.ArchiveTemplateVersionsRequest": {
"type": "object",
"properties": {
"all": {
"description": "By default, only failed versions are archived. Set this to true\nto archive all unused versions regardless of job status.",
"type": "boolean"
}
}
},
"codersdk.AssignableRoles": {
"type": "object",
"properties": {
@ -10087,6 +10213,9 @@ const docTemplate = `{
"codersdk.TemplateVersion": {
"type": "object",
"properties": {
"archived": {
"type": "boolean"
},
"created_at": {
"type": "string",
"format": "date-time"