public AuditService(ILogger logger, HighlightClient client, IAuditContext context)
 {
     _logger     = logger;
     _client     = client;
     _auditFile  = context.AuditFile;
     _companyIds = context.CompanyIds.ToArray();
 }
 public AppInfoService(ILogger logger, HighlightClient client, IAppInfoContext context)
 {
     _logger           = logger;
     _client           = client;
     _templateFileName = context.TemplateFileName;
     _outputFileName   = context.OutputFileName;
     _domainIds        = context.DomainIds.ToArray();
     _appIds           = new HashSet <string>(context.AppIds);
 }
Пример #3
0
        // traitement principal
        async Task Run(ILogger logger, Args args)
        {
            WebTaskMonitorFactory.MaxConcurrency = args.MaxConcurrency.Value;

            using (var client = new HighlightClient(args.Url.Value)) {
                try {
                    var credSrv = new CredentialService(logger);
                    await client.Authenticate(await credSrv.GetCredential(args));
                } catch (Exception ex) {
                    throw new UnauthorizedAccessException("Authentication failed", ex);
                }

                Exception appInfoServiceException = null;
                try {
                    var appInfoService = new AppInfoService(logger, client, args);
                    await appInfoService.Run();
                } catch (Exception ex) {
                    appInfoServiceException = ex;
                }

                Exception auditServiceException = null;
                try {
                    var auditService = new AuditService(logger, client, args);
                    await auditService.Run();
                } catch (Exception ex) {
                    auditServiceException = ex;
                }

                if (appInfoServiceException != null || auditServiceException != null)
                {
                    if (appInfoServiceException == null)
                    {
                        throw auditServiceException;
                    }
                    if (auditServiceException == null)
                    {
                        throw appInfoServiceException;
                    }
                    throw new AggregateException(appInfoServiceException, auditServiceException);
                }
            }
        }