31 instantiations of ResourceUrlAnnotation
Aspire.Hosting (8)
ApplicationModel\ResourceUrlAnnotation.cs (1)
49return new()
ApplicationModel\ResourceUrlsEditor.cs (1)
85_urls.Add(new ResourceUrlAnnotation
Orchestrator\ApplicationOrchestrator.cs (4)
337var url = new ResourceUrlAnnotation { Url = allocatedEndpoint.UriString, Endpoint = endpointReference }; 348EndpointBindingMode.SingleAddress when !allocatedEndpoint.Address.Equals(endpoint.TargetHost, StringComparison.OrdinalIgnoreCase) => new ResourceUrlAnnotation 357_ => new ResourceUrlAnnotation 389url = new ResourceUrlAnnotation
ResourceBuilderExtensions.cs (2)
2064return builder.WithAnnotation(new ResourceUrlAnnotation { Url = url, DisplayText = displayText }); 2137c.Urls.Add(new() { Endpoint = endpoint, Url = urlValue, DisplayText = displayText });
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)
696urls.Add(new()
Aspire.Hosting.Foundry.Tests (1)
HostedAgentExtensionTests.cs (1)
140var url = new ResourceUrlAnnotation
Aspire.Hosting.Qdrant (1)
QdrantBuilderExtensions.cs (1)
100.WithUrlForEndpoint(QdrantServerResource.HttpEndpointName, e => new ResourceUrlAnnotation() { Url = "/dashboard", DisplayText = "Qdrant Dashboard" });
Aspire.Hosting.Redis (1)
RedisBuilderExtensions.cs (1)
419redisResource.Annotations.Add(new ResourceUrlAnnotation
Aspire.Hosting.Tests (14)
Dashboard\DashboardResourceTests.cs (2)
834new() { Url = "http://localhost:5003", Endpoint = ((IResourceWithEndpoints)dashboard).GetEndpoint("http") }, 835new() { Url = "https://localhost:5005", Endpoint = ((IResourceWithEndpoints)dashboard).GetEndpoint("https") }
WithUrlsTests.cs (12)
142.WithUrls(c => c.Urls.Add(new() { Url = "https://example.com", DisplayText = "Example" })) 661c.Urls.Add(new() { Url = "http://example.com/", DisplayLocation = UrlDisplayLocation.SummaryAndDetails }); 662c.Urls.Add(new() { Url = "http://example.com/internal", DisplayLocation = UrlDisplayLocation.DetailsOnly }); 663c.Urls.Add(new() { Url = "http://example.com/out-of-range", DisplayLocation = (UrlDisplayLocation)100 }); 726return new() { Url = "https://example.com" }; 752.WithUrls(c => c.Urls.Add(new() { Url = "https://callback-before.com/sub-path", DisplayText = "Example" })) 755.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 851.WithUrlForEndpoint("http", _ => new() 895return new() { Url = "/sub-path" }; 925c.Urls.Add(new() { Endpoint = c.GetEndpoint("test"), Url = "/sub-path" }); 959c.Urls.Add(new() 1011c.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 })
69 references to ResourceUrlAnnotation
Aspire.Hosting (28)
ApplicationModel\ResourceExtensions.cs (1)
745public static bool TryGetUrls(this IResource resource, [NotNullWhen(true)] out IEnumerable<ResourceUrlAnnotation>? urls)
ApplicationModel\ResourceUrlAnnotation.cs (1)
46internal 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)
456foreach (var url in c.Urls)
Dcp\ResourceSnapshotBuilder.cs (4)
305var processedEndpointUrls = new HashSet<ResourceUrlAnnotation>(); 315foreach (var endpointUrl in urlsForEndpoint) 341foreach (var endpointUrl in crossResourceEndpointUrls) 365foreach (var url in nonEndpointUrls)
Orchestrator\ApplicationOrchestrator.cs (8)
305var urls = new List<ResourceUrlAnnotation>(); 337var url = new ResourceUrlAnnotation { Url = allocatedEndpoint.UriString, Endpoint = endpointReference }; 344var additionalUrl = allocatedEndpoint.BindingMode switch 434foreach (var staticUrl in staticUrls) 483var primaryUrl = urls.FirstOrDefault(u => string.Equals(u.Endpoint?.EndpointName, primaryLaunchProfileEndpoint.Name, StringComparisons.EndpointAnnotationName)); 496foreach (var url in urls) 537foreach (var url in urls) 554foreach (var url in urls)
ProjectResourceBuilderExtensions.cs (1)
771var url = context.Urls.FirstOrDefault(u => string.Equals(u.Endpoint?.EndpointName, endpoint.Name, StringComparisons.EndpointAnnotationName));
ResourceBuilderExtensions.cs (8)
2023/// To modify the URL for a specific endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Action{ResourceUrlAnnotation})"/>. 2051foreach (var u in c.Urls) 2154/// To add another URL for an endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Func{EndpointReference, ResourceUrlAnnotation})"/>. 2183public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, string endpointName, Action<ResourceUrlAnnotation> callback) 2188var urlForEndpoint = context.Urls.FirstOrDefault(u => u.Endpoint?.EndpointName == endpointName); 2213/// To customize the URL that is automatically added for an endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Action{ResourceUrlAnnotation})"/>. 2230public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, string endpointName, Func<EndpointReference, ResourceUrlAnnotation> callback) 2238var url = callback(endpoint).WithEndpoint(endpoint);
Aspire.Hosting.Azure.CosmosDB (1)
AzureCosmosDBExtensions.cs (1)
506var url = context.Urls.FirstOrDefault(u => u.Endpoint?.EndpointName == KnownUrls.DataExplorer.EndpointName);
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)
301var http = ctx.Urls.FirstOrDefault(u => u.Endpoint?.EndpointName == "http" || u.Endpoint?.EndpointName == "https");
Aspire.Hosting.Foundry.Tests (2)
HostedAgentExtensionTests.cs (2)
140var url = new ResourceUrlAnnotation 145var urls = new List<ResourceUrlAnnotation> { url };
Aspire.Hosting.Qdrant.Tests (1)
QdrantFunctionalTests.cs (1)
247var urls = qdrant.Resource.Annotations.OfType<ResourceUrlAnnotation>();
Aspire.Hosting.Redis.Tests (4)
AddRedisTests.cs (4)
308var managementUrl = Assert.Single(redis.Annotations.OfType<ResourceUrlAnnotation>(), u => u.DisplayText == "Manage (Insights)"); 333var managementUrl = Assert.Single(redis.Annotations.OfType<ResourceUrlAnnotation>(), u => u.DisplayText == "Manage (Commander)");
Aspire.Hosting.Tests (28)
Dashboard\DashboardResourceTests.cs (3)
832var urls = new List<ResourceUrlAnnotation> 846var httpUrl = urls.FirstOrDefault(u => u.Endpoint?.EndpointName == "http"); 847var 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 (22)
153var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 177var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 203var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 204var endpointUrl = urls.First(u => u.Endpoint is not null); 231var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 264var urls = projectB.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 307var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 330var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 361var urls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 766var allUrls = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>(); 767var endpointUrl = allUrls.FirstOrDefault(u => u.Endpoint?.EndpointName == "test"); 768var staticBeforeUrl = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://static-before.com")); 769var callbackBeforeUrl = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://callback-before.com")); 770var staticAfter = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://static-after.com")); 771var callbackAfter = allUrls.FirstOrDefault(u => u.Endpoint is null && u.Url.StartsWith("https://callback-after.com")); 827var endpointUrl = project.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test"); 866var launchProfileUrls = project.Resource.Annotations.OfType<ResourceUrlAnnotation>().Where(u => u.Endpoint?.EndpointName == "http"); 907var endpointUrl = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test" && u.Url.EndsWith("/sub-path")); 937var endpointUrl = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test" && u.Url.EndsWith("/sub-path"));