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

Function AgentScriptFromProto

codersdk/agentsdk/convert.go:185–208  ·  view source on GitHub ↗
(protoScript *proto.WorkspaceAgentScript)

Source from the content-addressed store, hash-verified

183}
184
185func 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
210func ProtoFromScript(s codersdk.WorkspaceAgentScript) *proto.WorkspaceAgentScript {
211 return &proto.WorkspaceAgentScript{

Callers 1

AgentScriptsFromProtoFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected