(s proto.Lifecycle_State)
| 401 | } |
| 402 | |
| 403 | func LifecycleStateFromProto(s proto.Lifecycle_State) (codersdk.WorkspaceAgentLifecycle, error) { |
| 404 | caps, ok := proto.Lifecycle_State_name[int32(s)] |
| 405 | if !ok { |
| 406 | return "", xerrors.Errorf("unknown lifecycle state: %d", s) |
| 407 | } |
| 408 | return codersdk.WorkspaceAgentLifecycle(strings.ToLower(caps)), nil |
| 409 | } |
| 410 | |
| 411 | func ProtoFromLifecycleState(s codersdk.WorkspaceAgentLifecycle) (proto.Lifecycle_State, error) { |
| 412 | caps, ok := proto.Lifecycle_State_value[strings.ToUpper(string(s))] |