コード例 #1
0
        public async Task <IActionResult> DeleteAsync(string locatorType, string locator)
        {
            Build build = await _builds.GetByLocatorAsync(GetLocatorType(locatorType), locator);

            if (build == null)
            {
                return(NotFound());
            }
            Engine engine = await _engines.GetAsync(build.EngineRef);

            if (engine == null)
            {
                return(NotFound());
            }
            if (!await AuthorizeAsync(engine, Operations.Update))
            {
                return(StatusCode(StatusCodes.Status403Forbidden));
            }

            await _engineService.CancelBuildAsync(engine.Id);

            return(Ok());
        }