Ejemplo n.º 1
0
        static async Task Main(string[] args)
        {
            _Workspace = new AzureSentinelWorkspace();
            _Workspace.SubscriptionId = Environment.GetEnvironmentVariable("AzureSubscriptionId");
            _Workspace.ResourceGroup  = Environment.GetEnvironmentVariable("AzureSentinelResourceGroup");
            _Workspace.WorkspaceName  = Environment.GetEnvironmentVariable("AzureSentinelWorkspaceName");
            _Workspace.AppRegistration.DirectoryId = Environment.GetEnvironmentVariable("AppRegistrationDirectoryId");
            _Workspace.AppRegistration.ClientId    = Environment.GetEnvironmentVariable("AppRegistrationClientId");
            _Workspace.AppRegistration.AppSecret   = Environment.GetEnvironmentVariable("AppRegistrationSecret");

            System.Console.WriteLine(String.Format("Azure Subscription Id: {0}", _Workspace.SubscriptionId));
            System.Console.WriteLine(String.Format("Resource Group: {0}", _Workspace.ResourceGroup));
            System.Console.WriteLine(String.Format("Workspace: {0}", _Workspace.WorkspaceName));
            System.Console.WriteLine(String.Format("App Registration ClientId: {0}", _Workspace.AppRegistration.ClientId));
            System.Console.WriteLine(String.Format("App Registration DirectoryId:: {0}", _Workspace.AppRegistration.DirectoryId));
            System.Console.WriteLine(String.Format("Eventhub Name: {0}", Environment.GetEnvironmentVariable("EventHubName")));

            _EventHubService = new EventHubService(Environment.GetEnvironmentVariable("EventHubConnectionString"), Environment.GetEnvironmentVariable("EventHubName"));

            while (true)
            {
                await ProcessSentinelIncidentsAsync();

                await Task.Delay(TimeSpan.FromSeconds(10));
            }
        }
Ejemplo n.º 2
0
        public EventHubViewModel(IEventHubService service)
        {
            this.SaveSettings = true;
            this.PastMinutes = 1;
            this.PastMessages = 1;
            this.MessagePerPartition = DEFAULT_MESSAGE_PER_PARTIION;

            _service = service;
            this.Partitions = new ObservableCollection<PartitionViewModel>();
            this.Messages = new ObservableCollection<MessageViewModel>();

            _service.MessageReceived.Subscribe((m) =>
            {
                App.Current.Dispatcher.BeginInvoke(new Action(() => {
                    var view = new MessageViewModel(m);
                    _allMessages.Insert(0,view);
                    Messages.Insert(0,view);
                    NumberOfMessagesReceived++;
                    if (Messages.Count > Partitions.Count * MessagePerPartition)
                    {
                        Messages.RemoveAt(Messages.Count - 1);
                        _allMessages.RemoveAt(_allMessages.Count - 1);
                    }
                }), null);
            });
            SetupCommands();
        }
        internal EventHubTarget(IEventHubService eventHubService)
        {
            TaskDelayMilliseconds = 200;
            BatchSize             = 100;

            _eventHubService = eventHubService;
        }
Ejemplo n.º 4
0
        public EventHubViewModel(IEventHubService service)
        {
            this.SaveSettings        = true;
            this.PastMinutes         = 1;
            this.PastMessages        = 1;
            this.MessagePerPartition = DEFAULT_MESSAGE_PER_PARTIION;

            _service        = service;
            this.Partitions = new ObservableCollection <PartitionViewModel>();
            this.Messages   = new ObservableCollection <MessageViewModel>();



            _service.MessageReceived.Subscribe((m) =>
            {
                App.Current.Dispatcher.BeginInvoke(new Action(() => {
                    var view = new MessageViewModel(m);
                    _allMessages.Insert(0, view);
                    Messages.Insert(0, view);
                    NumberOfMessagesReceived++;
                    if (Messages.Count > Partitions.Count * MessagePerPartition)
                    {
                        Messages.RemoveAt(Messages.Count - 1);
                        _allMessages.RemoveAt(_allMessages.Count - 1);
                    }
                }), null);
            });
            SetupCommands();
        }
