34 instantiations of ResourceSnapshot
Aspire.Cli.Tests (34)
Backchannel\ResourceSnapshotMapperTests.cs (13)
14var snapshot = new ResourceSnapshot 64new() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 65new() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" } 79new() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 80new() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" } 94new() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 95new() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 96new() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" } 109new() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 110new() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 111new() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" } 125new() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" } 138new() { Name = "Cache-Zuyppzgw", DisplayName = "Cache", ResourceType = "Container", State = "Running" }
Commands\AgentMcpCommandTests.cs (5)
166new ResourceSnapshot 236new ResourceSnapshot 313new ResourceSnapshot 429new ResourceSnapshot 518new ResourceSnapshot
Commands\DescribeCommandTests.cs (8)
262new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 264new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 266new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" }, 268new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" }, 306new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 308new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 310new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" }, 312new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
Commands\LogsCommandTests.cs (3)
589new ResourceSnapshot 597new ResourceSnapshot 604new ResourceSnapshot
Mcp\ListResourcesToolTests.cs (5)
58new ResourceSnapshot 65new ResourceSnapshot 72new ResourceSnapshot 104new ResourceSnapshot 143new ResourceSnapshot
63 references to ResourceSnapshot
aspire (48)
Backchannel\AppHostAuxiliaryBackchannel.cs (11)
285public async Task<List<ResourceSnapshot>> GetResourceSnapshotsAsync(CancellationToken cancellationToken = default) 293var snapshots = await rpc.InvokeWithCancellationAsync<List<ResourceSnapshot>>( 308public async IAsyncEnumerable<ResourceSnapshot> WatchResourceSnapshotsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) 314IAsyncEnumerable<ResourceSnapshot>? snapshots; 317snapshots = await rpc.InvokeWithCancellationAsync<IAsyncEnumerable<ResourceSnapshot>>( 333await foreach (var snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false)) 524public async IAsyncEnumerable<ResourceSnapshot> WatchResourcesV2Async( 532await foreach (var snapshot in WatchResourceSnapshotsAsync(cancellationToken).ConfigureAwait(false)) 547IAsyncEnumerable<ResourceSnapshot>? snapshots; 550snapshots = await rpc.InvokeWithCancellationAsync<IAsyncEnumerable<ResourceSnapshot>>( 565await 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)
61Task<List<ResourceSnapshot>> GetResourceSnapshotsAsync(CancellationToken cancellationToken = default); 68IAsyncEnumerable<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"/>. 22public static List<ResourceJson> MapToResourceJsonList(IEnumerable<ResourceSnapshot> snapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true) 29/// Maps a <see cref="ResourceSnapshot"/> to <see cref="ResourceJson"/>. 35public static ResourceJson MapToResourceJson(ResourceSnapshot snapshot, IReadOnlyList<ResourceSnapshot> allSnapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true) 85foreach (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 150public static IReadOnlyList<ResourceSnapshot> ResolveResources(string resourceName, IReadOnlyList<ResourceSnapshot> snapshots) 177public static string GetResourceName(ResourceSnapshot resource, IDictionary<string, ResourceSnapshot> allResources) 189public static string GetResourceName(ResourceSnapshot resource, IEnumerable<ResourceSnapshot> allResources) 192foreach (var item in allResources)
Commands\DescribeCommand.cs (6)
197var allResources = new Dictionary<string, ResourceSnapshot>(StringComparers.ResourceName); 198foreach (var snapshot in initialSnapshots) 208await foreach (var snapshot in connection.WatchResourceSnapshotsAsync(cancellationToken).ConfigureAwait(false)) 259private void DisplayResourcesTable(IReadOnlyList<ResourceSnapshot> snapshots) 295private static ResourceDisplayState BuildResourceDisplayState(ResourceSnapshot snapshot, IReadOnlyList<ResourceSnapshot> allResources)
Commands\LogsCommand.cs (6)
200IReadOnlyList<ResourceSnapshot> snapshots, 249IReadOnlyList<ResourceSnapshot> snapshots, 290IReadOnlyList<ResourceSnapshot> snapshots, 306private static LogEntry ParseLogLine(ResourceLogLine logLine, LogParser logParser, IReadOnlyList<ResourceSnapshot> snapshots) 346private static string ResolveResourceName(string resourceName, IReadOnlyList<ResourceSnapshot> snapshots) 348var snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, resourceName, StringComparisons.ResourceName));
Mcp\McpResourceToolRefreshService.cs (1)
94foreach (var resource in resourcesWithTools)
src\Aspire.Hosting\Backchannel\BackchannelDataTypes.cs (1)
164public required ResourceSnapshot[] Resources { get; init; }
Aspire.Cli.Tests (15)
Backchannel\ResourceSnapshotMapperTests.cs (8)
14var snapshot = new ResourceSnapshot 36var allSnapshots = new List<ResourceSnapshot> { snapshot }; 62var snapshots = new List<ResourceSnapshot> 77var snapshots = new List<ResourceSnapshot> 92var snapshots = new List<ResourceSnapshot> 107var snapshots = new List<ResourceSnapshot> 123var snapshots = new List<ResourceSnapshot> 136var snapshots = new List<ResourceSnapshot>
Commands\AgentMcpCommandTests.cs (1)
516return Task.FromResult(new List<ResourceSnapshot>
Commands\DescribeCommandTests.cs (1)
337List<ResourceSnapshot> resourceSnapshots,
TestServices\TestAppHostAuxiliaryBackchannel.cs (5)
27public List<ResourceSnapshot> ResourceSnapshots { get; set; } = []; 53public Func<CancellationToken, Task<List<ResourceSnapshot>>>? GetResourceSnapshotsHandler { get; set; } 60public Task<List<ResourceSnapshot>> GetResourceSnapshotsAsync(CancellationToken cancellationToken = default) 70public async IAsyncEnumerable<ResourceSnapshot> WatchResourceSnapshotsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) 72foreach (var snapshot in ResourceSnapshots)