Example #1
0
        public PackageUploadService(
            IPackageService packageService,
            IPackageFileService packageFileService,
            IEntitiesContext entitiesContext,
            IReservedNamespaceService reservedNamespaceService,
            IValidationService validationService,
            ICoreLicenseFileService coreLicenseFileService,
            ICoreReadmeFileService coreReadmeFileService,
            IDiagnosticsService diagnosticsService,
            IPackageVulnerabilitiesManagementService vulnerabilityService,
            IPackageMetadataValidationService metadataValidationService)
        {
            _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
            _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
            _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
            _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
            _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
            _coreLicenseFileService   = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
            _coreReadmeFileService    = coreReadmeFileService ?? throw new ArgumentNullException(nameof(coreReadmeFileService));

            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }
            _vulnerabilityService      = vulnerabilityService ?? throw new ArgumentNullException(nameof(vulnerabilityService));
            _metadataValidationService = metadataValidationService ?? throw new ArgumentNullException(nameof(metadataValidationService));
        }
Example #2
0
 public ReadMeService(
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IMarkdownService markdownService,
     ICoreReadmeFileService coreReadmeFileService)
 {
     _packageFileService    = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext       = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _markdownService       = markdownService ?? throw new ArgumentNullException(nameof(markdownService));
     _coreReadmeFileService = coreReadmeFileService ?? throw new ArgumentNullException(nameof(coreReadmeFileService));
 }
Example #3
0
 public PackageStatusProcessor(
     IEntityService <Package> galleryPackageService,
     IValidationFileService packageFileService,
     IValidatorProvider validatorProvider,
     ITelemetryService telemetryService,
     IOptionsSnapshot <SasDefinitionConfiguration> options,
     ILogger <EntityStatusProcessor <Package> > logger,
     ICoreLicenseFileService coreLicenseFileService,
     ICoreReadmeFileService coreReadmeFileService)
     : base(galleryPackageService, packageFileService, validatorProvider, telemetryService, logger)
 {
     _coreLicenseFileService     = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
     _sasDefinitionConfiguration = (options == null || options.Value == null) ? new SasDefinitionConfiguration() : options.Value;
     _coreReadmeFileService      = coreReadmeFileService ?? throw new ArgumentNullException(nameof(coreReadmeFileService));
 }
        public PackageDeleteService(
            IEntityRepository <Package> packageRepository,
            IEntityRepository <PackageRegistration> packageRegistrationRepository,
            IEntityRepository <PackageDelete> packageDeletesRepository,
            IEntitiesContext entitiesContext,
            IPackageService packageService,
            IIndexingService indexingService,
            IPackageFileService packageFileService,
            IAuditingService auditingService,
            IPackageDeleteConfiguration config,
            IStatisticsService statisticsService,
            ITelemetryService telemetryService,
            ISymbolPackageFileService symbolPackageFileService,
            ISymbolPackageService symbolPackageService,
            IEntityRepository <SymbolPackage> symbolPackageRepository,
            ICoreLicenseFileService coreLicenseFileService,
            ICoreReadmeFileService coreReadmeFileService)
        {
            _packageRepository             = packageRepository ?? throw new ArgumentNullException(nameof(packageRepository));
            _packageRegistrationRepository = packageRegistrationRepository ?? throw new ArgumentNullException(nameof(packageRegistrationRepository));
            _packageDeletesRepository      = packageDeletesRepository ?? throw new ArgumentNullException(nameof(packageDeletesRepository));
            _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
            _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
            _indexingService          = indexingService ?? throw new ArgumentNullException(nameof(indexingService));
            _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
            _auditingService          = auditingService ?? throw new ArgumentNullException(nameof(auditingService));
            _config                   = config ?? throw new ArgumentNullException(nameof(config));
            _statisticsService        = statisticsService ?? throw new ArgumentNullException(nameof(statisticsService));
            _telemetryService         = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
            _symbolPackageFileService = symbolPackageFileService ?? throw new ArgumentNullException(nameof(symbolPackageFileService));
            _symbolPackageService     = symbolPackageService ?? throw new ArgumentNullException(nameof(symbolPackageService));
            _symbolPackageRepository  = symbolPackageRepository ?? throw new ArgumentNullException(nameof(symbolPackageRepository));
            _coreLicenseFileService   = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
            _coreReadmeFileService    = coreReadmeFileService ?? throw new ArgumentNullException(nameof(coreReadmeFileService));

            if (config.HourLimitWithMaximumDownloads.HasValue &&
                config.StatisticsUpdateFrequencyInHours.HasValue &&
                config.HourLimitWithMaximumDownloads.Value <= config.StatisticsUpdateFrequencyInHours.Value)
            {
                throw new ArgumentException($"{nameof(_config.StatisticsUpdateFrequencyInHours)} must be less than " +
                                            $"{nameof(_config.HourLimitWithMaximumDownloads)}.",
                                            nameof(config));
            }
        }