35 instantiations of ResourceUrlAnnotation
Aspire.Hosting (9)
ApplicationModel\ResourceUrlAnnotation.cs (1)
44return new()
ApplicationModel\ResourceUrlsEditor.cs (1)
85_urls.Add(new ResourceUrlAnnotation
Orchestrator\ApplicationOrchestrator.cs (4)
335var url = new ResourceUrlAnnotation { Url = allocatedEndpoint.UriString, Endpoint = endpointReference }; 346EndpointBindingMode.SingleAddress when !allocatedEndpoint.Address.Equals(endpoint.TargetHost, StringComparison.OrdinalIgnoreCase) => new ResourceUrlAnnotation 355_ => new ResourceUrlAnnotation 387url = new ResourceUrlAnnotation
ResourceBuilderExtensions.cs (3)
2126return builder.WithAnnotation(new ResourceUrlAnnotation { Url = url, DisplayText = displayText }); 2199c.Urls.Add(new() { Endpoint = endpoint, Url = urlValue, DisplayText = displayText }); 2358url = new ResourceUrlAnnotation { Url = "/", Endpoint = endpoint };
Aspire.Hosting.Azure.Tests (2)
AzureCosmosDBExtensionsTests.cs (2)
1248new() { Url = "http://localhost:8080", Endpoint = cosmos.GetEndpoint("emulatorhealth") } 1273new() { Url = "http://localhost:1234", Endpoint = cosmos.GetEndpoint("data-explorer") }
Aspire.Hosting.DevTunnels (1)
DevTunnelResourceBuilderExtensions.cs (1)
690urls.Add(new()
Aspire.Hosting.DevTunnels.Tests (1)
DevTunnelResourceBuilderExtensionsTests.cs (1)
740context.Urls.Add(new() { Url = "https://example.com/diagnostics", DisplayText = "Custom diagnostics" });
Aspire.Hosting.Foundry.Tests (1)
HostedAgentExtensionTests.cs (1)
141var url = new ResourceUrlAnnotation
Aspire.Hosting.Qdrant (1)
QdrantBuilderExtensions.cs (1)
102.WithUrlForEndpoint(QdrantServerResource.HttpEndpointName, e => new ResourceUrlAnnotation() { Url = "/dashboard", DisplayText = "Manage", DisplayOrder = 1 });
Aspire.Hosting.Tests (17)
Dashboard\DashboardResourceTests.cs (2)
846new() { Url = "http://localhost:5003", Endpoint = ((IResourceWithEndpoints)dashboard).GetEndpoint("http") }, 847new() { Url = "https://localhost:5005", Endpoint = ((IResourceWithEndpoints)dashboard).GetEndpoint("https") }
WithUrlsTests.cs (15)
26var annotation = new ResourceUrlAnnotation 163.WithUrls(c => c.Urls.Add(new() { Url = "https://example.com", DisplayText = "Example" })) 680c.Urls.Add(new() { Url = "http://example.com/", DisplayLocation = UrlDisplayLocation.SummaryAndDetails }); 681c.Urls.Add(new() { Url = "http://example.com/internal", DisplayLocation = UrlDisplayLocation.DetailsOnly }); 682c.Urls.Add(new() { Url = "http://example.com/out-of-range", DisplayLocation = (UrlDisplayLocation)100 }); 745return new() { Url = "https://example.com" }; 771.WithUrls(c => c.Urls.Add(new() { Url = "https://callback-before.com/sub-path", DisplayText = "Example" })) 774.WithUrls(c => c.Urls.Add(new() { Url = "https://callback-after.com/sub-path" })) // This won't get updated because it's added after the relative URL 870.WithUrlForEndpoint("http", _ => new() 914return new() { Url = "/sub-path" }; 976var url = new ResourceUrlAnnotation 1004var otherUrl = new ResourceUrlAnnotation 1032c.Urls.Add(new() { Endpoint = c.GetEndpoint("test"), Url = "/sub-path" }); 1066c.Urls.Add(new() 1118c.Urls.Add(new()
Stress.AppHost (1)
AppHost.cs (1)
86.WithUrls(c => c.Urls.Add(new() { Url = "https://someplace.com", DisplayText = "Some place" }))
TestShop.AppHost (2)
AppHost.cs (2)
67.WithUrlForEndpoint("https", _ => new() 100.WithUrlForEndpoint("https", ep => new() { Url = "/health", DisplayText = "Health", DisplayLocation = UrlDisplayLocation.DetailsOnly })
76 references to ResourceUrlAnnotation
Aspire.Hosting (30)
ApplicationModel\ResourceExtensions.cs (1)
746public static bool TryGetUrls(this IResource resource, [NotNullWhen(true)] out IEnumerable<ResourceUrlAnnotation>? urls)
ApplicationModel\ResourceUrlAnnotation.cs (1)
42internal ResourceUrlAnnotation WithEndpoint(EndpointReference endpoint)
ApplicationModel\ResourceUrlsCallbackContext.cs (2)
17public class ResourceUrlsCallbackContext(DistributedApplicationExecutionContext executionContext, IResource resource, List<ResourceUrlAnnotation>? urls = null, CancellationToken cancellationToken = default) 55public List<ResourceUrlAnnotation> Urls { get; } = urls ?? [];
ApplicationModel\ResourceUrlsEditor.cs (2)
10internal sealed class ResourceUrlsEditor(DistributedApplicationExecutionContext executionContext, List<ResourceUrlAnnotation> urls, CancellationToken cancellationToken = default) 13private readonly List<ResourceUrlAnnotation> _urls = urls ?? throw new ArgumentNullException(nameof(urls));
Dashboard\DashboardEventHandlers.cs (1)
303foreach (var url in c.Urls)
Dcp\ResourceSnapshotBuilder.cs (4)
305var processedEndpointUrls = new HashSet<ResourceUrlAnnotation>(); 315foreach (var endpointUrl in urlsForEndpoint) 339foreach (var endpointUrl in crossResourceEndpointUrls) 361foreach (var url in nonEndpointUrls)
Orchestrator\ApplicationOrchestrator.cs (8)
303var urls = new List<ResourceUrlAnnotation>(); 335var url = new ResourceUrlAnnotation { Url = allocatedEndpoint.UriString, Endpoint = endpointReference }; 342var additionalUrl = allocatedEndpoint.BindingMode switch 432foreach (var staticUrl in staticUrls) 481var primaryUrl = urls.FirstOrDefault(u => string.Equals(u.Endpoint?.EndpointName, primaryLaunchProfileEndpoint.Name, StringComparisons.EndpointAnnotationName)); 494foreach (var url in urls) 535foreach (var url in urls) 552foreach (var url in urls)
ProjectResourceBuilderExtensions.cs (1)
797var url = context.Urls.FirstOrDefault(u => string.Equals(u.Endpoint?.EndpointName, endpoint.Name, StringComparisons.EndpointAnnotationName));
ResourceBuilderExtensions.cs (10)
2085/// To modify the URL for a specific endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Action{ResourceUrlAnnotation})"/>. 2113foreach (var u in c.Urls) 2216/// To add another URL for an endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Func{EndpointReference, ResourceUrlAnnotation})"/>. 2245public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, string endpointName, Action<ResourceUrlAnnotation> callback) 2259var url = context.Urls.FirstOrDefault(u => u.Endpoint?.EndpointName == endpointName); 2282/// To customize the URL that is automatically added for an endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Action{ResourceUrlAnnotation})"/>. 2299public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, string endpointName, Func<EndpointReference, ResourceUrlAnnotation> callback) 2307var url = callback(endpoint).WithEndpoint(endpoint); 2333public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, EndpointReference endpoint, Action<ResourceUrlAnnotation> callback) 2346var url = context.Urls.FirstOrDefault(u =>
Aspire.Hosting.Azure.Tests (4)
AzureCosmosDBExtensionsTests.cs (4)
1246var urls = new List<ResourceUrlAnnotation> 1260var healthUrl = Assert.Single(urls, u => u.Endpoint?.EndpointName == "emulatorhealth"); 1271var urls = new List<ResourceUrlAnnotation> 1285var explorerUrl = Assert.Single(urls, u => u.Endpoint?.EndpointName == "data-explorer");
Aspire.Hosting.Foundry (1)
HostedAgent\HostedAgentBuilderExtension.cs (1)
303var http = ctx.Urls.FirstOrDefault(u => u.Endpoint?.EndpointName == "http" || u.Endpoint?.EndpointName == "https");
Aspire.Hosting.Foundry.Tests (2)
HostedAgentExtensionTests.cs (2)
141var url = new ResourceUrlAnnotation 146var urls = new List<ResourceUrlAnnotation> { url };
Aspire.Hosting.Qdrant.Tests (1)
QdrantFunctionalTests.cs (1)
247var urls = qdrant.Resource.Annotations.OfType<ResourceUrlAnnotation>();
Aspire.Hosting.Redis.Tests (3)
AddRedisTests.cs (3)
308var managementUrl = await GetManagementUrlAsync(redis, "Manage (Insights)"); 334var managementUrl = await GetManagementUrlAsync(redis, "Manage (Commander)"); 1047private static async Task<ResourceUrlAnnotation> GetManagementUrlAsync(IResource resource, string displayText)
Aspire.Hosting.Tests (35)
Dashboard\DashboardResourceTests.cs (3)
844var urls = new List<ResourceUrlAnnotation> 858var httpUrl = urls.FirstOrDefault(u => u.Endpoint?.EndpointName == "http"); 859var httpsUrl = urls.FirstOrDefault(u => u.Endpoint?.EndpointName == "https");
DistributedApplicationTests.cs (1)
1362var dashboardUrls = aspireDashboard.Annotations.OfType<ResourceUrlAnnotation>().ToList();
WithEndpointTests.cs (2)
813var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 847var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>();
WithUrlsTests.cs (29)
26var annotation = new ResourceUrlAnnotation 32var updatedAnnotation = annotation.WithEndpoint(endpoint); 174var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 198var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 224var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 225var endpointUrl = urls.First(u => u.Endpoint is not null); 252var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 285var urls = projectB.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 328var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 351var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 381var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 785var allUrls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 786var endpointUrl = allUrls.FirstOrDefault(u => u.Endpoint?.EndpointName == "test"); 787var staticBeforeUrl = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://static-before.com")); 788var callbackBeforeUrl = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://callback-before.com")); 789var staticAfter = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://static-after.com")); 790var callbackAfter = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://callback-after.com")); 846var endpointUrl = project.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test"); 885var launchProfileUrls = project.Resource.Annotations.OfType<ResourceUrlAnnotation>().Where(u => u.Endpoint?.EndpointName == "http"); 926var endpointUrl = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test" && u.Url.EndsWith("/sub-path")); 959var url = Assert.Single(managed.Resource.Annotations.OfType<ResourceUrlAnnotation>(), u => u.DisplayText == "Manage"); 976var url = new ResourceUrlAnnotation 1004var otherUrl = new ResourceUrlAnnotation 1018var managementUrl = Assert.Single(context.Urls, url => url.DisplayText == "Manage"); 1044var endpointUrl = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test" && u.Url.EndsWith("/sub-path"));