Ejemplo n.º 1
0
        public async Task <IActionResult> Trigger([FromForm] string ruleName, CancellationToken token)
        {
            var rule = _options.Value.Rules.FirstOrDefault(x =>
                                                           x.Name.Equals(ruleName, StringComparison.OrdinalIgnoreCase));


            if (rule == null)
            {
                _log.LogWarning($"Tried to trigger {ruleName} rule but could not find it in the configuration");
                return(NotFound());
            }

            var eventLog = await _eventLogRepository.CreateManualAsync(token);

            await _executionRequestRepository.Create(rule, eventLog.Id, token);

            return(Ok());
        }