diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index f2a7dd2dee7a2..16e72d23e1eb5 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -10192,8 +10192,8 @@ const docTemplate = `{ "tags": [ "PortSharing" ], - "summary": "Get workspace agent port shares", - "operationId": "get-workspace-agent-port-shares", + "summary": "Delete workspace agent port share", + "operationId": "delete-workspace-agent-port-share", "parameters": [ { "type": "string", diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 74b5aad0afed5..cf4a96ddcb49f 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -9021,8 +9021,8 @@ ], "consumes": ["application/json"], "tags": ["PortSharing"], - "summary": "Get workspace agent port shares", - "operationId": "get-workspace-agent-port-shares", + "summary": "Delete workspace agent port share", + "operationId": "delete-workspace-agent-port-share", "parameters": [ { "type": "string", diff --git a/coderd/workspaceagentportshare.go b/coderd/workspaceagentportshare.go index b29f6baa2737c..c59825a2f32ca 100644 --- a/coderd/workspaceagentportshare.go +++ b/coderd/workspaceagentportshare.go @@ -135,8 +135,8 @@ func (api *API) workspaceAgentPortShares(rw http.ResponseWriter, r *http.Request }) } -// @Summary Get workspace agent port shares -// @ID get-workspace-agent-port-shares +// @Summary Delete workspace agent port share +// @ID delete-workspace-agent-port-share // @Security CoderSessionToken // @Accept json // @Tags PortSharing diff --git a/docs/reference/api/portsharing.md b/docs/reference/api/portsharing.md index 782d6012c9f12..d143e5e2ea14a 100644 --- a/docs/reference/api/portsharing.md +++ b/docs/reference/api/portsharing.md @@ -6,34 +6,42 @@ ```shell # Example request using curl -curl -X DELETE http://coder-server:8080/api/v2/workspaces/{workspace}/port-share \ - -H 'Content-Type: application/json' \ +curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace}/port-share \ + -H 'Accept: application/json' \ -H 'Coder-Session-Token: API_KEY' ``` -`DELETE /workspaces/{workspace}/port-share` +`GET /workspaces/{workspace}/port-share` -> Body parameter +### Parameters + +| Name | In | Type | Required | Description | +|-------------|------|--------------|----------|--------------| +| `workspace` | path | string(uuid) | true | Workspace ID | + +### Example responses + +> 200 Response ```json { - "agent_name": "string", - "port": 0 + "shares": [ + { + "agent_name": "string", + "port": 0, + "protocol": "http", + "share_level": "owner", + "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9" + } + ] } ``` -### Parameters - -| Name | In | Type | Required | Description | -|-------------|------|----------------------------------------------------------------------------------------------------------|----------|-----------------------------------| -| `workspace` | path | string(uuid) | true | Workspace ID | -| `body` | body | [codersdk.DeleteWorkspaceAgentPortShareRequest](schemas.md#codersdkdeleteworkspaceagentportsharerequest) | true | Delete port sharing level request | - ### Responses -| Status | Meaning | Description | Schema | -|--------|---------------------------------------------------------|-------------|--------| -| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | | +| Status | Meaning | Description | Schema | +|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------| +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.WorkspaceAgentPortShares](schemas.md#codersdkworkspaceagentportshares) | To perform this operation, you must be authenticated. [Learn more](authentication.md). @@ -90,3 +98,40 @@ curl -X POST http://coder-server:8080/api/v2/workspaces/{workspace}/port-share \ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.WorkspaceAgentPortShare](schemas.md#codersdkworkspaceagentportshare) | To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Delete workspace agent port share + +### Code samples + +```shell +# Example request using curl +curl -X DELETE http://coder-server:8080/api/v2/workspaces/{workspace}/port-share \ + -H 'Content-Type: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`DELETE /workspaces/{workspace}/port-share` + +> Body parameter + +```json +{ + "agent_name": "string", + "port": 0 +} +``` + +### Parameters + +| Name | In | Type | Required | Description | +|-------------|------|----------------------------------------------------------------------------------------------------------|----------|-----------------------------------| +| `workspace` | path | string(uuid) | true | Workspace ID | +| `body` | body | [codersdk.DeleteWorkspaceAgentPortShareRequest](schemas.md#codersdkdeleteworkspaceagentportsharerequest) | true | Delete port sharing level request | + +### Responses + +| Status | Meaning | Description | Schema | +|--------|---------------------------------------------------------|-------------|--------| +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | | + +To perform this operation, you must be authenticated. [Learn more](authentication.md).