Skip to content

Commit b43e6c3

Browse files
committed
GetWorkspaces
1 parent dab3704 commit b43e6c3

File tree

3 files changed

+329
-0
lines changed

3 files changed

+329
-0
lines changed

coderd/apidocs/docs.go

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,81 @@ const docTemplate = `{
2525
"host": "{{.Host}}",
2626
"basePath": "{{.BasePath}}",
2727
"paths": {
28+
"/workspaces": {
29+
"get": {
30+
"security": [
31+
{
32+
"CoderSessionToken": []
33+
}
34+
],
35+
"produces": [
36+
"application/json"
37+
],
38+
"tags": [
39+
"Workspaces"
40+
],
41+
"summary": "List workspaces.",
42+
"operationId": "get-workspaces",
43+
"parameters": [
44+
{
45+
"type": "string",
46+
"description": "Owner username",
47+
"name": "owner",
48+
"in": "query"
49+
},
50+
{
51+
"type": "string",
52+
"description": "Template name",
53+
"name": "template",
54+
"in": "query"
55+
},
56+
{
57+
"type": "string",
58+
"description": "Workspace name",
59+
"name": "name",
60+
"in": "query"
61+
},
62+
{
63+
"type": "string",
64+
"description": "Workspace status",
65+
"name": "status",
66+
"in": "query"
67+
},
68+
{
69+
"type": "boolean",
70+
"description": "Deleted workspaces",
71+
"name": "deleted",
72+
"in": "query"
73+
},
74+
{
75+
"type": "boolean",
76+
"description": "Has agent",
77+
"name": "has_agent",
78+
"in": "query"
79+
}
80+
],
81+
"responses": {
82+
"200": {
83+
"description": "OK",
84+
"schema": {
85+
"$ref": "#/definitions/codersdk.WorkspacesResponse"
86+
}
87+
},
88+
"400": {
89+
"description": "Bad Request",
90+
"schema": {
91+
"$ref": "#/definitions/codersdk.Response"
92+
}
93+
},
94+
"500": {
95+
"description": "Internal Server Error",
96+
"schema": {
97+
"$ref": "#/definitions/codersdk.Response"
98+
}
99+
}
100+
}
101+
}
102+
},
28103
"/workspaces/{id}": {
29104
"get": {
30105
"security": [
@@ -47,6 +122,12 @@ const docTemplate = `{
47122
"name": "id",
48123
"in": "path",
49124
"required": true
125+
},
126+
{
127+
"type": "string",
128+
"description": "Include deleted",
129+
"name": "include_deleted",
130+
"in": "query"
50131
}
51132
],
52133
"responses": {
@@ -55,6 +136,30 @@ const docTemplate = `{
55136
"schema": {
56137
"$ref": "#/definitions/codersdk.Workspace"
57138
}
139+
},
140+
"400": {
141+
"description": "Bad Request",
142+
"schema": {
143+
"$ref": "#/definitions/codersdk.Response"
144+
}
145+
},
146+
"404": {
147+
"description": "Not Found",
148+
"schema": {
149+
"$ref": "#/definitions/codersdk.Response"
150+
}
151+
},
152+
"410": {
153+
"description": "Gone",
154+
"schema": {
155+
"$ref": "#/definitions/codersdk.Response"
156+
}
157+
},
158+
"500": {
159+
"description": "Internal Server Error",
160+
"schema": {
161+
"$ref": "#/definitions/codersdk.Response"
162+
}
58163
}
59164
}
60165
}
@@ -139,6 +244,41 @@ const docTemplate = `{
139244
}
140245
}
141246
},
247+
"codersdk.Response": {
248+
"type": "object",
249+
"properties": {
250+
"detail": {
251+
"description": "Detail is a debug message that provides further insight into why the\naction failed. This information can be technical and a regular golang\nerr.Error() text.\n- \"database: too many open connections\"\n- \"stat: too many open files\"",
252+
"type": "string"
253+
},
254+
"message": {
255+
"description": "Message is an actionable message that depicts actions the request took.\nThese messages should be fully formed sentences with proper punctuation.\nExamples:\n- \"A user has been created.\"\n- \"Failed to create a user.\"",
256+
"type": "string"
257+
},
258+
"validations": {
259+
"description": "Validations are form field-specific friendly error messages. They will be\nshown on a form field in the UI. These can also be used to add additional\ncontext if there is a set of errors in the primary 'Message'.",
260+
"type": "array",
261+
"items": {
262+
"$ref": "#/definitions/codersdk.ValidationError"
263+
}
264+
}
265+
}
266+
},
267+
"codersdk.ValidationError": {
268+
"type": "object",
269+
"required": [
270+
"detail",
271+
"field"
272+
],
273+
"properties": {
274+
"detail": {
275+
"type": "string"
276+
},
277+
"field": {
278+
"type": "string"
279+
}
280+
}
281+
},
142282
"codersdk.Workspace": {
143283
"type": "object",
144284
"properties": {
@@ -426,6 +566,20 @@ const docTemplate = `{
426566
"type": "string"
427567
}
428568
}
569+
},
570+
"codersdk.WorkspacesResponse": {
571+
"type": "object",
572+
"properties": {
573+
"count": {
574+
"type": "integer"
575+
},
576+
"workspaces": {
577+
"type": "array",
578+
"items": {
579+
"$ref": "#/definitions/codersdk.Workspace"
580+
}
581+
}
582+
}
429583
}
430584
},
431585
"securityDefinitions": {

coderd/apidocs/swagger.json

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,81 @@
1717
},
1818
"basePath": "/api/v2",
1919
"paths": {
20+
"/workspaces": {
21+
"get": {
22+
"security": [
23+
{
24+
"CoderSessionToken": []
25+
}
26+
],
27+
"produces": [
28+
"application/json"
29+
],
30+
"tags": [
31+
"Workspaces"
32+
],
33+
"summary": "List workspaces.",
34+
"operationId": "get-workspaces",
35+
"parameters": [
36+
{
37+
"type": "string",
38+
"description": "Owner username",
39+
"name": "owner",
40+
"in": "query"
41+
},
42+
{
43+
"type": "string",
44+
"description": "Template name",
45+
"name": "template",
46+
"in": "query"
47+
},
48+
{
49+
"type": "string",
50+
"description": "Workspace name",
51+
"name": "name",
52+
"in": "query"
53+
},
54+
{
55+
"type": "string",
56+
"description": "Workspace status",
57+
"name": "status",
58+
"in": "query"
59+
},
60+
{
61+
"type": "boolean",
62+
"description": "Deleted workspaces",
63+
"name": "deleted",
64+
"in": "query"
65+
},
66+
{
67+
"type": "boolean",
68+
"description": "Has agent",
69+
"name": "has_agent",
70+
"in": "query"
71+
}
72+
],
73+
"responses": {
74+
"200": {
75+
"description": "OK",
76+
"schema": {
77+
"$ref": "#/definitions/codersdk.WorkspacesResponse"
78+
}
79+
},
80+
"400": {
81+
"description": "Bad Request",
82+
"schema": {
83+
"$ref": "#/definitions/codersdk.Response"
84+
}
85+
},
86+
"500": {
87+
"description": "Internal Server Error",
88+
"schema": {
89+
"$ref": "#/definitions/codersdk.Response"
90+
}
91+
}
92+
}
93+
}
94+
},
2095
"/workspaces/{id}": {
2196
"get": {
2297
"security": [
@@ -39,6 +114,12 @@
39114
"name": "id",
40115
"in": "path",
41116
"required": true
117+
},
118+
{
119+
"type": "string",
120+
"description": "Include deleted",
121+
"name": "include_deleted",
122+
"in": "query"
42123
}
43124
],
44125
"responses": {
@@ -47,6 +128,30 @@
47128
"schema": {
48129
"$ref": "#/definitions/codersdk.Workspace"
49130
}
131+
},
132+
"400": {
133+
"description": "Bad Request",
134+
"schema": {
135+
"$ref": "#/definitions/codersdk.Response"
136+
}
137+
},
138+
"404": {
139+
"description": "Not Found",
140+
"schema": {
141+
"$ref": "#/definitions/codersdk.Response"
142+
}
143+
},
144+
"410": {
145+
"description": "Gone",
146+
"schema": {
147+
"$ref": "#/definitions/codersdk.Response"
148+
}
149+
},
150+
"500": {
151+
"description": "Internal Server Error",
152+
"schema": {
153+
"$ref": "#/definitions/codersdk.Response"
154+
}
50155
}
51156
}
52157
}
@@ -131,6 +236,41 @@
131236
}
132237
}
133238
},
239+
"codersdk.Response": {
240+
"type": "object",
241+
"properties": {
242+
"detail": {
243+
"description": "Detail is a debug message that provides further insight into why the\naction failed. This information can be technical and a regular golang\nerr.Error() text.\n- \"database: too many open connections\"\n- \"stat: too many open files\"",
244+
"type": "string"
245+
},
246+
"message": {
247+
"description": "Message is an actionable message that depicts actions the request took.\nThese messages should be fully formed sentences with proper punctuation.\nExamples:\n- \"A user has been created.\"\n- \"Failed to create a user.\"",
248+
"type": "string"
249+
},
250+
"validations": {
251+
"description": "Validations are form field-specific friendly error messages. They will be\nshown on a form field in the UI. These can also be used to add additional\ncontext if there is a set of errors in the primary 'Message'.",
252+
"type": "array",
253+
"items": {
254+
"$ref": "#/definitions/codersdk.ValidationError"
255+
}
256+
}
257+
}
258+
},
259+
"codersdk.ValidationError": {
260+
"type": "object",
261+
"required": [
262+
"detail",
263+
"field"
264+
],
265+
"properties": {
266+
"detail": {
267+
"type": "string"
268+
},
269+
"field": {
270+
"type": "string"
271+
}
272+
}
273+
},
134274
"codersdk.Workspace": {
135275
"type": "object",
136276
"properties": {
@@ -418,6 +558,20 @@
418558
"type": "string"
419559
}
420560
}
561+
},
562+
"codersdk.WorkspacesResponse": {
563+
"type": "object",
564+
"properties": {
565+
"count": {
566+
"type": "integer"
567+
},
568+
"workspaces": {
569+
"type": "array",
570+
"items": {
571+
"$ref": "#/definitions/codersdk.Workspace"
572+
}
573+
}
574+
}
421575
}
422576
},
423577
"securityDefinitions": {

0 commit comments

Comments
 (0)