@@ -2,6 +2,7 @@ package coder
2
2
3
3
import (
4
4
"context"
5
+ "encoding/json"
5
6
"io"
6
7
"net/http"
7
8
"net/url"
@@ -84,6 +85,10 @@ type CreateEnvironmentRequest struct {
84
85
GPUs int `json:"gpus"`
85
86
Services []string `json:"services"`
86
87
UseContainerVM bool `json:"use_container_vm"`
88
+
89
+ // Template comes from the parse template route on cemanager.
90
+ // This field should never be manually populated
91
+ Template Template `json:"template,omitempty"`
87
92
}
88
93
89
94
// CreateEnvironment sends a request to create an environment.
@@ -104,24 +109,9 @@ type ParseTemplateRequest struct {
104
109
}
105
110
106
111
// Template is a Workspaces As Code (WAC) template.
107
- type Template struct {
108
- Workspace Workspace `json:"workspace"`
109
- }
110
-
111
- // Workspace defines values on the workspace that can be configured.
112
- type Workspace struct {
113
- Name string `json:"name"`
114
- Image string `json:"image"`
115
- ContainerBasedVM bool `json:"container-based-vm"`
116
- Resources Resources `json:"resources"`
117
- }
118
-
119
- // Resources defines compute values that can be configured for a workspace.
120
- type Resources struct {
121
- CPU float32 `json:"cpu" `
122
- Memory float32 `json:"memory"`
123
- Disk int `json:"disk"`
124
- }
112
+ // For now, let's not interpret it on the CLI level. We just need
113
+ // to forward this as part of the create env request.
114
+ type Template = json.RawMessage
125
115
126
116
// ParseTemplate parses a template config. It support both remote repositories and local files.
127
117
// If a local file is specified then all other values in the request are ignored.
0 commit comments