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

Method handleAutomationJobsUpdate

internal/extension/host_api.go:1476–1514  ·  view source on GitHub ↗
(ctx context.Context, raw json.RawMessage)

Source from the content-addressed store, hash-verified

1474}
1475
1476func (h *HostAPIHandler) handleAutomationJobsUpdate(ctx context.Context, raw json.RawMessage) (any, error) {
1477 automation, err := h.automationManager()
1478 if err != nil {
1479 return nil, err
1480 }
1481
1482 var params hostAPIAutomationJobUpdateParams
1483 if err := decodeHostAPIParams(raw, &params); err != nil {
1484 return nil, err
1485 }
1486 if strings.TrimSpace(params.ID) == "" {
1487 return nil, invalidParamsRPCError(errors.New("id is required"))
1488 }
1489 if !params.HasChanges() {
1490 return nil, invalidParamsRPCError(errors.New("automation job update must include at least one field"))
1491 }
1492
1493 current, err := automation.GetJob(ctx, params.ID)
1494 if err != nil {
1495 return nil, err
1496 }
1497
1498 if current.Source == automationpkg.JobSourceConfig {
1499 if err := validateHostAPIConfigJobUpdate(params.UpdateJobRequest); err != nil {
1500 return nil, invalidParamsRPCError(err)
1501 }
1502 return automation.SetJobEnabled(ctx, current.ID, *params.Enabled)
1503 }
1504
1505 next, err := h.applyJobUpdateParams(ctx, current, params.UpdateJobRequest)
1506 if err != nil {
1507 return nil, err
1508 }
1509 if err := next.Validate("job"); err != nil {
1510 return nil, invalidParamsRPCError(err)
1511 }
1512
1513 return automation.UpdateJob(ctx, next)
1514}
1515
1516func (h *HostAPIHandler) handleAutomationJobsDelete(ctx context.Context, raw json.RawMessage) (any, error) {
1517 automation, err := h.automationManager()

Callers

nothing calls this directly

Calls 10

automationManagerMethod · 0.95
applyJobUpdateParamsMethod · 0.95
decodeHostAPIParamsFunction · 0.85
invalidParamsRPCErrorFunction · 0.85
GetJobMethod · 0.65
SetJobEnabledMethod · 0.65
ValidateMethod · 0.65
UpdateJobMethod · 0.65
HasChangesMethod · 0.45

Tested by

no test coverage detected