Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIs to read auditSources from nuget.config files #5620

Merged
merged 6 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

#nullable enable

using System;
using System.Collections.Generic;

Expand All @@ -14,13 +16,19 @@ public interface IPackageSourceProvider
/// <returns>Enumerable of all of the package sources</returns>
IEnumerable<PackageSource> LoadPackageSources();

/// <summary>
/// Gets a list of all of the audit sources
/// </summary>
/// <returns>Read only list of all of the audit sources</returns>
IReadOnlyList<PackageSource> LoadAuditSources();

/// <summary>
/// Gets the source that matches a given name.
/// </summary>
/// <param name="name">Name of source to be searched for</param>
/// <returns>PackageSource that matches the given name. Null if none was found</returns>
/// <throws>ArgumentException when <paramref name="name"/> is null or empty.</throws>
PackageSource GetPackageSourceByName(string name);
PackageSource? GetPackageSourceByName(string name);

/// <summary>
/// Gets the source that matches a given source url.
Expand All @@ -29,12 +37,12 @@ public interface IPackageSourceProvider
/// <returns>PackageSource that matches the given source. Null if none was found</returns>
/// <throws>ArgumentException when <paramref name="source"/> is null or empty.</throws>
/// <remarks>There may be multiple sources that match a given url. This method will return the first.</remarks>
PackageSource GetPackageSourceBySource(string source);
PackageSource? GetPackageSourceBySource(string source);

/// <summary>
/// Event raised when the package sources have been changed.
/// </summary>
event EventHandler PackageSourcesChanged;
event EventHandler? PackageSourcesChanged;

/// <summary>
/// Removes the package source that matches the given name
Expand Down Expand Up @@ -86,12 +94,12 @@ public interface IPackageSourceProvider
/// <summary>
/// Gets the name of the active PackageSource
/// </summary>
string ActivePackageSourceName { get; }
string? ActivePackageSourceName { get; }

/// <summary>
/// Gets the Default push source
/// </summary>
string DefaultPushSource { get; }
string? DefaultPushSource { get; }

