(protoScript *proto.WorkspaceAgentScript)
| 183 | } |
| 184 | |
| 185 | func AgentScriptFromProto(protoScript *proto.WorkspaceAgentScript) (codersdk.WorkspaceAgentScript, error) { |
| 186 | id, err := uuid.FromBytes(protoScript.Id) |
| 187 | if err != nil { |
| 188 | return codersdk.WorkspaceAgentScript{}, xerrors.Errorf("parse id: %w", err) |
| 189 | } |
| 190 | |
| 191 | logSourceID, err := uuid.FromBytes(protoScript.LogSourceId) |
| 192 | if err != nil { |
| 193 | return codersdk.WorkspaceAgentScript{}, xerrors.Errorf("parse log source id: %w", err) |
| 194 | } |
| 195 | |
| 196 | return codersdk.WorkspaceAgentScript{ |
| 197 | ID: id, |
| 198 | LogSourceID: logSourceID, |
| 199 | LogPath: protoScript.LogPath, |
| 200 | Script: protoScript.Script, |
| 201 | Cron: protoScript.Cron, |
| 202 | RunOnStart: protoScript.RunOnStart, |
| 203 | RunOnStop: protoScript.RunOnStop, |
| 204 | StartBlocksLogin: protoScript.StartBlocksLogin, |
| 205 | Timeout: protoScript.Timeout.AsDuration(), |
| 206 | DisplayName: protoScript.DisplayName, |
| 207 | }, nil |
| 208 | } |
| 209 | |
| 210 | func ProtoFromScript(s codersdk.WorkspaceAgentScript) *proto.WorkspaceAgentScript { |
| 211 | return &proto.WorkspaceAgentScript{ |
no test coverage detected