MCPcopy Create free account
hub / github.com/compozy/agh / applyJobUpdateParams

Method applyJobUpdateParams

internal/extension/host_api.go:2214–2250  ·  view source on GitHub ↗
(
	ctx context.Context,
	current automationpkg.Job,
	req apicontract.UpdateJobRequest,
)

Source from the content-addressed store, hash-verified

2212}
2213
2214func (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
2252func validateHostAPIConfigJobUpdate(req apicontract.UpdateJobRequest) error {
2253 switch {

Callers 1

Calls 1

Tested by

no test coverage detected