private async Task <Uri> GetNupkgUrl(Package package, ValidationConfigurationItem validationConfiguration)
        {
            if (await _packageFileService.DoesPackageFileExistAsync(package))
            {
                return(await _packageFileService.GetPackageReadUriAsync(package));
            }
            else if (await _packageFileService.DoesValidationPackageFileExistAsync(package))
            {
                return(await _packageFileService.GetValidationPackageReadUriAsync(package, DateTimeOffset.UtcNow.Add(validationConfiguration.FailAfter)));
            }

            throw new Exception($"Package {package.PackageRegistration.Id} {package.NormalizedVersion} does not exist neither in validation nor in public container");
        }
        private async Task <IValidationRequest> CreateValidationRequest(
            PackageValidationSet packageValidationSet,
            PackageValidation packageValidation,
            Package package,
            ValidationConfigurationItem validationConfiguration)
        {
            var validationRequest = new ValidationRequest(
                validationId: packageValidation.Key,
                packageKey: packageValidationSet.PackageKey,
                packageId: packageValidationSet.PackageId,
                packageVersion: packageValidationSet.PackageNormalizedVersion,
                nupkgUrl: (await GetNupkgUrl(package, validationConfiguration)).AbsoluteUri
                );

            return(validationRequest);
        }
 private void UpdateStatsForValidationSuccess(ValidationSetProcessorResult processorStats, ValidationConfigurationItem validationConfiguration)
 {
     processorStats.AnyValidationSucceeded = true;
     if (validationConfiguration.FailureBehavior == ValidationFailureBehavior.MustSucceed)
     {
         processorStats.AnyRequiredValidationSucceeded = true;
     }
 }
        private async Task ProcessIncompleteValidation(PackageValidation packageValidation, ValidationConfigurationItem validationConfiguration)
        {
            // need to check validation timeout
            var duration = DateTime.UtcNow - packageValidation.Started;

            if (duration > validationConfiguration.FailAfter)
            {
                _logger.LogWarning("Failing validation {Validation} for package {PackageId} {PackageVersion} that runs longer than configured failure timout {FailAfter}",
                                   packageValidation.Type,
                                   packageValidation.PackageValidationSet.PackageId,
                                   packageValidation.PackageValidationSet.PackageNormalizedVersion,
                                   validationConfiguration.FailAfter);
                await _validationStorageService.UpdateValidationStatusAsync(packageValidation, ValidationStatus.Failed);

                return;
            }
        }