Ejemplo n.º 5
0
 public TicketService(ITicketRepository ticketRepository, IMapper mapper, ICommandTicketRepository commandTicketRepository,
                      IEventHubService eventHubService)
 {
     _ticketRepository        = ticketRepository;
     _commandTicketRepository = commandTicketRepository;
     _mapper          = mapper;
     _eventHubService = eventHubService;
 }
 public WebSocketModuleChannel(string urlPath, IServiceProvider serviceProvider)
     : base(urlPath, true)
 {
     _jobService = serviceProvider.GetService <IJobService>();
     _hubService = serviceProvider.GetService <IEventHubService>();
     _hubService.Subscribe <JobInfo>(this, async jobInfo => {
         await BroadcastAsync(new EventResponse <JobInfo>(jobInfo).ToString());
     });
 }
Ejemplo n.º 7
0
 public CommandService(IMeterService meterService, IServicesUtils servicesUtils,
                       IMiddlewareProviderService middlewareProviderService, IMapper mapper, IThreadService threadService,
                       ITicketService ticketService, IEventHubService eventHubService)
 {
     _meterService              = meterService;
     _servicesUtils             = servicesUtils;
     _middlewareProviderService = middlewareProviderService;
     _ticketService             = ticketService;
     _mapper          = mapper;
     _threadService   = threadService;
     _eventHubService = eventHubService;
 }
Ejemplo n.º 8
0
 public RunController(UserManager <ApplicationUser> userManager,
                      IActivityRepo activityRepo, IEventHubService eventHubService,
                      IPointRepo pointRepo, IRunnerRepo runnerRepo, ICloudStorageService cloudStorageService,
                      ISharedRunService sharedRunService)
 {
     _userManager         = userManager;
     _activityRepo        = activityRepo;
     _eventHubService     = eventHubService;
     _pointRepo           = pointRepo;
     _runnerRepo          = runnerRepo;
     _cloudStorageService = cloudStorageService;
     _sharedRunService    = sharedRunService;
 }
Ejemplo n.º 9
0
        public StreamManager(
            ITwitterStreamingClient twitterStreamingClient,
            ISentimentAnalysisService sentimentAnalysisService,
            IEventHubService eventHubService,
            ILoggerFactory loggerFactory,
            TwitterSettings twitterSettings)
        {
            this.twitterStreamingClient   = twitterStreamingClient;
            this.sentimentAnalysisService = sentimentAnalysisService;
            this.eventHubService          = eventHubService;
            this.twitterSettings          = twitterSettings;

            this.logger = loggerFactory.CreateLogger(nameof(StreamManager));
        }
        public MainViewModel(IEventHubService eventHubService)
        {
            _eventHubService      = eventHubService;
            SerialNumber          = System.Guid.NewGuid().ToString().Substring(0, 8);
            MakeCappuccinoCommand = new DelegateCommand(MakeCappuccino);
            MakeEspressoCommand   = new DelegateCommand(MakeEspresso);
            Logs = new ObservableCollection <string>();

            _dispatcherTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(2)
            };
            _dispatcherTimer.Tick += DispatchTimer_Tick;
        }
