MCPcopy Index your code
hub / github.com/coder/coder / ProtoFromAppHealthsRequest

Function ProtoFromAppHealthsRequest

codersdk/agentsdk/convert.go:360–378  ·  view source on GitHub ↗
(req PostAppHealthsRequest)

Source from the content-addressed store, hash-verified

358}
359
360func 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
380func ProtoFromLog(log Log) (*proto.Log, error) {
381 lvl, ok := proto.Log_Level_value[strings.ToUpper(string(log.Level))]

Callers 1

AppHealthPosterFunction · 0.85

Calls 2

AppHealthTypeAlias · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected