56 instantiations of ResourceSnapshot
Aspire.Cli.Tests (56)
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\ExportCommandTests.cs (18)
50new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 51new ResourceSnapshot { Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 128new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 205new ResourceSnapshot { Name = "other-resource", DisplayName = "other-resource", ResourceType = "Project", State = "Running" }, 228new ResourceSnapshot { Name = "target-resource", DisplayName = "target-resource", ResourceType = "Container", State = "Running" }, 332new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 333new ResourceSnapshot { Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 334new ResourceSnapshot { Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 453new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 454new ResourceSnapshot { Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 511new ResourceSnapshot { Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 512new ResourceSnapshot { Name = "webfrontend", DisplayName = "webfrontend", ResourceType = "Project", State = "Running" }, 570new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 571new ResourceSnapshot { Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 572new ResourceSnapshot { Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 621new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 646new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 647new ResourceSnapshot { Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
Commands\LogsCommandTests.cs (3)
589new ResourceSnapshot 597new ResourceSnapshot 604new ResourceSnapshot
Commands\PsCommandTests.cs (4)
215new ResourceSnapshot 227new ResourceSnapshot 291new ResourceSnapshot 348new ResourceSnapshot { Name = "apiservice", ResourceType = "Project", State = "Running" }
Mcp\ListResourcesToolTests.cs (5)
58new ResourceSnapshot 65new ResourceSnapshot 72new ResourceSnapshot 104new ResourceSnapshot 143new ResourceSnapshot
76 references to ResourceSnapshot
aspire (59)
Backchannel\AppHostAuxiliaryBackchannel.cs (11)
285public async Task<List<ResourceSnapshot>> GetResourceSnapshotsAsync(CancellationToken cancellationToken = default) 293var snapshots = await rpc.InvokeWithCancellationAsync<List<ResourceSnapshot>>( 311public async IAsyncEnumerable<ResourceSnapshot> WatchResourceSnapshotsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) 317IAsyncEnumerable<ResourceSnapshot>? snapshots; 320snapshots = await rpc.InvokeWithCancellationAsync<IAsyncEnumerable<ResourceSnapshot>>( 336await foreach (var snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false)) 527public async IAsyncEnumerable<ResourceSnapshot> WatchResourcesV2Async( 535await foreach (var snapshot in WatchResourceSnapshotsAsync(cancellationToken).ConfigureAwait(false)) 550IAsyncEnumerable<ResourceSnapshot>? snapshots; 553snapshots = await rpc.InvokeWithCancellationAsync<IAsyncEnumerable<ResourceSnapshot>>( 568await 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 (20)
12/// Maps <see cref="ResourceSnapshot"/> to <see cref="ResourceJson"/> for serialization. 18/// <see cref="ResourceSnapshot.Name"/> and <see cref="ResourceSnapshot.DisplayName"/>. 20internal static IEnumerable<ResourceSnapshot> WhereMatchesResourceName(IEnumerable<ResourceSnapshot> snapshots, string resourceName) 27/// Maps a list of <see cref="ResourceSnapshot"/> to a list of <see cref="ResourceJson"/>. 32public static List<ResourceJson> MapToResourceJsonList(IEnumerable<ResourceSnapshot> snapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true) 39/// Maps a <see cref="ResourceSnapshot"/> to <see cref="ResourceJson"/>. 45public static ResourceJson MapToResourceJson(ResourceSnapshot snapshot, IReadOnlyList<ResourceSnapshot> allSnapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true) 95foreach (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 160public static IReadOnlyList<ResourceSnapshot> ResolveResources(string resourceName, IReadOnlyList<ResourceSnapshot> snapshots) 187public static string GetResourceName(ResourceSnapshot resource, IDictionary<string, ResourceSnapshot> allResources) 199public static string GetResourceName(ResourceSnapshot resource, IEnumerable<ResourceSnapshot> allResources) 202foreach (var item in allResources)
Commands\DescribeCommand.cs (8)
162private int ExecuteSnapshot(IReadOnlyList<ResourceSnapshot> snapshots, string? dashboardBaseUrl, string? resourceName, OutputFormat format) 194private async Task<int> ExecuteWatchAsync(IAppHostAuxiliaryBackchannel connection, IReadOnlyList<ResourceSnapshot> initialSnapshots, string? dashboardBaseUrl, string? resourceName, OutputFormat format, CancellationToken cancellationToken) 199var allResources = new Dictionary<string, ResourceSnapshot>(StringComparers.ResourceName); 200foreach (var snapshot in initialSnapshots) 210await foreach (var snapshot in connection.WatchResourceSnapshotsAsync(cancellationToken).ConfigureAwait(false)) 261private void DisplayResourcesTable(IReadOnlyList<ResourceSnapshot> snapshots) 297private static ResourceDisplayState BuildResourceDisplayState(ResourceSnapshot snapshot, IReadOnlyList<ResourceSnapshot> allResources)
Commands\ExportCommand.cs (3)
205private static void AddResources(ExportArchive exportArchive, IReadOnlyList<ResourceSnapshot> snapshots, string? resourceName) 228IReadOnlyList<ResourceSnapshot> snapshots, 246var snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, name, StringComparisons.ResourceName));
Commands\LogsCommand.cs (6)
205IReadOnlyList<ResourceSnapshot> snapshots, 254IReadOnlyList<ResourceSnapshot> snapshots, 295IReadOnlyList<ResourceSnapshot> snapshots, 311private static LogEntry ParseLogLine(ResourceLogLine logLine, LogParser logParser, IReadOnlyList<ResourceSnapshot> snapshots) 351private static string ResolveResourceName(string resourceName, IReadOnlyList<ResourceSnapshot> snapshots) 353var snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, resourceName, StringComparisons.ResourceName));
Commands\McpToolsCommand.cs (2)
85foreach (var r in resourcesWithTools) 111foreach (var resource in resourcesWithTools)
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 (17)
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,
Commands\ExportCommandTests.cs (1)
691List<ResourceSnapshot> resourceSnapshots,
Commands\PsCommandTests.cs (1)
346return Task.FromResult(new List<ResourceSnapshot>
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)