Ejemplo n.º 11
0
 public MqttChannel(IEventHubService hubService, ILoggerFactory loggerFactory)
 {
     _logger     = loggerFactory.CreateLogger <MqttChannel>();
     _hubService = hubService;
     _hubService.Subscribe <JobInfo>(this, jobInfo => {
         if (_client != null && _client.IsConnected)
         {
             var topic     = TopicFactory(JobService.PREFIX);
             var eventData = new EventResponse <JobInfo>(jobInfo);
             _client.Publish(topic, eventData.ToBytes());
             _logger.LogInformation($"Published {topic}");
             _logger.LogDebug($"{topic} with data: {eventData}");
         }
     });
 }
        public EventHubViewModel(IEventHubService eventHubService)
        {
            _publisherService         = eventHubService;
            _deviceSettingDataService = Mvx.IoCProvider.Resolve <IDeviceSettingDataService>();
            _timerService             = Mvx.IoCProvider.Resolve <ITimerService <EventHubViewModel> >();

            _eventHubSetting = new EventHubSetting();

            SetConnectionStatus();

            ConsoleLogType = ConsoleLogTypes.EventHub;

            _statusChangedMessageToken         = _messageService.Subscribe <EventHubStatusUpdatedMessage>(HandleStatusChangedMessage);
            _timerServiceTriggeredMessageToken = _messageService.Subscribe <TimerServiceTriggeredMessage <EventHubViewModel> >(HandleTimerTrigger);
        }
 public MiddlewaresMessageHandlerService(IThreadService threadService, IMeterEnergyService meterEnergyService,
                                         IMeterService meterService, IMapper mapper, IDeviceLogService deviceLogService, ISmcService smcService,
                                         ISmcAlarmService smcAlarmService, IMeterAlarmService meterAlarmService, ISmcUnregisteredService smcUnregisteredService, IModemService modemService,
                                         IMeterUnregisteredService meterUnregisteredService, IEventHubService eventHubService)
 {
     _threadService            = threadService;
     _meterEnergyService       = meterEnergyService;
     _meterService             = meterService;
     _deviceLogService         = deviceLogService;
     _smcService               = smcService;
     _smcAlarmService          = smcAlarmService;
     _meterAlarmService        = meterAlarmService;
     _smcUnregisteredService   = smcUnregisteredService;
     _meterUnregisteredService = meterUnregisteredService;
     _modemService             = modemService;
     _mapper          = mapper;
     _eventHubService = eventHubService;
 }
Ejemplo n.º 14
0
 public JobService(ILoggerFactory loggerFactory, IFileService fileService, IDeviceService deviceService, IEventHubService hubService, CancellationToken cancellationToken)
 {
     _loggerFactory     = loggerFactory;
     _logger            = loggerFactory.CreateLogger <JobService>();
     _fileService       = fileService;
     _deviceService     = deviceService;
     _fileStream        = null;
     _hubService        = hubService;
     _cancellationToken = cancellationToken;
     State = JobStates.Stop;
     Task.Run(async() => {
         try {
             await Background();
         } catch (Exception ex) {
             _logger.LogError(ex.Message);
             StopJob();
         }
     }, _cancellationToken);
 }
Ejemplo n.º 15
0
 public EventHubSpammerFunction(IEventHubService eventHubService)
 {
     _eventHubService = eventHubService ?? throw new ArgumentNullException(nameof(eventHubService));
 }
Ejemplo n.º 16
0
 public DeviceLogService(IDeviceLogRepository deviceLogRepository, IMapper mapper, IEventHubService eventHubService)
 {
     _deviceLogRepository = deviceLogRepository;
     _mapper          = mapper;
     _eventHubService = eventHubService;
 }
Ejemplo n.º 17
0
 public HubCommandBus(
     IEventHubService hubService)
 {
     _hubService = hubService;
 }
Ejemplo n.º 18
0
 public GetMessages(ITelegramService telegramService, IRandomService randomService, IEventHubService eventHub)
 {
     _telegramService = telegramService;
     _randomService   = randomService;
     _eventHub        = eventHub;
 }
 public MeasurementToEventAsyncCollector(IEventHubService eventHubService)
 {
     _eventHubService = EnsureArg.IsNotNull(eventHubService, nameof(eventHubService));
 }
 public EventHubController(IEventHubService eventHubService)
 {
     _eventHubService = eventHubService;
 }
Ejemplo n.º 21
0
 public HubEventBus(IEventHubService bus)
 {
     _bus = bus;
 }