public static async Task Run( ISettings settings, IPackageSourceProvider sourceProvider, string packageId, string packageVersion, string source, string apiKey, bool nonInteractive, bool noServiceEndpoint, Func <string, bool> confirmFunc, ILogger logger) { source = CommandRunnerUtility.ResolveSource(sourceProvider, source); PackageSource packageSource = CommandRunnerUtility.GetOrCreatePackageSource(sourceProvider, source); // Only warn for V3 style sources because they have a service index which is different from the final push url. if (packageSource.IsHttp && !packageSource.IsHttps && (packageSource.ProtocolVersion == 3 || packageSource.Source.EndsWith("json", StringComparison.OrdinalIgnoreCase))) { logger.LogWarning(string.Format(CultureInfo.CurrentCulture, Strings.Warning_HttpServerUsage, "delete", packageSource.Source)); } var packageUpdateResource = await CommandRunnerUtility.GetPackageUpdateResource(sourceProvider, packageSource); await packageUpdateResource.Delete( packageId, packageVersion, endpoint => apiKey ?? CommandRunnerUtility.GetApiKey(settings, endpoint, source), desc => nonInteractive || confirmFunc(desc), noServiceEndpoint, logger); }
public static async Task Run( ISettings settings, IPackageSourceProvider sourceProvider, IList <string> packagePaths, string source, string apiKey, string symbolSource, string symbolApiKey, int timeoutSeconds, bool disableBuffering, bool noSymbols, bool noServiceEndpoint, bool skipDuplicate, ILogger logger) { source = CommandRunnerUtility.ResolveSource(sourceProvider, source); symbolSource = CommandRunnerUtility.ResolveSymbolSource(sourceProvider, symbolSource); if (timeoutSeconds == 0) { timeoutSeconds = 5 * 60; } PackageSource packageSource = CommandRunnerUtility.GetOrCreatePackageSource(sourceProvider, source); var packageUpdateResource = await CommandRunnerUtility.GetPackageUpdateResource(sourceProvider, packageSource); // Only warn for V3 style sources because they have a service index which is different from the final push url. if (packageSource.IsHttp && !packageSource.IsHttps && (packageSource.ProtocolVersion == 3 || packageSource.Source.EndsWith("json", StringComparison.OrdinalIgnoreCase))) { logger.LogWarning(string.Format(CultureInfo.CurrentCulture, Strings.Warning_HttpServerUsage, "push", packageSource.Source)); } packageUpdateResource.Settings = settings; SymbolPackageUpdateResourceV3 symbolPackageUpdateResource = null; // figure out from index.json if pushing snupkg is supported var sourceUri = packageUpdateResource.SourceUri; if (string.IsNullOrEmpty(symbolSource) && !noSymbols && !sourceUri.IsFile && sourceUri.IsAbsoluteUri) { symbolPackageUpdateResource = await CommandRunnerUtility.GetSymbolPackageUpdateResource(sourceProvider, source); if (symbolPackageUpdateResource != null) { symbolSource = symbolPackageUpdateResource.SourceUri.AbsoluteUri; symbolApiKey = apiKey; } } await packageUpdateResource.Push( packagePaths, symbolSource, timeoutSeconds, disableBuffering, endpoint => apiKey ?? CommandRunnerUtility.GetApiKey(settings, endpoint, source), symbolsEndpoint => symbolApiKey ?? CommandRunnerUtility.GetApiKey(settings, symbolsEndpoint, symbolSource), noServiceEndpoint, skipDuplicate, symbolPackageUpdateResource, logger); }