( ctx context.Context, current automationpkg.Job, req apicontract.UpdateJobRequest, )
| 2212 | } |
| 2213 | |
| 2214 | func (h *HostAPIHandler) applyJobUpdateParams( |
| 2215 | ctx context.Context, |
| 2216 | current automationpkg.Job, |
| 2217 | req apicontract.UpdateJobRequest, |
| 2218 | ) (automationpkg.Job, error) { |
| 2219 | next := current |
| 2220 | if req.Name != nil { |
| 2221 | next.Name = strings.TrimSpace(*req.Name) |
| 2222 | } |
| 2223 | if req.AgentName != nil { |
| 2224 | next.AgentName = strings.TrimSpace(*req.AgentName) |
| 2225 | } |
| 2226 | if req.WorkspaceID != nil { |
| 2227 | workspaceID, err := h.resolveAutomationWorkspaceID(ctx, *req.WorkspaceID) |
| 2228 | if err != nil { |
| 2229 | return automationpkg.Job{}, err |
| 2230 | } |
| 2231 | next.WorkspaceID = workspaceID |
| 2232 | } |
| 2233 | if req.Prompt != nil { |
| 2234 | next.Prompt = strings.TrimSpace(*req.Prompt) |
| 2235 | } |
| 2236 | if req.Schedule != nil { |
| 2237 | schedule := *req.Schedule |
| 2238 | next.Schedule = &schedule |
| 2239 | } |
| 2240 | if req.Enabled != nil { |
| 2241 | next.Enabled = *req.Enabled |
| 2242 | } |
| 2243 | if req.Retry != nil { |
| 2244 | next.Retry = *req.Retry |
| 2245 | } |
| 2246 | if req.FireLimit != nil { |
| 2247 | next.FireLimit = *req.FireLimit |
| 2248 | } |
| 2249 | return next, nil |
| 2250 | } |
| 2251 | |
| 2252 | func validateHostAPIConfigJobUpdate(req apicontract.UpdateJobRequest) error { |
| 2253 | switch { |
no test coverage detected