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
SSH key
  • Loading branch information
mtojek committed Jan 9, 2023
commit 91c78f43ffb6396f03f82f946e167d4d13a77ce0
86 changes: 86 additions & 0 deletions coderd/apidoc/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,72 @@ const docTemplate = `{
}
}
},
"/users/{user}/gitsshkey": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Get user Git SSH key",
"operationId": "get-user-git-ssh-key",
"parameters": [
{
"type": "string",
"description": "User ID, name, or me",
"name": "user",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.GitSSHKey"
}
}
}
},
"put": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Regenerate user SSH key",
"operationId": "regenerate-user-ssh-key",
"parameters": [
{
"type": "string",
"description": "User ID, name, or me",
"name": "user",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.GitSSHKey"
}
}
}
}
},
"/users/{user}/keys": {
"post": {
"security": [
Expand Down Expand Up @@ -4661,6 +4727,26 @@ const docTemplate = `{
}
}
},
"codersdk.GitSSHKey": {
"type": "object",
"properties": {
"created_at": {
"type": "string",
"format": "date-time"
},
"public_key": {
"type": "string"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"user_id": {
"type": "string",
"format": "uuid"
}
}
},
"codersdk.GoogleInstanceIdentityToken": {
"type": "object",
"required": [
Expand Down
78 changes: 78 additions & 0 deletions coderd/apidoc/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,64 @@
}
}
},
"/users/{user}/gitsshkey": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Users"],
"summary": "Get user Git SSH key",
"operationId": "get-user-git-ssh-key",
"parameters": [
{
"type": "string",
"description": "User ID, name, or me",
"name": "user",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.GitSSHKey"
}
}
}
},
"put": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Users"],
"summary": "Regenerate user SSH key",
"operationId": "regenerate-user-ssh-key",
"parameters": [
{
"type": "string",
"description": "User ID, name, or me",
"name": "user",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.GitSSHKey"
}
}
}
}
},
"/users/{user}/keys": {
"post": {
"security": [
Expand Down Expand Up @@ -4172,6 +4230,26 @@
}
}
},
"codersdk.GitSSHKey": {
"type": "object",
"properties": {
"created_at": {
"type": "string",
"format": "date-time"
},
"public_key": {
"type": "string"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"user_id": {
"type": "string",
"format": "uuid"
}
}
},
"codersdk.GoogleInstanceIdentityToken": {
"type": "object",
"required": ["json_web_token"],
Expand Down
16 changes: 16 additions & 0 deletions coderd/gitsshkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import (
"github.com/coder/coder/codersdk"
)

// @Summary Regenerate user SSH key
// @ID regenerate-user-ssh-key
// @Security CoderSessionToken
// @Produce json
// @Tags Users
// @Param user path string true "User ID, name, or me"
// @Success 200 {object} codersdk.GitSSHKey
// @Router /users/{user}/gitsshkey [put]
func (api *API) regenerateGitSSHKey(rw http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
Expand Down Expand Up @@ -73,6 +81,14 @@ func (api *API) regenerateGitSSHKey(rw http.ResponseWriter, r *http.Request) {
})
}

// @Summary Get user Git SSH key
// @ID get-user-git-ssh-key
// @Security CoderSessionToken
// @Produce json
// @Tags Users
// @Param user path string true "User ID, name, or me"
// @Success 200 {object} codersdk.GitSSHKey
// @Router /users/{user}/gitsshkey [get]
func (api *API) gitSSHKey(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
user := httpmw.UserParam(r)
Expand Down
6 changes: 3 additions & 3 deletions codersdk/gitsshkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
)

type GitSSHKey struct {
UserID uuid.UUID `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
UserID uuid.UUID `json:"user_id" format:"uuid"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
PublicKey string `json:"public_key"`
}

Expand Down
20 changes: 20 additions & 0 deletions docs/api/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,26 @@ CreateParameterRequest is a structure used to create a new parameter value for a
| `type` | string | false | | |
| `validate_url` | string | false | | |

## codersdk.GitSSHKey

```json
{
"created_at": "2019-08-24T14:15:22Z",
"public_key": "string",
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| ------------ | ------ | -------- | ------------ | ----------- |
| `created_at` | string | false | | |
| `public_key` | string | false | | |
| `updated_at` | string | false | | |
| `user_id` | string | false | | |

## codersdk.GoogleInstanceIdentityToken

```json
Expand Down
80 changes: 80 additions & 0 deletions docs/api/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,86 @@ curl -X DELETE http://coder-server:8080/api/v2/users/{user} \

To perform this operation, you must be authenticated. [Learn more](authentication.md).

## Get user Git SSH key

### Code samples

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

`GET /users/{user}/gitsshkey`

### Parameters

| Name | In | Type | Required | Description |
| ------ | ---- | ------ | -------- | -------------------- |
| `user` | path | string | true | User ID, name, or me |

### Example responses

> 200 Response

```json
{
"created_at": "2019-08-24T14:15:22Z",
"public_key": "string",
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}
```

### Responses

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

To perform this operation, you must be authenticated. [Learn more](authentication.md).

## Regenerate user SSH key

### Code samples

```shell
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{user}/gitsshkey \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```

`PUT /users/{user}/gitsshkey`

### Parameters

| Name | In | Type | Required | Description |
| ------ | ---- | ------ | -------- | -------------------- |
| `user` | path | string | true | User ID, name, or me |

### Example responses

> 200 Response

```json
{
"created_at": "2019-08-24T14:15:22Z",
"public_key": "string",
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}
```

### Responses

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

To perform this operation, you must be authenticated. [Learn more](authentication.md).

## Create new session key

### Code samples
Expand Down