90 instantiations of EndpointAnnotation
Aspire.Hosting (6)
Dashboard\DashboardEventHandlers.cs (4)
226dashboardResource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: endpointName, uriScheme: endpointContext.Scheme, isProxied: true));
245dashboardResource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: address.Scheme, port: address.Port, isProxied: true)
650annotation = new EndpointAnnotation(ProtocolType.Tcp, name: endpointName, uriScheme: context.Scheme, isProxied: true, transport: transport)
659annotation = new EndpointAnnotation(ProtocolType.Tcp, name: endpointName, uriScheme: address.Scheme, port: address.Port, isProxied: true, transport: transport)
Aspire.Hosting.Azure.Tests (1)
Aspire.Hosting.Blazor.Tests (1)
Aspire.Hosting.DevTunnels (1)
Aspire.Hosting.Dotnet.Tests (2)
Aspire.Hosting.Maui (1)
Aspire.Hosting.Maui.Tests (9)
Aspire.Hosting.Radius.Tests (7)
Publishing\RadiusServiceDiscoveryTests.cs (7)
26resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", port: 5000, targetPort: 8080));
37resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", port: 5000));
48resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http"));
59resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https"));
70var https = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
83resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "tcp", name: "one"));
84resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "tcp", name: "two"));
Aspire.Hosting.Testing.Tests (1)
Aspire.Hosting.Tests (61)
ApplicationModel\McpServerEndpointAnnotationTests.cs (8)
73var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
88var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
103var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
119var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
135var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
150var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
165var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
182var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
ConditionalReferenceExpressionTests.cs (5)
82var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
246var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
260var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "tcp")
277var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
290var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
EndpointReferenceTests.cs (33)
53var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
71var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
90var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
105var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
124var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
143var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
157var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
171var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", targetPort: 5000);
185var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
204var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
222var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
253var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
266var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
279var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
292var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
305var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", targetPort: 5000);
318var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
330var annotation = new EndpointAnnotation(ProtocolType.Tcp, KnownNetworkIdentifiers.LocalhostNetwork, uriScheme: "http", name: "http");
402var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "blah", name: "http");
446var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
476var httpEndpoint = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "http");
492resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http"));
493resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "tcp", name: "grpc"));
520resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http"));
547resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https"));
568resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: scheme));
581resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https"));
598resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http"));
599resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https"));
611resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http"));
629resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http"));
651resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http"));
665resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http"));
WithOtlpExporterTests.cs (5)
160dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: endpointName, uriScheme: "http", port: 18889, isProxied: true, transport: transport));
197dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: KnownEndpointNames.OtlpGrpcEndpointName, uriScheme: "http", port: 18889, isProxied: true, transport: "http2"));
198dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: KnownEndpointNames.OtlpHttpEndpointName, uriScheme: "http", port: 18890, isProxied: true));
252dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: KnownEndpointNames.OtlpGrpcEndpointName, uriScheme: "http", port: 18889, isProxied: true, transport: "http2"));
282dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: KnownEndpointNames.OtlpGrpcEndpointName, uriScheme: "http", port: 18889, isProxied: true, transport: "http2"));
660 references to EndpointAnnotation
Aspire.Hosting (139)
Dcp\DcpModelUtilities.cs (12)
31internal static void ValidateEndpointPorts(IResource modelResource, EndpointAnnotation endpoint)
37if (EndpointAnnotation.NormalizePort(endpoint.TargetPort) is null)
39throw new InvalidOperationException($"The endpoint '{endpoint.Name}' for container resource '{modelResourceName}' must specify the {nameof(EndpointAnnotation.TargetPort)} value");
44throw new InvalidOperationException($"The endpoint '{endpoint.Name}' for resource '{modelResourceName}' is not using a proxy, and it has a value of {nameof(EndpointAnnotation.Port)} property that is different from the value of {nameof(EndpointAnnotation.TargetPort)} property. For proxy-less endpoints they must match.");
58internal static bool TryGetEffectiveFixedPublicPort(IResource resource, EndpointAnnotation endpoint, bool randomizePorts, out int publicPort)
60var effectivePublicPort = EndpointAnnotation.NormalizePort(resource.IsContainer() ? endpoint.SpecifiedPort : endpoint.Port);
78internal static bool NeedsGeneratedPublicPort(IResource resource, EndpointAnnotation endpoint, bool randomizePorts)
104var ea = sp.EndpointAnnotation;
345if (!TryGetEndpoint(res, ts.EndpointName, out var endpoint))
383private static bool TryGetEndpoint(IResource resource, string? endpointName, [NotNullWhen(true)] out EndpointAnnotation? endpoint)
386if (resource.TryGetAnnotationsOfType<EndpointAnnotation>(out var endpoints))
ResourceBuilderExtensions.cs (18)
1489/// Each non-excluded endpoint (where <see cref="EndpointAnnotation.ExcludeReferenceEndpoint"/> is <c>false</c>) defined on the source resource will be injected using the format defined by
1500/// Resource authors can opt out individual endpoints by setting <see cref="EndpointAnnotation.ExcludeReferenceEndpoint"/> to <c>true</c>
1520/// Each non-excluded endpoint (where <see cref="EndpointAnnotation.ExcludeReferenceEndpoint"/> is <c>false</c>) defined on the source resource will be injected using the format defined by
1532/// Resource authors can opt out individual endpoints by setting <see cref="EndpointAnnotation.ExcludeReferenceEndpoint"/> to <c>true</c>
1743/// The <see cref="WithEndpoint{T}(IResourceBuilder{T}, string, Action{EndpointAnnotation}, bool)"/> method allows
1745/// other values to compatible/consistent values. For example setting the <see cref="EndpointAnnotation.Protocol"/> property
1746/// of the endpoint annotation in the callback will not automatically change the <see cref="EndpointAnnotation.UriScheme"/>.
1766public static IResourceBuilder<T> WithEndpoint<T>(this IResourceBuilder<T> builder, [EndpointName] string endpointName, Action<EndpointAnnotation> callback, bool createIfNotExists = true) where T : IResourceWithEndpoints
1772var endpoint = builder.Resource.Annotations
1773.OfType<EndpointAnnotation>()
1839!builder.Resource.Annotations.OfType<EndpointAnnotation>().Any(endpoint => string.Equals(endpoint.Name, endpointName, StringComparisons.EndpointAnnotationName)))
1876var existing = builder.Resource.Annotations.OfType<EndpointAnnotation>()
1909var annotation = new EndpointAnnotation(
1952/// <see cref="EndpointAnnotation.TargetPortEnvironmentVariable"/> is updated
1955private static void ConfigureEndpointEnvironmentVariable<T>(IResourceBuilder<T> builder, EndpointAnnotation endpointAnnotation, string? env) where T : IResourceWithEndpoints
2167if (!builder.Resource.TryGetAnnotationsOfType<EndpointAnnotation>(out var endpoints))
2172foreach (var endpoint in endpoints)
Aspire.Hosting.Azure.AppContainers (3)
Aspire.Hosting.Azure.AppService (2)
Aspire.Hosting.Azure.Kusto.Tests (4)
Aspire.Hosting.Azure.Sandboxes (1)
Aspire.Hosting.Azure.ServiceBus (1)
Aspire.Hosting.Azure.Tests (57)
Aspire.Hosting.Blazor (7)
Aspire.Hosting.Blazor.Tests (10)
Aspire.Hosting.Browsers (2)
Aspire.Hosting.Browsers.Tests (2)
Aspire.Hosting.DevTunnels (2)
Aspire.Hosting.Docker (1)
Aspire.Hosting.Dotnet (1)
Aspire.Hosting.Dotnet.Tests (25)
Aspire.Hosting.Foundry (4)
Aspire.Hosting.Foundry.Tests (7)
Aspire.Hosting.Garnet.Tests (4)
Aspire.Hosting.Java.Tests (10)
Aspire.Hosting.JavaScript (7)
Aspire.Hosting.JavaScript.Tests (10)
Aspire.Hosting.Kafka.Tests (5)
Aspire.Hosting.Keycloak.Tests (6)
Aspire.Hosting.Kubernetes (4)
Aspire.Hosting.Maui (5)
Aspire.Hosting.Maui.Tests (22)
Aspire.Hosting.Milvus.Tests (7)
Aspire.Hosting.MongoDB (1)
Aspire.Hosting.MongoDB.Tests (8)
Aspire.Hosting.MySql.Tests (4)
Aspire.Hosting.Nats.Tests (4)
Aspire.Hosting.Oracle.Tests (6)
Aspire.Hosting.PostgreSQL.Tests (14)
Aspire.Hosting.Qdrant.Tests (11)
Aspire.Hosting.RabbitMQ.Tests (4)
Aspire.Hosting.Radius (7)
Aspire.Hosting.Radius.Tests (1)
Aspire.Hosting.Redis (2)
Aspire.Hosting.Redis.Tests (15)
Aspire.Hosting.Seq.Tests (8)
Aspire.Hosting.SqlServer.Tests (4)
Aspire.Hosting.Testing.Tests (2)
Aspire.Hosting.Tests (211)
ApplicationModel\McpServerEndpointAnnotationTests.cs (8)
73var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
88var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
103var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
119var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
135var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
150var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
165var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
182var endpointAnnotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
ConditionalReferenceExpressionTests.cs (5)
82var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
246var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
260var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "tcp")
277var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
290var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
EndpointReferenceTests.cs (24)
27Assert.Same(web.Resource.Annotations.OfType<EndpointAnnotation>().Single(), endpoint.EndpointAnnotation);
46Assert.Same(web.Resource.Annotations.OfType<EndpointAnnotation>().Single(), endpoint.EndpointAnnotation);
53var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
71var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
90var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
105var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
124var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
143var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
157var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
171var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", targetPort: 5000);
185var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
204var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
222var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
253var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
266var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
279var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
292var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
305var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", targetPort: 5000);
318var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
330var annotation = new EndpointAnnotation(ProtocolType.Tcp, KnownNetworkIdentifiers.LocalhostNetwork, uriScheme: "http", name: "http");
353var annotation = endpoint.EndpointAnnotation;
402var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "blah", name: "http");
446var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
476var httpEndpoint = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "http");
WithEndpointTests.cs (56)
85typeof(EndpointAnnotation),
96typeof(EndpointAnnotation),
107var isProxiedProperty = typeof(EndpointAnnotation).GetProperty(nameof(EndpointAnnotation.IsProxied), BindingFlags.Public | BindingFlags.Instance);
115var endpoint = new EndpointAnnotation(ProtocolType.Tcp);
125typeof(EndpointAnnotation),
135var endpoint = Assert.IsType<EndpointAnnotation>(constructor!.Invoke([ProtocolType.Tcp, "http", null, "http", null, null, null, true]));
149var endpoint = Assert.Single(container.Resource.Annotations.OfType<EndpointAnnotation>());
162var endpoint = Assert.Single(container.Resource.Annotations.OfType<EndpointAnnotation>());
197var endpoint = container.Resource.Annotations.OfType<EndpointAnnotation>()
213var endpoint = container.Resource.Annotations.OfType<EndpointAnnotation>()
239var endpoints = resource.Annotations.OfType<EndpointAnnotation>().ToArray();
658var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
674var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "https");
690var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
707var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
724var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
780var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "api");
798var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
815var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
832var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
860var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>()
877var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>()
912var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>()
950Assert.False(projectA.Resource.TryGetAnnotationsOfType<EndpointAnnotation>(out var annotations));
967Assert.True(projectA.Resource.TryGetAnnotationsOfType<EndpointAnnotation>(out _));
984Assert.True(projectA.Resource.TryGetAnnotationsOfType<EndpointAnnotation>(out _));
997var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "mybinding");
1012var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "https");
1026var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "mybinding");
1038var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>()
1074EndpointAnnotation endpoint = Assert.Single(projectA.Resource.Annotations.OfType<EndpointAnnotation>());
1108EndpointAnnotation endpoint = Assert.Single(projectA.Resource.Annotations.OfType<EndpointAnnotation>());
Aspire.Hosting.Valkey.Tests (4)
Aspire.Hosting.Yarp.Tests (4)
TestProject.AppHost (2)