Skip to content
Open
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
8 changes: 5 additions & 3 deletions Inedo.ProGet/ApiKeyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ public sealed class ApiKeyInfo
// * Required when Type is Feed; otherwise must be null
public string[]? PackagePermissions { get; set; }

// Name of the feed the feed key applies to
// Name of the feeds the feed key applies to
// * Optional when Type is Feed; otherwise must be null
// * Must be null when FeedGroup has a value
// * Value is a comma-separated list of feed names
public string? Feed { get; set; }

/// Name of the feed group the key applies to
/// Name of the feed groups the key applies to
// * Optional when Type is Feed; otherwise must be null
// * Must be null when Feed has a value
// * Must be null when Feeds has a value
// * Value is a comma-separated list of feed group names
public string? FeedGroup { get; set; }

public DateTime? Expiration { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Inedo.ProGet/ProGetClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public async Task<ApiKeyInfo> CreateApiKeyAsync(ApiKeyInfo apiKeyInfo, Cancellat
{
ArgumentNullException.ThrowIfNull(apiKeyInfo);

var versionRequired = apiKeyInfo.Type == ApiKeyType.Feed ? new Version(24, 0, 3) : null;
var versionRequired = apiKeyInfo.Type == ApiKeyType.Feed ? new Version(24, 0, 3) : ((apiKeyInfo.Feed?.Contains(',') ?? false) || (apiKeyInfo.FeedGroup?.Contains(',') ?? false)) ? new Version(25, 0, 23) : null;
var editionRequired = apiKeyInfo.Type != ApiKeyType.Personal ? ProGetEdition.Basic : (ProGetEdition?)null;

using var response = await this.http.PostAsJsonAsync("api/api-keys/create", apiKeyInfo, ProGetApiJsonContext.Default.ApiKeyInfo, cancellationToken).ConfigureAwait(false);
Expand Down
8 changes: 4 additions & 4 deletions pgutil/ApiKeys/Create/FeedCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ private sealed class FeedCommand : IConsoleCommand
public static string Name => "feed";
public static string Description => "Creates a feed API key. The key is the only thing written to stdout on success";
public static string Examples => """
$> pgutil apikeys create feed --feed=public-npm --permissions="view,add" --key=abcd12345
$> pgutil apikeys create feed --feed="public-npm,public-nuget" --permissions="view,add" --key=abcd12345

$> pgutil apikeys create feed --group=production-feeds --key=wxyz67890 --expiration="2024/08/01"
$> pgutil apikeys create feed --group="production-feeds,test-feeds" --key=wxyz67890 --expiration="2024/08/01"

$> pgutil apikeys create feed --feed=*

Expand Down Expand Up @@ -90,14 +90,14 @@ private sealed class FeedNameOption : IConsoleOption
{
public static bool Required => false;
public static string Name => "--feed";
public static string Description => "Name of the feed to associate with the key, or \"*\" for all feeds";
public static string Description => "Name of the feeds to associate with the key. Value is a comma-separated list of feed names or \"*\" for all feeds.";
}

private sealed class FeedGroupOption : IConsoleOption
{
public static bool Required => false;
public static string Name => "--group";
public static string Description => "Name of the feed group to associate with the key";
public static string Description => "Name of the feed groups to associate with the key. Value is a comma-separated list of feed group names.";
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pgutil/ApiKeys/ListCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static async Task<int> ExecuteAsync(CommandContext context, CancellationT
data.Add((" User:", key.User ?? "(unknown)"));
else if (key.Type == ApiKeyType.Feed)
{
data.Add(key.FeedGroup is not null ? (" Feed group:", key.FeedGroup) : (" Feed:", key.Feed ?? "* (all)"));
data.Add(key.FeedGroup is not null ? (" Feed groups:", key.FeedGroup) : (" Feeds:", key.Feed ?? "* (all)"));
data.Add((" Permissions:", string.Join(", ", key.PackagePermissions ?? [])));
}
CM.WriteTwoColumnList(data);
Expand Down