public async Task <IActionResult> GetDeletionJobDefinition(int projectId)
        {
            _logger.LogInformation("Getting deletion job definition in project {projectId}", projectId);

            var jobDefinition = await _jobDefinitionService.GetDeletionJobDefinition(projectId);

            var result = _mapper.Map <JobDefinitionDto>(jobDefinition);

            return(Ok(result));
        }
예제 #2
0
        public async Task <IActionResult> GetDeletionJobDefinition(int projectId)
        {
            _logger.LogRequest("Getting deletion job definition in project {projectId}", projectId);

            var jobDefinition = await _jobDefinitionService.GetDeletionJobDefinition(projectId);

            var result = _mapper.Map <JobDefinitionDto>(jobDefinition);

            _logger.LogResponse("Deletion job definition in project {projectId} retrieved. Reponse body: {@result}", projectId, result);

            return(Ok(result));
        }
예제 #3
0
        public override string Execute()
        {
            if (!(AutoConfirm || Console.GetYesNo($"Are you sure you want to remove project {Name}?", false)))
            {
                return(string.Empty);
            }

            Console.WriteLine($"Trying to remove project {Name}...");

            string message;

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

            if (project != null)
            {
                var deletionJobDefinition = _jobDefinitionService.GetDeletionJobDefinition(project.Id).Result;
                if (deletionJobDefinition != null &&
                    (AutoConfirm || Console.GetYesNo("Do you want to remove the related resources as well?", false)))
                {
                    _projectService.MarkProjectDeleting(project.Id).Wait();
                    message = $"Project {Name} is being removed. You will be notified once the process has been done";
                }
                else
                {
                    _projectService.DeleteProject(project.Id).Wait();
                    message = $"Project {Name} has been removed successfully";
                }

                Logger.LogInformation(message);
            }
            else
            {
                message = $"Project {Name} was not found";
            }

            return(message);
        }