@@ -179,60 +179,16 @@ func (api *API) workspaceAgentManifest(rw http.ResponseWriter, r *http.Request)
179
179
})
180
180
return
181
181
}
182
-
183
- apps , err := agentproto .SDKAppsFromProto (manifest .Apps )
184
- if err != nil {
185
- httpapi .Write (ctx , rw , http .StatusInternalServerError , codersdk.Response {
186
- Message : "Internal error converting workspace agent apps." ,
187
- Detail : err .Error (),
188
- })
189
- return
190
- }
191
-
192
- scripts , err := agentproto .SDKAgentScriptsFromProto (manifest .Scripts )
193
- if err != nil {
194
- httpapi .Write (ctx , rw , http .StatusInternalServerError , codersdk.Response {
195
- Message : "Internal error converting workspace agent scripts." ,
196
- Detail : err .Error (),
197
- })
198
- return
199
- }
200
-
201
- agentID , err := uuid .FromBytes (manifest .AgentId )
182
+ sdkManifest , err := agentsdk .ManifestFromProto (manifest )
202
183
if err != nil {
203
184
httpapi .Write (ctx , rw , http .StatusInternalServerError , codersdk.Response {
204
- Message : "Internal error converting workspace agent ID." ,
205
- Detail : err .Error (),
206
- })
207
- return
208
- }
209
- workspaceID , err := uuid .FromBytes (manifest .WorkspaceId )
210
- if err != nil {
211
- httpapi .Write (ctx , rw , http .StatusInternalServerError , codersdk.Response {
212
- Message : "Internal error converting workspace ID." ,
185
+ Message : "Internal error converting manifest." ,
213
186
Detail : err .Error (),
214
187
})
215
188
return
216
189
}
217
190
218
- httpapi .Write (ctx , rw , http .StatusOK , agentsdk.Manifest {
219
- AgentID : agentID ,
220
- AgentName : manifest .AgentName ,
221
- OwnerName : manifest .OwnerUsername ,
222
- WorkspaceID : workspaceID ,
223
- WorkspaceName : manifest .WorkspaceName ,
224
- Apps : apps ,
225
- Scripts : scripts ,
226
- DERPMap : tailnet .DERPMapFromProto (manifest .DerpMap ),
227
- DERPForceWebSockets : manifest .DerpForceWebsockets ,
228
- GitAuthConfigs : int (manifest .GitAuthConfigs ),
229
- EnvironmentVariables : manifest .EnvironmentVariables ,
230
- Directory : manifest .Directory ,
231
- VSCodePortProxyURI : manifest .VsCodePortProxyUri ,
232
- MOTDFile : manifest .MotdPath ,
233
- DisableDirectConnections : manifest .DisableDirectConnections ,
234
- Metadata : agentproto .SDKAgentMetadataDescriptionsFromProto (manifest .Metadata ),
235
- })
191
+ httpapi .Write (ctx , rw , http .StatusOK , sdkManifest )
236
192
}
237
193
238
194
const AgentAPIVersionREST = "1.0"
0 commit comments