public PackagePhysicalFileMetadata DownloadPackage(string packageId,
                                                           IVersion version,
                                                           string feedId,
                                                           Uri feedUri,
                                                           FeedType feedType,
                                                           string feedUsername,
                                                           string feedPassword,
                                                           bool forcePackageDownload,
                                                           int maxDownloadAttempts,
                                                           TimeSpan downloadAttemptBackoff)
        {
            IPackageDownloader?downloader = null;

            switch (feedType)
            {
            case FeedType.Maven:
                downloader = new MavenPackageDownloader(fileSystem);
                break;

            case FeedType.NuGet:
                downloader = new NuGetPackageDownloader(fileSystem, variables);
                break;

            case FeedType.GitHub:
                downloader = new GitHubPackageDownloader(log, fileSystem);
                break;

            case FeedType.Helm:
                downloader = new HelmChartPackageDownloader(fileSystem);
                break;

            case FeedType.Docker:
            case FeedType.AwsElasticContainerRegistry:
                downloader = new DockerImagePackageDownloader(engine, fileSystem, commandLineRunner, variables, log);
                break;

            case FeedType.S3:
                downloader = new S3PackageDownloader(log, fileSystem);
                break;

            default:
                throw new NotImplementedException($"No Calamari downloader exists for feed type `{feedType}`.");
            }
            Log.Verbose($"Feed type provided `{feedType}` using {downloader.GetType().Name}");

            return(downloader.DownloadPackage(
                       packageId,
                       version,
                       feedId,
                       feedUri,
                       feedUsername,
                       feedPassword,
                       forcePackageDownload,
                       maxDownloadAttempts,
                       downloadAttemptBackoff));
        }
        public PackagePhysicalFileMetadata DownloadPackage(
            string packageId,
            IVersion version,
            string feedId,
            Uri feedUri,
            FeedType feedType,
            ICredentials feedCredentials,
            bool forcePackageDownload,
            int maxDownloadAttempts,
            TimeSpan downloadAttemptBackoff)
        {
            IPackageDownloader downloader = null;

            switch (feedType)
            {
            case FeedType.Maven:
                downloader = new MavenPackageDownloader();
                break;

            case FeedType.NuGet:
                downloader = new NuGetPackageDownloader();
                break;

            case FeedType.GitHub:
                downloader = new GitHubPackageDownloader();
                break;

            case FeedType.Helm:
                downloader = new HelmChartPackageDownloader(engine, fileSystem, commandLineRunner);
                break;

            default:
                throw new NotImplementedException($"No Calamari downloader exists for feed type `{feedType}`.");
            }
            Log.Verbose($"Feed type provided `{feedType}` using {downloader.GetType().Name}");

            return(downloader.DownloadPackage(
                       packageId,
                       version,
                       feedId,
                       feedUri,
                       feedCredentials,
                       forcePackageDownload,
                       maxDownloadAttempts,
                       downloadAttemptBackoff));
        }