70 instantiations of EndpointAnnotation
Aspire.Hosting (6)
Dashboard\DashboardEventHandlers.cs (4)
376dashboardResource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: endpointName, uriScheme: endpointContext.Scheme, isProxied: true));
395dashboardResource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: address.Scheme, port: address.Port, isProxied: true)
776annotation = new EndpointAnnotation(ProtocolType.Tcp, name: endpointName, uriScheme: context.Scheme, isProxied: true, transport: transport)
785annotation = new EndpointAnnotation(ProtocolType.Tcp, name: endpointName, uriScheme: address.Scheme, port: address.Port, isProxied: true, transport: transport)
Aspire.Hosting.Azure.Tests (1)
Aspire.Hosting.DevTunnels (1)
Aspire.Hosting.Maui (1)
Aspire.Hosting.Maui.Tests (2)
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 (51)
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)
77var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
126var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
140var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "tcp")
157var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
170var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
EndpointReferenceTests.cs (24)
16var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
34var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
53var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
68var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
87var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
106var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
120var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
134var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", targetPort: 5000);
148var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
167var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
185var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
216var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
229var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
242var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
255var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
268var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", targetPort: 5000);
281var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
293var annotation = new EndpointAnnotation(ProtocolType.Tcp, KnownNetworkIdentifiers.LocalhostNetwork, uriScheme: "http", name: "http");
341var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "blah", name: "http");
385var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
415var httpEndpoint = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "http");
431resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http"));
432resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "tcp", name: "grpc"));
459resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http"));
WithOtlpExporterTests.cs (5)
91dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: endpointName, uriScheme: "http", port: 18889, isProxied: true, transport: transport));
128dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: KnownEndpointNames.OtlpGrpcEndpointName, uriScheme: "http", port: 18889, isProxied: true, transport: "http2"));
129dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: KnownEndpointNames.OtlpHttpEndpointName, uriScheme: "http", port: 18890, isProxied: true));
183dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: KnownEndpointNames.OtlpGrpcEndpointName, uriScheme: "http", port: 18889, isProxied: true, transport: "http2"));
213dashboard.Resource.Annotations.Add(new EndpointAnnotation(ProtocolType.Tcp, name: KnownEndpointNames.OtlpGrpcEndpointName, uriScheme: "http", port: 18889, isProxied: true, transport: "http2"));
537 references to EndpointAnnotation
Aspire.Hosting (125)
Dcp\DcpExecutor.cs (10)
654.Select(r => (ModelResource: r, Endpoints: r.Annotations.OfType<EndpointAnnotation>().ToArray()))
661foreach (var endpoint in sp.Endpoints)
683foreach (var endpoint in endpoints)
747private static bool GetEffectiveIsProxied(IResource resource, EndpointAnnotation endpoint, bool randomizePorts)
780private static bool TryGetEffectiveFixedPublicPort(IResource resource, EndpointAnnotation endpoint, bool randomizePorts, out int publicPort)
782var effectivePublicPort = EndpointAnnotation.NormalizePort(resource.IsContainer() ? endpoint.SpecifiedPort : endpoint.Port);
802private void EnsureProxylessEndpointPort(IResource resource, EndpointAnnotation endpoint)
837private static bool NeedsPublicPort(IResource resource, EndpointAnnotation endpoint)
846private int? TryGetPersistedProxylessEndpointPort(IResource resource, EndpointAnnotation endpoint)
869private static string GetPersistedProxylessEndpointPortKey(IResource resource, EndpointAnnotation endpoint)
ResourceBuilderExtensions.cs (18)
1184/// 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
1195/// Resource authors can opt out individual endpoints by setting <see cref="EndpointAnnotation.ExcludeReferenceEndpoint"/> to <c>true</c>
1215/// 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
1227/// Resource authors can opt out individual endpoints by setting <see cref="EndpointAnnotation.ExcludeReferenceEndpoint"/> to <c>true</c>
1438/// The <see cref="WithEndpoint{T}(IResourceBuilder{T}, string, Action{EndpointAnnotation}, bool)"/> method allows
1440/// other values to compatible/consistent values. For example setting the <see cref="EndpointAnnotation.Protocol"/> property
1441/// of the endpoint annotation in the callback will not automatically change the <see cref="EndpointAnnotation.UriScheme"/>.
1461public static IResourceBuilder<T> WithEndpoint<T>(this IResourceBuilder<T> builder, [EndpointName] string endpointName, Action<EndpointAnnotation> callback, bool createIfNotExists = true) where T : IResourceWithEndpoints
1467var endpoint = builder.Resource.Annotations
1468.OfType<EndpointAnnotation>()
1534!builder.Resource.Annotations.OfType<EndpointAnnotation>().Any(endpoint => string.Equals(endpoint.Name, endpointName, StringComparisons.EndpointAnnotationName)))
1571var existing = builder.Resource.Annotations.OfType<EndpointAnnotation>()
1604var annotation = new EndpointAnnotation(
1647/// <see cref="EndpointAnnotation.TargetPortEnvironmentVariable"/> is updated
1650private static void ConfigureEndpointEnvironmentVariable<T>(IResourceBuilder<T> builder, EndpointAnnotation endpointAnnotation, string? env) where T : IResourceWithEndpoints
1862if (!builder.Resource.TryGetAnnotationsOfType<EndpointAnnotation>(out var endpoints))
1867foreach (var endpoint in endpoints)
Aspire.Hosting.Azure.AppContainers (3)
Aspire.Hosting.Azure.AppService (2)
Aspire.Hosting.Azure.Kusto.Tests (4)
Aspire.Hosting.Azure.Sandboxes (2)
Aspire.Hosting.Azure.Tests (45)
Aspire.Hosting.Blazor (7)
Aspire.Hosting.Blazor.Tests (1)
Aspire.Hosting.Browsers (2)
Aspire.Hosting.Browsers.Tests (2)
Aspire.Hosting.DevTunnels (2)
Aspire.Hosting.Docker (1)
Aspire.Hosting.Dotnet.Tests (2)
Aspire.Hosting.Foundry (4)
Aspire.Hosting.Foundry.Tests (7)
Aspire.Hosting.Garnet.Tests (4)
Aspire.Hosting.Java.Tests (10)
Aspire.Hosting.JavaScript (2)
Aspire.Hosting.JavaScript.Tests (2)
Aspire.Hosting.Kafka.Tests (5)
Aspire.Hosting.Keycloak.Tests (6)
Aspire.Hosting.Kubernetes (4)
Aspire.Hosting.Maui (2)
Aspire.Hosting.Maui.Tests (7)
Aspire.Hosting.Milvus.Tests (7)
Aspire.Hosting.MongoDB.Tests (6)
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 (5)
Aspire.Hosting.Radius.Tests (1)
Aspire.Hosting.Redis (2)
Aspire.Hosting.Redis.Tests (12)
Aspire.Hosting.Seq.Tests (8)
Aspire.Hosting.SqlServer.Tests (4)
Aspire.Hosting.Testing.Tests (2)
Aspire.Hosting.Tests (186)
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)
77var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
126var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
140var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "tcp")
157var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
170var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "tcp");
EndpointReferenceTests.cs (21)
16var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
34var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
53var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
68var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
87var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
106var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
120var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
134var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", targetPort: 5000);
148var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
167var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
185var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
216var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
229var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
242var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
255var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "https");
268var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http", targetPort: 5000);
281var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
293var annotation = new EndpointAnnotation(ProtocolType.Tcp, KnownNetworkIdentifiers.LocalhostNetwork, uriScheme: "http", name: "http");
341var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "blah", name: "http");
385var annotation = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", name: "http");
415var httpEndpoint = new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "https", name: "http");
WithEndpointTests.cs (56)
78typeof(EndpointAnnotation),
89typeof(EndpointAnnotation),
100var isProxiedProperty = typeof(EndpointAnnotation).GetProperty(nameof(EndpointAnnotation.IsProxied), BindingFlags.Public | BindingFlags.Instance);
108var endpoint = new EndpointAnnotation(ProtocolType.Tcp);
118typeof(EndpointAnnotation),
128var endpoint = Assert.IsType<EndpointAnnotation>(constructor!.Invoke([ProtocolType.Tcp, "http", null, "http", null, null, null, true]));
142var endpoint = Assert.Single(container.Resource.Annotations.OfType<EndpointAnnotation>());
155var endpoint = Assert.Single(container.Resource.Annotations.OfType<EndpointAnnotation>());
172var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>()
211var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>()
246var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>()
284Assert.False(projectA.Resource.TryGetAnnotationsOfType<EndpointAnnotation>(out var annotations));
301Assert.True(projectA.Resource.TryGetAnnotationsOfType<EndpointAnnotation>(out _));
318Assert.True(projectA.Resource.TryGetAnnotationsOfType<EndpointAnnotation>(out _));
329var endpoint = container.Resource.Annotations.OfType<EndpointAnnotation>()
345var endpoint = container.Resource.Annotations.OfType<EndpointAnnotation>()
363var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "mybinding");
378var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "https");
392var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "mybinding");
414var endpoints = resource.Annotations.OfType<EndpointAnnotation>().ToArray();
782var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>()
818EndpointAnnotation endpoint = Assert.Single(projectA.Resource.Annotations.OfType<EndpointAnnotation>());
852EndpointAnnotation endpoint = Assert.Single(projectA.Resource.Annotations.OfType<EndpointAnnotation>());
919var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
935var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "https");
951var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
968var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
985var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
1041var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "api");
1059var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
1076var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
1093var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>(), e => e.Name == "http");
Aspire.Hosting.Valkey.Tests (4)
Aspire.Hosting.Yarp.Tests (4)
TestProject.AppHost (2)