(req PostAppHealthsRequest)
| 358 | } |
| 359 | |
| 360 | func ProtoFromAppHealthsRequest(req PostAppHealthsRequest) (*proto.BatchUpdateAppHealthRequest, error) { |
| 361 | pReq := &proto.BatchUpdateAppHealthRequest{} |
| 362 | for id, h := range req.Healths { |
| 363 | hp, ok := proto.AppHealth_value[strings.ToUpper(string(h))] |
| 364 | if !ok { |
| 365 | return nil, xerrors.Errorf("unknown app health: %s", h) |
| 366 | } |
| 367 | |
| 368 | // Copy the ID, otherwise all updates will have the same ID (the last |
| 369 | // one in the list). |
| 370 | var idCopy uuid.UUID |
| 371 | copy(idCopy[:], id[:]) |
| 372 | pReq.Updates = append(pReq.Updates, &proto.BatchUpdateAppHealthRequest_HealthUpdate{ |
| 373 | Id: idCopy[:], |
| 374 | Health: proto.AppHealth(hp), |
| 375 | }) |
| 376 | } |
| 377 | return pReq, nil |
| 378 | } |
| 379 | |
| 380 | func ProtoFromLog(log Log) (*proto.Log, error) { |
| 381 | lvl, ok := proto.Log_Level_value[strings.ToUpper(string(log.Level))] |
no test coverage detected