File tree 2 files changed +12
-5
lines changed
main/kotlin/com/coder/gateway/models 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ data class WorkspaceAgentModel(
17
17
val agentID : UUID ? ,
18
18
val workspaceID : UUID ,
19
19
val workspaceName : String ,
20
- val name : String , // Name of the workspace OR the agent if this is for an agent.
20
+ val name : String , // Name of the workspace OR workspace. agent if this is for an agent.
21
21
val templateID : UUID ,
22
22
val templateName : String ,
23
23
val templateIconPath : String ,
Original file line number Diff line number Diff line change @@ -5,12 +5,19 @@ import com.coder.gateway.sdk.v2.models.WorkspaceStatus
5
5
import com.coder.gateway.sdk.v2.models.WorkspaceTransition
6
6
7
7
class DataGen {
8
- static WorkspaceAgentModel workspace (String name , String workspaceName = name) {
8
+ // Create a random workspace agent model. If the workspace name is omitted
9
+ // then return a model without any agent bits, similar to what
10
+ // toAgentModels() does if the workspace does not specify any agents.
11
+ // TODO: Maybe better to randomly generate the workspace and then call
12
+ // toAgentModels() on it. Also the way an "agent" model can have no
13
+ // agent in it seems weird; can we refactor to remove
14
+ // WorkspaceAgentModel and use the original structs from the API?
15
+ static WorkspaceAgentModel workspace (String name , String workspaceName = " " , UUID agentId = UUID . randomUUID()) {
9
16
return new WorkspaceAgentModel (
17
+ workspaceName == " " ? null : agentId,
10
18
UUID . randomUUID(),
11
- UUID . randomUUID(),
12
- workspaceName,
13
- name,
19
+ workspaceName == " " ? name : workspaceName,
20
+ workspaceName == " " ? name : (workspaceName + " ." + name),
14
21
UUID . randomUUID(),
15
22
" template-name" ,
16
23
" template-icon-path" ,
You can’t perform that action at this time.
0 commit comments