Skip to content

feat: Add workspace proxy enterprise cli commands #7123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Fix compile and make gen
  • Loading branch information
Emyrk committed Apr 17, 2023
commit 5f05cbff36de5c91d6a0bfa0ac3662a478667e45
80 changes: 38 additions & 42 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 32 additions & 3 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions coderd/httpmw/workspaceproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ func ExtractWorkspaceProxy(opts ExtractWorkspaceProxyConfig) func(http.Handler)

type workspaceProxyParamContextKey struct{}

// WorkspaceProxy returns the worksace proxy from the ExtractWorkspaceProxyParam handler.
func WorkspaceProxy(r *http.Request) database.WorkspaceProxy {
// WorkspaceProxyParam returns the worksace proxy from the ExtractWorkspaceProxyParam handler.
func WorkspaceProxyParam(r *http.Request) database.WorkspaceProxy {
user, ok := r.Context().Value(workspaceProxyParamContextKey{}).(database.WorkspaceProxy)
if !ok {
panic("developer error: workspace proxy parameter middleware not provided")
Expand Down
44 changes: 44 additions & 0 deletions docs/api/enterprise.md
Original file line number Diff line number Diff line change
Expand Up @@ -1272,3 +1272,47 @@ curl -X POST http://coder-server:8080/api/v2/workspaceproxies \
| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.WorkspaceProxy](schemas.md#codersdkworkspaceproxy) |

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

## Delete workspace proxy

### Code samples

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

`DELETE /workspaceproxies/{workspaceproxy}`

### Parameters

| Name | In | Type | Required | Description |
| ---------------- | ---- | ------------ | -------- | ---------------- |
| `workspaceproxy` | path | string(uuid) | true | Proxy ID or name |

### Example responses

> 200 Response

```json
{
"detail": "string",
"message": "string",
"validations": [
{
"detail": "string",
"field": "string"
}
]
}
```

### Responses

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

To perform this operation, you must be authenticated. [Learn more](authentication.md).
102 changes: 0 additions & 102 deletions docs/api/workspaceproxies.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,6 @@
"title": "Users",
"path": "./api/users.md"
},
{
"title": "WorkspaceProxies",
"path": "./api/workspaceproxies.md"
},
{
"title": "Workspaces",
"path": "./api/workspaces.md"
Expand Down
6 changes: 3 additions & 3 deletions enterprise/coderd/workspaceproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (

// @Summary Delete workspace proxy
// @ID delete-workspace-proxy
// @Security CoderSessionToken
// @Accept json
// @Security CoderSessionTokeny

// @Produce json
// @Tags Enterprise
// @Param workspaceproxy path string true "Proxy ID or name" format(uuid)
Expand All @@ -33,7 +33,7 @@ import (
func (api *API) deleteWorkspaceProxy(rw http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
proxy = httpmw.WorkspaceProxy(r)
proxy = httpmw.WorkspaceProxyParam(r)
auditor = api.AGPL.Auditor.Load()
aReq, commitAudit = audit.InitRequest[database.WorkspaceProxy](rw, &audit.RequestParams{
Audit: *auditor,
Expand Down
1 change: 0 additions & 1 deletion site/src/api/typesGenerated.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// From codersdk/apikey.go
export interface APIKey {
readonly id: string
Expand Down