Skip to content

Commit 9dd385c

Browse files
committed
cancel
1 parent ff622a7 commit 9dd385c

File tree

6 files changed

+271
-58
lines changed

6 files changed

+271
-58
lines changed

coderd/apidoc/docs.go

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,41 @@ const docTemplate = `{
10061006
}
10071007
}
10081008
},
1009+
"/templateversions/{id}/cancel": {
1010+
"patch": {
1011+
"security": [
1012+
{
1013+
"CoderSessionToken": []
1014+
}
1015+
],
1016+
"produces": [
1017+
"application/json"
1018+
],
1019+
"tags": [
1020+
"Templates"
1021+
],
1022+
"summary": "Cancel template version by ID",
1023+
"operationId": "cancel-template-version-by-id",
1024+
"parameters": [
1025+
{
1026+
"type": "string",
1027+
"format": "uuid",
1028+
"description": "Template version ID",
1029+
"name": "id",
1030+
"in": "path",
1031+
"required": true
1032+
}
1033+
],
1034+
"responses": {
1035+
"200": {
1036+
"description": "OK",
1037+
"schema": {
1038+
"$ref": "#/definitions/codersdk.Response"
1039+
}
1040+
}
1041+
}
1042+
}
1043+
},
10091044
"/templateversions/{id}/schema": {
10101045
"get": {
10111046
"security": [
@@ -1019,8 +1054,8 @@ const docTemplate = `{
10191054
"tags": [
10201055
"Templates"
10211056
],
1022-
"summary": "Get template version schema by template version ID",
1023-
"operationId": "get-template-version-schema-by-template-version-id",
1057+
"summary": "Get template version schema by ID",
1058+
"operationId": "get-template-version-schema-by-id",
10241059
"parameters": [
10251060
{
10261061
"type": "string",
@@ -1037,7 +1072,7 @@ const docTemplate = `{
10371072
"schema": {
10381073
"type": "array",
10391074
"items": {
1040-
"$ref": "#/definitions/codersdk.ParameterSchema"
1075+
"$ref": "#/definitions/parameter.ComputedValue"
10411076
}
10421077
}
10431078
}
@@ -4057,6 +4092,44 @@ const docTemplate = `{
40574092
"netip.Addr": {
40584093
"type": "object"
40594094
},
4095+
"parameter.ComputedValue": {
4096+
"type": "object",
4097+
"properties": {
4098+
"created_at": {
4099+
"type": "string"
4100+
},
4101+
"default_source_value": {
4102+
"type": "boolean"
4103+
},
4104+
"destination_scheme": {
4105+
"type": "string"
4106+
},
4107+
"id": {
4108+
"type": "string"
4109+
},
4110+
"name": {
4111+
"type": "string"
4112+
},
4113+
"schema_id": {
4114+
"type": "string"
4115+
},
4116+
"scope": {
4117+
"type": "string"
4118+
},
4119+
"scope_id": {
4120+
"type": "string"
4121+
},
4122+
"source_scheme": {
4123+
"type": "string"
4124+
},
4125+
"source_value": {
4126+
"type": "string"
4127+
},
4128+
"updated_at": {
4129+
"type": "string"
4130+
}
4131+
}
4132+
},
40604133
"tailcfg.DERPMap": {
40614134
"type": "object",
40624135
"properties": {

coderd/apidoc/swagger.json

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,37 @@
874874
}
875875
}
876876
},
877+
"/templateversions/{id}/cancel": {
878+
"patch": {
879+
"security": [
880+
{
881+
"CoderSessionToken": []
882+
}
883+
],
884+
"produces": ["application/json"],
885+
"tags": ["Templates"],
886+
"summary": "Cancel template version by ID",
887+
"operationId": "cancel-template-version-by-id",
888+
"parameters": [
889+
{
890+
"type": "string",
891+
"format": "uuid",
892+
"description": "Template version ID",
893+
"name": "id",
894+
"in": "path",
895+
"required": true
896+
}
897+
],
898+
"responses": {
899+
"200": {
900+
"description": "OK",
901+
"schema": {
902+
"$ref": "#/definitions/codersdk.Response"
903+
}
904+
}
905+
}
906+
}
907+
},
877908
"/templateversions/{id}/schema": {
878909
"get": {
879910
"security": [
@@ -883,8 +914,8 @@
883914
],
884915
"produces": ["application/json"],
885916
"tags": ["Templates"],
886-
"summary": "Get template version schema by template version ID",
887-
"operationId": "get-template-version-schema-by-template-version-id",
917+
"summary": "Get template version schema by ID",
918+
"operationId": "get-template-version-schema-by-id",
888919
"parameters": [
889920
{
890921
"type": "string",
@@ -901,7 +932,7 @@
901932
"schema": {
902933
"type": "array",
903934
"items": {
904-
"$ref": "#/definitions/codersdk.ParameterSchema"
935+
"$ref": "#/definitions/parameter.ComputedValue"
905936
}
906937
}
907938
}
@@ -3702,6 +3733,44 @@
37023733
"netip.Addr": {
37033734
"type": "object"
37043735
},
3736+
"parameter.ComputedValue": {
3737+
"type": "object",
3738+
"properties": {
3739+
"created_at": {
3740+
"type": "string"
3741+
},
3742+
"default_source_value": {
3743+
"type": "boolean"
3744+
},
3745+
"destination_scheme": {
3746+
"type": "string"
3747+
},
3748+
"id": {
3749+
"type": "string"
3750+
},
3751+
"name": {
3752+
"type": "string"
3753+
},
3754+
"schema_id": {
3755+
"type": "string"
3756+
},
3757+
"scope": {
3758+
"type": "string"
3759+
},
3760+
"scope_id": {
3761+
"type": "string"
3762+
},
3763+
"source_scheme": {
3764+
"type": "string"
3765+
},
3766+
"source_value": {
3767+
"type": "string"
3768+
},
3769+
"updated_at": {
3770+
"type": "string"
3771+
}
3772+
}
3773+
},
37053774
"tailcfg.DERPMap": {
37063775
"type": "object",
37073776
"properties": {

coderd/coderd.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ func New(options *Options) *API {
409409
apiKeyMiddleware,
410410
httpmw.ExtractTemplateVersionParam(options.Database),
411411
)
412-
413412
r.Get("/", api.templateVersion)
414413
r.Patch("/cancel", api.patchCancelTemplateVersion)
415414
r.Get("/schema", api.templateVersionSchema)

coderd/templateversions.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ func (api *API) templateVersion(rw http.ResponseWriter, r *http.Request) {
6969
httpapi.Write(ctx, rw, http.StatusOK, convertTemplateVersion(templateVersion, convertProvisionerJob(job), user))
7070
}
7171

72+
// @Summary Cancel template version by ID
73+
// @ID cancel-template-version-by-id
74+
// @Security CoderSessionToken
75+
// @Produce json
76+
// @Tags Templates
77+
// @Param id path string true "Template version ID" format(uuid)
78+
// @Success 200 {object} codersdk.Response
79+
// @Router /templateversions/{id}/cancel [patch]
7280
func (api *API) patchCancelTemplateVersion(rw http.ResponseWriter, r *http.Request) {
7381
ctx := r.Context()
7482
var (
@@ -184,6 +192,14 @@ func (api *API) templateVersionSchema(rw http.ResponseWriter, r *http.Request) {
184192
httpapi.Write(ctx, rw, http.StatusOK, apiSchemas)
185193
}
186194

195+
// @Summary Get template version schema by ID
196+
// @ID get-template-version-schema-by-id
197+
// @Security CoderSessionToken
198+
// @Produce json
199+
// @Tags Templates
200+
// @Param id path string true "Template version ID" format(uuid)
201+
// @Success 200 {array} parameter.ComputedValue
202+
// @Router /templateversions/{id}/schema [get]
187203
func (api *API) templateVersionParameters(rw http.ResponseWriter, r *http.Request) {
188204
ctx := r.Context()
189205
var (

docs/api/schemas.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4061,6 +4061,40 @@ Parameter represents a set value for the scope.
40614061

40624062
_None_
40634063

4064+
## parameter.ComputedValue
4065+
4066+
```json
4067+
{
4068+
"created_at": "string",
4069+
"default_source_value": true,
4070+
"destination_scheme": "string",
4071+
"id": "string",
4072+
"name": "string",
4073+
"schema_id": "string",
4074+
"scope": "string",
4075+
"scope_id": "string",
4076+
"source_scheme": "string",
4077+
"source_value": "string",
4078+
"updated_at": "string"
4079+
}
4080+
```
4081+
4082+
### Properties
4083+
4084+
| Name | Type | Required | Restrictions | Description |
4085+
| ---------------------- | ------- | -------- | ------------ | ----------- |
4086+
| `created_at` | string | false | | |
4087+
| `default_source_value` | boolean | false | | |
4088+
| `destination_scheme` | string | false | | |
4089+
| `id` | string | false | | |
4090+
| `name` | string | false | | |
4091+
| `schema_id` | string | false | | |
4092+
| `scope` | string | false | | |
4093+
| `scope_id` | string | false | | |
4094+
| `source_scheme` | string | false | | |
4095+
| `source_value` | string | false | | |
4096+
| `updated_at` | string | false | | |
4097+
40644098
## tailcfg.DERPMap
40654099

40664100
```json

0 commit comments

Comments
 (0)