@@ -115,17 +115,32 @@ func (a *SubAgentAPI) CreateSubAgent(ctx context.Context, req *agentproto.Create
115
115
health = database .WorkspaceAppHealthInitializing
116
116
}
117
117
118
- sharingLevel := database .AppSharingLevelOwner
118
+ var sharingLevel database.AppSharingLevel
119
119
switch app .GetShare () {
120
+ case agentproto .CreateSubAgentRequest_App_OWNER :
121
+ sharingLevel = database .AppSharingLevelOwner
120
122
case agentproto .CreateSubAgentRequest_App_AUTHENTICATED :
121
123
sharingLevel = database .AppSharingLevelAuthenticated
122
124
case agentproto .CreateSubAgentRequest_App_PUBLIC :
123
125
sharingLevel = database .AppSharingLevelPublic
126
+ default :
127
+ return codersdk.ValidationError {
128
+ Field : "share" ,
129
+ Detail : fmt .Sprint ("%q is not a valid app sharing level" ),
130
+ }
124
131
}
125
132
126
- openIn := database .WorkspaceAppOpenInSlimWindow
127
- if app .GetOpenIn () == agentproto .CreateSubAgentRequest_App_TAB {
133
+ var openIn database.WorkspaceAppOpenIn
134
+ switch app .GetOpenIn () {
135
+ case agentproto .CreateSubAgentRequest_App_SLIM_WINDOW :
136
+ openIn = database .WorkspaceAppOpenInSlimWindow
137
+ case agentproto .CreateSubAgentRequest_App_TAB :
128
138
openIn = database .WorkspaceAppOpenInTab
139
+ default :
140
+ return codersdk.ValidationError {
141
+ Field : "open_in" ,
142
+ Detail : fmt .Sprint ("%q is not an open in setting" ),
143
+ }
129
144
}
130
145
131
146
_ , err := a .Database .InsertWorkspaceApp (ctx , database.InsertWorkspaceAppParams {
0 commit comments