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

Function ProtoFromLifecycle

codersdk/agentsdk/convert.go:392–401  ·  view source on GitHub ↗
(req PostLifecycleRequest)

Source from the content-addressed store, hash-verified

390}
391
392func ProtoFromLifecycle(req PostLifecycleRequest) (*proto.Lifecycle, error) {
393 s, ok := proto.Lifecycle_State_value[strings.ToUpper(string(req.State))]
394 if !ok {
395 return nil, xerrors.Errorf("unknown lifecycle state: %s", req.State)
396 }
397 return &proto.Lifecycle{
398 State: proto.Lifecycle_State(s),
399 ChangedAt: timestamppb.New(req.ChangedAt),
400 }, nil
401}
402
403func LifecycleStateFromProto(s proto.Lifecycle_State) (codersdk.WorkspaceAgentLifecycle, error) {
404 caps, ok := proto.Lifecycle_State_name[int32(s)]

Callers 2

TestProtoFromLifecycleFunction · 0.92
reportLifecycleMethod · 0.92

Calls 3

Lifecycle_StateTypeAlias · 0.92
NewMethod · 0.65
ErrorfMethod · 0.45

Tested by 1

TestProtoFromLifecycleFunction · 0.74