( cmd *cobra.Command, client DaemonClient, input automationTriggerCommandInput, )
| 1628 | } |
| 1629 | |
| 1630 | func buildAutomationTriggerCreateRequest( |
| 1631 | cmd *cobra.Command, |
| 1632 | client DaemonClient, |
| 1633 | input automationTriggerCommandInput, |
| 1634 | ) (AutomationTriggerCreateRequest, error) { |
| 1635 | scope, workspaceID, err := resolveAutomationScopeWorkspace( |
| 1636 | cmd.Context(), |
| 1637 | client, |
| 1638 | input.ScopeRaw, |
| 1639 | input.WorkspaceRef, |
| 1640 | ) |
| 1641 | if err != nil { |
| 1642 | return AutomationTriggerCreateRequest{}, err |
| 1643 | } |
| 1644 | retry, err := parseAutomationRetryFlag(input.RetryRaw) |
| 1645 | if err != nil { |
| 1646 | return AutomationTriggerCreateRequest{}, err |
| 1647 | } |
| 1648 | filter, err := parseAutomationFilterFlags(input.FilterFlags) |
| 1649 | if err != nil { |
| 1650 | return AutomationTriggerCreateRequest{}, err |
| 1651 | } |
| 1652 | |
| 1653 | request := AutomationTriggerCreateRequest{ |
| 1654 | Scope: scope, |
| 1655 | Name: strings.TrimSpace(input.Name), |
| 1656 | AgentName: strings.TrimSpace(input.AgentName), |
| 1657 | WorkspaceID: workspaceID, |
| 1658 | Prompt: strings.TrimSpace(input.Prompt), |
| 1659 | Event: strings.TrimSpace(input.EventRaw), |
| 1660 | Filter: filter, |
| 1661 | WebhookID: strings.TrimSpace(input.WebhookID), |
| 1662 | EndpointSlug: strings.TrimSpace(input.EndpointSlug), |
| 1663 | WebhookSecretValue: input.WebhookSecretValue, |
| 1664 | } |
| 1665 | if cmd.Flags().Changed(automationEnabledKey) { |
| 1666 | request.Enabled = new(input.Enabled) |
| 1667 | } |
| 1668 | if retry != nil { |
| 1669 | request.Retry = retry |
| 1670 | } |
| 1671 | return request, nil |
| 1672 | } |
| 1673 | |
| 1674 | func buildAutomationTriggerUpdateRequest( |
| 1675 | cmd *cobra.Command, |
no test coverage detected