(pdc *proto.WorkspaceAgentDevcontainer)
| 429 | } |
| 430 | |
| 431 | func DevcontainerFromProto(pdc *proto.WorkspaceAgentDevcontainer) (codersdk.WorkspaceAgentDevcontainer, error) { |
| 432 | id, err := uuid.FromBytes(pdc.Id) |
| 433 | if err != nil { |
| 434 | return codersdk.WorkspaceAgentDevcontainer{}, xerrors.Errorf("parse id: %w", err) |
| 435 | } |
| 436 | var subagentID uuid.NullUUID |
| 437 | if pdc.SubagentId != nil { |
| 438 | subagentID.Valid = true |
| 439 | subagentID.UUID, err = uuid.FromBytes(pdc.SubagentId) |
| 440 | if err != nil { |
| 441 | return codersdk.WorkspaceAgentDevcontainer{}, xerrors.Errorf("parse subagent id: %w", err) |
| 442 | } |
| 443 | } |
| 444 | return codersdk.WorkspaceAgentDevcontainer{ |
| 445 | ID: id, |
| 446 | Name: pdc.Name, |
| 447 | WorkspaceFolder: pdc.WorkspaceFolder, |
| 448 | ConfigPath: pdc.ConfigPath, |
| 449 | SubagentID: subagentID, |
| 450 | }, nil |
| 451 | } |
| 452 | |
| 453 | func ProtoFromDevcontainers(dcs []codersdk.WorkspaceAgentDevcontainer) []*proto.WorkspaceAgentDevcontainer { |
| 454 | ret := make([]*proto.WorkspaceAgentDevcontainer, len(dcs)) |
no test coverage detected