34 instantiations of ResourceSnapshot
Aspire.Cli.Tests (34)
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\LogsCommandTests.cs (3)
589
new
ResourceSnapshot
597
new
ResourceSnapshot
604
new
ResourceSnapshot
Mcp\ListResourcesToolTests.cs (5)
58
new
ResourceSnapshot
65
new
ResourceSnapshot
72
new
ResourceSnapshot
104
new
ResourceSnapshot
143
new
ResourceSnapshot
63 references to ResourceSnapshot
aspire (48)
Backchannel\AppHostAuxiliaryBackchannel.cs (11)
285
public async Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(CancellationToken cancellationToken = default)
293
var snapshots = await rpc.InvokeWithCancellationAsync<List<
ResourceSnapshot
>>(
308
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
314
IAsyncEnumerable<
ResourceSnapshot
>? snapshots;
317
snapshots = await rpc.InvokeWithCancellationAsync<IAsyncEnumerable<
ResourceSnapshot
>>(
333
await foreach (
var
snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false))
524
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourcesV2Async(
532
await foreach (
var
snapshot in WatchResourceSnapshotsAsync(cancellationToken).ConfigureAwait(false))
547
IAsyncEnumerable<
ResourceSnapshot
>? snapshots;
550
snapshots = await rpc.InvokeWithCancellationAsync<IAsyncEnumerable<
ResourceSnapshot
>>(
565
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 (16)
12
/// Maps <see cref="
ResourceSnapshot
"/> to <see cref="ResourceJson"/> for serialization.
17
/// Maps a list of <see cref="
ResourceSnapshot
"/> to a list of <see cref="ResourceJson"/>.
22
public static List<ResourceJson> MapToResourceJsonList(IEnumerable<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true)
29
/// Maps a <see cref="
ResourceSnapshot
"/> to <see cref="ResourceJson"/>.
35
public static ResourceJson MapToResourceJson(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allSnapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true)
85
foreach (
var
match in matches)
143
/// First tries an exact match on <see cref="
ResourceSnapshot
.Name"/>, then falls back
144
/// to matching by <see cref="
ResourceSnapshot
.DisplayName"/> only when the display name is
150
public static IReadOnlyList<
ResourceSnapshot
> ResolveResources(string resourceName, IReadOnlyList<
ResourceSnapshot
> snapshots)
177
public static string GetResourceName(
ResourceSnapshot
resource, IDictionary<string,
ResourceSnapshot
> allResources)
189
public static string GetResourceName(
ResourceSnapshot
resource, IEnumerable<
ResourceSnapshot
> allResources)
192
foreach (
var
item in allResources)
Commands\DescribeCommand.cs (6)
197
var allResources = new Dictionary<string,
ResourceSnapshot
>(StringComparers.ResourceName);
198
foreach (
var
snapshot in initialSnapshots)
208
await foreach (
var
snapshot in connection.WatchResourceSnapshotsAsync(cancellationToken).ConfigureAwait(false))
259
private void DisplayResourcesTable(IReadOnlyList<
ResourceSnapshot
> snapshots)
295
private static ResourceDisplayState BuildResourceDisplayState(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allResources)
Commands\LogsCommand.cs (6)
200
IReadOnlyList<
ResourceSnapshot
> snapshots,
249
IReadOnlyList<
ResourceSnapshot
> snapshots,
290
IReadOnlyList<
ResourceSnapshot
> snapshots,
306
private static LogEntry ParseLogLine(ResourceLogLine logLine, LogParser logParser, IReadOnlyList<
ResourceSnapshot
> snapshots)
346
private static string ResolveResourceName(string resourceName, IReadOnlyList<
ResourceSnapshot
> snapshots)
348
var
snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, resourceName, StringComparisons.ResourceName));
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 (15)
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,
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)