Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
a3fbe72
docs: audit, deploymentconfig, files, parameters
mtojek Dec 22, 2022
fbe1d70
Swagger comments in workspacebuilds.go
mtojek Jan 2, 2023
96daf47
structs in workspacebuilds.go
mtojek Jan 2, 2023
663ec87
workspaceagents: instance identity
mtojek Jan 2, 2023
fc00d7e
workspaceagents.go in progress
mtojek Jan 2, 2023
67a85b9
workspaceagents.go in progress
mtojek Jan 2, 2023
ce8c7ea
Agents
mtojek Jan 2, 2023
d2a9af5
workspacebuilds.go
mtojek Jan 2, 2023
f37c6b3
/workspaces
mtojek Jan 3, 2023
250982a
templates.go, templateversions.go
mtojek Jan 3, 2023
ff622a7
templateversion.go in progress
mtojek Jan 3, 2023
9dd385c
cancel
mtojek Jan 3, 2023
f96351a
templateversions
mtojek Jan 3, 2023
15de3b6
wip
mtojek Jan 3, 2023
596cdbd
Merge branch 'main' into 3522-workspacebuilds-1
mtojek Jan 3, 2023
eb4ba48
Merge
mtojek Jan 3, 2023
e314c24
x-apidocgen
mtojek Jan 4, 2023
97cd7ac
NullTime hack not needed anymore
mtojek Jan 4, 2023
ae06598
Fix: x-apidocgen
mtojek Jan 4, 2023
c82eb01
Merge branch '3522-workspacebuilds-1' into 3522-templates-1
mtojek Jan 4, 2023
77815d3
Merge branch '3522-templates-1' into 3522-organizations-1
mtojek Jan 4, 2023
7aa0f65
Members
mtojek Jan 4, 2023
b93398e
Fixes
mtojek Jan 4, 2023
5c96bd5
Fix
mtojek Jan 4, 2023
4667f07
WIP
mtojek Jan 5, 2023
0cd9c4a
Merge branch 'main' into 3522-templates-1
mtojek Jan 5, 2023
5405c0c
WIP
mtojek Jan 9, 2023
801cad1
Merge branch '3522-users-1' into 3522-organizations-1
mtojek Jan 9, 2023
0dc1d2a
Users
mtojek Jan 9, 2023
9285425
Logout
mtojek Jan 9, 2023
6979a7f
User profile
mtojek Jan 9, 2023
62a26f9
Status suspend activate
mtojek Jan 9, 2023
b1f389b
User roles
mtojek Jan 9, 2023
14a1654
User tokens
mtojek Jan 9, 2023
5c22629
Keys
mtojek Jan 9, 2023
91c78f4
SSH key
mtojek Jan 9, 2023
c06a636
All
mtojek Jan 9, 2023
ee6dbb1
Typo
mtojek Jan 9, 2023
8f22f8d
Fix
mtojek Jan 9, 2023
77be926
Entitlements
mtojek Jan 9, 2023
4fcedb0
Groups
mtojek Jan 9, 2023
35eae4e
SCIM
mtojek Jan 9, 2023
a7f6add
Fix
mtojek Jan 9, 2023
0f9b0f6
Merge branch 'main' into 3522-enterprise-1
mtojek Jan 9, 2023
3ecfad7
Fix
mtojek Jan 9, 2023
05b6a98
Clean templates
mtojek Jan 9, 2023
03d9e9a
Merge branch 'main' into 3522-enterprise-1
mtojek Jan 11, 2023
1ebf408
Sort API pages
mtojek Jan 11, 2023
c2977cf
Fix: HashedSecret
mtojek Jan 11, 2023
cbacf76
WIP
mtojek Jan 11, 2023
08f1f26
Merge branch 'main' into 3522-validation
mtojek Jan 11, 2023
b23edb4
WIP
mtojek Jan 11, 2023
2f70137
WIP
mtojek Jan 12, 2023
33d93d6
Fix: cover workspaceagents
mtojek Jan 12, 2023
76701b8
Assert: consistent ID and summary
mtojek Jan 12, 2023
7165276
Assert: success or failure defined
mtojek Jan 12, 2023
12e502a
Fix: parallel
mtojek Jan 12, 2023
b501822
Refactor
mtojek Jan 12, 2023
1d30352
Support enterprise
mtojek Jan 12, 2023
9272c01
Go comment goes to top
mtojek Jan 12, 2023
38b6dad
Security
mtojek Jan 12, 2023
a565c15
assertPathParametersDefined
mtojek Jan 12, 2023
1bc8556
assertUniqueRoutes
mtojek Jan 12, 2023
d0964f9
assertRequestBody
mtojek Jan 12, 2023
b2d838f
More fixes
mtojek Jan 12, 2023
182419a
Fix: exceptions
mtojek Jan 12, 2023
cb78089
Fix field format
mtojek Jan 12, 2023
fa2d030
Address PR comments
mtojek Jan 13, 2023
ecb2d5a
Refactor
mtojek Jan 13, 2023
47b6d3e
Merge branch 'main' into 3522-validation
mtojek Jan 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Entitlements
  • Loading branch information
mtojek committed Jan 9, 2023
commit 77be926a08b44e3711c84a36b239ac0fc48825bf
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/me
cd site
yarn run format:write:only ../docs/admin/prometheus.md

coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen -not \( -path './scripts/apidocgen/node_modules' -prune \) -type f) $(wildcard coderd/*.go) $(wildcard codersdk/*.go) .swaggo
coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen -not \( -path './scripts/apidocgen/node_modules' -prune \) -type f) $(wildcard coderd/*.go) $(wildcard enterprise/coderd/*.go) $(wildcard codersdk/*.go) .swaggo
./scripts/apidocgen/generate.sh
cd site
yarn run format:write:only ../docs/api ../docs/manifest.json ../coderd/apidoc/swagger.json
Expand Down
74 changes: 74 additions & 0 deletions coderd/apidoc/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,31 @@ const docTemplate = `{
}
}
},
"/entitlements": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Enterprise"
],
"summary": "Get entitlements",
"operationId": "get-entitlements",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.Entitlements"
}
}
}
}
},
"/files": {
"post": {
"security": [
Expand Down Expand Up @@ -4788,6 +4813,55 @@ const docTemplate = `{
}
}
},
"codersdk.Entitlements": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"type": "string"
}
},
"experimental": {
"type": "boolean"
},
"features": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/codersdk.Feature"
}
},
"has_license": {
"type": "boolean"
},
"trial": {
"type": "boolean"
},
"warnings": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"codersdk.Feature": {
"type": "object",
"properties": {
"actual": {
"type": "integer"
},
"enabled": {
"type": "boolean"
},
"entitlement": {
"type": "string"
},
"limit": {
"type": "integer"
}
}
},
"codersdk.GenerateAPIKeyResponse": {
"type": "object",
"properties": {
Expand Down
70 changes: 70 additions & 0 deletions coderd/apidoc/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,27 @@
}
}
},
"/entitlements": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Enterprise"],
"summary": "Get entitlements",
"operationId": "get-entitlements",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.Entitlements"
}
}
}
}
},
"/files": {
"post": {
"security": [
Expand Down Expand Up @@ -4279,6 +4300,55 @@
}
}
},
"codersdk.Entitlements": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"type": "string"
}
},
"experimental": {
"type": "boolean"
},
"features": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/codersdk.Feature"
}
},
"has_license": {
"type": "boolean"
},
"trial": {
"type": "boolean"
},
"warnings": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"codersdk.Feature": {
"type": "object",
"properties": {
"actual": {
"type": "integer"
},
"enabled": {
"type": "boolean"
},
"entitlement": {
"type": "string"
},
"limit": {
"type": "integer"
}
}
},
"codersdk.GenerateAPIKeyResponse": {
"type": "object",
"properties": {
Expand Down
52 changes: 52 additions & 0 deletions docs/api/enterprise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Enterprise

> This page is incomplete, stay tuned.

## Get entitlements

### Code samples

```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/entitlements \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```

`GET /entitlements`

### Example responses

> 200 Response

```json
{
"errors": ["string"],
"experimental": true,
"features": {
"property1": {
"actual": 0,
"enabled": true,
"entitlement": "string",
"limit": 0
},
"property2": {
"actual": 0,
"enabled": true,
"entitlement": "string",
"limit": 0
}
},
"has_license": true,
"trial": true,
"warnings": ["string"]
}
```

### Responses

| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | -------------------------------------------------------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Entitlements](schemas.md#codersdkentitlements) |

To perform this operation, you must be authenticated. [Learn more](authentication.md).
58 changes: 58 additions & 0 deletions docs/api/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,64 @@ CreateParameterRequest is a structure used to create a new parameter value for a
| `usage` | string | false | | |
| `value` | integer | false | | |

## codersdk.Entitlements

```json
{
"errors": ["string"],
"experimental": true,
"features": {
"property1": {
"actual": 0,
"enabled": true,
"entitlement": "string",
"limit": 0
},
"property2": {
"actual": 0,
"enabled": true,
"entitlement": "string",
"limit": 0
}
},
"has_license": true,
"trial": true,
"warnings": ["string"]
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| ------------------ | ------------------------------------ | -------- | ------------ | ----------- |
| `errors` | array of string | false | | |
| `experimental` | boolean | false | | |
| `features` | object | false | | |
| » `[any property]` | [codersdk.Feature](#codersdkfeature) | false | | |
| `has_license` | boolean | false | | |
| `trial` | boolean | false | | |
| `warnings` | array of string | false | | |

## codersdk.Feature

```json
{
"actual": 0,
"enabled": true,
"entitlement": "string",
"limit": 0
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| ------------- | ------- | -------- | ------------ | ----------- |
| `actual` | integer | false | | |
| `enabled` | boolean | false | | |
| `entitlement` | string | false | | |
| `limit` | integer | false | | |

## codersdk.GenerateAPIKeyResponse

```json
Expand Down
4 changes: 4 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@
"title": "Authorization",
"path": "./api/authorization.md"
},
{
"title": "Enterprise",
"path": "./api/enterprise.md"
},
{
"title": "Files",
"path": "./api/files.md"
Expand Down
7 changes: 7 additions & 0 deletions enterprise/coderd/coderd.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,13 @@ func (api *API) updateEntitlements(ctx context.Context) error {
return nil
}

// @Summary Get entitlements
// @ID get-entitlements
// @Security CoderSessionToken
// @Produce json
// @Tags Enterprise
// @Success 200 {object} codersdk.Entitlements
// @Router /entitlements [get]
func (api *API) serveEntitlements(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
api.entitlementsMu.RLock()
Expand Down
2 changes: 1 addition & 1 deletion scripts/apidocgen/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ log "Use temporary file: ${API_MD_TMP_FILE}"
pushd "${PROJECT_ROOT}"
go run github.com/swaggo/swag/cmd/swag@v1.8.6 init \
--generalInfo="coderd.go" \
--dir="./coderd,./codersdk" \
--dir="./coderd,./codersdk,./enterprise/coderd" \
--output="./coderd/apidoc" \
--outputTypes="go,json" \
--parseDependency=true
Expand Down