MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / Delete

Method Delete

agent/app/service/agents.go:772–797  ·  view source on GitHub ↗
(req dto.AgentDeleteReq)

Source from the content-addressed store, hash-verified

770}
771
772func (a AgentService) Delete(req dto.AgentDeleteReq) error {
773 agent, err := agentRepo.GetFirst(repo.WithByID(req.ID))
774 if err != nil {
775 return err
776 }
777 resources, err := a.deleteCheckByAgent(agent)
778 if err != nil {
779 return err
780 }
781 if len(resources) > 0 {
782 return buserr.New("ErrAgentWebsiteBound")
783 }
784 if agent.AppInstallID == 0 {
785 return agentRepo.DeleteByID(agent.ID)
786 }
787 operate := request.AppInstalledOperate{
788 InstallId: agent.AppInstallID,
789 Operate: constant.Delete,
790 TaskID: req.TaskID,
791 ForceDelete: req.ForceDelete,
792 }
793 if err := NewIAppInstalledService().Operate(operate); err != nil {
794 return err
795 }
796 return nil
797}
798
799func (a AgentService) DeleteCheck(req dto.AgentIDReq) ([]dto.AppResource, error) {
800 agent, err := agentRepo.GetFirst(repo.WithByID(req.AgentID))

Callers 1

BatchOperateMethod · 0.95

Calls 6

deleteCheckByAgentMethod · 0.95
NewIAppInstalledServiceFunction · 0.85
GetFirstMethod · 0.65
WithByIDMethod · 0.65
DeleteByIDMethod · 0.65
OperateMethod · 0.65

Tested by

no test coverage detected