| 108 | } |
| 109 | |
| 110 | func (c *Client) GetWorkspaceAgentPortShares(ctx context.Context, workspaceID uuid.UUID) (WorkspaceAgentPortShares, error) { |
| 111 | var shares WorkspaceAgentPortShares |
| 112 | res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/workspaces/%s/port-share", workspaceID), nil) |
| 113 | if err != nil { |
| 114 | return shares, err |
| 115 | } |
| 116 | defer res.Body.Close() |
| 117 | if res.StatusCode != http.StatusOK { |
| 118 | return shares, ReadBodyAsError(res) |
| 119 | } |
| 120 | |
| 121 | return shares, json.NewDecoder(res.Body).Decode(&shares) |
| 122 | } |
| 123 | |
| 124 | func (c *Client) UpsertWorkspaceAgentPortShare(ctx context.Context, workspaceID uuid.UUID, req UpsertWorkspaceAgentPortShareRequest) (WorkspaceAgentPortShare, error) { |
| 125 | var share WorkspaceAgentPortShare |