( ctx context.Context, req hostAPIAutomationJobCreateParams, )
| 2173 | } |
| 2174 | |
| 2175 | func (h *HostAPIHandler) jobFromCreateParams( |
| 2176 | ctx context.Context, |
| 2177 | req hostAPIAutomationJobCreateParams, |
| 2178 | ) (automationpkg.Job, error) { |
| 2179 | workspaceID, err := h.resolveAutomationWorkspaceID(ctx, req.WorkspaceID) |
| 2180 | if err != nil { |
| 2181 | return automationpkg.Job{}, err |
| 2182 | } |
| 2183 | |
| 2184 | enabled := true |
| 2185 | if req.Enabled != nil { |
| 2186 | enabled = *req.Enabled |
| 2187 | } |
| 2188 | |
| 2189 | retry := automationpkg.DefaultRetryConfig() |
| 2190 | if req.Retry != nil { |
| 2191 | retry = *req.Retry |
| 2192 | } |
| 2193 | |
| 2194 | fireLimit := automationpkg.DefaultFireLimitConfig() |
| 2195 | if req.FireLimit != nil { |
| 2196 | fireLimit = *req.FireLimit |
| 2197 | } |
| 2198 | |
| 2199 | schedule := req.Schedule |
| 2200 | return automationpkg.Job{ |
| 2201 | Scope: req.Scope, |
| 2202 | Name: strings.TrimSpace(req.Name), |
| 2203 | AgentName: strings.TrimSpace(req.AgentName), |
| 2204 | WorkspaceID: workspaceID, |
| 2205 | Prompt: strings.TrimSpace(req.Prompt), |
| 2206 | Schedule: &schedule, |
| 2207 | Enabled: enabled, |
| 2208 | Retry: retry, |
| 2209 | FireLimit: fireLimit, |
| 2210 | Source: automationpkg.JobSourceDynamic, |
| 2211 | }, nil |
| 2212 | } |
| 2213 | |
| 2214 | func (h *HostAPIHandler) applyJobUpdateParams( |
| 2215 | ctx context.Context, |
no test coverage detected