( cmd *cobra.Command, client DaemonClient, input automationJobUpdateInput, )
| 307 | } |
| 308 | |
| 309 | func buildAutomationJobUpdateRequest( |
| 310 | cmd *cobra.Command, |
| 311 | client DaemonClient, |
| 312 | input automationJobUpdateInput, |
| 313 | ) (AutomationJobUpdateRequest, error) { |
| 314 | request := AutomationJobUpdateRequest{} |
| 315 | if cmd.Flags().Changed(automationNameKey) { |
| 316 | request.Name = new(strings.TrimSpace(input.Name)) |
| 317 | } |
| 318 | if cmd.Flags().Changed("agent") { |
| 319 | request.AgentName = new(strings.TrimSpace(input.AgentName)) |
| 320 | } |
| 321 | if cmd.Flags().Changed("workspace") { |
| 322 | workspaceID, err := resolveAutomationWorkspaceID(cmd.Context(), client, input.WorkspaceRef) |
| 323 | if err != nil { |
| 324 | return AutomationJobUpdateRequest{}, err |
| 325 | } |
| 326 | request.WorkspaceID = new(workspaceID) |
| 327 | } |
| 328 | if cmd.Flags().Changed(automationPromptKey) { |
| 329 | request.Prompt = new(strings.TrimSpace(input.Prompt)) |
| 330 | } |
| 331 | if cmd.Flags().Changed("schedule") { |
| 332 | schedule, err := parseAutomationScheduleFlag(input.ScheduleRaw) |
| 333 | if err != nil { |
| 334 | return AutomationJobUpdateRequest{}, err |
| 335 | } |
| 336 | request.Schedule = &schedule |
| 337 | } |
| 338 | if cmd.Flags().Changed(automationRetryKey) { |
| 339 | retry, err := parseAutomationRetryFlag(input.RetryRaw) |
| 340 | if err != nil { |
| 341 | return AutomationJobUpdateRequest{}, err |
| 342 | } |
| 343 | if retry == nil { |
| 344 | return AutomationJobUpdateRequest{}, errors.New( |
| 345 | `cli: --retry requires "none", "backoff", or "backoff:<max_retries>:<base_delay>"`, |
| 346 | ) |
| 347 | } |
| 348 | request.Retry = retry |
| 349 | } |
| 350 | if cmd.Flags().Changed(automationEnabledKey) { |
| 351 | request.Enabled = new(input.Enabled) |
| 352 | } |
| 353 | return request, nil |
| 354 | } |
| 355 | |
| 356 | func newAutomationJobsDeleteCommand(deps commandDeps) *cobra.Command { |
| 357 | return &cobra.Command{ |
no test coverage detected