/// <summary>
/// Updates the active package source with the given source.
Expand Down

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions src/NuGet.Core/NuGet.Configuration/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ NuGet.Configuration.ClientCertificateProvider
~NuGet.Configuration.ClientCertificateProvider.Remove(System.Collections.Generic.IReadOnlyList<NuGet.Configuration.ClientCertItem> items) -> void
NuGet.Configuration.ConfigurationConstants
NuGet.Configuration.ConfigurationDefaults
~NuGet.Configuration.ConfigurationDefaults.DefaultPackageRestoreConsent.get -> string
~NuGet.Configuration.ConfigurationDefaults.DefaultPackageSources.get -> System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource>
~NuGet.Configuration.ConfigurationDefaults.DefaultPushSource.get -> string
NuGet.Configuration.ConfigurationDefaults.DefaultPackageRestoreConsent.get -> string?
NuGet.Configuration.ConfigurationDefaults.DefaultPackageSources.get -> System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource!>!
NuGet.Configuration.ConfigurationDefaults.DefaultPushSource.get -> string?
NuGet.Configuration.CredentialRequestType
NuGet.Configuration.CredentialRequestType.Forbidden = 2 -> NuGet.Configuration.CredentialRequestType
NuGet.Configuration.CredentialRequestType.Proxy = 0 -> NuGet.Configuration.CredentialRequestType
Expand Down Expand Up @@ -69,20 +69,20 @@ NuGet.Configuration.IExtensionLocator
NuGet.Configuration.IMachineWideSettings
~NuGet.Configuration.IMachineWideSettings.Settings.get -> NuGet.Configuration.ISettings
NuGet.Configuration.IPackageSourceProvider
~NuGet.Configuration.IPackageSourceProvider.ActivePackageSourceName.get -> string
~NuGet.Configuration.IPackageSourceProvider.AddPackageSource(NuGet.Configuration.PackageSource source) -> void
~NuGet.Configuration.IPackageSourceProvider.DefaultPushSource.get -> string
~NuGet.Configuration.IPackageSourceProvider.DisablePackageSource(string name) -> void
~NuGet.Configuration.IPackageSourceProvider.EnablePackageSource(string name) -> void
~NuGet.Configuration.IPackageSourceProvider.GetPackageSourceByName(string name) -> NuGet.Configuration.PackageSource
~NuGet.Configuration.IPackageSourceProvider.GetPackageSourceBySource(string source) -> NuGet.Configuration.PackageSource
~NuGet.Configuration.IPackageSourceProvider.IsPackageSourceEnabled(string name) -> bool
~NuGet.Configuration.IPackageSourceProvider.LoadPackageSources() -> System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource>
NuGet.Configuration.IPackageSourceProvider.PackageSourcesChanged -> System.EventHandler
~NuGet.Configuration.IPackageSourceProvider.RemovePackageSource(string name) -> void
~NuGet.Configuration.IPackageSourceProvider.SaveActivePackageSource(NuGet.Configuration.PackageSource source) -> void
~NuGet.Configuration.IPackageSourceProvider.SavePackageSources(System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource> sources) -> void
~NuGet.Configuration.IPackageSourceProvider.UpdatePackageSource(NuGet.Configuration.PackageSource source, bool updateCredentials, bool updateEnabled) -> void
NuGet.Configuration.IPackageSourceProvider.ActivePackageSourceName.get -> string?
NuGet.Configuration.IPackageSourceProvider.AddPackageSource(NuGet.Configuration.PackageSource! source) -> void
NuGet.Configuration.IPackageSourceProvider.DefaultPushSource.get -> string?
NuGet.Configuration.IPackageSourceProvider.DisablePackageSource(string! name) -> void
NuGet.Configuration.IPackageSourceProvider.EnablePackageSource(string! name) -> void
NuGet.Configuration.IPackageSourceProvider.GetPackageSourceByName(string! name) -> NuGet.Configuration.PackageSource?
NuGet.Configuration.IPackageSourceProvider.GetPackageSourceBySource(string! source) -> NuGet.Configuration.PackageSource?
NuGet.Configuration.IPackageSourceProvider.IsPackageSourceEnabled(string! name) -> bool
NuGet.Configuration.IPackageSourceProvider.LoadPackageSources() -> System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource!>!
NuGet.Configuration.IPackageSourceProvider.PackageSourcesChanged -> System.EventHandler?
NuGet.Configuration.IPackageSourceProvider.RemovePackageSource(string! name) -> void
NuGet.Configuration.IPackageSourceProvider.SaveActivePackageSource(NuGet.Configuration.PackageSource! source) -> void
NuGet.Configuration.IPackageSourceProvider.SavePackageSources(System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource!>! sources) -> void
NuGet.Configuration.IPackageSourceProvider.UpdatePackageSource(NuGet.Configuration.PackageSource! source, bool updateCredentials, bool updateEnabled) -> void
NuGet.Configuration.IProxyCache
~NuGet.Configuration.IProxyCache.Add(System.Net.IWebProxy proxy) -> void
~NuGet.Configuration.IProxyCache.GetProxy(System.Uri uri) -> System.Net.IWebProxy
Expand Down Expand Up @@ -186,28 +186,28 @@ NuGet.Configuration.PackageSourceMappingSourceItem
~NuGet.Configuration.PackageSourceMappingSourceItem.Patterns.get -> System.Collections.Generic.IList<NuGet.Configuration.PackagePatternItem>
~NuGet.Configuration.PackageSourceMappingSourceItem.SetKey(string value) -> void
NuGet.Configuration.PackageSourceProvider
~NuGet.Configuration.PackageSourceProvider.ActivePackageSourceName.get -> string
~NuGet.Configuration.PackageSourceProvider.AddPackageSource(NuGet.Configuration.PackageSource source) -> void
~NuGet.Configuration.PackageSourceProvider.DefaultPushSource.get -> string
~NuGet.Configuration.PackageSourceProvider.DisablePackageSource(NuGet.Configuration.PackageSource source) -> void
~NuGet.Configuration.PackageSourceProvider.DisablePackageSource(string name) -> void
~NuGet.Configuration.PackageSourceProvider.EnablePackageSource(string name) -> void
~NuGet.Configuration.PackageSourceProvider.GetPackageSourceByName(string name) -> NuGet.Configuration.PackageSource
~NuGet.Configuration.PackageSourceProvider.GetPackageSourceBySource(string source) -> NuGet.Configuration.PackageSource
~NuGet.Configuration.PackageSourceProvider.GetPackageSourceNamesMatchingNamePrefix(string namePrefix) -> System.Collections.Generic.HashSet<string>
~NuGet.Configuration.PackageSourceProvider.IsPackageSourceEnabled(NuGet.Configuration.PackageSource source) -> bool
~NuGet.Configuration.PackageSourceProvider.IsPackageSourceEnabled(string name) -> bool
~NuGet.Configuration.PackageSourceProvider.LoadPackageSources() -> System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource>
~NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings settings) -> void
~NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings settings, System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource> configurationDefaultSources) -> void
~NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings settings, System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource> configurationDefaultSources, bool enablePackageSourcesChangedEvent) -> void
~NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings settings, bool enablePackageSourcesChangedEvent) -> void
NuGet.Configuration.PackageSourceProvider.PackageSourcesChanged -> System.EventHandler
~NuGet.Configuration.PackageSourceProvider.RemovePackageSource(string name) -> void
~NuGet.Configuration.PackageSourceProvider.SaveActivePackageSource(NuGet.Configuration.PackageSource source) -> void
~NuGet.Configuration.PackageSourceProvider.SavePackageSources(System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource> sources) -> void
~NuGet.Configuration.PackageSourceProvider.Settings.get -> NuGet.Configuration.ISettings
~NuGet.Configuration.PackageSourceProvider.UpdatePackageSource(NuGet.Configuration.PackageSource source, bool updateCredentials, bool updateEnabled) -> void
NuGet.Configuration.PackageSourceProvider.ActivePackageSourceName.get -> string?
NuGet.Configuration.PackageSourceProvider.AddPackageSource(NuGet.Configuration.PackageSource! source) -> void
NuGet.Configuration.PackageSourceProvider.DefaultPushSource.get -> string?
NuGet.Configuration.PackageSourceProvider.DisablePackageSource(NuGet.Configuration.PackageSource! source) -> void
NuGet.Configuration.PackageSourceProvider.DisablePackageSource(string! name) -> void
NuGet.Configuration.PackageSourceProvider.EnablePackageSource(string! name) -> void
NuGet.Configuration.PackageSourceProvider.GetPackageSourceByName(string! name) -> NuGet.Configuration.PackageSource?
NuGet.Configuration.PackageSourceProvider.GetPackageSourceBySource(string! source) -> NuGet.Configuration.PackageSource?
NuGet.Configuration.PackageSourceProvider.GetPackageSourceNamesMatchingNamePrefix(string! namePrefix) -> System.Collections.Generic.HashSet<string!>!
NuGet.Configuration.PackageSourceProvider.IsPackageSourceEnabled(NuGet.Configuration.PackageSource! source) -> bool
NuGet.Configuration.PackageSourceProvider.IsPackageSourceEnabled(string! name) -> bool
NuGet.Configuration.PackageSourceProvider.LoadPackageSources() -> System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource!>!
NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings! settings) -> void
NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings! settings, System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource!>! configurationDefaultSources) -> void
NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings! settings, System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource!>! configurationDefaultSources, bool enablePackageSourcesChangedEvent) -> void
NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings! settings, bool enablePackageSourcesChangedEvent) -> void
NuGet.Configuration.PackageSourceProvider.PackageSourcesChanged -> System.EventHandler?
NuGet.Configuration.PackageSourceProvider.RemovePackageSource(string! name) -> void
NuGet.Configuration.PackageSourceProvider.SaveActivePackageSource(NuGet.Configuration.PackageSource! source) -> void
NuGet.Configuration.PackageSourceProvider.SavePackageSources(System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource!>! sources) -> void
NuGet.Configuration.PackageSourceProvider.Settings.get -> NuGet.Configuration.ISettings!
NuGet.Configuration.PackageSourceProvider.UpdatePackageSource(NuGet.Configuration.PackageSource! source, bool updateCredentials, bool updateEnabled) -> void
NuGet.Configuration.ProxyCache
~NuGet.Configuration.ProxyCache.Add(System.Net.IWebProxy proxy) -> void
~NuGet.Configuration.ProxyCache.GetCredential(System.Uri proxyAddress, string authType) -> System.Net.NetworkCredential
Expand Down Expand Up @@ -401,15 +401,15 @@ override NuGet.Configuration.UnknownItem.IsEmpty() -> bool
~override NuGet.Configuration.VirtualSettingSection.Clone() -> NuGet.Configuration.SettingBase
~override sealed NuGet.Configuration.AddItem.Equals(object other) -> bool
override sealed NuGet.Configuration.AddItem.GetHashCode() -> int
~static NuGet.Configuration.ConfigurationDefaults.Instance.get -> NuGet.Configuration.ConfigurationDefaults
static NuGet.Configuration.ConfigurationDefaults.Instance.get -> NuGet.Configuration.ConfigurationDefaults!
~static NuGet.Configuration.EncryptionUtility.DecryptString(string encryptedString) -> string
~static NuGet.Configuration.EncryptionUtility.EncryptString(string value) -> string
~static NuGet.Configuration.NuGetPathContext.Create(NuGet.Configuration.ISettings settings) -> NuGet.Configuration.NuGetPathContext
~static NuGet.Configuration.NuGetPathContext.Create(string settingsRoot) -> NuGet.Configuration.NuGetPathContext
~static NuGet.Configuration.NullSettings.Instance.get -> NuGet.Configuration.NullSettings
~static NuGet.Configuration.PackageSourceCredential.FromUserInput(string source, string username, string password, bool storePasswordInClearText, string validAuthenticationTypesText) -> NuGet.Configuration.PackageSourceCredential
static NuGet.Configuration.PackageSourceMapping.GetPackageSourceMapping(NuGet.Configuration.ISettings! settings) -> NuGet.Configuration.PackageSourceMapping!
~static NuGet.Configuration.PackageSourceProvider.LoadPackageSources(NuGet.Configuration.ISettings settings) -> System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource>
static NuGet.Configuration.PackageSourceProvider.LoadPackageSources(NuGet.Configuration.ISettings! settings) -> System.Collections.Generic.IEnumerable<NuGet.Configuration.PackageSource!>!
~static NuGet.Configuration.ProxyCache.Instance.get -> NuGet.Configuration.ProxyCache
~static NuGet.Configuration.Settings.ApplyEnvironmentTransform(string value) -> string
~static NuGet.Configuration.Settings.GetFileNameAndItsRoot(string root, string settingsPath) -> System.Tuple<string, string>
Expand Down
7 changes: 7 additions & 0 deletions src/NuGet.Core/NuGet.Configuration/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#nullable enable
NuGet.Configuration.ConfigurationDefaults.DefaultAuditSources.get -> System.Collections.Generic.IReadOnlyList<NuGet.Configuration.PackageSource!>!
NuGet.Configuration.IPackageSourceProvider.LoadAuditSources() -> System.Collections.Generic.IReadOnlyList<NuGet.Configuration.PackageSource!>!
NuGet.Configuration.PackageSourceProvider.LoadAuditSources() -> System.Collections.Generic.IReadOnlyList<NuGet.Configuration.PackageSource!>!
NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings! settings, NuGet.Configuration.ConfigurationDefaults! configurationDefaults) -> void
NuGet.Configuration.PackageSourceProvider.PackageSourceProvider(NuGet.Configuration.ISettings! settings, NuGet.Configuration.ConfigurationDefaults! configurationDefaults, bool enablePackageSourcesChangedEvent) -> void
NuGet.Configuration.SettingElementType.AuditSources = 20 -> NuGet.Configuration.SettingElementType
~NuGet.Configuration.SettingElement.ConfigPath.get -> string
~NuGet.Configuration.SettingItem.GetAttributes() -> System.Collections.Generic.IReadOnlyDictionary<string, string>
~NuGet.Configuration.Settings.GetAllSettingSections() -> System.Collections.Generic.IEnumerable<string>
~static NuGet.Configuration.ConfigurationConstants.GetConfigKeys() -> System.Collections.Generic.IReadOnlyList<string>
~static readonly NuGet.Configuration.ConfigurationConstants.AuditSources -> string
Loading