mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
feat: use Agent v2 API for Service Banner (#11806)
Agent uses the v2 API for the service banner, rather than the v1 HTTP API. One of several for #10534
This commit is contained in:
@ -637,24 +637,6 @@ func (c *Client) PostLogSource(ctx context.Context, req PostLogSource) (codersdk
|
||||
return logSource, json.NewDecoder(res.Body).Decode(&logSource)
|
||||
}
|
||||
|
||||
// GetServiceBanner relays the service banner config.
|
||||
func (c *Client) GetServiceBanner(ctx context.Context) (codersdk.ServiceBannerConfig, error) {
|
||||
res, err := c.SDK.Request(ctx, http.MethodGet, "/api/v2/appearance", nil)
|
||||
if err != nil {
|
||||
return codersdk.ServiceBannerConfig{}, err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
// If the route does not exist then Enterprise code is not enabled.
|
||||
if res.StatusCode == http.StatusNotFound {
|
||||
return codersdk.ServiceBannerConfig{}, nil
|
||||
}
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return codersdk.ServiceBannerConfig{}, codersdk.ReadBodyAsError(res)
|
||||
}
|
||||
var cfg codersdk.AppearanceConfig
|
||||
return cfg.ServiceBanner, json.NewDecoder(res.Body).Decode(&cfg)
|
||||
}
|
||||
|
||||
type ExternalAuthResponse struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
TokenExtra map[string]interface{} `json:"token_extra"`
|
||||
|
Reference in New Issue
Block a user