| 346 | } |
| 347 | |
| 348 | func ProtoFromSubsystems(ss []codersdk.AgentSubsystem) ([]proto.Startup_Subsystem, error) { |
| 349 | ret := make([]proto.Startup_Subsystem, len(ss)) |
| 350 | for i, s := range ss { |
| 351 | pi, ok := proto.Startup_Subsystem_value[strings.ToUpper(string(s))] |
| 352 | if !ok { |
| 353 | return nil, xerrors.Errorf("unknown subsystem: %s", s) |
| 354 | } |
| 355 | ret[i] = proto.Startup_Subsystem(pi) |
| 356 | } |
| 357 | return ret, nil |
| 358 | } |
| 359 | |
| 360 | func ProtoFromAppHealthsRequest(req PostAppHealthsRequest) (*proto.BatchUpdateAppHealthRequest, error) { |
| 361 | pReq := &proto.BatchUpdateAppHealthRequest{} |