@@ -15,14 +15,16 @@ const (
15
15
AuthProviderOIDC AuthProviderType = "oidc"
16
16
)
17
17
18
- // ConfigAuth describes the authentication configuration for a Coder deployment.
18
+ // ConfigAuth describes the authentication configuration for a Coder
19
+ // deployment.
19
20
type ConfigAuth struct {
20
21
ProviderType * AuthProviderType `json:"provider_type"`
21
22
OIDC * ConfigOIDC `json:"oidc"`
22
23
SAML * ConfigSAML `json:"saml"`
23
24
}
24
25
25
- // ConfigOIDC describes the OIDC configuration for single-signon support in Coder.
26
+ // ConfigOIDC describes the OIDC configuration for single-signon support in
27
+ // Coder.
26
28
type ConfigOIDC struct {
27
29
ClientID * string `json:"client_id"`
28
30
ClientSecret * string `json:"client_secret"`
@@ -38,26 +40,30 @@ type ConfigSAML struct {
38
40
PublicKeyCertificate * string `json:"public_key_certificate"`
39
41
}
40
42
41
- // ConfigOAuthBitbucketServer describes the Bitbucket integration configuration for a Coder deployment.
43
+ // ConfigOAuthBitbucketServer describes the Bitbucket integration configuration
44
+ // for a Coder deployment.
42
45
type ConfigOAuthBitbucketServer struct {
43
46
BaseURL string `json:"base_url" diff:"oauth.bitbucket_server.base_url"`
44
47
}
45
48
46
- // ConfigOAuthGitHub describes the Github integration configuration for a Coder deployment.
49
+ // ConfigOAuthGitHub describes the Github integration configuration for a Coder
50
+ // deployment.
47
51
type ConfigOAuthGitHub struct {
48
52
BaseURL string `json:"base_url"`
49
53
ClientID string `json:"client_id"`
50
54
ClientSecret string `json:"client_secret"`
51
55
}
52
56
53
- // ConfigOAuthGitLab describes the GitLab integration configuration for a Coder deployment.
57
+ // ConfigOAuthGitLab describes the GitLab integration configuration for a Coder
58
+ // deployment.
54
59
type ConfigOAuthGitLab struct {
55
60
BaseURL string `json:"base_url"`
56
61
ClientID string `json:"client_id" `
57
62
ClientSecret string `json:"client_secret"`
58
63
}
59
64
60
- // ConfigOAuth describes the aggregate git integration configuration for a Coder deployment.
65
+ // ConfigOAuth describes the aggregate git integration configuration for a
66
+ // Coder deployment.
61
67
type ConfigOAuth struct {
62
68
BitbucketServer ConfigOAuthBitbucketServer `json:"bitbucket_server"`
63
69
GitHub ConfigOAuthGitHub `json:"github"`
@@ -140,18 +146,81 @@ func (c *DefaultClient) PutSiteConfigExtensionMarketplace(ctx context.Context, r
140
146
141
147
// ConfigWorkspaces is the site configuration for workspace attributes.
142
148
type ConfigWorkspaces struct {
143
- GPUVendor string `json:"gpu_vendor,omitempty" valid:"in(nvidia|amd)"`
144
- EnableContainerVMs bool `json:"enable_container_vms,omitempty"`
145
- EnableWorkspacesAsCode bool `json:"enable_workspaces_as_code,omitempty"`
146
- EnableP2P bool `json:"enable_p2p,omitempty"`
149
+ GPUVendor string `json:"gpu_vendor"`
150
+ EnableContainerVMs bool `json:"enable_container_vms"`
151
+ EnableWorkspacesAsCode bool `json:"enable_workspaces_as_code"`
147
152
}
148
153
149
154
// SiteConfigWorkspaces fetches the workspace configuration.
150
155
func (c * DefaultClient ) SiteConfigWorkspaces (ctx context.Context ) (* ConfigWorkspaces , error ) {
151
156
var conf ConfigWorkspaces
152
- // TODO: use the `/api/v0/workspaces/config route once we migrate from using general config
153
- if err := c .requestBody (ctx , http .MethodGet , "/api/private/config" , nil , & conf ); err != nil {
157
+ if err := c .requestBody (ctx , http .MethodGet , "/api/v0/workspaces/config" , nil , & conf ); err != nil {
154
158
return nil , err
155
159
}
156
160
return & conf , nil
157
161
}
162
+
163
+ // PutSiteConfigWorkspaces sets the workspace configuration.
164
+ func (c * DefaultClient ) PutSiteConfigWorkspaces (ctx context.Context , req ConfigWorkspaces ) error {
165
+ return c .requestBody (ctx , http .MethodPut , "/api/v0/workspaces/config" , req , nil )
166
+ }
167
+
168
+ type ConfigDormancy struct {
169
+ // UserDormancyThresholdDays is not currently updatable.
170
+ // UserDormancyThresholdDays int `json:"user_dormancy_threshold_days"`
171
+ UserDeletionThresholdDays int `json:"user_deletion_threshold_days"`
172
+ }
173
+
174
+ // SiteConfigDormancy fetches the dormancy configuration.
175
+ func (c * DefaultClient ) SiteConfigDormancy (ctx context.Context ) (* ConfigDormancy , error ) {
176
+ var conf ConfigDormancy
177
+ if err := c .requestBody (ctx , http .MethodGet , "/api/private/dormancy/config" , nil , & conf ); err != nil {
178
+ return nil , err
179
+ }
180
+ return & conf , nil
181
+ }
182
+
183
+ // PutSiteConfigDormancy sets the dormancy configuration.
184
+ func (c * DefaultClient ) PutSiteConfigDormancy (ctx context.Context , req ConfigDormancy ) error {
185
+ return c .requestBody (ctx , http .MethodPut , "/api/private/dormancy/config" , req , nil )
186
+ }
187
+
188
+ type ConfigDevURLAccess struct {
189
+ Private bool `json:"private"`
190
+ Org bool `json:"org"`
191
+ Authed bool `json:"authed"`
192
+ Public bool `json:"public"`
193
+ }
194
+
195
+ // SiteConfigDevURLAccess fetches the DevURL access configuration.
196
+ func (c * DefaultClient ) SiteConfigDevURLAccess (ctx context.Context ) (* ConfigDevURLAccess , error ) {
197
+ var conf ConfigDevURLAccess
198
+ if err := c .requestBody (ctx , http .MethodGet , "/api/private/devurls/config" , nil , & conf ); err != nil {
199
+ return nil , err
200
+ }
201
+ return & conf , nil
202
+ }
203
+
204
+ // PutSiteConfigDevURLAccess sets the DevURL access configuration.
205
+ func (c * DefaultClient ) PutSiteConfigDevURLAccess (ctx context.Context , req ConfigDevURLAccess ) error {
206
+ return c .requestBody (ctx , http .MethodPut , "/api/private/devurls/config" , req , nil )
207
+ }
208
+
209
+ // ConfigSSHSettings is the site configuration for SSH.
210
+ type ConfigSSHSettings struct {
211
+ KeygenAlgorithm string `json:"keygen_algorithm"`
212
+ }
213
+
214
+ // SiteConfigSSHSettings fetches the SSH configuration.
215
+ func (c * DefaultClient ) SiteConfigSSHSettings (ctx context.Context ) (* ConfigSSHSettings , error ) {
216
+ var conf ConfigSSHSettings
217
+ if err := c .requestBody (ctx , http .MethodGet , "/api/private/ssh/config" , nil , & conf ); err != nil {
218
+ return nil , err
219
+ }
220
+ return & conf , nil
221
+ }
222
+
223
+ // PutSiteConfigSSHSettings sets the SSH configuration.
224
+ func (c * DefaultClient ) PutSiteConfigSSHSettings (ctx context.Context , req ConfigSSHSettings ) error {
225
+ return c .requestBody (ctx , http .MethodPut , "/api/private/ssh/config" , req , nil )
226
+ }
0 commit comments