60 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)
351var url = new ResourceUrlAnnotation { Url = allocatedEndpoint.UriString, Endpoint = endpointReference }; 362EndpointBindingMode.SingleAddress when !allocatedEndpoint.Address.Equals(endpoint.TargetHost, StringComparison.OrdinalIgnoreCase) => new ResourceUrlAnnotation 371_ => new ResourceUrlAnnotation 403url = new ResourceUrlAnnotation
ResourceBuilderExtensions.cs (3)
2390return builder.WithAnnotation(new ResourceUrlAnnotation { Url = url, DisplayText = displayText }); 2463c.Urls.Add(new() { Endpoint = endpoint, Url = urlValue, DisplayText = displayText }); 2628url = new ResourceUrlAnnotation { Url = "/", Endpoint = endpoint };
Aspire.Hosting.Azure.EntraId.Tests (2)
EntraIdProvisioningTests.cs (2)
1303.WithUrlForEndpoint("https", _ => new ResourceUrlAnnotation 1481context.Urls.Add(new()
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 (3)
DevTunnelMonitorTests.cs (2)
265context.Urls.Add(new() 270context.Urls.Add(new()
DevTunnelResourceBuilderExtensionsTests.cs (1)
781context.Urls.Add(new() { Url = "https://example.com/diagnostics", DisplayText = "Custom diagnostics" });
Aspire.Hosting.Foundry.Tests (1)
HostedAgentExtensionTests.cs (1)
144var 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 (38)
Dashboard\DashboardResourceTests.cs (2)
854new() { Url = "http://localhost:5003", Endpoint = ((IResourceWithEndpoints)dashboard).GetEndpoint("http") }, 855new() { Url = "https://localhost:5005", Endpoint = ((IResourceWithEndpoints)dashboard).GetEndpoint("https") }
EndpointReferenceTests.cs (16)
527new() { Url = "https://localhost:8443/original" }, 528new() { Url = "https://public.example/path" }, 529new() { Url = "https://alias.example/home" }, 530new() { Url = "https://public.example/duplicate" } 559endpoint.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() { Url = "https://frontend.example/path" }]); 575resource.GetEndpoint("http").EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() { Url = "http://frontend.example" }]); 576resource.GetEndpoint("https").EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() { Url = "https://separate.example" }]); 589host.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() { Url = "https://public.example/app" }]); 608new() { Url = "http://preferred.example:8080/app" }, 609new() { Url = "https://frontend.example/app" }, 610new() { Url = "https://frontend.example:443/swagger" }, 611new() { Url = "https://127.0.0.1:8443/" }, 612new() { Url = "https://frontend.example:9443/" } 628endpoint.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() { Url = url }]); 663endpoint.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() { Url = "https://frontend.example/app" }]); 677endpoint.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() { Url = "https://local.example" }]);
Orchestrator\ApplicationOrchestratorTests.cs (5)
171.WithUrlForEndpoint("http", _ => new() { Url = "http://localhost:8080/secondary", DisplayLocation = UrlDisplayLocation.DetailsOnly }); 207.WithUrlForEndpoint("http", _ => new() { Url = "http://localhost:8080/secondary", DisplayLocation = UrlDisplayLocation.DetailsOnly }); 347.WithUrlForEndpoint("http", _ => new() { Url = "https://frontend.example/swagger" }) 348.WithUrlForEndpoint("http", _ => new() { Url = "https://admin.example", DisplayOrder = 1000 }) 410context.Urls[0] = new ResourceUrlAnnotation
WithUrlsTests.cs (15)
47var annotation = new ResourceUrlAnnotation 186var url = new ResourceUrlAnnotation 214var otherUrl = new ResourceUrlAnnotation 371.WithUrls(c => c.Urls.Add(new() { Url = "https://example.com", DisplayText = "Example" })) 772c.Urls.Add(new() { Url = "http://example.com/", DisplayLocation = UrlDisplayLocation.SummaryAndDetails }); 773c.Urls.Add(new() { Url = "http://example.com/internal", DisplayLocation = UrlDisplayLocation.DetailsOnly }); 774c.Urls.Add(new() { Url = "http://example.com/out-of-range", DisplayLocation = (UrlDisplayLocation)100 }); 837return new() { Url = "https://example.com" }; 863.WithUrls(c => c.Urls.Add(new() { Url = "https://callback-before.com/sub-path", DisplayText = "Example" })) 866.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 962.WithUrlForEndpoint("http", _ => new() 1006return new() { Url = "/sub-path" }; 1068c.Urls.Add(new() { Endpoint = c.GetEndpoint("test"), Url = "/sub-path" }); 1102c.Urls.Add(new() 1154c.Urls.Add(new()
Stress.AppHost (1)
AppHost.cs (1)
87.WithUrls(c => c.Urls.Add(new() { Url = "https://someplace.com", DisplayText = "Some place" }))
TestShop.AppHost (2)
AppHost.cs (2)
152.WithUrlForEndpoint("https", _ => new() 191.WithUrlForEndpoint("https", ep => new() { Url = "/health", DisplayText = "Health", DisplayLocation = UrlDisplayLocation.DetailsOnly })
93 references to ResourceUrlAnnotation
Aspire.Hosting (35)
ApplicationModel\DisplayOrderAnnotation.cs (1)
8/// <see cref="ResourceUrlAnnotation.DisplayOrder"/>. Resources without a display order are treated as having an order of 0.
ApplicationModel\EndpointAnnotation.cs (1)
32internal ValueSnapshot<IReadOnlyList<ResourceUrlAnnotation>> BrowserUrlsSnapshot { get; } = new();
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)
572var processedEndpointUrls = new HashSet<ResourceUrlAnnotation>(); 582foreach (var endpointUrl in urlsForEndpoint) 606foreach (var endpointUrl in crossResourceEndpointUrls) 628foreach (var url in nonEndpointUrls)
Orchestrator\ApplicationOrchestrator.cs (10)
318var urls = new List<ResourceUrlAnnotation>(); 351var url = new ResourceUrlAnnotation { Url = allocatedEndpoint.UriString, Endpoint = endpointReference }; 358var additionalUrl = allocatedEndpoint.BindingMode switch 448foreach (var staticUrl in staticUrls) 500var primaryUrl = urls.FirstOrDefault(u => string.Equals(u.Endpoint?.EndpointName, primaryLaunchProfileEndpoint.Name, StringComparisons.EndpointAnnotationName)); 513foreach (var url in urls) 554foreach (var url in urls) 571foreach (var url in urls) 602foreach (var url in urls) 627Uri? GetBrowserUrl(ResourceUrlAnnotation url)
ProjectResourceBuilderExtensions.cs (1)
845var url = context.Urls.FirstOrDefault(u => string.Equals(u.Endpoint?.EndpointName, endpoint.Name, StringComparisons.EndpointAnnotationName));
ResourceBuilderExtensions.cs (10)
2349/// To modify the URL for a specific endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Action{ResourceUrlAnnotation})"/>. 2377foreach (var u in c.Urls) 2480/// To add another URL for an endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Func{EndpointReference, ResourceUrlAnnotation})"/>. 2515public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, string endpointName, Action<ResourceUrlAnnotation> callback) 2529var url = context.Urls.FirstOrDefault(u => u.Endpoint?.EndpointName == endpointName); 2552/// To customize the URL that is automatically added for an endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Action{ResourceUrlAnnotation})"/>. 2569public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, string endpointName, Func<EndpointReference, ResourceUrlAnnotation> callback) 2577var url = callback(endpoint).WithEndpoint(endpoint); 2603public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, EndpointReference endpoint, Action<ResourceUrlAnnotation> callback) 2616var url = context.Urls.FirstOrDefault(u =>
ResourceTraitBuilderExtensions.cs (1)
71/// A relative sort key. Higher values appear first, consistent with <see cref="ResourceUrlAnnotation.DisplayOrder"/>.
Aspire.Hosting.Azure.EntraId.Tests (1)
EntraIdProvisioningTests.cs (1)
1514Assert.Empty(web.Resource.Annotations.OfType<ResourceUrlAnnotation>());
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.DevTunnels (2)
DevTunnelResourceBuilderExtensions.cs (2)
740foreach (var url in portResource.Annotations.OfType<ResourceUrlAnnotation>())
Aspire.Hosting.DevTunnels.Tests (1)
DevTunnelMonitorTests.cs (1)
263var tunnelUrl = Assert.Single(context.Urls, url => url.Endpoint?.EndpointName == DevTunnelPortResource.TunnelEndpointName);
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)
144var url = new ResourceUrlAnnotation 149var 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)
310var managementUrl = await GetManagementUrlAsync(redis, "Manage (Insights)"); 336var managementUrl = await GetManagementUrlAsync(redis, "Manage (Commander)"); 1109private static async Task<ResourceUrlAnnotation> GetManagementUrlAsync(IResource resource, string displayText)
Aspire.Hosting.Tests (43)
Dashboard\DashboardResourceTests.cs (3)
852var urls = new List<ResourceUrlAnnotation> 866var httpUrl = urls.FirstOrDefault(u => u.Endpoint?.EndpointName == "http"); 867var httpsUrl = urls.FirstOrDefault(u => u.Endpoint?.EndpointName == "https");
DistributedApplicationTests.cs (1)
1436var dashboardUrls = aspireDashboard.Annotations.OfType<ResourceUrlAnnotation>().ToList();
Orchestrator\ApplicationOrchestratorTests.cs (8)
193frontend.Resource.Annotations.OfType<ResourceUrlAnnotation>().Select(url => url.Url)); 217frontend.Resource.Annotations.OfType<ResourceUrlAnnotation>().Select(url => url.Url)); 329var primaryUrl = frontend.Resource.Annotations.OfType<ResourceUrlAnnotation>().First(); 363Assert.Equal("https://manager.example/admin", Assert.Single(manager.Resource.Annotations.OfType<ResourceUrlAnnotation>()).Url); 409var original = context.Urls[0]; 476frontend.Resource.Annotations.OfType<ResourceUrlAnnotation>().Select(url => url.Url)); 495Assert.Empty(frontend.Resource.Annotations.OfType<ResourceUrlAnnotation>());
WithEndpointTests.cs (2)
1069var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 1103var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>();
WithUrlsTests.cs (29)
47var annotation = new ResourceUrlAnnotation 53var updatedAnnotation = annotation.WithEndpoint(endpoint); 186var url = new ResourceUrlAnnotation 214var otherUrl = new ResourceUrlAnnotation 228var managementUrl = Assert.Single(context.Urls, url => url.DisplayText == "Manage"); 382var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 406var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 432var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 433var endpointUrl = urls.First(u => u.Endpoint is not null); 460var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 493var urls = projectB.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 536var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 559var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 589var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 877var allUrls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 878var endpointUrl = allUrls.FirstOrDefault(u => u.Endpoint?.EndpointName == "test"); 879var staticBeforeUrl = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://static-before.com")); 880var callbackBeforeUrl = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://callback-before.com")); 881var staticAfter = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://static-after.com")); 882var callbackAfter = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://callback-after.com")); 938var endpointUrl = project.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test"); 977var launchProfileUrls = project.Resource.Annotations.OfType<ResourceUrlAnnotation>().Where(u => u.Endpoint?.EndpointName == "http"); 1018var endpointUrl = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test" && u.Url.EndsWith("/sub-path")); 1051var url = Assert.Single(managed.Resource.Annotations.OfType<ResourceUrlAnnotation>(), u => u.DisplayText == "Manage"); 1080var endpointUrl = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test" && u.Url.EndsWith("/sub-path"));