( taskID string, req *contract.SetTaskExecutionProfileRequest, )
| 2189 | } |
| 2190 | |
| 2191 | func taskExecutionProfileFromRequest( |
| 2192 | taskID string, |
| 2193 | req *contract.SetTaskExecutionProfileRequest, |
| 2194 | ) (*taskpkg.ExecutionProfile, error) { |
| 2195 | trimmedID := strings.TrimSpace(taskID) |
| 2196 | if trimmedID == "" { |
| 2197 | return nil, NewTaskValidationError(errors.New("task id is required")) |
| 2198 | } |
| 2199 | if req == nil { |
| 2200 | return nil, NewTaskValidationError(errors.New("task execution profile request is required")) |
| 2201 | } |
| 2202 | if strings.TrimSpace(req.TaskID) != "" && strings.TrimSpace(req.TaskID) != trimmedID { |
| 2203 | return nil, NewTaskValidationError(fmt.Errorf( |
| 2204 | "task_execution_profile.task_id must match task id %q", |
| 2205 | trimmedID, |
| 2206 | )) |
| 2207 | } |
| 2208 | profile := *req |
| 2209 | profile.TaskID = trimmedID |
| 2210 | profile.CreatedAt = time.Time{} |
| 2211 | profile.UpdatedAt = time.Time{} |
| 2212 | return &profile, nil |
| 2213 | } |
| 2214 | |
| 2215 | func cancelTaskFromRequest(req contract.CancelTaskRequest) (taskpkg.CancelTask, error) { |
| 2216 | cancelReq := taskpkg.CancelTask{ |
no test coverage detected