@@ -14,57 +14,57 @@ import (
14
14
// Client is a HTTP client for a subset of Coder API routes that external
15
15
// proxies need.
16
16
type Client struct {
17
- CoderSDKClient * codersdk.Client
17
+ SDKClient * codersdk.Client
18
18
// HACK: the issue-signed-app-token requests may issue redirect responses
19
19
// (which need to be forwarded to the client), so the client we use to make
20
20
// those requests must ignore redirects.
21
- CoderSDKClientIgnoreRedirects * codersdk.Client
21
+ sdkClientIgnoreRedirects * codersdk.Client
22
22
}
23
23
24
24
// New creates a external proxy client for the provided primary coder server
25
25
// URL.
26
26
func New (serverURL * url.URL ) * Client {
27
- coderSDKClient := codersdk .New (serverURL )
28
- coderSDKClient .SessionTokenHeader = httpmw .WorkspaceProxyAuthTokenHeader
27
+ sdkClient := codersdk .New (serverURL )
28
+ sdkClient .SessionTokenHeader = httpmw .WorkspaceProxyAuthTokenHeader
29
29
30
- coderSDKClientIgnoreRedirects := codersdk .New (serverURL )
31
- coderSDKClientIgnoreRedirects .HTTPClient .CheckRedirect = func (req * http.Request , via []* http.Request ) error {
30
+ sdkClientIgnoreRedirects := codersdk .New (serverURL )
31
+ sdkClientIgnoreRedirects .HTTPClient .CheckRedirect = func (req * http.Request , via []* http.Request ) error {
32
32
return http .ErrUseLastResponse
33
33
}
34
- coderSDKClientIgnoreRedirects .SessionTokenHeader = httpmw .WorkspaceProxyAuthTokenHeader
34
+ sdkClientIgnoreRedirects .SessionTokenHeader = httpmw .WorkspaceProxyAuthTokenHeader
35
35
36
36
return & Client {
37
- CoderSDKClient : coderSDKClient ,
38
- CoderSDKClientIgnoreRedirects : coderSDKClientIgnoreRedirects ,
37
+ SDKClient : sdkClient ,
38
+ sdkClientIgnoreRedirects : sdkClientIgnoreRedirects ,
39
39
}
40
40
}
41
41
42
42
// SetSessionToken sets the session token for the client. An error is returned
43
43
// if the session token is not in the correct format for external proxies.
44
44
func (c * Client ) SetSessionToken (token string ) error {
45
- c .CoderSDKClient .SetSessionToken (token )
46
- c .CoderSDKClientIgnoreRedirects .SetSessionToken (token )
45
+ c .SDKClient .SetSessionToken (token )
46
+ c .sdkClientIgnoreRedirects .SetSessionToken (token )
47
47
return nil
48
48
}
49
49
50
50
// SessionToken returns the currently set token for the client.
51
51
func (c * Client ) SessionToken () string {
52
- return c .CoderSDKClient .SessionToken ()
52
+ return c .SDKClient .SessionToken ()
53
53
}
54
54
55
55
// Request wraps the underlying codersdk.Client's Request method.
56
56
func (c * Client ) Request (ctx context.Context , method , path string , body interface {}, opts ... codersdk.RequestOption ) (* http.Response , error ) {
57
- return c .CoderSDKClient .Request (ctx , method , path , body , opts ... )
57
+ return c .SDKClient .Request (ctx , method , path , body , opts ... )
58
58
}
59
59
60
60
// RequestIgnoreRedirects wraps the underlying codersdk.Client's Request method
61
61
// on the client that ignores redirects.
62
62
func (c * Client ) RequestIgnoreRedirects (ctx context.Context , method , path string , body interface {}, opts ... codersdk.RequestOption ) (* http.Response , error ) {
63
- return c .CoderSDKClientIgnoreRedirects .Request (ctx , method , path , body , opts ... )
63
+ return c .sdkClientIgnoreRedirects .Request (ctx , method , path , body , opts ... )
64
64
}
65
65
66
66
// DialWorkspaceAgent calls the underlying codersdk.Client's DialWorkspaceAgent
67
67
// method.
68
68
func (c * Client ) DialWorkspaceAgent (ctx context.Context , agentID uuid.UUID , options * codersdk.DialWorkspaceAgentOptions ) (agentConn * codersdk.WorkspaceAgentConn , err error ) {
69
- return c .CoderSDKClient .DialWorkspaceAgent (ctx , agentID , options )
69
+ return c .SDKClient .DialWorkspaceAgent (ctx , agentID , options )
70
70
}
0 commit comments