mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: archive template versions to hide them from the ui (#10179)
* api + cli implementation
This commit is contained in:
Generated
+16
@@ -987,6 +987,20 @@ _None_
|
||||
| `service_banner` | [codersdk.ServiceBannerConfig](#codersdkservicebannerconfig) | false | | |
|
||||
| `support_links` | array of [codersdk.LinkConfig](#codersdklinkconfig) | false | | |
|
||||
|
||||
## codersdk.ArchiveTemplateVersionsRequest
|
||||
|
||||
```json
|
||||
{
|
||||
"all": true
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
| ----- | ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `all` | boolean | false | | By default, only failed versions are archived. Set this to true to archive all unused versions regardless of job status. |
|
||||
|
||||
## codersdk.AssignableRoles
|
||||
|
||||
```json
|
||||
@@ -4709,6 +4723,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
|
||||
```json
|
||||
{
|
||||
"archived": true,
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"created_by": {
|
||||
"avatar_url": "http://example.com",
|
||||
@@ -4748,6 +4763,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
| ----------------- | --------------------------------------------------------------------------- | -------- | ------------ | ----------- |
|
||||
| `archived` | boolean | false | | |
|
||||
| `created_at` | string | false | | |
|
||||
| `created_by` | [codersdk.MinimalUser](#codersdkminimaluser) | false | | |
|
||||
| `id` | string | false | | |
|
||||
|
||||
Generated
+151
@@ -373,6 +373,7 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templat
|
||||
|
||||
```json
|
||||
{
|
||||
"archived": true,
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"created_by": {
|
||||
"avatar_url": "http://example.com",
|
||||
@@ -443,6 +444,7 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templat
|
||||
|
||||
```json
|
||||
{
|
||||
"archived": true,
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"created_by": {
|
||||
"avatar_url": "http://example.com",
|
||||
@@ -537,6 +539,7 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/templa
|
||||
|
||||
```json
|
||||
{
|
||||
"archived": true,
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"created_by": {
|
||||
"avatar_url": "http://example.com",
|
||||
@@ -838,6 +841,7 @@ curl -X GET http://coder-server:8080/api/v2/templates/{template}/versions \
|
||||
```json
|
||||
[
|
||||
{
|
||||
"archived": true,
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"created_by": {
|
||||
"avatar_url": "http://example.com",
|
||||
@@ -887,6 +891,7 @@ Status Code **200**
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
| -------------------- | ------------------------------------------------------------------------ | -------- | ------------ | ----------- |
|
||||
| `[array item]` | array | false | | |
|
||||
| `» archived` | boolean | false | | |
|
||||
| `» created_at` | string(date-time) | false | | |
|
||||
| `» created_by` | [codersdk.MinimalUser](schemas.md#codersdkminimaluser) | false | | |
|
||||
| `»» avatar_url` | string(uri) | false | | |
|
||||
@@ -984,6 +989,60 @@ curl -X PATCH http://coder-server:8080/api/v2/templates/{template}/versions \
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Archive template unused versions by template id
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X POST http://coder-server:8080/api/v2/templates/{template}/versions/archive \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`POST /templates/{template}/versions/archive`
|
||||
|
||||
> Body parameter
|
||||
|
||||
```json
|
||||
{
|
||||
"all": true
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | In | Type | Required | Description |
|
||||
| ---------- | ---- | -------------------------------------------------------------------------------------------- | -------- | --------------- |
|
||||
| `template` | path | string(uuid) | true | Template ID |
|
||||
| `body` | body | [codersdk.ArchiveTemplateVersionsRequest](schemas.md#codersdkarchivetemplateversionsrequest) | true | Archive request |
|
||||
|
||||
### 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
|
||||
@@ -1011,6 +1070,7 @@ curl -X GET http://coder-server:8080/api/v2/templates/{template}/versions/{templ
|
||||
```json
|
||||
[
|
||||
{
|
||||
"archived": true,
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"created_by": {
|
||||
"avatar_url": "http://example.com",
|
||||
@@ -1060,6 +1120,7 @@ Status Code **200**
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
| -------------------- | ------------------------------------------------------------------------ | -------- | ------------ | ----------- |
|
||||
| `[array item]` | array | false | | |
|
||||
| `» archived` | boolean | false | | |
|
||||
| `» created_at` | string(date-time) | false | | |
|
||||
| `» created_by` | [codersdk.MinimalUser](schemas.md#codersdkminimaluser) | false | | |
|
||||
| `»» avatar_url` | string(uri) | false | | |
|
||||
@@ -1128,6 +1189,7 @@ curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion} \
|
||||
|
||||
```json
|
||||
{
|
||||
"archived": true,
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"created_by": {
|
||||
"avatar_url": "http://example.com",
|
||||
@@ -1207,6 +1269,7 @@ curl -X PATCH http://coder-server:8080/api/v2/templateversions/{templateversion}
|
||||
|
||||
```json
|
||||
{
|
||||
"archived": true,
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"created_by": {
|
||||
"avatar_url": "http://example.com",
|
||||
@@ -1250,6 +1313,50 @@ curl -X PATCH http://coder-server:8080/api/v2/templateversions/{templateversion}
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Archive template version
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X POST http://coder-server:8080/api/v2/templateversions/{templateversion}/archive \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`POST /templateversions/{templateversion}/archive`
|
||||
|
||||
### 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).
|
||||
|
||||
## Cancel template version by ID
|
||||
|
||||
### Code samples
|
||||
@@ -2342,6 +2449,50 @@ curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/s
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Unarchive template version
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X POST http://coder-server:8080/api/v2/templateversions/{templateversion}/unarchive \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`POST /templateversions/{templateversion}/unarchive`
|
||||
|
||||
### 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 variables by template version
|
||||
|
||||
### Code samples
|
||||
|
||||
Generated
+1
@@ -35,6 +35,7 @@ Templates are written in standard Terraform and describe the infrastructure for
|
||||
|
||||
| Name | Purpose |
|
||||
| ------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||
| [<code>archive</code>](./templates_archive.md) | Archive unused or failed template versions from a given template(s) |
|
||||
| [<code>create</code>](./templates_create.md) | Create a template from the current directory or as specified by flag |
|
||||
| [<code>delete</code>](./templates_delete.md) | Delete templates |
|
||||
| [<code>edit</code>](./templates_edit.md) | Edit the metadata of a template by name. |
|
||||
|
||||
Generated
+29
@@ -0,0 +1,29 @@
|
||||
<!-- DO NOT EDIT | GENERATED CONTENT -->
|
||||
|
||||
# templates archive
|
||||
|
||||
Archive unused or failed template versions from a given template(s)
|
||||
|
||||
## Usage
|
||||
|
||||
```console
|
||||
coder templates archive [flags] [template-name...]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### --all
|
||||
|
||||
| | |
|
||||
| ---- | ----------------- |
|
||||
| Type | <code>bool</code> |
|
||||
|
||||
Include all unused template versions. By default, only failed template versions are archived.
|
||||
|
||||
### -y, --yes
|
||||
|
||||
| | |
|
||||
| ---- | ----------------- |
|
||||
| Type | <code>bool</code> |
|
||||
|
||||
Bypass prompts.
|
||||
Generated
+5
-3
@@ -24,6 +24,8 @@ coder templates versions
|
||||
|
||||
## Subcommands
|
||||
|
||||
| Name | Purpose |
|
||||
| ------------------------------------------------- | ----------------------------------------------- |
|
||||
| [<code>list</code>](./templates_versions_list.md) | List all the versions of the specified template |
|
||||
| Name | Purpose |
|
||||
| ----------------------------------------------------------- | ----------------------------------------------- |
|
||||
| [<code>archive</code>](./templates_versions_archive.md) | Archive a template version(s). |
|
||||
| [<code>list</code>](./templates_versions_list.md) | List all the versions of the specified template |
|
||||
| [<code>unarchive</code>](./templates_versions_unarchive.md) | Unarchive a template version(s). |
|
||||
|
||||
Generated
+21
@@ -0,0 +1,21 @@
|
||||
<!-- DO NOT EDIT | GENERATED CONTENT -->
|
||||
|
||||
# templates versions archive
|
||||
|
||||
Archive a template version(s).
|
||||
|
||||
## Usage
|
||||
|
||||
```console
|
||||
coder templates versions archive [flags] <template-name> [template-version-names...]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### -y, --yes
|
||||
|
||||
| | |
|
||||
| ---- | ----------------- |
|
||||
| Type | <code>bool</code> |
|
||||
|
||||
Bypass prompts.
|
||||
Generated
+10
-2
@@ -17,9 +17,17 @@ coder templates versions list [flags] <template>
|
||||
| | |
|
||||
| ------- | ----------------------------------------------------- |
|
||||
| Type | <code>string-array</code> |
|
||||
| Default | <code>name,created at,created by,status,active</code> |
|
||||
| Default | <code>Name,Created At,Created By,Status,Active</code> |
|
||||
|
||||
Columns to display in table output. Available columns: name, created at, created by, status, active.
|
||||
Columns to display in table output. Available columns: name, created at, created by, status, active, archived.
|
||||
|
||||
### --include-archived
|
||||
|
||||
| | |
|
||||
| ---- | ----------------- |
|
||||
| Type | <code>bool</code> |
|
||||
|
||||
Include archived versions in the result list.
|
||||
|
||||
### -o, --output
|
||||
|
||||
|
||||
Generated
+21
@@ -0,0 +1,21 @@
|
||||
<!-- DO NOT EDIT | GENERATED CONTENT -->
|
||||
|
||||
# templates versions unarchive
|
||||
|
||||
Unarchive a template version(s).
|
||||
|
||||
## Usage
|
||||
|
||||
```console
|
||||
coder templates versions unarchive [flags] <template-name> [template-version-names...]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### -y, --yes
|
||||
|
||||
| | |
|
||||
| ---- | ----------------- |
|
||||
| Type | <code>bool</code> |
|
||||
|
||||
Bypass prompts.
|
||||
@@ -811,6 +811,11 @@
|
||||
"description": "Manage templates",
|
||||
"path": "cli/templates.md"
|
||||
},
|
||||
{
|
||||
"title": "templates archive",
|
||||
"description": "Archive unused or failed template versions from a given template(s)",
|
||||
"path": "cli/templates_archive.md"
|
||||
},
|
||||
{
|
||||
"title": "templates create",
|
||||
"description": "Create a template from the current directory or as specified by flag",
|
||||
@@ -851,11 +856,21 @@
|
||||
"description": "Manage different versions of the specified template",
|
||||
"path": "cli/templates_versions.md"
|
||||
},
|
||||
{
|
||||
"title": "templates versions archive",
|
||||
"description": "Archive a template version(s).",
|
||||
"path": "cli/templates_versions_archive.md"
|
||||
},
|
||||
{
|
||||
"title": "templates versions list",
|
||||
"description": "List all the versions of the specified template",
|
||||
"path": "cli/templates_versions_list.md"
|
||||
},
|
||||
{
|
||||
"title": "templates versions unarchive",
|
||||
"description": "Unarchive a template version(s).",
|
||||
"path": "cli/templates_versions_unarchive.md"
|
||||
},
|
||||
{
|
||||
"title": "tokens",
|
||||
"description": "Manage personal access tokens",
|
||||
|
||||
Reference in New Issue
Block a user