public Task <HttpMonitor> GetHttpMonitorByIdAsync(HttpMonitorId httpMonitorId) { if (httpMonitorId == null) { throw new ArgumentNullException(nameof(httpMonitorId)); } return(_repository.GetByIdAsync(httpMonitorId)); }
public async Task <HttpMonitorCheck> ExecuteAsync(HttpMonitorId httpMonitorId) { var httpMonitor = await _repository.GetByIdAsync(httpMonitorId); if (httpMonitor == null) { throw new EntityNotFoundException(httpMonitorId); } var cmd = httpMonitor.CreateCheckHttpEndpoint(HttpMonitorCheckId.Create()); return(await _executor.CheckHttpEndpointAsync(cmd)); }
public static async Task HttpMonitorHandlesHttpMonitorChecked( [QueueTrigger("events-httpmonitorchecked-httpmonitor")] string json, TraceWriter log, [Inject] IHttpMonitorRepository repository) { var @event = JsonConvert.DeserializeObject <HttpMonitorChecked>(json, Constants.JsonSerializerSettings); var monitor = await repository.GetByIdAsync(@event.HttpMonitorCheck.HttpMonitorId); monitor?.Handle(@event); await repository.PutAsync(monitor); }