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