SetTaskExecutionProfile replaces one task-owned execution profile.
(c *gin.Context)
| 633 | |
| 634 | // SetTaskExecutionProfile replaces one task-owned execution profile. |
| 635 | func (h *BaseHandlers) SetTaskExecutionProfile(c *gin.Context) { |
| 636 | manager, ok := h.requireTaskManager(c) |
| 637 | if !ok { |
| 638 | return |
| 639 | } |
| 640 | |
| 641 | taskID, err := requiredPathID(c.Param("id"), "task id") |
| 642 | if err != nil { |
| 643 | h.respondError(c, StatusForTaskError(err), err) |
| 644 | return |
| 645 | } |
| 646 | |
| 647 | var req contract.SetTaskExecutionProfileRequest |
| 648 | if err := c.ShouldBindJSON(&req); err != nil { |
| 649 | h.respondError( |
| 650 | c, |
| 651 | http.StatusBadRequest, |
| 652 | NewTaskValidationError(fmt.Errorf("%s: decode task execution profile request: %w", h.transportName(), err)), |
| 653 | ) |
| 654 | return |
| 655 | } |
| 656 | |
| 657 | profile, err := taskExecutionProfileFromRequest(taskID, &req) |
| 658 | if err != nil { |
| 659 | h.respondError(c, StatusForTaskError(err), err) |
| 660 | return |
| 661 | } |
| 662 | |
| 663 | actor, err := h.taskActorContext(c, taskActionSetProfile) |
| 664 | if err != nil { |
| 665 | h.respondError(c, StatusForTaskError(err), err) |
| 666 | return |
| 667 | } |
| 668 | |
| 669 | stored, err := manager.SetExecutionProfile(c.Request.Context(), taskID, profile, actor) |
| 670 | if err != nil { |
| 671 | h.respondError(c, StatusForTaskError(err), err) |
| 672 | return |
| 673 | } |
| 674 | |
| 675 | c.JSON(http.StatusOK, contract.TaskExecutionProfileResponse{Profile: stored}) |
| 676 | } |
| 677 | |
| 678 | // DeleteTaskExecutionProfile removes one persisted task-owned execution profile. |
| 679 | func (h *BaseHandlers) DeleteTaskExecutionProfile(c *gin.Context) { |
nothing calls this directly
no test coverage detected