chore: move agent functions from codersdk into agentsdk (#5903)

* chore: rename `AgentConn` to `WorkspaceAgentConn`

The codersdk was becoming bloated with consts for the workspace
agent that made no sense to a reader. `Tailnet*` is an example
of these consts.

* chore: remove `Get` prefix from *Client functions

* chore: remove `BypassRatelimits` option in `codersdk.Client`

It feels wrong to have this as a direct option because it's so infrequently
needed by API callers. It's better to directly modify headers in the two
places that we actually use it.

* Merge `appearance.go` and `buildinfo.go` into `deployment.go`

* Merge `experiments.go` and `features.go` into `deployment.go`

* Fix `make gen` referencing old type names

* Merge `error.go` into `client.go`

`codersdk.Response` lived in `error.go`, which is wrong.

* chore: refactor workspace agent functions into agentsdk

It was odd conflating the codersdk that clients should use
with functions that only the agent should use. This separates
them into two SDKs that are closely coupled, but separate.

* Merge `insights.go` into `deployment.go`

* Merge `organizationmember.go` into `organizations.go`

* Merge `quota.go` into `workspaces.go`

* Rename `sse.go` to `serversentevents.go`

* Rename `codersdk.WorkspaceAppHostResponse` to `codersdk.AppHostResponse`

* Format `.vscode/settings.json`

* Fix outdated naming in `api.ts`

* Fix app host response

* Fix unsupported type

* Fix imported type
This commit is contained in:
Kyle Carberry
2023-01-29 15:47:24 -06:00
committed by GitHub
parent e49f41652f
commit 7ad87505c8
115 changed files with 2491 additions and 2567 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"strconv"
"strings"
@ -328,7 +329,14 @@ func scaletestCleanup() *cobra.Command {
return err
}
client.BypassRatelimits = true
client.HTTPClient = &http.Client{
Transport: &headerTransport{
transport: http.DefaultTransport,
headers: map[string]string{
codersdk.BypassRatelimitHeader: "true",
},
},
}
cmd.PrintErrln("Fetching scaletest workspaces...")
var (
@ -506,7 +514,14 @@ It is recommended that all rate limits are disabled on the server before running
return err
}
client.BypassRatelimits = true
client.HTTPClient = &http.Client{
Transport: &headerTransport{
transport: http.DefaultTransport,
headers: map[string]string{
codersdk.BypassRatelimitHeader: "true",
},
},
}
if count <= 0 {
return xerrors.Errorf("--count is required and must be greater than 0")
@ -668,7 +683,7 @@ It is recommended that all rate limits are disabled on the server before running
if runCommand != "" {
config.ReconnectingPTY = &reconnectingpty.Config{
// AgentID is set by the test automatically.
Init: codersdk.ReconnectingPTYInit{
Init: codersdk.WorkspaceAgentReconnectingPTYInit{
ID: uuid.Nil,
Height: 24,
Width: 80,