56 instantiations of ResourceSnapshot
Aspire.Cli.Tests (56)
Backchannel\ResourceSnapshotMapperTests.cs (13)
14
var snapshot = new
ResourceSnapshot
64
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" },
65
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
79
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" },
80
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
94
new
() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" },
95
new
() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" },
96
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
109
new
() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" },
110
new
() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" },
111
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
125
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" }
138
new
() { Name = "Cache-Zuyppzgw", DisplayName = "Cache", ResourceType = "Container", State = "Running" }
Commands\AgentMcpCommandTests.cs (5)
166
new
ResourceSnapshot
236
new
ResourceSnapshot
313
new
ResourceSnapshot
429
new
ResourceSnapshot
518
new
ResourceSnapshot
Commands\DescribeCommandTests.cs (8)
262
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
264
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
266
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
268
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
306
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
308
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
310
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
312
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
Commands\ExportCommandTests.cs (18)
50
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
51
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
128
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
205
new
ResourceSnapshot
{ Name = "other-resource", DisplayName = "other-resource", ResourceType = "Project", State = "Running" },
228
new
ResourceSnapshot
{ Name = "target-resource", DisplayName = "target-resource", ResourceType = "Container", State = "Running" },
332
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
333
new
ResourceSnapshot
{ Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
334
new
ResourceSnapshot
{ Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
453
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
454
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
511
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
512
new
ResourceSnapshot
{ Name = "webfrontend", DisplayName = "webfrontend", ResourceType = "Project", State = "Running" },
570
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
571
new
ResourceSnapshot
{ Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
572
new
ResourceSnapshot
{ Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
621
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
646
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
647
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
Commands\LogsCommandTests.cs (3)
589
new
ResourceSnapshot
597
new
ResourceSnapshot
604
new
ResourceSnapshot
Commands\PsCommandTests.cs (4)
215
new
ResourceSnapshot
227
new
ResourceSnapshot
291
new
ResourceSnapshot
348
new
ResourceSnapshot
{ Name = "apiservice", ResourceType = "Project", State = "Running" }
Mcp\ListResourcesToolTests.cs (5)
58
new
ResourceSnapshot
65
new
ResourceSnapshot
72
new
ResourceSnapshot
104
new
ResourceSnapshot
143
new
ResourceSnapshot
76 references to ResourceSnapshot
aspire (59)
Backchannel\AppHostAuxiliaryBackchannel.cs (11)
285
public async Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(CancellationToken cancellationToken = default)
293
var snapshots = await rpc.InvokeWithCancellationAsync<List<
ResourceSnapshot
>>(
311
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
317
IAsyncEnumerable<
ResourceSnapshot
>? snapshots;
320
snapshots = await rpc.InvokeWithCancellationAsync<IAsyncEnumerable<
ResourceSnapshot
>>(
336
await foreach (
var
snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false))
527
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourcesV2Async(
535
await foreach (
var
snapshot in WatchResourceSnapshotsAsync(cancellationToken).ConfigureAwait(false))
550
IAsyncEnumerable<
ResourceSnapshot
>? snapshots;
553
snapshots = await rpc.InvokeWithCancellationAsync<IAsyncEnumerable<
ResourceSnapshot
>>(
568
await foreach (
var
snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false))
Backchannel\BackchannelJsonSerializerContext.cs (5)
45
[JsonSerializable(typeof(
ResourceSnapshot
))]
46
[JsonSerializable(typeof(
ResourceSnapshot
[]))]
47
[JsonSerializable(typeof(List<
ResourceSnapshot
>))]
48
[JsonSerializable(typeof(IAsyncEnumerable<
ResourceSnapshot
>))]
49
[JsonSerializable(typeof(MessageFormatterEnumerableTracker.EnumeratorResults<
ResourceSnapshot
>))]
Backchannel\IAppHostAuxiliaryBackchannel.cs (2)
61
Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(CancellationToken cancellationToken = default);
68
IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync(CancellationToken cancellationToken = default);
Backchannel\ResourceSnapshotMapper.cs (20)
12
/// Maps <see cref="
ResourceSnapshot
"/> to <see cref="ResourceJson"/> for serialization.
18
/// <see cref="
ResourceSnapshot
.Name"/> and <see cref="
ResourceSnapshot
.DisplayName"/>.
20
internal static IEnumerable<
ResourceSnapshot
> WhereMatchesResourceName(IEnumerable<
ResourceSnapshot
> snapshots, string resourceName)
27
/// Maps a list of <see cref="
ResourceSnapshot
"/> to a list of <see cref="ResourceJson"/>.
32
public static List<ResourceJson> MapToResourceJsonList(IEnumerable<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true)
39
/// Maps a <see cref="
ResourceSnapshot
"/> to <see cref="ResourceJson"/>.
45
public static ResourceJson MapToResourceJson(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allSnapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true)
95
foreach (
var
match in matches)
153
/// First tries an exact match on <see cref="
ResourceSnapshot
.Name"/>, then falls back
154
/// to matching by <see cref="
ResourceSnapshot
.DisplayName"/> only when the display name is
160
public static IReadOnlyList<
ResourceSnapshot
> ResolveResources(string resourceName, IReadOnlyList<
ResourceSnapshot
> snapshots)
187
public static string GetResourceName(
ResourceSnapshot
resource, IDictionary<string,
ResourceSnapshot
> allResources)
199
public static string GetResourceName(
ResourceSnapshot
resource, IEnumerable<
ResourceSnapshot
> allResources)
202
foreach (
var
item in allResources)
Commands\DescribeCommand.cs (8)
162
private int ExecuteSnapshot(IReadOnlyList<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl, string? resourceName, OutputFormat format)
194
private async Task<int> ExecuteWatchAsync(IAppHostAuxiliaryBackchannel connection, IReadOnlyList<
ResourceSnapshot
> initialSnapshots, string? dashboardBaseUrl, string? resourceName, OutputFormat format, CancellationToken cancellationToken)
199
var allResources = new Dictionary<string,
ResourceSnapshot
>(StringComparers.ResourceName);
200
foreach (
var
snapshot in initialSnapshots)
210
await foreach (
var
snapshot in connection.WatchResourceSnapshotsAsync(cancellationToken).ConfigureAwait(false))
261
private void DisplayResourcesTable(IReadOnlyList<
ResourceSnapshot
> snapshots)
297
private static ResourceDisplayState BuildResourceDisplayState(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allResources)
Commands\ExportCommand.cs (3)
205
private static void AddResources(ExportArchive exportArchive, IReadOnlyList<
ResourceSnapshot
> snapshots, string? resourceName)
228
IReadOnlyList<
ResourceSnapshot
> snapshots,
246
var
snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, name, StringComparisons.ResourceName));
Commands\LogsCommand.cs (6)
205
IReadOnlyList<
ResourceSnapshot
> snapshots,
254
IReadOnlyList<
ResourceSnapshot
> snapshots,
295
IReadOnlyList<
ResourceSnapshot
> snapshots,
311
private static LogEntry ParseLogLine(ResourceLogLine logLine, LogParser logParser, IReadOnlyList<
ResourceSnapshot
> snapshots)
351
private static string ResolveResourceName(string resourceName, IReadOnlyList<
ResourceSnapshot
> snapshots)
353
var
snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, resourceName, StringComparisons.ResourceName));
Commands\McpToolsCommand.cs (2)
85
foreach (
var
r in resourcesWithTools)
111
foreach (
var
resource in resourcesWithTools)
Mcp\McpResourceToolRefreshService.cs (1)
94
foreach (
var
resource in resourcesWithTools)
src\Aspire.Hosting\Backchannel\BackchannelDataTypes.cs (1)
164
public required
ResourceSnapshot
[] Resources { get; init; }
Aspire.Cli.Tests (17)
Backchannel\ResourceSnapshotMapperTests.cs (8)
14
var
snapshot = new ResourceSnapshot
36
var allSnapshots = new List<
ResourceSnapshot
> { snapshot };
62
var snapshots = new List<
ResourceSnapshot
>
77
var snapshots = new List<
ResourceSnapshot
>
92
var snapshots = new List<
ResourceSnapshot
>
107
var snapshots = new List<
ResourceSnapshot
>
123
var snapshots = new List<
ResourceSnapshot
>
136
var snapshots = new List<
ResourceSnapshot
>
Commands\AgentMcpCommandTests.cs (1)
516
return Task.FromResult(new List<
ResourceSnapshot
>
Commands\DescribeCommandTests.cs (1)
337
List<
ResourceSnapshot
> resourceSnapshots,
Commands\ExportCommandTests.cs (1)
691
List<
ResourceSnapshot
> resourceSnapshots,
Commands\PsCommandTests.cs (1)
346
return Task.FromResult(new List<
ResourceSnapshot
>
TestServices\TestAppHostAuxiliaryBackchannel.cs (5)
27
public List<
ResourceSnapshot
> ResourceSnapshots { get; set; } = [];
53
public Func<CancellationToken, Task<List<
ResourceSnapshot
>>>? GetResourceSnapshotsHandler { get; set; }
60
public Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(CancellationToken cancellationToken = default)
70
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
72
foreach (
var
snapshot in ResourceSnapshots)