Skip to content

Commit c49f146

Browse files
committed
Templates
1 parent 1a1ccc4 commit c49f146

File tree

5 files changed

+843
-1
lines changed

5 files changed

+843
-1
lines changed

coderd/apidocs/docs.go

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,107 @@ const docTemplate = `{
2525
"host": "{{.Host}}",
2626
"basePath": "{{.BasePath}}",
2727
"paths": {
28+
"/organizations/{organization-id}/templates/": {
29+
"post": {
30+
"security": [
31+
{
32+
"CoderSessionToken": []
33+
}
34+
],
35+
"produces": [
36+
"application/json"
37+
],
38+
"tags": [
39+
"Templates"
40+
],
41+
"summary": "Create template by organization",
42+
"operationId": "create-template-by-organization",
43+
"parameters": [
44+
{
45+
"description": "Request body",
46+
"name": "request",
47+
"in": "body",
48+
"required": true,
49+
"schema": {
50+
"$ref": "#/definitions/codersdk.CreateTemplateRequest"
51+
}
52+
},
53+
{
54+
"type": "string",
55+
"description": "Organization ID",
56+
"name": "organization-id",
57+
"in": "path",
58+
"required": true
59+
}
60+
],
61+
"responses": {
62+
"200": {
63+
"description": "OK",
64+
"schema": {
65+
"$ref": "#/definitions/codersdk.Template"
66+
}
67+
},
68+
"404": {
69+
"description": "Not Found",
70+
"schema": {
71+
"$ref": "#/definitions/codersdk.Response"
72+
}
73+
},
74+
"500": {
75+
"description": "Internal Server Error",
76+
"schema": {
77+
"$ref": "#/definitions/codersdk.Response"
78+
}
79+
}
80+
}
81+
}
82+
},
83+
"/templates/{id}": {
84+
"get": {
85+
"security": [
86+
{
87+
"CoderSessionToken": []
88+
}
89+
],
90+
"produces": [
91+
"application/json"
92+
],
93+
"tags": [
94+
"Templates"
95+
],
96+
"summary": "Get template metadata",
97+
"operationId": "get-template",
98+
"parameters": [
99+
{
100+
"type": "string",
101+
"description": "Template ID",
102+
"name": "id",
103+
"in": "path",
104+
"required": true
105+
}
106+
],
107+
"responses": {
108+
"200": {
109+
"description": "OK",
110+
"schema": {
111+
"$ref": "#/definitions/codersdk.Template"
112+
}
113+
},
114+
"404": {
115+
"description": "Not Found",
116+
"schema": {
117+
"$ref": "#/definitions/codersdk.Response"
118+
}
119+
},
120+
"500": {
121+
"description": "Internal Server Error",
122+
"schema": {
123+
"$ref": "#/definitions/codersdk.Response"
124+
}
125+
}
126+
}
127+
}
128+
},
28129
"/workspaces": {
29130
"get": {
30131
"security": [
@@ -166,6 +267,83 @@ const docTemplate = `{
166267
}
167268
},
168269
"definitions": {
270+
"codersdk.CreateParameterRequest": {
271+
"type": "object",
272+
"required": [
273+
"destination_scheme",
274+
"name",
275+
"source_scheme",
276+
"source_value"
277+
],
278+
"properties": {
279+
"copy_from_parameter": {
280+
"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.",
281+
"type": "string"
282+
},
283+
"destination_scheme": {
284+
"type": "string",
285+
"enum": [
286+
"environment_variable",
287+
"provisioner_variable"
288+
]
289+
},
290+
"name": {
291+
"type": "string"
292+
},
293+
"source_scheme": {
294+
"type": "string",
295+
"enum": [
296+
"data"
297+
]
298+
},
299+
"source_value": {
300+
"type": "string"
301+
}
302+
}
303+
},
304+
"codersdk.CreateTemplateRequest": {
305+
"type": "object",
306+
"required": [
307+
"name",
308+
"template_version_id"
309+
],
310+
"properties": {
311+
"allow_user_cancel_workspace_jobs": {
312+
"description": "Allow users to cancel in-progress workspace jobs.\n*bool as the default value is \"true\".",
313+
"type": "boolean"
314+
},
315+
"default_ttl_ms": {
316+
"description": "DefaultTTLMillis allows optionally specifying the default TTL\nfor all workspaces created from this template.",
317+
"type": "integer"
318+
},
319+
"description": {
320+
"description": "Description is a description of what the template contains. It must be\nless than 128 bytes.",
321+
"type": "string"
322+
},
323+
"display_name": {
324+
"description": "DisplayName is the displayed name of the template.",
325+
"type": "string"
326+
},
327+
"icon": {
328+
"description": "Icon is a relative path or external URL that specifies\nan icon to be displayed in the dashboard.",
329+
"type": "string"
330+
},
331+
"name": {
332+
"description": "Name is the name of the template.",
333+
"type": "string"
334+
},
335+
"parameter_values": {
336+
"type": "array",
337+
"items": {
338+
"$ref": "#/definitions/codersdk.CreateParameterRequest"
339+
}
340+
},
341+
"template_version_id": {
342+
"description": "VersionID is an in-progress or completed job to use as an initial version\nof the template.\n\nThis is required on creation to enable a user-flow of validating a\ntemplate works. There is no reason the data-model cannot support empty\ntemplates, but it doesn't make sense for users.",
343+
"type": "string"
344+
}
345+
}
346+
},
169347
"codersdk.DERPRegion": {
170348
"type": "object",
171349
"properties": {
@@ -264,6 +442,80 @@ const docTemplate = `{
264442
}
265443
}
266444
},
445+
"codersdk.Template": {
446+
"type": "object",
447+
"properties": {
448+
"active_user_count": {
449+
"description": "ActiveUserCount is set to -1 when loading.",
450+
"type": "integer"
451+
},
452+
"active_version_id": {
453+
"type": "string"
454+
},
455+
"allow_user_cancel_workspace_jobs": {
456+
"type": "boolean"
457+
},
458+
"build_time_stats": {
459+
"$ref": "#/definitions/codersdk.TemplateBuildTimeStats"
460+
},
461+
"created_at": {
462+
"type": "string"
463+
},
464+
"created_by_id": {
465+
"type": "string"
466+
},
467+
"created_by_name": {
468+
"type": "string"
469+
},
470+
"default_ttl_ms": {
471+
"type": "integer"
472+
},
473+
"description": {
474+
"type": "string"
475+
},
476+
"display_name": {
477+
"type": "string"
478+
},
479+
"icon": {
480+
"type": "string"
481+
},
482+
"id": {
483+
"type": "string"
484+
},
485+
"name": {
486+
"type": "string"
487+
},
488+
"organization_id": {
489+
"type": "string"
490+
},
491+
"provisioner": {
492+
"type": "string"
493+
},
494+
"updated_at": {
495+
"type": "string"
496+
},
497+
"workspace_owner_count": {
498+
"type": "integer"
499+
}
500+
}
501+
},
502+
"codersdk.TemplateBuildTimeStats": {
503+
"type": "object",
504+
"additionalProperties": {
505+
"$ref": "#/definitions/codersdk.TransitionStats"
506+
}
507+
},
508+
"codersdk.TransitionStats": {
509+
"type": "object",
510+
"properties": {
511+
"p50": {
512+
"type": "integer"
513+
},
514+
"p95": {
515+
"type": "integer"
516+
}
517+
}
518+
},
267519
"codersdk.ValidationError": {
268520
"type": "object",
269521
"required": [

0 commit comments

Comments
 (0)