Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2bbeff5

Browse files
authored
docs: applications and authorization (#5477)
* docs: Applications * WIP * WIP * WIP * Fix: consume * Fix: @description * Fix * Fix: s/none//g * Fix: godoc nice * Fix: description * Fix: It * Fix: code sample trim empty line * More fixes * Fix: br
1 parent 935bb99 commit 2bbeff5

20 files changed

+830
-231
lines changed

coderd/apidoc/docs.go

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,107 @@ const docTemplate = `{
2525
"host": "{{.Host}}",
2626
"basePath": "{{.BasePath}}",
2727
"paths": {
28+
"/applications/auth-redirect": {
29+
"get": {
30+
"security": [
31+
{
32+
"CoderSessionToken": []
33+
}
34+
],
35+
"tags": [
36+
"Applications"
37+
],
38+
"summary": "Redirect to URI with encrypted API key",
39+
"operationId": "redirect-to-uri-with-encrypted-api-key",
40+
"parameters": [
41+
{
42+
"type": "string",
43+
"description": "Redirect destination",
44+
"name": "redirect_uri",
45+
"in": "query"
46+
}
47+
],
48+
"responses": {
49+
"307": {
50+
"description": "Temporary Redirect"
51+
}
52+
}
53+
}
54+
},
55+
"/applications/host": {
56+
"get": {
57+
"security": [
58+
{
59+
"CoderSessionToken": []
60+
}
61+
],
62+
"produces": [
63+
"application/json"
64+
],
65+
"tags": [
66+
"Applications"
67+
],
68+
"summary": "Get applications host",
69+
"operationId": "get-app-host",
70+
"responses": {
71+
"200": {
72+
"description": "OK",
73+
"schema": {
74+
"$ref": "#/definitions/codersdk.GetAppHostResponse"
75+
}
76+
}
77+
}
78+
}
79+
},
80+
"/authcheck": {
81+
"post": {
82+
"security": [
83+
{
84+
"CoderSessionToken": []
85+
}
86+
],
87+
"consumes": [
88+
"application/json"
89+
],
90+
"produces": [
91+
"application/json"
92+
],
93+
"tags": [
94+
"Authorization"
95+
],
96+
"summary": "Check authorization",
97+
"operationId": "check-authorization",
98+
"parameters": [
99+
{
100+
"description": "Authorization request",
101+
"name": "request",
102+
"in": "body",
103+
"required": true,
104+
"schema": {
105+
"$ref": "#/definitions/codersdk.AuthorizationRequest"
106+
}
107+
}
108+
],
109+
"responses": {
110+
"200": {
111+
"description": "OK",
112+
"schema": {
113+
"$ref": "#/definitions/codersdk.AuthorizationResponse"
114+
}
115+
}
116+
}
117+
}
118+
},
28119
"/organizations/{organization-id}/templates/": {
29120
"post": {
30121
"security": [
31122
{
32123
"CoderSessionToken": []
33124
}
34125
],
126+
"consumes": [
127+
"application/json"
128+
],
35129
"produces": [
36130
"application/json"
37131
],
@@ -427,6 +521,9 @@ const docTemplate = `{
427521
"CoderSessionToken": []
428522
}
429523
],
524+
"consumes": [
525+
"application/json"
526+
],
430527
"produces": [
431528
"application/json"
432529
],
@@ -468,6 +565,9 @@ const docTemplate = `{
468565
"CoderSessionToken": []
469566
}
470567
],
568+
"consumes": [
569+
"application/json"
570+
],
471571
"produces": [
472572
"application/json"
473573
],
@@ -509,6 +609,9 @@ const docTemplate = `{
509609
"CoderSessionToken": []
510610
}
511611
],
612+
"consumes": [
613+
"application/json"
614+
],
512615
"produces": [
513616
"application/json"
514617
],
@@ -553,6 +656,9 @@ const docTemplate = `{
553656
"CoderSessionToken": []
554657
}
555658
],
659+
"consumes": [
660+
"application/json"
661+
],
556662
"produces": [
557663
"application/json"
558664
],
@@ -624,7 +730,67 @@ const docTemplate = `{
624730
}
625731
},
626732
"definitions": {
733+
"codersdk.AuthorizationCheck": {
734+
"description": "AuthorizationCheck is used to check if the currently authenticated user (or the specified user) can do a given action to a given set of objects.",
735+
"type": "object",
736+
"properties": {
737+
"action": {
738+
"type": "string",
739+
"enum": [
740+
"create",
741+
"read",
742+
"update",
743+
"delete"
744+
]
745+
},
746+
"object": {
747+
"description": "Object can represent a \"set\" of objects, such as:\n\t- All workspaces in an organization\n\t- All workspaces owned by me\n\t- All workspaces across the entire product\nWhen defining an object, use the most specific language when possible to\nproduce the smallest set. Meaning to set as many fields on 'Object' as\nyou can. Example, if you want to check if you can update all workspaces\nowned by 'me', try to also add an 'OrganizationID' to the settings.\nOmitting the 'OrganizationID' could produce the incorrect value, as\nworkspaces have both ` + "`" + `user` + "`" + ` and ` + "`" + `organization` + "`" + ` owners.",
748+
"$ref": "#/definitions/codersdk.AuthorizationObject"
749+
}
750+
}
751+
},
752+
"codersdk.AuthorizationObject": {
753+
"description": "AuthorizationObject can represent a \"set\" of objects, such as: all workspaces in an organization, all workspaces owned by me, all workspaces across the entire product.",
754+
"type": "object",
755+
"properties": {
756+
"organization_id": {
757+
"description": "OrganizationID (optional) adds the set constraint to all resources owned by a given organization.",
758+
"type": "string"
759+
},
760+
"owner_id": {
761+
"description": "OwnerID (optional) adds the set constraint to all resources owned by a given user.",
762+
"type": "string"
763+
},
764+
"resource_id": {
765+
"description": "ResourceID (optional) reduces the set to a singular resource. This assigns\na resource ID to the resource type, eg: a single workspace.\nThe rbac library will not fetch the resource from the database, so if you\nare using this option, you should also set the ` + "`" + `OwnerID` + "`" + ` and ` + "`" + `OrganizationID` + "`" + `\nif possible. Be as specific as possible using all the fields relevant.",
766+
"type": "string"
767+
},
768+
"resource_type": {
769+
"description": "ResourceType is the name of the resource.\n` + "`" + `./coderd/rbac/object.go` + "`" + ` has the list of valid resource types.",
770+
"type": "string"
771+
}
772+
}
773+
},
774+
"codersdk.AuthorizationRequest": {
775+
"type": "object",
776+
"properties": {
777+
"checks": {
778+
"description": "Checks is a map keyed with an arbitrary string to a permission check.\nThe key can be any string that is helpful to the caller, and allows\nmultiple permission checks to be run in a single request.\nThe key ensures that each permission check has the same key in the\nresponse.",
779+
"type": "object",
780+
"additionalProperties": {
781+
"$ref": "#/definitions/codersdk.AuthorizationCheck"
782+
}
783+
}
784+
}
785+
},
786+
"codersdk.AuthorizationResponse": {
787+
"type": "object",
788+
"additionalProperties": {
789+
"type": "boolean"
790+
}
791+
},
627792
"codersdk.CreateParameterRequest": {
793+
"description": "CreateParameterRequest is a structure used to create a new parameter value for a scope.",
628794
"type": "object",
629795
"required": [
630796
"destination_scheme",
@@ -712,6 +878,15 @@ const docTemplate = `{
712878
}
713879
}
714880
},
881+
"codersdk.GetAppHostResponse": {
882+
"type": "object",
883+
"properties": {
884+
"host": {
885+
"description": "Host is the externally accessible URL for the Coder instance.",
886+
"type": "string"
887+
}
888+
}
889+
},
715890
"codersdk.Healthcheck": {
716891
"type": "object",
717892
"properties": {

0 commit comments

Comments
 (0)