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