コード例 #1
0
        public async Task <IActionResult> DeleteJobTaskDefinition(int projectId, int jobId, int taskId)
        {
            _logger.LogInformation("Deleting job task definition {taskId} in job definition {jobId}, project {projectId}", taskId, jobId, projectId);

            await _jobDefinitionService.DeleteJobTaskDefinition(taskId);

            return(NoContent());
        }
コード例 #2
0
        public override string Execute()
        {
            if (!(AutoConfirm || Console.GetYesNo($"Are you sure you want to remove task {Name} from job definition {Job}?", false)))
            {
                return(string.Empty);
            }

            Console.WriteLine($"Trying to remove task \"{Name}\" from job definition {Job}...");

            string message;

            var project = _projectService.GetProjectByName(Project).Result;

            if (project != null)
            {
                var job = _jobDefinitionService.GetJobDefinitionByName(project.Id, Job).Result;

                if (job != null)
                {
                    var task = _jobDefinitionService.GetJobTaskDefinitionByName(project.Id, job.Id, Name).Result;

                    if (task != null)
                    {
                        _jobDefinitionService.DeleteJobTaskDefinition(project.Id, job.Id, task.Id).Wait();

                        message = $"Task {Name} has been removed successfully";
                        Logger.LogInformation(message);
                        return(message);
                    }
                }
            }

            message = $"Failed to remove task {Name}. Make sure the project, job definition, and task names are correct.";

            return(message);
        }